Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Sep 16, 2020
1 parent c2b75e3 commit be0a8dd
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 48 deletions.
5 changes: 5 additions & 0 deletions x-pack/plugins/ui_actions_enhanced/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/consistent-type-definitions": 0
}
}
28 changes: 28 additions & 0 deletions x-pack/plugins/ui_actions_enhanced/common/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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 { SerializableState } from '../../../../src/plugins/kibana_utils/common';

export type BaseActionConfig = SerializableState;

export type SerializedAction<Config extends BaseActionConfig = BaseActionConfig> = {
readonly factoryId: string;
readonly name: string;
readonly config: Config;
};

/**
* Serialized representation of a triggers-action pair, used to persist in storage.
*/
export type SerializedEvent = {
eventId: string;
triggers: string[];
action: SerializedAction;
};

export type DynamicActionsState = {
events: SerializedEvent[];
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const dashboards = [
{ id: 'dashboard2', title: 'Dashboard 2' },
];

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type DashboardDrilldownConfig = {
dashboardId?: string;
useCurrentFilters: boolean;
Expand Down Expand Up @@ -120,7 +119,6 @@ export const dashboardFactory = new ActionFactory(dashboardDrilldownActionFactor
getFeatureUsageStart: () => licensingMock.createStart().featureUsage,
});

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type UrlDrilldownConfig = {
url: string;
openInNewTab: boolean;
Expand Down
21 changes: 2 additions & 19 deletions x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,9 @@
*/

import { TriggerId } from '../../../../../src/plugins/ui_actions/public';
import { SerializableState } from '../../../../../src/plugins/kibana_utils/common';
import { SerializedAction, SerializedEvent, BaseActionConfig } from '../../common/types';

export type BaseActionConfig = SerializableState;

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type SerializedAction<Config extends BaseActionConfig = BaseActionConfig> = {
readonly factoryId: string;
readonly name: string;
readonly config: Config;
};

/**
* Serialized representation of a triggers-action pair, used to persist in storage.
*/
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type SerializedEvent = {
eventId: string;
triggers: string[];
action: SerializedAction;
};
export { SerializedAction, SerializedEvent, BaseActionConfig };

/**
* Action factory context passed into ActionFactories' CollectConfig, getDisplayName, getIconType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ import { LicensingPluginSetup, LicensingPluginStart } from '../../../licensing/p
import { SavedObjectReference } from '../../../../../src/core/types';
import { PersistableStateDefinition } from '../../../../../src/plugins/kibana_utils/common';

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type DynamicActionsState = {
events: SerializedEvent[];
};
import { DynamicActionsState } from '../../common/types';

export { DynamicActionsState };

export interface UiActionsServiceEnhancementsParams {
readonly actionFactories?: ActionFactoryRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { TimeRange } from '../../../../../src/plugins/data/public';
* https://github.com/microsoft/TypeScript/issues/15300 is fixed so we use a type
* here instead
*/
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type InheritedChildrenInput = {
timeRange: TimeRange;
id?: string;
Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/ui_actions_enhanced/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ export {
SerializedAction as UiActionsEnhancedSerializedAction,
SerializedEvent as UiActionsEnhancedSerializedEvent,
} from './types';

export {
DynamicActionsState,
BaseActionConfig as UiActionsEnhancedBaseActionConfig,
SerializedAction as UiActionsEnhancedSerializedAction,
SerializedEvent as UiActionsEnhancedSerializedEvent,
} from '../common/types';
25 changes: 3 additions & 22 deletions x-pack/plugins/ui_actions_enhanced/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,9 @@
import {
PersistableState,
PersistableStateDefinition,
SerializableState,
} from '../../../../src/plugins/kibana_utils/common';

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type SerializedAction<Config extends SerializableState = SerializableState> = {
readonly factoryId: string;
readonly name: string;
readonly config: Config;
};

/**
* Serialized representation of a triggers-action pair, used to persist in storage.
*/
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type SerializedEvent = {
eventId: string;
triggers: string[];
action: SerializedAction;
};

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type DynamicActionsState = {
events: SerializedEvent[];
};
import { SerializedAction, SerializedEvent, DynamicActionsState } from '../common/types';

export type ActionFactoryRegistry = Map<string, ActionFactory>;

Expand All @@ -43,3 +22,5 @@ export interface ActionFactory<P extends SerializedEvent = SerializedEvent>
extends PersistableState<P> {
id: string;
}

export { SerializedEvent, SerializedAction, DynamicActionsState };

0 comments on commit be0a8dd

Please sign in to comment.