@@ -21,12 +21,20 @@ import { EmbeddableSetup, EmbeddableStart } from '../../../src/plugins/embeddabl
2121import { Plugin , CoreSetup , CoreStart } from '../../../src/core/public' ;
2222import { HelloWorldEmbeddableFactory , HELLO_WORLD_EMBEDDABLE } from './hello_world' ;
2323import { TODO_EMBEDDABLE , TodoEmbeddableFactory , TodoInput , TodoOutput } from './todo' ;
24- import { MULTI_TASK_TODO_EMBEDDABLE , MultiTaskTodoEmbeddableFactory } from './multi_task_todo' ;
24+ import {
25+ MULTI_TASK_TODO_EMBEDDABLE ,
26+ MultiTaskTodoEmbeddableFactory ,
27+ MultiTaskTodoInput ,
28+ MultiTaskTodoOutput ,
29+ } from './multi_task_todo' ;
2530import {
2631 SEARCHABLE_LIST_CONTAINER ,
2732 SearchableListContainerFactory ,
2833} from './searchable_list_container' ;
2934import { LIST_CONTAINER , ListContainerFactory } from './list_container' ;
35+ import { createSampleData } from './create_sample_data' ;
36+ import { TodoRefInput , TodoRefOutput , TODO_REF_EMBEDDABLE } from './todo/todo_ref_embeddable' ;
37+ import { TodoRefEmbeddableFactory } from './todo/todo_ref_embeddable_factory' ;
3038
3139export interface EmbeddableExamplesSetupDependencies {
3240 embeddable : EmbeddableSetup ;
@@ -36,9 +44,18 @@ export interface EmbeddableExamplesStartDependencies {
3644 embeddable : EmbeddableStart ;
3745}
3846
47+ export interface EmbeddableExamplesStart {
48+ createSampleData : ( ) => Promise < void > ;
49+ }
50+
3951export class EmbeddableExamplesPlugin
4052 implements
41- Plugin < void , void , EmbeddableExamplesSetupDependencies , EmbeddableExamplesStartDependencies > {
53+ Plugin <
54+ void ,
55+ EmbeddableExamplesStart ,
56+ EmbeddableExamplesSetupDependencies ,
57+ EmbeddableExamplesStartDependencies
58+ > {
4259 public setup (
4360 core : CoreSetup < EmbeddableExamplesStartDependencies > ,
4461 deps : EmbeddableExamplesSetupDependencies
@@ -48,7 +65,7 @@ export class EmbeddableExamplesPlugin
4865 new HelloWorldEmbeddableFactory ( )
4966 ) ;
5067
51- deps . embeddable . registerEmbeddableFactory (
68+ deps . embeddable . registerEmbeddableFactory < MultiTaskTodoInput , MultiTaskTodoOutput > (
5269 MULTI_TASK_TODO_EMBEDDABLE ,
5370 new MultiTaskTodoEmbeddableFactory ( )
5471 ) ;
@@ -73,9 +90,21 @@ export class EmbeddableExamplesPlugin
7390 openModal : ( await core . getStartServices ( ) ) [ 0 ] . overlays . openModal ,
7491 } ) )
7592 ) ;
93+
94+ deps . embeddable . registerEmbeddableFactory < TodoRefInput , TodoRefOutput > (
95+ TODO_REF_EMBEDDABLE ,
96+ new TodoRefEmbeddableFactory ( async ( ) => ( {
97+ savedObjectsClient : ( await core . getStartServices ( ) ) [ 0 ] . savedObjects . client ,
98+ getEmbeddableFactory : ( await core . getStartServices ( ) ) [ 1 ] . embeddable . getEmbeddableFactory ,
99+ } ) )
100+ ) ;
76101 }
77102
78- public start ( core : CoreStart , deps : EmbeddableExamplesStartDependencies ) { }
103+ public start ( core : CoreStart , deps : EmbeddableExamplesStartDependencies ) {
104+ return {
105+ createSampleData : ( ) => createSampleData ( core . savedObjects . client ) ,
106+ } ;
107+ }
79108
80109 public stop ( ) { }
81110}
0 commit comments