mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[Content management] BWC - versioned content (#152729)
This commit is contained in:
parent
e36ed9658d
commit
206a9d114d
44 changed files with 715 additions and 804 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
import * as React from 'react';
|
||||
import { ContentClientProvider, ContentClient } from '@kbn/content-management-plugin/public';
|
||||
import { ContentTypeRegistry } from '@kbn/content-management-plugin/public/registry';
|
||||
|
||||
import { Todos } from '../todos';
|
||||
import { TodosClient } from './todos_client';
|
||||
|
@ -19,6 +20,10 @@ export default {
|
|||
};
|
||||
|
||||
const todosClient = new TodosClient();
|
||||
|
||||
const contentTypeRegistry = new ContentTypeRegistry();
|
||||
contentTypeRegistry.register({ id: 'todos', version: { latest: 'v1' } });
|
||||
|
||||
const contentClient = new ContentClient((contentType: string) => {
|
||||
switch (contentType) {
|
||||
case 'todos':
|
||||
|
@ -27,7 +32,7 @@ const contentClient = new ContentClient((contentType: string) => {
|
|||
default:
|
||||
throw new Error(`Unknown content type: ${contentType}`);
|
||||
}
|
||||
});
|
||||
}, contentTypeRegistry);
|
||||
|
||||
export const SimpleTodoApp = () => (
|
||||
<ContentClientProvider contentClient={contentClient}>
|
||||
|
|
|
@ -31,10 +31,17 @@ export class ContentManagementExamplesPlugin
|
|||
},
|
||||
});
|
||||
|
||||
contentManagement.registry.register({
|
||||
id: 'todos',
|
||||
version: {
|
||||
latest: 'v1',
|
||||
},
|
||||
});
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
public start(core: CoreStart) {
|
||||
public start(core: CoreStart, deps: StartDeps) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -13,20 +13,13 @@ import {
|
|||
} from '@kbn/content-management-plugin/server';
|
||||
import { v4 } from 'uuid';
|
||||
import {
|
||||
createInSchema,
|
||||
searchInSchema,
|
||||
Todo,
|
||||
TODO_CONTENT_ID,
|
||||
updateInSchema,
|
||||
TodoSearchOut,
|
||||
TodoCreateOut,
|
||||
TodoUpdateOut,
|
||||
TodoDeleteOut,
|
||||
TodoGetOut,
|
||||
createOutSchema,
|
||||
getOutSchema,
|
||||
updateOutSchema,
|
||||
searchOutSchema,
|
||||
TodoUpdateIn,
|
||||
TodoSearchIn,
|
||||
TodoCreateIn,
|
||||
|
@ -39,40 +32,10 @@ export const registerTodoContentType = ({
|
|||
}) => {
|
||||
contentManagement.register({
|
||||
id: TODO_CONTENT_ID,
|
||||
schemas: {
|
||||
content: {
|
||||
create: {
|
||||
in: {
|
||||
data: createInSchema,
|
||||
},
|
||||
out: {
|
||||
result: createOutSchema,
|
||||
},
|
||||
},
|
||||
update: {
|
||||
in: {
|
||||
data: updateInSchema,
|
||||
},
|
||||
out: {
|
||||
result: updateOutSchema,
|
||||
},
|
||||
},
|
||||
search: {
|
||||
in: {
|
||||
query: searchInSchema,
|
||||
},
|
||||
out: {
|
||||
result: searchOutSchema,
|
||||
},
|
||||
},
|
||||
get: {
|
||||
out: {
|
||||
result: getOutSchema,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
storage: new TodosStorage(),
|
||||
version: {
|
||||
latest: 'v1',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue