Correctly type ILM's optional dependencies as optional (#63255)
And guard against their absence.
This commit is contained in:
parent
d8a295dcbc
commit
8a283de3c5
4 changed files with 8 additions and 6 deletions
|
@ -23,11 +23,13 @@ import {
|
||||||
|
|
||||||
import { defaultColdPhase, defaultWarmPhase, defaultHotPhase } from '../store/defaults';
|
import { defaultColdPhase, defaultWarmPhase, defaultHotPhase } from '../store/defaults';
|
||||||
|
|
||||||
export let trackUiMetric: (metricType: UiStatsMetricType, eventName: string) => void;
|
export let trackUiMetric = (metricType: UiStatsMetricType, eventName: string) => {};
|
||||||
|
|
||||||
export function init(usageCollection: UsageCollectionSetup): void {
|
export function init(usageCollection?: UsageCollectionSetup): void {
|
||||||
|
if (usageCollection) {
|
||||||
trackUiMetric = usageCollection.reportUiStats.bind(usageCollection, UIM_APP_NAME);
|
trackUiMetric = usageCollection.reportUiStats.bind(usageCollection, UIM_APP_NAME);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getUiMetricsForPhases(phases: any): any {
|
export function getUiMetricsForPhases(phases: any): any {
|
||||||
const phaseUiMetrics = [
|
const phaseUiMetrics = [
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { ManagementSetup } from '../../../../src/plugins/management/public';
|
||||||
import { IndexManagementPluginSetup } from '../../index_management/public';
|
import { IndexManagementPluginSetup } from '../../index_management/public';
|
||||||
|
|
||||||
export interface PluginsDependencies {
|
export interface PluginsDependencies {
|
||||||
usageCollection: UsageCollectionSetup;
|
usageCollection?: UsageCollectionSetup;
|
||||||
management: ManagementSetup;
|
management: ManagementSetup;
|
||||||
indexManagement?: IndexManagementPluginSetup;
|
indexManagement?: IndexManagementPluginSetup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ export class IndexLifecycleManagementServerPlugin implements Plugin<void, void,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (config.ui.enabled) {
|
if (config.ui.enabled) {
|
||||||
if (indexManagement.indexDataEnricher) {
|
if (indexManagement && indexManagement.indexDataEnricher) {
|
||||||
indexManagement.indexDataEnricher.add(indexLifecycleDataEnricher);
|
indexManagement.indexDataEnricher.add(indexLifecycleDataEnricher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { isEsError } from './lib/is_es_error';
|
||||||
|
|
||||||
export interface Dependencies {
|
export interface Dependencies {
|
||||||
licensing: LicensingPluginSetup;
|
licensing: LicensingPluginSetup;
|
||||||
indexManagement: IndexManagementPluginSetup;
|
indexManagement?: IndexManagementPluginSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RouteDependencies {
|
export interface RouteDependencies {
|
||||||
|
|
Loading…
Reference in a new issue