Advanced ui actions 2 np (#46948) (#47020)

* feat: 🎸 move advanced_ui_actions plugin to NP

* fix: 🐛 fix NP plugin configs

* fix: 🐛 remove import from legacy platform
This commit is contained in:
Vadim Dalecky 2019-10-01 19:41:56 +02:00 committed by GitHub
parent 0edb03fba4
commit 569f8004d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 45 additions and 83 deletions

View file

@ -48,8 +48,13 @@ function renderBadges(badges: IAction[], embeddable: IEmbeddable) {
));
}
function isVisualizeEmbeddable(embeddable: IEmbeddable | any): embeddable is any {
return embeddable.type === 'VISUALIZE_EMBEDDABLE_TYPE';
const VISUALIZE_EMBEDDABLE_TYPE = 'visualization';
type VisualizeEmbeddable = any;
function isVisualizeEmbeddable(
embeddable: IEmbeddable | VisualizeEmbeddable
): embeddable is VisualizeEmbeddable {
return embeddable.type === VISUALIZE_EMBEDDABLE_TYPE;
}
export function PanelHeader({

View file

@ -2,7 +2,7 @@
"prefix": "xpack",
"paths": {
"xpack.actions": "legacy/plugins/actions",
"xpack.advancedUiActions": "legacy/plugins/advanced_ui_actions",
"xpack.advancedUiActions": "plugins/advanced_ui_actions",
"xpack.alerting": "legacy/plugins/alerting",
"xpack.apm": "legacy/plugins/apm",
"xpack.beatsManagement": "legacy/plugins/beats_management",

View file

@ -43,7 +43,6 @@ import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects'
import { snapshotRestore } from './legacy/plugins/snapshot_restore';
import { actions } from './legacy/plugins/actions';
import { alerting } from './legacy/plugins/alerting';
import { advancedUiActions } from './legacy/plugins/advanced_ui_actions';
import { lens } from './legacy/plugins/lens';
module.exports = function (kibana) {
@ -88,6 +87,5 @@ module.exports = function (kibana) {
snapshotRestore(kibana),
actions(kibana),
alerting(kibana),
advancedUiActions(kibana),
];
};

View file

@ -1,16 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { resolve } from 'path';
export const advancedUiActions = (kibana: any) =>
new kibana.Plugin({
id: 'advanced_ui_actions',
publicDir: resolve(__dirname, 'public'),
uiExports: {
hacks: 'plugins/advanced_ui_actions/np_ready/public/legacy',
},
});

View file

@ -1,21 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
/* eslint-disable @kbn/eslint/no-restricted-paths */
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, {
embeddable: npSetup.plugins.embeddable,
uiActions: npSetup.plugins.uiActions,
});
export const start = pluginInstance.start(npStart.core, {
embeddable: npStart.plugins.embeddable,
uiActions: npStart.plugins.uiActions,
});

View file

@ -1,9 +1,9 @@
{
"id": "advanced_ui_actions",
"id": "advancedUiActions",
"version": "kibana",
"requiredPlugins": [
"embeddable",
"ui_actions"
"uiActions"
],
"server": false,
"ui": true

View file

@ -8,7 +8,7 @@ import { canInheritTimeRange } from './can_inherit_time_range';
import {
HelloWorldEmbeddable,
HelloWorldContainer,
} from '../../../../../../../src/plugins/embeddable/public/lib/test_samples';
} from '../../../../src/plugins/embeddable/public/lib/test_samples';
/** eslint-enable */
import { TimeRangeEmbeddable, TimeRangeContainer } from './test_helpers';

View file

@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Embeddable, IContainer, ContainerInput } from 'src/plugins/embeddable/public';
import { TimeRange } from '../../../../../../../src/plugins/data/public';
import { Embeddable, IContainer, ContainerInput } from '../../../../src/plugins/embeddable/public';
import { TimeRange } from '../../../../src/plugins/data/public';
import { TimeRangeInput } from './custom_time_range_action';
interface ContainerTimeRangeInput extends ContainerInput<TimeRangeInput> {

View file

@ -10,18 +10,18 @@ import { skip } from 'rxjs/operators';
import * as Rx from 'rxjs';
import { mount } from 'enzyme';
import { EmbeddableFactory } from '../../../../../../../src/plugins/embeddable/public';
import { EmbeddableFactory } from '../../../../src/plugins/embeddable/public';
import { TimeRangeEmbeddable, TimeRangeContainer, TIME_RANGE_EMBEDDABLE } from './test_helpers';
import { TimeRangeEmbeddableFactory } from './test_helpers/time_range_embeddable_factory';
import { CustomTimeRangeAction } from './custom_time_range_action';
import { coreMock } from '../../../../../../../src/core/public/mocks';
import { coreMock } from '../../../../src/core/public/mocks';
/* eslint-disable */
import {
HelloWorldEmbeddableFactory,
HELLO_WORLD_EMBEDDABLE_TYPE,
HelloWorldEmbeddable,
HelloWorldContainer,
} from '../../../../../../../src/plugins/embeddable/public/lib/test_samples';
} from '../../../../src/plugins/embeddable/public/lib/test_samples';
/* eslint-enable */
import { nextTick } from 'test_utils/enzyme_helpers';

View file

@ -7,19 +7,13 @@
import { i18n } from '@kbn/i18n';
import React from 'react';
import { IEmbeddable, Embeddable, EmbeddableInput } from 'src/plugins/embeddable/public';
import {
IAction,
IncompatibleActionError,
} from '../../../../../../../src/plugins/ui_actions/public';
import { TimeRange } from '../../../../../../../src/plugins/data/public';
import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../../../src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable';
import { VisualizeEmbeddable } from '../../../../../../../src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable';
import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../../../src/legacy/core_plugins/kibana/public/visualize/embeddable/constants';
import { IAction, IncompatibleActionError } from '../../../../src/plugins/ui_actions/public';
import { TimeRange } from '../../../../src/plugins/data/public';
import { CustomizeTimeRangeModal } from './customize_time_range_modal';
import { OpenModal, CommonlyUsedRange } from './types';
const CUSTOM_TIME_RANGE = 'CUSTOM_TIME_RANGE';
const SEARCH_EMBEDDABLE_TYPE = 'search';
export interface TimeRangeInput extends EmbeddableInput {
timeRange: TimeRange;
@ -31,6 +25,9 @@ function hasTimeRange(
return (embeddable as Embeddable<TimeRangeInput>).getInput().timeRange !== undefined;
}
const VISUALIZE_EMBEDDABLE_TYPE = 'visualization';
type VisualizeEmbeddable = any;
function isVisualizeEmbeddable(
embeddable: IEmbeddable | VisualizeEmbeddable
): embeddable is VisualizeEmbeddable {

View file

@ -9,12 +9,11 @@ import { findTestSubject } from '@elastic/eui/lib/test';
import { skip } from 'rxjs/operators';
import * as Rx from 'rxjs';
import { mount } from 'enzyme';
import { EmbeddableFactory } from '../../../../../../../src/plugins/embeddable/public';
import { EmbeddableFactory } from '../../../../src/plugins/embeddable/public';
import { TimeRangeEmbeddable, TimeRangeContainer, TIME_RANGE_EMBEDDABLE } from './test_helpers';
import { TimeRangeEmbeddableFactory } from './test_helpers/time_range_embeddable_factory';
import { CustomTimeRangeBadge } from './custom_time_range_badge';
import { coreMock } from '../../../../../../../src/core/public/mocks';
import { coreMock } from '../../../../src/core/public/mocks';
import { ReactElement } from 'react';
import { nextTick } from 'test_utils/enzyme_helpers';

View file

@ -6,14 +6,9 @@
import React from 'react';
import { prettyDuration, commonDurationRanges } from '@elastic/eui';
import { IEmbeddable, Embeddable, EmbeddableInput } from 'src/plugins/embeddable/public';
import {
IAction,
IncompatibleActionError,
} from '../../../../../../../src/plugins/ui_actions/public';
import { TimeRange } from '../../../../../../../src/plugins/data/public';
import { IAction, IncompatibleActionError } from '../../../../src/plugins/ui_actions/public';
import { TimeRange } from '../../../../src/plugins/data/public';
import { CustomizeTimeRangeModal } from './customize_time_range_modal';
import { doesInheritTimeRange } from './does_inherit_time_range';
import { OpenModal, CommonlyUsedRange } from './types';

View file

@ -19,8 +19,8 @@ import {
EuiFlexItem,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { Embeddable, IContainer, ContainerInput } from 'src/plugins/embeddable/public';
import { TimeRange } from '../../../../../../../src/plugins/data/public';
import { Embeddable, IContainer, ContainerInput } from '../../../../src/plugins/embeddable/public';
import { TimeRange } from '../../../../src/plugins/data/public';
import { TimeRangeInput } from './custom_time_range_action';
import { doesInheritTimeRange } from './does_inherit_time_range';
import { CommonlyUsedRange } from './types';

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Embeddable, IContainer, ContainerInput } from 'src/plugins/embeddable/public';
import { Embeddable, IContainer, ContainerInput } from '../../../../src/plugins/embeddable/public';
import { TimeRangeInput } from './custom_time_range_action';
export function doesInheritTimeRange(embeddable: Embeddable<TimeRangeInput>) {

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { PluginInitializerContext } from 'src/core/public';
import { PluginInitializerContext } from '../../../../src/core/public';
import { AdvancedUiActionsPublicPlugin } from './plugin';
export function plugin(initializerContext: PluginInitializerContext) {

View file

@ -4,14 +4,19 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'src/core/public';
import { IUiActionsStart, IUiActionsSetup } from 'src/plugins/ui_actions/public';
import {
PluginInitializerContext,
CoreSetup,
CoreStart,
Plugin,
} from '../../../../src/core/public';
import { IUiActionsStart, IUiActionsSetup } from '../../../../src/plugins/ui_actions/public';
import {
CONTEXT_MENU_TRIGGER,
PANEL_BADGE_TRIGGER,
Setup as EmbeddableSetup,
Start as EmbeddableStart,
} from '../../../../../../../src/plugins/embeddable/public';
} from '../../../../src/plugins/embeddable/public';
import { CustomTimeRangeAction } from './custom_time_range_action';
import { CustomTimeRangeBadge } from './custom_time_range_badge';

View file

@ -9,8 +9,8 @@ import {
Container,
ContainerOutput,
GetEmbeddableFactory,
} from '../../../../../../../../src/plugins/embeddable/public';
import { TimeRange } from '../../../../../../../../src/plugins/data/public';
} from '../../../../../src/plugins/embeddable/public';
import { TimeRange } from '../../../../../src/plugins/data/public';
/**
* interfaces are not allowed to specify a sub-set of the required types until

View file

@ -9,8 +9,8 @@ import {
Embeddable,
EmbeddableInput,
IContainer,
} from '../../../../../../../../src/plugins/embeddable/public';
import { TimeRange } from '../../../../../../../../src/plugins/data/public';
} from '../../../../../src/plugins/embeddable/public';
import { TimeRange } from '../../../../../src/plugins/data/public';
interface EmbeddableTimeRangeInput extends EmbeddableInput {
timeRange: TimeRange;

View file

@ -8,8 +8,8 @@ import {
EmbeddableInput,
IContainer,
EmbeddableFactory,
} from '../../../../../../../../src/plugins/embeddable/public';
import { TimeRange } from '../../../../../../../../src/plugins/data/public';
} from '../../../../../src/plugins/embeddable/public';
import { TimeRange } from '../../../../../src/plugins/data/public';
import { TIME_RANGE_EMBEDDABLE, TimeRangeEmbeddable } from './time_range_embeddable';
interface EmbeddableTimeRangeInput extends EmbeddableInput {

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { OverlayRef } from 'src/core/public';
import { OverlayRef } from '../../../../src/core/public';
export interface CommonlyUsedRange {
from: string;