diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx index 505399f3150bec..8abd2d9cab5a61 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx @@ -244,7 +244,7 @@ test('HelloWorldContainer in edit mode hides disabledActions', async () => { const fooContextMenuActionItem1 = findTestSubject(component1, 'embeddablePanelAction-FOO'); const fooContextMenuActionItem2 = findTestSubject(component2, 'embeddablePanelAction-FOO'); - expect(fooContextMenuActionItem1.length).toBe(1); + expect(fooContextMenuActionItem1.length).toBe(2); expect(fooContextMenuActionItem2.length).toBe(0); }); diff --git a/src/plugins/ui_actions/public/actions/action_internal.test.ts b/src/plugins/ui_actions/public/actions/action_internal.test.ts index 2a2b639434ac29..b14346180c2741 100644 --- a/src/plugins/ui_actions/public/actions/action_internal.test.ts +++ b/src/plugins/ui_actions/public/actions/action_internal.test.ts @@ -30,75 +30,4 @@ describe('ActionInternal', () => { const action = new ActionInternal(defaultActionDef); expect(action.id).toBe('test-action'); }); - - describe('serialize()', () => { - test('can serialize very simple action', () => { - const action = new ActionInternal(defaultActionDef); - - action.config = {}; - - const serialized = action.serialize(); - - expect(serialized).toMatchObject({ - id: 'test-action', - name: '', - config: expect.any(Object), - }); - }); - - test('can serialize action with modified state', () => { - const action = new ActionInternal({ - ...defaultActionDef, - type: 'ACTION_TYPE' as any, - order: 11, - }); - - action.name = 'qux'; - action.config = { foo: 'bar' }; - - const serialized = action.serialize(); - - expect(serialized).toMatchObject({ - id: 'test-action', - factoryId: 'ACTION_TYPE', - name: 'qux', - config: { - foo: 'bar', - }, - }); - }); - }); - - describe('deserialize', () => { - const serialized = { - id: 'id', - factoryId: 'type', - name: 'name', - config: { - foo: 'foo', - }, - }; - - test('can deserialize action state', () => { - const action = new ActionInternal({ - ...defaultActionDef, - }); - - action.deserialize(serialized); - - expect(action.name).toBe('name'); - expect(action.config).toMatchObject(serialized.config); - }); - - test('does not overwrite action id and type', () => { - const action = new ActionInternal({ - ...defaultActionDef, - }); - - action.deserialize(serialized); - - expect(action.id).toBe('test-action'); - expect(action.type).toBe(''); - }); - }); }); diff --git a/src/plugins/ui_actions/public/actions/action_internal.ts b/src/plugins/ui_actions/public/actions/action_internal.ts index ef27b78464f2b4..b6652f7e8a50a0 100644 --- a/src/plugins/ui_actions/public/actions/action_internal.ts +++ b/src/plugins/ui_actions/public/actions/action_internal.ts @@ -21,7 +21,6 @@ import { Action, ActionContext as Context, AnyActionDefinition } from './action' import { Presentable } from '../util/presentable'; import { uiToReactComponent } from '../../../kibana_react/public'; import { ActionType } from '../types'; -import { SerializedAction } from './types'; export class ActionInternal implements Action>, Presentable> { @@ -33,9 +32,6 @@ export class ActionInternal public readonly MenuItem? = this.definition.MenuItem; public readonly ReactMenuItem? = this.MenuItem ? uiToReactComponent(this.MenuItem) : undefined; - public name: string = ''; - public config?: object; - public execute(context: Context) { return this.definition.execute(context); } @@ -59,25 +55,6 @@ export class ActionInternal if (!this.definition.getHref) return undefined; return this.definition.getHref(context); } - - public serialize() { - if (!this.config) { - throw new Error('Action does not have a config.'); - } - - const serialized: SerializedAction = { - factoryId: this.type, - name: this.name, - config: this.config, - }; - - return serialized; - } - - public deserialize({ name, config }: SerializedAction) { - this.name = name; - this.config = config as object; - } } export type AnyActionInternal = ActionInternal; diff --git a/src/plugins/ui_actions/public/actions/dynamic_action_manager_state.ts b/src/plugins/ui_actions/public/actions/dynamic_action_manager_state.ts index 2d767ebe18968e..ba42fc4d15ce7b 100644 --- a/src/plugins/ui_actions/public/actions/dynamic_action_manager_state.ts +++ b/src/plugins/ui_actions/public/actions/dynamic_action_manager_state.ts @@ -36,7 +36,7 @@ export interface State { readonly fetchCount: number; /** - * List of all fetched events. If `null`, means now events have been loaded yet. + * List of all fetched events. */ readonly events: readonly SerializedEvent[]; } @@ -71,7 +71,7 @@ export const transitions: Transitions = { addEvent: state => (event: SerializedEvent) => ({ ...state, - events: [...(state.events || []), event], + events: [...state.events, event], }), removeEvent: state => (eventId: string) => ({ diff --git a/src/plugins/ui_actions/public/util/configurable.ts b/src/plugins/ui_actions/public/util/configurable.ts index ea13bab4d2e5ee..323bacd033bd5d 100644 --- a/src/plugins/ui_actions/public/util/configurable.ts +++ b/src/plugins/ui_actions/public/util/configurable.ts @@ -32,10 +32,8 @@ export interface Configurable config is Config; + readonly isConfigValid: (config: Config) => boolean; /** * `UiComponent` to be rendered when collecting configuration for this item. diff --git a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx b/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx index 866fde9f3a1d03..dbed6da46ba465 100644 --- a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx +++ b/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx @@ -242,7 +242,7 @@ function useDrilldownsStateManager( notifications: NotificationsStart ) { const [isLoading, setIsLoading] = useState(false); - const [drilldowns, setDrilldowns] = useState(); + const [drilldowns, setDrilldowns] = useState(); const isMounted = useMountedState(); async function run(op: () => Promise) { diff --git a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/test_data.ts b/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/test_data.ts index a4d09dddbaf310..aaf9a0e3dd0204 100644 --- a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/test_data.ts +++ b/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/test_data.ts @@ -49,6 +49,10 @@ class MockDynamicActionManager implements PublicMethodsOf }; } + async deleteEvent() { + throw new Error('not implemented'); + } + async start() {} async stop() {} }