Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate test plugins ⇒ NP (kbn_tp_embeddable_explorer) #64756

Merged
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions test/plugin_functional/plugins/kbn_tp_embeddable_explorer/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"id": "kbn_tp_embeddable_explorer",
"version": "0.0.1",
"kibanaVersion": "kibana",
"requiredPlugins": [
"visTypeMarkdown",
"visTypeVislib",
"data",
"embeddable",
"uiActions",
"inspector",
"discover"
],
"server": false,
"ui": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
DASHBOARD_CONTAINER_TYPE,
DashboardContainer,
DashboardContainerInput,
} from '../../../../../../../../src/plugins/dashboard/public';
} from '../../../../../../src/plugins/dashboard/public';

import { dashboardInput } from './dashboard_input';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { ViewMode, CONTACT_CARD_EMBEDDABLE, HELLO_WORLD_EMBEDDABLE } from '../embeddable_api';
import { DashboardContainerInput } from '../../../../../../../../src/plugins/dashboard/public';
import { DashboardContainerInput } from '../../../../../../src/plugins/dashboard/public';

export const dashboardInput: DashboardContainerInput = {
panels: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* under the License.
*/

export * from '../../../../../../../src/plugins/embeddable/public';
export * from '../../../../../../../src/plugins/embeddable/public/lib/test_samples';
export { HELLO_WORLD_EMBEDDABLE } from '../../../../../../../examples/embeddable_examples/public';
export * from '../../../../../src/plugins/embeddable/public';
export * from '../../../../../src/plugins/embeddable/public/lib/test_samples';
export {
HELLO_WORLD_EMBEDDABLE,
HelloWorldEmbeddableFactory,
} from '../../../../../examples/embeddable_examples/public';

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { CoreSetup, Plugin, AppMountParameters } from 'kibana/public';
import { UiActionsStart, UiActionsSetup } from '../../../../../src/plugins/ui_actions/public';
import { createHelloWorldAction } from '../../../../../src/plugins/ui_actions/public/tests/test_samples';

import {
Start as InspectorStartContract,
Setup as InspectorSetupContract,
} from '../../../../../src/plugins/inspector/public';

import { App } from './app';
import {
CONTEXT_MENU_TRIGGER,
CONTACT_CARD_EMBEDDABLE,
HELLO_WORLD_EMBEDDABLE,
HelloWorldEmbeddableFactory,
ContactCardEmbeddableFactory,
SayHelloAction,
createSendMessageAction,
} from './embeddable_api';
import {
EmbeddableStart,
EmbeddableSetup,
} from '.../../../../../../../src/plugins/embeddable/public';

export interface SetupDependencies {
embeddable: EmbeddableSetup;
inspector: InspectorSetupContract;
uiActions: UiActionsSetup;
}

interface StartDependencies {
embeddable: EmbeddableStart;
uiActions: UiActionsStart;
inspector: InspectorStartContract;
}

export type EmbeddableExplorerSetup = void;
export type EmbeddableExplorerStart = void;

export class EmbeddableExplorerPublicPlugin
implements
Plugin<EmbeddableExplorerSetup, EmbeddableExplorerStart, SetupDependencies, StartDependencies> {
public setup(core: CoreSetup, setupDeps: SetupDependencies): EmbeddableExplorerSetup {
const helloWorldAction = createHelloWorldAction({} as any);
const sayHelloAction = new SayHelloAction(alert);
const sendMessageAction = createSendMessageAction({} as any);

setupDeps.uiActions.registerAction(helloWorldAction);
setupDeps.uiActions.registerAction(sayHelloAction);
setupDeps.uiActions.registerAction(sendMessageAction);

setupDeps.uiActions.attachAction(CONTEXT_MENU_TRIGGER, helloWorldAction.id);

setupDeps.embeddable.registerEmbeddableFactory(
HELLO_WORLD_EMBEDDABLE,
new HelloWorldEmbeddableFactory()
);

setupDeps.embeddable.registerEmbeddableFactory(
CONTACT_CARD_EMBEDDABLE,
new ContactCardEmbeddableFactory((() => null) as any, {} as any)
);

core.application.register({
id: 'EmbeddableExplorer',
title: 'Embeddable Explorer',
async mount(params: AppMountParameters) {
const startPlugins = (await core.getStartServices())[1] as StartDependencies;
render(<App embeddableServices={startPlugins.embeddable} />, params.element);

return () => unmountComponentAtNode(params.element);
},
});
}

public start() {}
public stop() {}
}