diff --git a/x-pack/legacy/plugins/integrations_manager/common/types.ts b/x-pack/legacy/plugins/integrations_manager/common/types.ts index 96622a84bbe71..6049a33f45893 100644 --- a/x-pack/legacy/plugins/integrations_manager/common/types.ts +++ b/x-pack/legacy/plugins/integrations_manager/common/types.ts @@ -10,15 +10,14 @@ export { Request, ResponseToolkit, Server, ServerRoute } from 'hapi'; export type InstallationStatus = Installed['status'] | NotInstalled['status']; -export enum AssetType { - config = 'config', - dashboard = 'dashboard', - visualization = 'visualization', - search = 'search', - ingestPipeline = 'ingest-pipeline', - indexPattern = 'index-pattern', - timelionSheet = 'timelion-sheet', -} +export type AssetType = + | 'config' + | 'dashboard' + | 'visualization' + | 'search' + | 'ingest-pipeline' + | 'index-pattern' + | 'timelion-sheet'; // Registry's response types // from /search diff --git a/x-pack/legacy/plugins/integrations_manager/server/packages/index.ts b/x-pack/legacy/plugins/integrations_manager/server/packages/index.ts index 301b7b1c2de7f..44369e3574692 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/packages/index.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/packages/index.ts @@ -15,12 +15,12 @@ export * from './handlers'; export type CallESAsCurrentUser = ScopedClusterClient['callAsCurrentUser']; export const SAVED_OBJECT_TYPES = new Set([ - AssetType.config, - AssetType.dashboard, - AssetType.indexPattern, - AssetType.search, - AssetType.timelionSheet, - AssetType.visualization, + 'config', + 'dashboard', + 'index-pattern', + 'search', + 'timelion-sheet', + 'visualization', ]); export function getClusterAccessor(esClient: IClusterClient, req: Request) { diff --git a/x-pack/legacy/plugins/integrations_manager/server/packages/install.ts b/x-pack/legacy/plugins/integrations_manager/server/packages/install.ts index 7aec740846978..6df6cefb3723b 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/packages/install.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/packages/install.ts @@ -45,7 +45,7 @@ export async function installAssets(options: { // Only install certain Kibana assets during package installation. // All other asset types need special handling - const typesToInstall = [AssetType.visualization, AssetType.dashboard, AssetType.search]; + const typesToInstall: AssetType[] = ['visualization', 'dashboard', 'search']; const installationPromises = typesToInstall.map(async assetType => installKibanaSavedObjects({ savedObjectsClient, pkgkey, assetType }) diff --git a/x-pack/legacy/plugins/integrations_manager/server/packages/remove.ts b/x-pack/legacy/plugins/integrations_manager/server/packages/remove.ts index 030c68ca20b48..69ba20b77c166 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/packages/remove.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/packages/remove.ts @@ -29,9 +29,10 @@ export async function removeInstallation(options: { // Delete the installed assets const deletePromises = installedObjects.map(async ({ id, type }) => { - if (assetUsesObjects(type as AssetType)) { - savedObjectsClient.delete(type, id); - } else if (type === AssetType.ingestPipeline) { + const assetType = type as AssetType; + if (assetUsesObjects(assetType)) { + savedObjectsClient.delete(assetType, id); + } else if (assetType === 'ingest-pipeline') { deletePipeline(callCluster, id); } });