Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 13 additions & 14 deletions examples/bfetch_explorer/public/mount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ export interface BfetchDeps {
explorer: ExplorerService;
}

export const mount = (
coreSetup: CoreSetup<BfetchExplorerStartPlugins>,
explorer: ExplorerService
) => async ({ appBasePath, element }: AppMountParameters) => {
const [core, plugins] = await coreSetup.getStartServices();
const deps: BfetchDeps = { appBasePath, core, plugins, explorer };
const reactElement = (
<KibanaContextProvider services={deps}>
<App />
</KibanaContextProvider>
);
render(reactElement, element);
return () => unmountComponentAtNode(element);
};
export const mount =
(coreSetup: CoreSetup<BfetchExplorerStartPlugins>, explorer: ExplorerService) =>
async ({ appBasePath, element }: AppMountParameters) => {
const [core, plugins] = await coreSetup.getStartServices();
const deps: BfetchDeps = { appBasePath, core, plugins, explorer };
const reactElement = (
<KibanaContextProvider services={deps}>
<App />
</KibanaContextProvider>
);
render(reactElement, element);
return () => unmountComponentAtNode(element);
};
3 changes: 2 additions & 1 deletion examples/dashboard_embeddable_examples/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export class DashboardEmbeddableExamples implements Plugin<void, void, {}, Start
return renderApp(
{
basename: params.appBasePath,
DashboardContainerByValueRenderer: depsStart.dashboard.getDashboardContainerByValueRenderer(),
DashboardContainerByValueRenderer:
depsStart.dashboard.getDashboardContainerByValueRenderer(),
},
params.element
);
Expand Down
3 changes: 2 additions & 1 deletion examples/embeddable_examples/public/book/book_embeddable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ function getHasMatch(search?: string, savedAttributes?: BookSavedObjectAttribute

export class BookEmbeddable
extends Embeddable<BookEmbeddableInput, BookEmbeddableOutput>
implements ReferenceOrValueEmbeddable<BookByValueInput, BookByReferenceInput> {
implements ReferenceOrValueEmbeddable<BookByValueInput, BookByReferenceInput>
{
public readonly type = BOOK_EMBEDDABLE;
private subscription: Subscription;
private node?: HTMLElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export class BookEmbeddableFactoryDefinition
BookEmbeddableOutput,
BookEmbeddable,
BookSavedObjectAttributes
> {
>
{
public readonly type = BOOK_EMBEDDABLE;
public savedObjectMetaData = {
name: 'Book',
Expand Down Expand Up @@ -116,10 +117,8 @@ export class BookEmbeddableFactoryDefinition

private async unwrapMethod(savedObjectId: string): Promise<BookSavedObjectAttributes> {
const { savedObjectsClient } = await this.getStartServices();
const savedObject: SimpleSavedObject<BookSavedObjectAttributes> = await savedObjectsClient.get<BookSavedObjectAttributes>(
this.type,
savedObjectId
);
const savedObject: SimpleSavedObject<BookSavedObjectAttributes> =
await savedObjectsClient.get<BookSavedObjectAttributes>(this.type, savedObjectId);
return { ...savedObject.attributes };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ interface StartServices {

export type ListContainerFactory = EmbeddableFactory<ContainerInput, ContainerOutput>;
export class ListContainerFactoryDefinition
implements EmbeddableFactoryDefinition<ContainerInput, ContainerOutput> {
implements EmbeddableFactoryDefinition<ContainerInput, ContainerOutput>
{
public readonly type = LIST_CONTAINER;
public readonly isContainerType = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export type SimpleEmbeddableInput = EmbeddableInput & {

export type SimpleEmbeddableFactory = EmbeddableFactory;
export class SimpleEmbeddableFactoryDefinition
implements EmbeddableFactoryDefinition<SimpleEmbeddableInput> {
implements EmbeddableFactoryDefinition<SimpleEmbeddableInput>
{
public readonly type = SIMPLE_EMBEDDABLE;

// we need to provide migration function every time we change the interface of our state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export type MultiTaskTodoEmbeddableFactory = EmbeddableFactory<

export class MultiTaskTodoEmbeddableFactoryDefinition
implements
EmbeddableFactoryDefinition<MultiTaskTodoInput, MultiTaskTodoOutput, MultiTaskTodoEmbeddable> {
EmbeddableFactoryDefinition<MultiTaskTodoInput, MultiTaskTodoOutput, MultiTaskTodoEmbeddable>
{
public readonly type = MULTI_TASK_TODO_EMBEDDABLE;

public async isEditable() {
Expand Down
115 changes: 62 additions & 53 deletions examples/embeddable_examples/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,65 +88,74 @@ export class EmbeddableExamplesPlugin
EmbeddableExamplesStart,
EmbeddableExamplesSetupDependencies,
EmbeddableExamplesStartDependencies
> {
>
{
private exampleEmbeddableFactories: Partial<ExampleEmbeddableFactories> = {};

public setup(
core: CoreSetup<EmbeddableExamplesStartDependencies>,
deps: EmbeddableExamplesSetupDependencies
) {
this.exampleEmbeddableFactories.getHelloWorldEmbeddableFactory = deps.embeddable.registerEmbeddableFactory(
HELLO_WORLD_EMBEDDABLE,
new HelloWorldEmbeddableFactoryDefinition()
);

this.exampleEmbeddableFactories.getMigrationsEmbeddableFactory = deps.embeddable.registerEmbeddableFactory(
SIMPLE_EMBEDDABLE,
new SimpleEmbeddableFactoryDefinition()
);

this.exampleEmbeddableFactories.getMultiTaskTodoEmbeddableFactory = deps.embeddable.registerEmbeddableFactory(
MULTI_TASK_TODO_EMBEDDABLE,
new MultiTaskTodoEmbeddableFactoryDefinition()
);

this.exampleEmbeddableFactories.getSearchableListContainerEmbeddableFactory = deps.embeddable.registerEmbeddableFactory(
SEARCHABLE_LIST_CONTAINER,
new SearchableListContainerFactoryDefinition(async () => ({
embeddableServices: (await core.getStartServices())[1].embeddable,
}))
);

this.exampleEmbeddableFactories.getListContainerEmbeddableFactory = deps.embeddable.registerEmbeddableFactory(
LIST_CONTAINER,
new ListContainerFactoryDefinition(async () => ({
embeddableServices: (await core.getStartServices())[1].embeddable,
}))
);

this.exampleEmbeddableFactories.getTodoEmbeddableFactory = deps.embeddable.registerEmbeddableFactory(
TODO_EMBEDDABLE,
new TodoEmbeddableFactoryDefinition(async () => ({
openModal: (await core.getStartServices())[0].overlays.openModal,
}))
);

this.exampleEmbeddableFactories.getTodoRefEmbeddableFactory = deps.embeddable.registerEmbeddableFactory(
TODO_REF_EMBEDDABLE,
new TodoRefEmbeddableFactoryDefinition(async () => ({
savedObjectsClient: (await core.getStartServices())[0].savedObjects.client,
getEmbeddableFactory: (await core.getStartServices())[1].embeddable.getEmbeddableFactory,
}))
);
this.exampleEmbeddableFactories.getBookEmbeddableFactory = deps.embeddable.registerEmbeddableFactory(
BOOK_EMBEDDABLE,
new BookEmbeddableFactoryDefinition(async () => ({
getAttributeService: (await core.getStartServices())[1].embeddable.getAttributeService,
openModal: (await core.getStartServices())[0].overlays.openModal,
savedObjectsClient: (await core.getStartServices())[0].savedObjects.client,
overlays: (await core.getStartServices())[0].overlays,
}))
);
this.exampleEmbeddableFactories.getHelloWorldEmbeddableFactory =
deps.embeddable.registerEmbeddableFactory(
HELLO_WORLD_EMBEDDABLE,
new HelloWorldEmbeddableFactoryDefinition()
);

this.exampleEmbeddableFactories.getMigrationsEmbeddableFactory =
deps.embeddable.registerEmbeddableFactory(
SIMPLE_EMBEDDABLE,
new SimpleEmbeddableFactoryDefinition()
);

this.exampleEmbeddableFactories.getMultiTaskTodoEmbeddableFactory =
deps.embeddable.registerEmbeddableFactory(
MULTI_TASK_TODO_EMBEDDABLE,
new MultiTaskTodoEmbeddableFactoryDefinition()
);

this.exampleEmbeddableFactories.getSearchableListContainerEmbeddableFactory =
deps.embeddable.registerEmbeddableFactory(
SEARCHABLE_LIST_CONTAINER,
new SearchableListContainerFactoryDefinition(async () => ({
embeddableServices: (await core.getStartServices())[1].embeddable,
}))
);

this.exampleEmbeddableFactories.getListContainerEmbeddableFactory =
deps.embeddable.registerEmbeddableFactory(
LIST_CONTAINER,
new ListContainerFactoryDefinition(async () => ({
embeddableServices: (await core.getStartServices())[1].embeddable,
}))
);

this.exampleEmbeddableFactories.getTodoEmbeddableFactory =
deps.embeddable.registerEmbeddableFactory(
TODO_EMBEDDABLE,
new TodoEmbeddableFactoryDefinition(async () => ({
openModal: (await core.getStartServices())[0].overlays.openModal,
}))
);

this.exampleEmbeddableFactories.getTodoRefEmbeddableFactory =
deps.embeddable.registerEmbeddableFactory(
TODO_REF_EMBEDDABLE,
new TodoRefEmbeddableFactoryDefinition(async () => ({
savedObjectsClient: (await core.getStartServices())[0].savedObjects.client,
getEmbeddableFactory: (await core.getStartServices())[1].embeddable.getEmbeddableFactory,
}))
);
this.exampleEmbeddableFactories.getBookEmbeddableFactory =
deps.embeddable.registerEmbeddableFactory(
BOOK_EMBEDDABLE,
new BookEmbeddableFactoryDefinition(async () => ({
getAttributeService: (await core.getStartServices())[1].embeddable.getAttributeService,
openModal: (await core.getStartServices())[0].overlays.openModal,
savedObjectsClient: (await core.getStartServices())[0].savedObjects.client,
overlays: (await core.getStartServices())[0].overlays,
}))
);

const editBookAction = createEditBookAction(async () => ({
getAttributeService: (await core.getStartServices())[1].embeddable.getAttributeService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export type SearchableListContainerFactory = EmbeddableFactory<
ContainerOutput
>;
export class SearchableListContainerFactoryDefinition
implements EmbeddableFactoryDefinition<SearchableContainerInput, ContainerOutput> {
implements EmbeddableFactoryDefinition<SearchableContainerInput, ContainerOutput>
{
public readonly type = SEARCHABLE_LIST_CONTAINER;
public readonly isContainerType = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ interface StartServices {
export type TodoEmbeddableFactory = EmbeddableFactory<TodoInput, TodoOutput, TodoEmbeddable>;

export class TodoEmbeddableFactoryDefinition
implements EmbeddableFactoryDefinition<TodoInput, TodoOutput, TodoEmbeddable> {
implements EmbeddableFactoryDefinition<TodoInput, TodoOutput, TodoEmbeddable>
{
public readonly type = TODO_EMBEDDABLE;

constructor(private getStartServices: () => Promise<StartServices>) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export class TodoRefEmbeddableFactoryDefinition
TodoRefOutput,
TodoRefEmbeddable,
TodoSavedObjectAttributes
> {
>
{
public readonly type = TODO_REF_EMBEDDABLE;
public readonly savedObjectMetaData = {
name: 'Todo',
Expand Down
3 changes: 2 additions & 1 deletion examples/embeddable_examples/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export interface EmbeddableExamplesSetupDependencies {
}

export class EmbeddableExamplesPlugin
implements Plugin<void, void, EmbeddableExamplesSetupDependencies> {
implements Plugin<void, void, EmbeddableExamplesSetupDependencies>
{
public setup(core: CoreSetup, { embeddable }: EmbeddableExamplesSetupDependencies) {
core.savedObjects.registerType(todoSavedObject);
core.savedObjects.registerType(bookSavedObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ export class IndexPatternFieldEditorPlugin implements Plugin<void, void, SetupDe
links: [
{
label: 'README',
href:
'https://github.com/elastic/kibana/blob/master/src/plugins/index_pattern_field_editor/README.md',
href: 'https://github.com/elastic/kibana/blob/master/src/plugins/index_pattern_field_editor/README.md',
iconType: 'logoGithub',
size: 's',
target: '_blank',
Expand Down
2 changes: 1 addition & 1 deletion examples/locator_examples/public/locator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ export class HelloLocatorDefinition implements LocatorDefinition<HelloLocatorPar
};

public readonly migrations = {
'0.0.2': (migrateV1ToV2 as unknown) as MigrateFunction,
'0.0.2': migrateV1ToV2 as unknown as MigrateFunction,
};
}
3 changes: 2 additions & 1 deletion examples/locator_examples/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export interface LocatorExamplesSetup {
}

export class LocatorExamplesPlugin
implements Plugin<LocatorExamplesSetup, void, SetupDeps, StartDeps> {
implements Plugin<LocatorExamplesSetup, void, SetupDeps, StartDeps>
{
public setup(core: CoreSetup<StartDeps>, plugins: SetupDeps) {
const locator = plugins.share.url.locators.create(new HelloLocatorDefinition());

Expand Down
3 changes: 1 addition & 2 deletions examples/locator_explorer/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ export class LocatorExplorerPlugin implements Plugin<void, void, SetupDeps, Star
links: [
{
label: 'README',
href:
'https://github.com/elastic/kibana/blob/master/src/plugins/share/common/url_service/locators/README.md',
href: 'https://github.com/elastic/kibana/blob/master/src/plugins/share/common/url_service/locators/README.md',
iconType: 'logoGithub',
size: 's',
target: '_blank',
Expand Down
9 changes: 3 additions & 6 deletions examples/routing_example/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,21 @@ function RoutingExplorer({
listItems={[
{
label: 'IRouter API docs',
href:
'https://github.com/elastic/kibana/blob/master/docs/development/core/server/kibana-plugin-core-server.irouter.md',
href: 'https://github.com/elastic/kibana/blob/master/docs/development/core/server/kibana-plugin-core-server.irouter.md',
iconType: 'logoGithub',
target: '_blank',
size: 's',
},
{
label: 'HttpHandler (core.http.fetch) API docs',
href:
'https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.httphandler.md',
href: 'https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.httphandler.md',
iconType: 'logoGithub',
target: '_blank',
size: 's',
},
{
label: 'Conventions',
href:
'https://github.com/elastic/kibana/tree/master/STYLEGUIDE.mdx#api-endpoints',
href: 'https://github.com/elastic/kibana/tree/master/STYLEGUIDE.mdx#api-endpoints',
iconType: 'logoGithub',
target: '_blank',
size: 's',
Expand Down
6 changes: 2 additions & 4 deletions examples/routing_example/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ export class RoutingExamplePlugin implements Plugin<{}, {}, SetupDeps, {}> {
links: [
{
label: 'IRouter',
href:
'https://github.com/elastic/kibana/blob/master/docs/development/core/server/kibana-plugin-core-server.irouter.md',
href: 'https://github.com/elastic/kibana/blob/master/docs/development/core/server/kibana-plugin-core-server.irouter.md',
iconType: 'logoGithub',
target: '_blank',
size: 's',
},
{
label: 'HttpHandler (core.http.fetch)',
href:
'https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.httphandler.md',
href: 'https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.httphandler.md',
iconType: 'logoGithub',
target: '_blank',
size: 's',
Expand Down
3 changes: 2 additions & 1 deletion examples/search_examples/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export class SearchExamplesPlugin
SearchExamplesPluginStart,
AppPluginSetupDependencies,
AppPluginStartDependencies
> {
>
{
public setup(
core: CoreSetup<AppPluginStartDependencies>,
{ developerExamples, share }: AppPluginSetupDependencies
Expand Down
10 changes: 2 additions & 8 deletions examples/search_examples/public/search_sessions/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -542,14 +542,8 @@ function SearchInspector({

function useAppState({ data }: { data: DataPublicPluginStart }) {
const stateContainer = useMemo(() => {
const {
filters,
time,
searchSessionId,
numericFieldName,
indexPatternId,
query,
} = getInitialStateFromUrl();
const { filters, time, searchSessionId, numericFieldName, indexPatternId, query } =
getInitialStateFromUrl();

if (filters) {
data.query.filterManager.setFilters(filters);
Expand Down
4 changes: 2 additions & 2 deletions examples/search_examples/server/fibonacci_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const fibonacciStrategyProvider = (): ISearchStrategy<
FibonacciResponse
> => {
const responseMap = new Map<string, [number[], number, number]>();
return ({
return {
search: (request: FibonacciRequest) => {
const id = request.id ?? uuid();
const [sequence, total, started] = responseMap.get(id) ?? [
Expand Down Expand Up @@ -48,5 +48,5 @@ export const fibonacciStrategyProvider = (): ISearchStrategy<
cancel: async (id: string) => {
responseMap.delete(id);
},
} as unknown) as ISearchStrategy<FibonacciRequest, FibonacciResponse>;
} as unknown as ISearchStrategy<FibonacciRequest, FibonacciResponse>;
};
Loading