From dd1485e2443de4dabdf266d632e273539d357da5 Mon Sep 17 00:00:00 2001 From: igoristic Date: Tue, 2 Feb 2021 15:08:39 -0500 Subject: [PATCH] Made imports static (#89935) (#90045) --- x-pack/plugins/monitoring/public/plugin.ts | 26 +++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/monitoring/public/plugin.ts b/x-pack/plugins/monitoring/public/plugin.ts index 52f8d07f4fdb65..65c0c4d915f9cc 100644 --- a/x-pack/plugins/monitoring/public/plugin.ts +++ b/x-pack/plugins/monitoring/public/plugin.ts @@ -27,6 +27,14 @@ import { ALERT_DETAILS, } from '../common/constants'; +import { createCpuUsageAlertType } from './alerts/cpu_usage_alert'; +import { createMissingMonitoringDataAlertType } from './alerts/missing_monitoring_data_alert'; +import { createLegacyAlertTypes } from './alerts/legacy_alert'; +import { createDiskUsageAlertType } from './alerts/disk_usage_alert'; +import { createThreadPoolRejectionsAlertType } from './alerts/thread_pool_rejections_alert'; +import { createMemoryUsageAlertType } from './alerts/memory_usage_alert'; +import { createCCRReadExceptionsAlertType } from './alerts/ccr_read_exceptions_alert'; + interface MonitoringSetupPluginDependencies { home?: HomePublicPluginSetup; cloud?: { isCloudEnabled: boolean }; @@ -72,7 +80,7 @@ export class MonitoringPlugin }); } - await this.registerAlertsAsync(plugins); + this.registerAlerts(plugins); const app: App = { id, @@ -135,19 +143,7 @@ export class MonitoringPlugin ]; } - private registerAlertsAsync = async (plugins: MonitoringSetupPluginDependencies) => { - const { createCpuUsageAlertType } = await import('./alerts/cpu_usage_alert'); - const { createMissingMonitoringDataAlertType } = await import( - './alerts/missing_monitoring_data_alert' - ); - const { createLegacyAlertTypes } = await import('./alerts/legacy_alert'); - const { createDiskUsageAlertType } = await import('./alerts/disk_usage_alert'); - const { createThreadPoolRejectionsAlertType } = await import( - './alerts/thread_pool_rejections_alert' - ); - const { createMemoryUsageAlertType } = await import('./alerts/memory_usage_alert'); - const { createCCRReadExceptionsAlertType } = await import('./alerts/ccr_read_exceptions_alert'); - + private registerAlerts(plugins: MonitoringSetupPluginDependencies) { const { triggersActionsUi: { alertTypeRegistry }, } = plugins; @@ -172,5 +168,5 @@ export class MonitoringPlugin for (const legacyAlertType of legacyAlertTypes) { alertTypeRegistry.register(legacyAlertType); } - }; + } }