Skip to content

Commit

Permalink
[ML] move declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Aug 5, 2020
1 parent bebf0a9 commit 4970f01
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 46 deletions.
51 changes: 10 additions & 41 deletions x-pack/plugins/ml/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,35 @@

import { i18n } from '@kbn/i18n';
import {
Plugin,
CoreStart,
CoreSetup,
AppMountParameters,
CoreSetup,
CoreStart,
Plugin,
PluginInitializerContext,
} from 'kibana/public';
import { BehaviorSubject } from 'rxjs';
import { take } from 'rxjs/operators';
import { ManagementSetup } from 'src/plugins/management/public';
import { SharePluginSetup, SharePluginStart, UrlGeneratorState } from 'src/plugins/share/public';
import { SharePluginSetup, SharePluginStart } from 'src/plugins/share/public';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';

import { DataPublicPluginStart } from 'src/plugins/data/public';
import { HomePublicPluginSetup } from 'src/plugins/home/public';
import { EmbeddableSetup } from 'src/plugins/embeddable/public';
import { AppStatus, AppUpdater } from '../../../../src/core/public';
import { AppStatus, AppUpdater, DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import { SecurityPluginSetup } from '../../security/public';
import { LicensingPluginSetup } from '../../licensing/public';
import { registerManagementSection } from './application/management';
import { LicenseManagementUIPluginSetup } from '../../license_management/public';
import { setDependencyCache } from './application/util/dependency_cache';
import { PLUGIN_ID, PLUGIN_ICON } from '../common/constants/app';
import { PLUGIN_ICON, PLUGIN_ID } from '../common/constants/app';
import { registerFeature } from './register_feature';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import { UiActionsSetup, UiActionsStart } from '../../../../src/plugins/ui_actions/public';
import {
registerMlUiActions,
APPLY_INFLUENCER_FILTERS_ACTION,
EDIT_SWIMLANE_PANEL_ACTION,
OPEN_IN_ANOMALY_EXPLORER_ACTION,
APPLY_TIME_RANGE_SELECTION_ACTION,
SWIM_LANE_SELECTION_TRIGGER,
} from './ui_actions';
import { registerMlUiActions } from './ui_actions';
import { KibanaLegacyStart } from '../../../../src/plugins/kibana_legacy/public';
import { registerUrlGenerator, MlUrlGeneratorState, ML_APP_URL_GENERATOR } from './url_generator';
import { isMlEnabled, isFullLicense } from '../common/license';
import {
EditSwimlanePanelContext,
SwimLaneDrilldownContext,
registerEmbeddables,
} from './embeddables';
import { registerUrlGenerator } from './url_generator';
import { isFullLicense, isMlEnabled } from '../common/license';
import { registerEmbeddables } from './embeddables';

export interface MlStartDependencies {
data: DataPublicPluginStart;
Expand All @@ -67,25 +55,6 @@ export interface MlSetupDependencies {
share: SharePluginSetup;
}

declare module '../../../../src/plugins/ui_actions/public' {
export interface ActionContextMapping {
[EDIT_SWIMLANE_PANEL_ACTION]: EditSwimlanePanelContext;
[OPEN_IN_ANOMALY_EXPLORER_ACTION]: SwimLaneDrilldownContext;
[APPLY_INFLUENCER_FILTERS_ACTION]: SwimLaneDrilldownContext;
[APPLY_TIME_RANGE_SELECTION_ACTION]: SwimLaneDrilldownContext;
}

export interface TriggerContextMapping {
[SWIM_LANE_SELECTION_TRIGGER]: SwimLaneDrilldownContext;
}
}

declare module '../../../../src/plugins/share/public' {
export interface UrlGeneratorStateMapping {
[ML_APP_URL_GENERATOR]: UrlGeneratorState<MlUrlGeneratorState>;
}
}

export type MlCoreSetup = CoreSetup<MlStartDependencies, MlPluginStart>;

export class MlPlugin implements Plugin<MlPluginSetup, MlPluginStart> {
Expand Down
34 changes: 30 additions & 4 deletions x-pack/plugins/ml/public/ui_actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,27 @@
*/

import { CoreSetup } from 'kibana/public';
import { createEditSwimlanePanelAction } from './edit_swimlane_panel_action';
import { createOpenInExplorerAction } from './open_in_anomaly_explorer_action';
import {
createEditSwimlanePanelAction,
EDIT_SWIMLANE_PANEL_ACTION,
} from './edit_swimlane_panel_action';
import {
createOpenInExplorerAction,
OPEN_IN_ANOMALY_EXPLORER_ACTION,
} from './open_in_anomaly_explorer_action';
import { UiActionsSetup } from '../../../../../src/plugins/ui_actions/public';
import { MlPluginStart, MlStartDependencies } from '../plugin';
import { CONTEXT_MENU_TRIGGER } from '../../../../../src/plugins/embeddable/public';
import { createApplyInfluencerFiltersAction } from './apply_influencer_filters_action';
import {
APPLY_INFLUENCER_FILTERS_ACTION,
createApplyInfluencerFiltersAction,
} from './apply_influencer_filters_action';
import { SWIM_LANE_SELECTION_TRIGGER, swimLaneSelectionTrigger } from './triggers';
import { createApplyTimeRangeSelectionAction } from './apply_time_range_action';
import {
APPLY_TIME_RANGE_SELECTION_ACTION,
createApplyTimeRangeSelectionAction,
} from './apply_time_range_action';
import { EditSwimlanePanelContext, SwimLaneDrilldownContext } from '../embeddables';

export { APPLY_TIME_RANGE_SELECTION_ACTION } from './apply_time_range_action';
export { EDIT_SWIMLANE_PANEL_ACTION } from './edit_swimlane_panel_action';
Expand Down Expand Up @@ -50,3 +63,16 @@ export function registerMlUiActions(
uiActions.addTriggerAction(SWIM_LANE_SELECTION_TRIGGER, applyTimeRangeSelectionAction);
uiActions.addTriggerAction(SWIM_LANE_SELECTION_TRIGGER, openInExplorerAction);
}

declare module '../../../../../src/plugins/ui_actions/public' {
export interface ActionContextMapping {
[EDIT_SWIMLANE_PANEL_ACTION]: EditSwimlanePanelContext;
[OPEN_IN_ANOMALY_EXPLORER_ACTION]: SwimLaneDrilldownContext;
[APPLY_INFLUENCER_FILTERS_ACTION]: SwimLaneDrilldownContext;
[APPLY_TIME_RANGE_SELECTION_ACTION]: SwimLaneDrilldownContext;
}

export interface TriggerContextMapping {
[SWIM_LANE_SELECTION_TRIGGER]: SwimLaneDrilldownContext;
}
}
12 changes: 11 additions & 1 deletion x-pack/plugins/ml/public/url_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@
*/

import { CoreSetup } from 'kibana/public';
import { SharePluginSetup, UrlGeneratorsDefinition } from '../../../../src/plugins/share/public';
import {
SharePluginSetup,
UrlGeneratorsDefinition,
UrlGeneratorState,
} from '../../../../src/plugins/share/public';
import { TimeRange } from '../../../../src/plugins/data/public';
import { setStateToKbnUrl } from '../../../../src/plugins/kibana_utils/public';
import { JobId } from '../../reporting/common/types';
import { ExplorerAppState } from './application/explorer/explorer_dashboard_service';
import { MlStartDependencies } from './plugin';

declare module '../../../../src/plugins/share/public' {
export interface UrlGeneratorStateMapping {
[ML_APP_URL_GENERATOR]: UrlGeneratorState<MlUrlGeneratorState>;
}
}

export const ML_APP_URL_GENERATOR = 'ML_APP_URL_GENERATOR';

export interface ExplorerUrlState {
Expand Down

0 comments on commit 4970f01

Please sign in to comment.