Embeddables 2 np (#46771) (#46783)

* chore: 🤖 move embeddable_api to NP "embeddable" plugin

* fix: 🐛 fix TypeScript type check errors

* fix: 🐛 fix TypeScript and build errors

* test: 💍 fix Jest tests

* fix: 🐛 fix translations

* test: 💍 add Mocha mocks

* fix: 🐛 change import syntax from function test sample plugin

* fix: 🐛 revert canvas changes back and leave placeholders

* chore: 🤖 revert more changes

* chore: 🤖 revert more changes

* fix: 🐛 fix TypeScript type check errors

* fix: 🐛 fix functional test imports

* fix: 🐛 fix x-pack Jest test importa

* test: 💍 fix advanced_ui_actiosn import for tests
This commit is contained in:
Vadim Dalecky 2019-09-27 16:41:23 +02:00 committed by GitHub
parent 4bda107558
commit e7c15e2609
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
146 changed files with 387 additions and 320 deletions

View file

@ -14,7 +14,7 @@
"dashboardEmbeddableContainer": "src/legacy/core_plugins/dashboard_embeddable_container",
"kbn": "src/legacy/core_plugins/kibana",
"kbnDocViews": "src/legacy/core_plugins/kbn_doc_views",
"embeddableApi": "src/legacy/core_plugins/embeddable_api",
"embeddableApi": "src/plugins/embeddable",
"kbnVislibVisTypes": "src/legacy/core_plugins/kbn_vislib_vis_types",
"visTypeMarkdown": "src/legacy/core_plugins/vis_type_markdown",
"visTypeMetric": "src/legacy/core_plugins/vis_type_metric",

View file

@ -24,12 +24,10 @@ import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helper
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory';
import {
ContactCardEmbeddable,
ContactCardEmbeddableInput,
ContactCardEmbeddableOutput,
} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable';
} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples';
import { DashboardOptions } from '../embeddable/dashboard_container_factory';
const embeddableFactories = new Map<string, EmbeddableFactory>();

View file

@ -26,12 +26,10 @@ import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helper
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory';
import {
ContactCardEmbeddableInput,
ContactCardEmbeddable,
ContactCardEmbeddableOutput,
} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable';
} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples';
const options: DashboardContainerOptions = {
application: {} as any,

View file

@ -30,7 +30,7 @@ import { getSampleDashboardInput } from '../../test_helpers';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
} from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory';
} from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples';
import { KibanaContextProvider } from '../../../../../../../../../plugins/kibana_react/public';
let dashboardContainer: DashboardContainer | undefined;

View file

@ -21,7 +21,8 @@ import { DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH } from '../dashboard_constant
import { DashboardPanelState } from '../types';
import { createPanelState } from './create_panel_state';
import { EmbeddableInput } from '../../embeddable_api';
import { CONTACT_CARD_EMBEDDABLE } from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { CONTACT_CARD_EMBEDDABLE } from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples';
interface TestInput extends EmbeddableInput {
test: string;

View file

@ -31,7 +31,7 @@ import { getSampleDashboardInput } from '../../test_helpers';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
} from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory';
} from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples';
import { KibanaContextProvider } from '../../../../../../../../../plugins/kibana_react/public';
let dashboardContainer: DashboardContainer | undefined;

View file

@ -32,14 +32,14 @@ import { getSampleDashboardInput } from '../lib/test_helpers';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
} from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory';
} from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples';
import {
ContactCardEmbeddableInput,
ContactCardEmbeddable,
ContactCardEmbeddableOutput,
} from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable';
} from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples';
import { embeddablePluginMock } from '../../../../../embeddable_api/public/np_ready/public/mocks';
import { createEditModeAction } from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples/actions/edit_mode_action';
import { createEditModeAction } from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples';
// eslint-disable-next-line
import { inspectorPluginMock } from '../../../../../../../plugins/inspector/public/mocks';
import { KibanaContextProvider } from '../../../../../../../plugins/kibana_react/public';

View file

@ -1,39 +1,2 @@
# The Embeddable API V2
The Embeddable API's main goal is to have documented and standardized ways to share and exchange information and functionality across applications and plugins.
There are three main pieces of this infrastructure:
- Embeddables & Containers
- Actions
- Triggers
## Embeddables & Containers
Embeddables are isolated, serializable, renderable widgets. A developer can hard code an embeddable inside their
application, or they can use some built in actions to allow users to dynamically add them to *containers*.
Containers are a special type of embeddable that can contain nested embeddables.
## Actions
Actions are pluggable pieces of functionality exposed to the user that take an embeddable as context, plus an optional action context.
## Triggers
Triggers are the way actions are connected to a user action. We ship with two default triggers, `CONTEXT_MENU_TRIGGER` and `APPLY_FILTER`.
Actions attached to the `CONTEXT_MENU_TRIGGER` will be displayed in supported embeddables context menu to the user. Actions attached to the `APPLY_FILTER` trigger will show up when any embeddable emits this trigger.
A developer can register new triggers that their embeddables, or external components, can emit (as long as they have an embeddable to pass along as context).
## Examples
Many examples can be viewed in the functionally tested `kbn_tp_embeddable_explorer` plugin, as well as the jest tested classes inside the `embeddable_api/public/test_samples` folder.
## Testing
Run unit tests
```shell
node scripts/jest embeddable_api
```
- Embeddables have been moved to `/src/plugins/embeddable` NP plugin.
- This legacy plugin is still there to make necessary CSS working, but soon will be completely deleted.

View file

@ -1,5 +1,5 @@
@import 'src/legacy/ui/public/styles/styling_constants';
@import './variables';
@import './np_ready/public/lib/panel/index';
@import './np_ready/public/lib/panel/panel_header/index';
@import '../../../../plugins/embeddable/public/lib/panel/index';
@import '../../../../plugins/embeddable/public/lib/panel/panel_header/index';

View file

@ -17,49 +17,4 @@
* under the License.
*/
import { PluginInitializerContext } from 'src/core/public';
import { EmbeddablePublicPlugin } from './plugin';
export {
ADD_PANEL_ACTION_ID,
APPLY_FILTER_ACTION,
APPLY_FILTER_TRIGGER,
PANEL_BADGE_TRIGGER,
Adapters,
AddPanelAction,
CONTEXT_MENU_TRIGGER,
Container,
ContainerInput,
ContainerOutput,
EDIT_PANEL_ACTION_ID,
EditPanelAction,
Embeddable,
EmbeddableChildPanel,
EmbeddableChildPanelProps,
EmbeddableFactory,
EmbeddableFactoryNotFoundError,
EmbeddableInput,
EmbeddableInstanceConfiguration,
EmbeddableOutput,
EmbeddablePanel,
ErrorEmbeddable,
GetEmbeddableFactories,
GetEmbeddableFactory,
IContainer,
IEmbeddable,
OutputSpec,
PanelNotFoundError,
PanelState,
PropertySpec,
SavedObjectMetaData,
ViewMode,
isErrorEmbeddable,
openAddPanelFlyout,
} from './lib';
export function plugin(initializerContext: PluginInitializerContext) {
return new EmbeddablePublicPlugin(initializerContext);
}
export { EmbeddablePublicPlugin as Plugin };
export * from './plugin';
export * from '../../../../../../plugins/embeddable/public';

View file

@ -17,12 +17,8 @@
* under the License.
*/
/* eslint-disable @kbn/eslint/no-restricted-paths */
// eslint-disable-next-line
import { npSetup, npStart } from 'ui/new_platform';
/* eslint-enable @kbn/eslint/no-restricted-paths */
import { plugin } from '.';
const pluginInstance = plugin({} as any);
export const setup = pluginInstance.setup(npSetup.core, { uiActions: npSetup.plugins.uiActions });
export const start = pluginInstance.start(npStart.core);
export const setup = npSetup.plugins.embeddable;
export const start = npStart.plugins.embeddable;

View file

@ -17,5 +17,5 @@
* under the License.
*/
export * from './actions';
export * from './embeddables';
// eslint-disable-next-line
export * from '../../../../../../../../plugins/embeddable/public/lib/test_samples';

View file

@ -17,46 +17,5 @@
* under the License.
*/
import { Plugin } from '.';
import { coreMock } from '../../../../../../core/public/mocks';
// eslint-disable-next-line
import { uiActionsPluginMock } from '../../../../../../plugins/ui_actions/public/mocks';
export type Setup = jest.Mocked<ReturnType<Plugin['setup']>>;
export type Start = jest.Mocked<ReturnType<Plugin['start']>>;
const createSetupContract = (): Setup => {
const setupContract: Setup = {
registerEmbeddableFactory: jest.fn(),
};
return setupContract;
};
const createStartContract = (): Start => {
const startContract: Start = {
registerEmbeddableFactory: jest.fn(),
getEmbeddableFactories: jest.fn(),
getEmbeddableFactory: jest.fn(),
};
return startContract;
};
const createInstance = () => {
const plugin = new Plugin({} as any);
const setup = plugin.setup(coreMock.createSetup(), {
uiActions: uiActionsPluginMock.createSetupContract(),
});
const doStart = () => plugin.start(coreMock.createStart());
return {
plugin,
setup,
doStart,
};
};
export const embeddablePluginMock = {
createSetupContract,
createStartContract,
createInstance,
};
export * from '../../../../../../plugins/embeddable/public/mocks';

View file

@ -24,7 +24,7 @@ import { getAppStateMock, getSavedDashboardMock } from './__tests__';
import { AppStateClass } from 'ui/state_management/app_state';
import { DashboardAppState } from './types';
import { TimeRange } from 'src/plugins/data/public';
import { ViewMode } from '../../../embeddable_api/public/np_ready/public';
import { ViewMode } from 'src/plugins/embeddable/public';
import { InputTimeRange } from 'ui/timefilter';
jest.mock('ui/registry/field_formats', () => ({

View file

@ -28,7 +28,7 @@ import { migrateLegacyQuery } from 'ui/utils/migrate_legacy_query';
import { Moment } from 'moment';
import { DashboardContainer } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public';
import { ViewMode } from '../../../embeddable_api/public/np_ready/public';
import { ViewMode } from '../../../../../../src/plugins/embeddable/public';
import { Query } from '../../../data/public';
import { getAppStateDefaults, migrateAppState } from './lib';

View file

@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
import { ViewMode } from '../../../embeddable_api/public/np_ready/public';
import { ViewMode } from '../../../../../../src/plugins/embeddable/public';
/**
* @param title {string} the current title of the dashboard

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { ViewMode } from '../../../../embeddable_api/public/np_ready/public';
import { ViewMode } from '../../../../../../../src/plugins/embeddable/public';
import { SavedObjectDashboard } from '../saved_dashboard/saved_dashboard';
import { DashboardAppStateDefaults } from '../types';

View file

@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
import { ViewMode } from '../../../../embeddable_api/public/np_ready/public';
import { ViewMode } from '../../../../../../plugins/embeddable/public';
import { TopNavIds } from './top_nav_ids';
import { NavAction } from '../types';

View file

@ -21,7 +21,7 @@ import { AppState } from 'ui/state_management/app_state';
import { Filter } from '@kbn/es-query';
import { Query } from 'src/legacy/core_plugins/data/public';
import { AppState as TAppState } from 'ui/state_management/app_state';
import { ViewMode } from 'src/legacy/core_plugins/embeddable_api/public/np_ready/public';
import { ViewMode } from 'src/plugins/embeddable/public';
import {
RawSavedDashboardPanelTo60,
RawSavedDashboardPanel610,

View file

@ -19,7 +19,7 @@
import '../doc_table';
import { capabilities } from 'ui/capabilities';
import { npStart } from 'ui/new_platform';
import { npStart, npSetup } from 'ui/new_platform';
import { i18n } from '@kbn/i18n';
import chrome from 'ui/chrome';
import { IPrivate } from 'ui/private';
@ -30,8 +30,7 @@ import {
EmbeddableFactory,
ErrorEmbeddable,
Container,
} from '../../../../embeddable_api/public/np_ready/public';
import { setup } from '../../../../embeddable_api/public/np_ready/public/legacy';
} from '../../../../../../plugins/embeddable/public';
import { SavedSearchLoader } from '../types';
import { SearchEmbeddable, SEARCH_EMBEDDABLE_TYPE } from './search_embeddable';
import { SearchInput, SearchOutput } from './types';
@ -112,4 +111,4 @@ export class SearchEmbeddableFactory extends EmbeddableFactory<
}
const factory = new SearchEmbeddableFactory(npStart.plugins.uiActions.executeTriggerActions);
setup.registerEmbeddableFactory(factory.type, factory);
npSetup.plugins.embeddable.registerEmbeddableFactory(factory.type, factory);

View file

@ -21,12 +21,8 @@ import { StaticIndexPattern } from 'ui/index_patterns';
import { TimeRange } from 'src/plugins/data/public';
import { Query } from 'src/legacy/core_plugins/data/public';
import { Filter } from '@kbn/es-query';
import { EmbeddableInput, EmbeddableOutput, IEmbeddable } from 'src/plugins/embeddable/public';
import { SavedSearch } from '../types';
import {
EmbeddableInput,
EmbeddableOutput,
IEmbeddable,
} from '../../../../embeddable_api/public/np_ready/public';
import { SortOrder } from '../doc_table/components/table_header/helpers';
export interface SearchInput extends EmbeddableInput {

View file

@ -19,7 +19,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Embeddable, EmbeddableOutput } from '../../../../embeddable_api/public/np_ready/public';
import { Embeddable, EmbeddableOutput } from '../../../../../../plugins/embeddable/public';
import { DisabledLabVisualization } from './disabled_lab_visualization';
import { VisualizeInput } from './visualize_embeddable';
import { VISUALIZE_EMBEDDABLE_TYPE } from './constants';

View file

@ -29,14 +29,14 @@ import {
} from 'ui/visualize/loader/types';
import { Subscription } from 'rxjs';
import * as Rx from 'rxjs';
import { TimeRange } from 'src/plugins/data/public';
import { Filter } from '@kbn/es-query';
import { TimeRange } from '../../../../../../plugins/data/public';
import {
EmbeddableInput,
EmbeddableOutput,
Embeddable,
Container,
} from '../../../../embeddable_api/public/np_ready/public';
} from '../../../../../../plugins/embeddable/public';
import { Query, onlyDisabledFiltersChanged } from '../../../../data/public';
import { VISUALIZE_EMBEDDABLE_TYPE } from './constants';

View file

@ -47,13 +47,13 @@ import { VisTypesRegistry, VisTypesRegistryProvider } from 'ui/registry/vis_type
import { IPrivate } from 'ui/private';
import { SavedObjectAttributes } from 'kibana/server';
import { npSetup } from 'ui/new_platform';
import {
EmbeddableFactory,
ErrorEmbeddable,
Container,
EmbeddableOutput,
} from '../../../../embeddable_api/public/np_ready/public';
import { setup } from '../../../../embeddable_api/public/np_ready/public/legacy';
} from '../../../../../../plugins/embeddable/public';
import { showNewVisModal } from '../wizard';
import { SavedVisualizations } from '../types';
import { DisabledLabEmbeddable } from './disabled_lab_embeddable';
@ -184,5 +184,8 @@ export class VisualizeEmbeddableFactory extends EmbeddableFactory<
}
VisualizeEmbeddableFactory.createVisualizeEmbeddableFactory().then(embeddableFactory => {
setup.registerEmbeddableFactory(VISUALIZE_EMBEDDABLE_TYPE, embeddableFactory);
npSetup.plugins.embeddable.registerEmbeddableFactory(
VISUALIZE_EMBEDDABLE_TYPE,
embeddableFactory
);
});

View file

@ -20,6 +20,7 @@
/* eslint-disable @kbn/eslint/no-restricted-paths */
import { coreMock } from '../../../../../core/public/mocks';
import { dataPluginMock } from '../../../../../plugins/data/public/mocks';
import { embeddablePluginMock } from '../../../../../plugins/embeddable/public/mocks';
import { expressionsPluginMock } from '../../../../../plugins/expressions/public/mocks';
import { inspectorPluginMock } from '../../../../../plugins/inspector/public/mocks';
import { uiActionsPluginMock } from '../../../../../plugins/ui_actions/public/mocks';
@ -28,12 +29,14 @@ import { uiActionsPluginMock } from '../../../../../plugins/ui_actions/public/mo
export const pluginsMock = {
createSetup: () => ({
data: dataPluginMock.createSetupContract(),
embeddable: embeddablePluginMock.createSetupContract(),
inspector: inspectorPluginMock.createSetupContract(),
expressions: expressionsPluginMock.createSetupContract(),
uiActions: uiActionsPluginMock.createSetupContract(),
}),
createStart: () => ({
data: dataPluginMock.createStartContract(),
embeddable: embeddablePluginMock.createStartContract(),
inspector: inspectorPluginMock.createStartContract(),
expressions: expressionsPluginMock.createStartContract(),
uiActions: uiActionsPluginMock.createStartContract(),

View file

@ -24,6 +24,9 @@ export const npSetup = {
chrome: {}
},
plugins: {
embeddable: {
registerEmbeddableFactory: sinon.fake(),
},
expressions: {
registerFunction: sinon.fake(),
registerRenderer: sinon.fake(),
@ -52,6 +55,11 @@ export const npStart = {
chrome: {}
},
plugins: {
embeddable: {
getEmbeddableFactory: sinon.fake(),
getEmbeddableFactories: sinon.fake(),
registerEmbeddableFactory: sinon.fake(),
},
expressions: {
registerFunction: sinon.fake(),
registerRenderer: sinon.fake(),

View file

@ -17,6 +17,7 @@
* under the License.
*/
import { IUiActionsStart, IUiActionsSetup } from 'src/plugins/ui_actions/public';
import { Start as EmbeddableStart, Setup as EmbeddableSetup } from 'src/plugins/embeddable/public';
import { LegacyCoreSetup, LegacyCoreStart } from '../../../../core/public';
import { Plugin as DataPlugin } from '../../../../plugins/data/public';
import { Plugin as ExpressionsPlugin } from '../../../../plugins/expressions/public';
@ -28,6 +29,7 @@ import { EuiUtilsStart } from '../../../../plugins/eui_utils/public';
export interface PluginsSetup {
data: ReturnType<DataPlugin['setup']>;
embeddable: EmbeddableSetup;
expressions: ReturnType<ExpressionsPlugin['setup']>;
inspector: InspectorSetup;
uiActions: IUiActionsSetup;
@ -35,6 +37,7 @@ export interface PluginsSetup {
export interface PluginsStart {
data: ReturnType<DataPlugin['start']>;
embeddable: EmbeddableStart;
eui_utils: EuiUtilsStart;
expressions: ReturnType<ExpressionsPlugin['start']>;
inspector: InspectorStart;

View file

@ -0,0 +1,39 @@
# The Embeddable API V2
The Embeddable API's main goal is to have documented and standardized ways to share and exchange information and functionality across applications and plugins.
There are three main pieces of this infrastructure:
- Embeddables & Containers
- Actions
- Triggers
## Embeddables & Containers
Embeddables are isolated, serializable, renderable widgets. A developer can hard code an embeddable inside their
application, or they can use some built in actions to allow users to dynamically add them to *containers*.
Containers are a special type of embeddable that can contain nested embeddables.
## Actions
Actions are pluggable pieces of functionality exposed to the user that take an embeddable as context, plus an optional action context.
## Triggers
Triggers are the way actions are connected to a user action. We ship with two default triggers, `CONTEXT_MENU_TRIGGER` and `APPLY_FILTER`.
Actions attached to the `CONTEXT_MENU_TRIGGER` will be displayed in supported embeddables context menu to the user. Actions attached to the `APPLY_FILTER` trigger will show up when any embeddable emits this trigger.
A developer can register new triggers that their embeddables, or external components, can emit (as long as they have an embeddable to pass along as context).
## Examples
Many examples can be viewed in the functionally tested `kbn_tp_embeddable_explorer` plugin, as well as the jest tested classes inside the `embeddable_api/public/test_samples` folder.
## Testing
Run unit tests
```shell
node scripts/jest embeddable_api
```

View file

@ -4,7 +4,7 @@
"server": false,
"ui": true,
"requiredPlugins": [
"embeddable",
"inspector"
"inspector",
"uiActions"
]
}

View file

@ -0,0 +1,65 @@
/*
* 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 { PluginInitializerContext } from 'src/core/public';
import { EmbeddablePublicPlugin } from './plugin';
export {
ADD_PANEL_ACTION_ID,
APPLY_FILTER_ACTION,
APPLY_FILTER_TRIGGER,
PANEL_BADGE_TRIGGER,
Adapters,
AddPanelAction,
CONTEXT_MENU_TRIGGER,
Container,
ContainerInput,
ContainerOutput,
EDIT_PANEL_ACTION_ID,
EditPanelAction,
Embeddable,
EmbeddableChildPanel,
EmbeddableChildPanelProps,
EmbeddableFactory,
EmbeddableFactoryNotFoundError,
EmbeddableInput,
EmbeddableInstanceConfiguration,
EmbeddableOutput,
EmbeddablePanel,
ErrorEmbeddable,
GetEmbeddableFactories,
GetEmbeddableFactory,
IContainer,
IEmbeddable,
OutputSpec,
PanelNotFoundError,
PanelState,
PropertySpec,
SavedObjectMetaData,
ViewMode,
isErrorEmbeddable,
openAddPanelFlyout,
} from './lib';
export function plugin(initializerContext: PluginInitializerContext) {
return new EmbeddablePublicPlugin(initializerContext);
}
export { EmbeddablePublicPlugin as Plugin };
export * from './plugin';

View file

@ -19,11 +19,7 @@
import { i18n } from '@kbn/i18n';
import { Filter } from '@kbn/es-query';
import {
IAction,
createAction,
IncompatibleActionError,
} from '../../../../../../../../plugins/ui_actions/public';
import { IAction, createAction, IncompatibleActionError } from '../ui_actions';
import { IEmbeddable, EmbeddableInput } from '../embeddables';
export const APPLY_FILTER_ACTION = 'APPLY_FILTER_ACTION';

View file

@ -31,7 +31,7 @@ import {
ContactCardEmbeddable,
} from '../test_samples/embeddables/contact_card/contact_card_embeddable';
// eslint-disable-next-line
import { inspectorPluginMock } from '../../../../../../../../plugins/inspector/public/mocks';
import { inspectorPluginMock } from 'src/plugins/inspector/public/mocks';
import { mount } from 'enzyme';
test('EmbeddableChildPanel renders an embeddable when it is done loading', async () => {

View file

@ -25,11 +25,11 @@ import { Subscription } from 'rxjs';
import { CoreStart } from 'src/core/public';
import { TGetActionsCompatibleWithTrigger } from 'src/plugins/ui_actions/public';
import { Start as InspectorStartContract } from 'src/plugins/inspector/public';
import { ErrorEmbeddable, IEmbeddable } from '../embeddables';
import { EmbeddablePanel } from '../panel';
import { IContainer } from './i_container';
import { GetEmbeddableFactory, GetEmbeddableFactories } from '../types';
import { Start as InspectorStartContract } from '../../../../../../../../plugins/inspector/public';
export interface EmbeddableChildPanelProps {
embeddableId: string;

View file

@ -0,0 +1,20 @@
/*
* 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.
*/
export * from '../../../inspector/public';

View file

@ -41,7 +41,7 @@ import {
ContactCardEmbeddableOutput,
} from '../test_samples/embeddables/contact_card/contact_card_embeddable';
// eslint-disable-next-line
import { inspectorPluginMock } from '../../../../../../../../plugins/inspector/public/mocks';
import { inspectorPluginMock } from 'src/plugins/inspector/public/mocks';
const actionRegistry = new Map<string, IAction>();
const triggerRegistry = new Map<string, ITrigger>();

View file

@ -24,9 +24,10 @@ import {
buildContextMenuForActions,
TGetActionsCompatibleWithTrigger,
IAction,
} from '../../../../../../../../plugins/ui_actions/public';
import { CoreStart } from '../../../../../../../../core/public';
} from '../ui_actions';
import { CoreStart } from '../../../../../core/public';
import { Start as InspectorStartContract } from '../inspector';
import { CONTEXT_MENU_TRIGGER, PANEL_BADGE_TRIGGER } from '../triggers';
import { IEmbeddable } from '../embeddables/i_embeddable';
import { ViewMode, GetEmbeddableFactory, GetEmbeddableFactories } from '../types';
@ -38,7 +39,6 @@ import { PanelHeader } from './panel_header/panel_header';
import { InspectPanelAction } from './panel_header/panel_actions/inspect_panel_action';
import { EditPanelAction } from '../actions';
import { CustomizePanelModal } from './panel_header/panel_actions/customize_title/customize_panel_modal';
import { Start as InspectorStartContract } from '../../../../../../../../plugins/inspector/public';
interface Props {
embeddable: IEmbeddable<any, any>;

View file

@ -29,7 +29,8 @@ import {
import { FilterableEmbeddableFactory } from '../../../../test_samples/embeddables/filterable_embeddable_factory';
import { FilterableContainer } from '../../../../test_samples/embeddables/filterable_container';
import { GetEmbeddableFactory } from '../../../../types';
import { coreMock } from '../../../../../../../../../../../core/public/mocks';
// eslint-disable-next-line
import { coreMock } from '../../../../../../../../core/public/mocks';
import { ContactCardEmbeddable } from '../../../../test_samples';
const embeddableFactories = new Map<string, EmbeddableFactory>();

View file

@ -18,10 +18,10 @@
*/
import { i18n } from '@kbn/i18n';
import { IAction } from 'src/plugins/ui_actions/public';
import { NotificationsStart } from 'src/core/public';
import { KibanaReactOverlays } from 'src/plugins/kibana_react/public';
import { ViewMode, GetEmbeddableFactory, GetEmbeddableFactories } from '../../../../types';
import { openAddPanelFlyout } from './open_add_panel_flyout';
import { NotificationsStart } from '../../../../../../../../../../../core/public';
import { KibanaReactOverlays } from '../../../../../../../../../../../plugins/kibana_react/public';
import { IContainer } from '../../../../containers';
export const ADD_PANEL_ACTION_ID = 'ADD_PANEL_ACTION_ID';

View file

@ -33,7 +33,7 @@ import { mount } from 'enzyme';
import { findTestSubject } from '@elastic/eui/lib/test';
// eslint-disable-next-line
import { coreMock } from '../../../../../../../../../../../core/public/mocks';
import { coreMock } from '../../../../../../../../core/public/mocks';
test('createNewEmbeddable() add embeddable to container', async () => {
const core = coreMock.createStart();

View file

@ -17,11 +17,11 @@
* under the License.
*/
import React from 'react';
import { NotificationsStart } from 'src/core/public';
import { KibanaReactOverlays } from 'src/plugins/kibana_react/public';
import { IContainer } from '../../../../containers';
import { AddPanelFlyout } from './add_panel_flyout';
import { GetEmbeddableFactory, GetEmbeddableFactories } from '../../../../types';
import { NotificationsStart } from '../../../../../../../../../../../core/public';
import { KibanaReactOverlays } from '../../../../../../../../../../../plugins/kibana_react/public';
export async function openAddPanelFlyout(options: {
embeddable: IContainer;

View file

@ -27,7 +27,7 @@ import {
ContactCardEmbeddable,
} from '../../../test_samples';
// eslint-disable-next-line
import { inspectorPluginMock } from '../../../../../../../../../../plugins/inspector/public/mocks';
import { inspectorPluginMock } from 'src/plugins/inspector/public/mocks';
import { FilterStateStore } from '@kbn/es-query';
import {
EmbeddableFactory,

View file

@ -18,8 +18,8 @@
*/
import { i18n } from '@kbn/i18n';
import { IAction } from '../../../../../../../../../../plugins/ui_actions/public';
import { Start as InspectorStartContract } from '../../../../../../../../../../plugins/inspector/public';
import { IAction } from 'src/plugins/ui_actions/public';
import { Start as InspectorStartContract } from 'src/plugins/inspector/public';
import { IEmbeddable } from '../../../embeddables';
export const INSPECT_PANEL_ACTION_ID = 'openInspector';

View file

@ -17,10 +17,7 @@
* under the License.
*/
import { i18n } from '@kbn/i18n';
import {
IAction,
IncompatibleActionError,
} from '../../../../../../../../../../plugins/ui_actions/public';
import { IAction, IncompatibleActionError } from '../../../ui_actions';
import { ContainerInput, IContainer } from '../../../containers';
import { ViewMode } from '../../../types';
import { IEmbeddable } from '../../../embeddables';

View file

@ -23,8 +23,6 @@ import React from 'react';
import { IAction } from 'src/plugins/ui_actions/public';
import { PanelOptionsMenu } from './panel_options_menu';
import { IEmbeddable } from '../../embeddables';
import { VisualizeEmbeddable } from '../../../../../../../kibana/public/visualize/embeddable/visualize_embeddable';
import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../../../kibana/public/visualize/embeddable/constants';
export interface PanelHeaderProps {
title?: string;
@ -49,10 +47,8 @@ function renderBadges(badges: IAction[], embeddable: IEmbeddable) {
));
}
function isVisualizeEmbeddable(
embeddable: IEmbeddable | VisualizeEmbeddable
): embeddable is VisualizeEmbeddable {
return embeddable.type === VISUALIZE_EMBEDDABLE_TYPE;
function isVisualizeEmbeddable(embeddable: IEmbeddable | any): embeddable is any {
return embeddable.type === 'VISUALIZE_EMBEDDABLE_TYPE';
}
export function PanelHeader({
@ -85,7 +81,7 @@ export function PanelHeader({
let viewDescr = '';
if (isVisualizeEmbeddable(embeddable)) {
const vd = (embeddable as VisualizeEmbeddable).getVisualizationDescription();
const vd = (embeddable as any).getVisualizationDescription();
if (vd) {
viewDescr = vd;
}

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { createAction } from '../../../../../../../../../plugins/ui_actions/public';
import { createAction } from '../../ui_actions';
import { ViewMode } from '../../types';
import { IEmbeddable } from '../../embeddables';

View file

@ -17,10 +17,7 @@
* under the License.
*/
import {
IAction,
IncompatibleActionError,
} from '../../../../../../../../../plugins/ui_actions/public';
import { IAction, IncompatibleActionError } from '../../ui_actions';
import { EmbeddableInput, Embeddable, EmbeddableOutput, IEmbeddable } from '../../embeddables';
export const SAY_HELLO_ACTION = 'SAY_HELLO_ACTION';

View file

@ -18,14 +18,11 @@
*/
import React from 'react';
import { EuiFlyoutBody } from '@elastic/eui';
import {
createAction,
IncompatibleActionError,
} from '../../../../../../../../../plugins/ui_actions/public';
import { createAction, IncompatibleActionError } from '../../ui_actions';
import { CoreStart } from '../../../../../../core/public';
import { Embeddable, EmbeddableInput } from '../../embeddables';
import { GetMessageModal } from './get_message_modal';
import { FullNameEmbeddableOutput, hasFullNameOutput } from './say_hello_action';
import { CoreStart } from '../../../../../../../../../core/public';
export const SEND_MESSAGE_ACTION = 'SEND_MESSAGE_ACTION';

View file

@ -21,12 +21,12 @@ import React from 'react';
import { i18n } from '@kbn/i18n';
import { TExecuteTriggerActions } from 'src/plugins/ui_actions/public';
import { CoreStart } from 'src/core/public';
import { EmbeddableFactory } from '../../../embeddables';
import { Container } from '../../../containers';
import { ContactCardEmbeddable, ContactCardEmbeddableInput } from './contact_card_embeddable';
import { ContactCardInitializer } from './contact_card_initializer';
import { EmbeddableFactoryOptions } from '../../../embeddables/embeddable_factory';
import { CoreStart } from '../../../../../../../../../../core/public';
export const CONTACT_CARD_EMBEDDABLE = 'CONTACT_CARD_EMBEDDABLE';

Some files were not shown because too many files have changed in this diff Show more