Skip to content

Commit 01daabc

Browse files
author
Stacey Gammon
authored
Move actions to NP (#44707)
* move actions to np * fix jest and types
1 parent 1ef6373 commit 01daabc

File tree

124 files changed

+1418
-1025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+1418
-1025
lines changed

.i18nrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"kbnESQuery": "packages/kbn-es-query",
2929
"inspector": "src/plugins/inspector",
3030
"kibana-react": "src/plugins/kibana_react",
31-
"esUi": "src/plugins/es_ui_shared"
31+
"esUi": "src/plugins/es_ui_shared",
32+
"uiActions": "src/plugins/ui_actions"
3233
},
3334
"exclude": ["src/legacy/ui/ui_render/ui_render_mixin.js"],
3435
"translations": []

src/dev/jest/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default {
5151
'!src/legacy/ui/public/{agg_types,vis}/**/*.d.ts',
5252
],
5353
moduleNameMapper: {
54+
'^src/plugins/(.*)': '<rootDir>/src/plugins/$1',
5455
'^plugins/([^\/.]*)(.*)': '<rootDir>/src/legacy/core_plugins/$1/public$2',
5556
'^ui/(.*)': '<rootDir>/src/legacy/ui/public/$1',
5657
'^uiExports/(.*)': '<rootDir>/src/dev/jest/mocks/file_mock.js',

src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/kibana.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "kibana",
44
"requiredPlugins": [
55
"embeddable",
6-
"inspector"
6+
"inspector",
7+
"ui_actions"
78
],
89
"server": false,
910
"ui": true

src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/legacy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const pluginInstance = plugin({} as any);
3333

3434
export const setup = pluginInstance.setup(npSetup.core, {
3535
embeddable: embeddableSetup,
36+
uiActions: npSetup.plugins.uiActions,
3637
});
3738

3839
export const start = pluginInstance.start(npStart.core, {
@@ -42,4 +43,5 @@ export const start = pluginInstance.start(npStart.core, {
4243
SavedObjectFinder,
4344
ExitFullScreenButton,
4445
},
46+
uiActions: npStart.plugins.uiActions,
4547
});

src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ beforeEach(async () => {
5353
notifications: {} as any,
5454
overlays: {} as any,
5555
savedObjectMetaData: {} as any,
56+
uiActions: {} as any,
5657
};
5758
const input = getSampleDashboardInput({
5859
panels: {

src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
*/
1919

2020
import { i18n } from '@kbn/i18n';
21+
import { IEmbeddable } from '../../../../../../embeddable_api/public/np_ready/public';
22+
import { DASHBOARD_CONTAINER_TYPE, DashboardContainer } from '../embeddable';
2123
import {
22-
Action,
23-
IEmbeddable,
24+
IAction,
2425
IncompatibleActionError,
25-
} from '../../../../../../embeddable_api/public/np_ready/public';
26-
import { DASHBOARD_CONTAINER_TYPE, DashboardContainer } from '../embeddable';
26+
} from '../../../../../../../../../src/plugins/ui_actions/public';
2727

2828
export const EXPAND_PANEL_ACTION = 'togglePanel';
2929

@@ -43,13 +43,12 @@ interface ActionContext {
4343
embeddable: IEmbeddable;
4444
}
4545

46-
export class ExpandPanelAction extends Action<ActionContext> {
46+
export class ExpandPanelAction implements IAction<ActionContext> {
4747
public readonly type = EXPAND_PANEL_ACTION;
48+
public readonly id = EXPAND_PANEL_ACTION;
49+
public order = 7;
4850

49-
constructor() {
50-
super(EXPAND_PANEL_ACTION);
51-
this.order = 7;
52-
}
51+
constructor() {}
5352

5453
public getDisplayName({ embeddable }: ActionContext) {
5554
if (!embeddable.parent || !isDashboard(embeddable.parent)) {

src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/dashboard_container.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const options: DashboardContainerOptions = {
4545
inspector: {} as any,
4646
SavedObjectFinder: () => null,
4747
ExitFullScreenButton: () => null,
48+
uiActions: {} as any,
4849
};
4950

5051
beforeEach(() => {

src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/dashboard_container.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import ReactDOM from 'react-dom';
2222
import { I18nProvider } from '@kbn/i18n/react';
2323
import { Filter } from '@kbn/es-query';
2424
import { RefreshInterval, TimeRange } from 'src/plugins/data/public';
25+
import { IUiActionsStart } from '../../../../../../../../plugins/ui_actions/public';
2526
import {
2627
Container,
2728
ContainerInput,
@@ -82,6 +83,7 @@ export interface DashboardContainerOptions {
8283
inspector: InspectorStartContract;
8384
SavedObjectFinder: React.ComponentType<any>;
8485
ExitFullScreenButton: React.ComponentType<any>;
86+
uiActions: IUiActionsStart;
8587
}
8688

8789
export type DashboardReactContextValue = KibanaReactContextValue<DashboardContainerOptions>;

src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/grid/dashboard_grid.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function prepare(props?: Partial<DashboardGridProps>) {
6868
inspector: {} as any,
6969
SavedObjectFinder: () => null,
7070
ExitFullScreenButton: () => null,
71+
uiActions: {} as any,
7172
};
7273
dashboardContainer = new DashboardContainer(initialInput, options);
7374
const defaultTestProps: DashboardGridProps = {

src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/grid/dashboard_grid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class DashboardGridUi extends React.Component<DashboardGridProps, State> {
266266
<EmbeddableChildPanel
267267
embeddableId={panel.explicitInput.id}
268268
container={this.props.container}
269-
getActions={this.props.kibana.services.embeddable.getTriggerCompatibleActions}
269+
getActions={this.props.kibana.services.uiActions.getTriggerCompatibleActions}
270270
getEmbeddableFactory={this.props.kibana.services.embeddable.getEmbeddableFactory}
271271
getAllEmbeddableFactories={this.props.kibana.services.embeddable.getEmbeddableFactories}
272272
overlays={this.props.kibana.services.overlays}

0 commit comments

Comments
 (0)