From 32b14be951c9995e09afaaf2960778a560822383 Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Wed, 2 Oct 2024 13:57:38 +0200 Subject: [PATCH] fixes --- .../plugins/fleet/common/types/models/epm.ts | 1 - .../epm/screens/detail/settings/settings.tsx | 2 +- .../fleet/server/types/rest_spec/epm.ts | 22 +++++++------------ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/x-pack/plugins/fleet/common/types/models/epm.ts b/x-pack/plugins/fleet/common/types/models/epm.ts index b6802a4fc2afa..b9e19fbc1947f 100644 --- a/x-pack/plugins/fleet/common/types/models/epm.ts +++ b/x-pack/plugins/fleet/common/types/models/epm.ts @@ -292,7 +292,6 @@ export type RegistrySearchResult = Pick< | 'data_streams' | 'policy_templates' | 'categories' - | 'owner' >; // from /categories diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/settings.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/settings.tsx index 33c866c6084a0..bffa043a8fa1c 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/settings.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/settings.tsx @@ -244,7 +244,7 @@ export const SettingsPage: React.FC = memo( numOfAssets: Object.entries(packageInfo.assets).reduce( (acc, [serviceName, serviceNameValue]) => acc + - Object.entries(serviceNameValue).reduce( + Object.entries(serviceNameValue || {}).reduce( (acc2, [assetName, assetNameValue]) => acc2 + assetNameValue.length, 0 ), diff --git a/x-pack/plugins/fleet/server/types/rest_spec/epm.ts b/x-pack/plugins/fleet/server/types/rest_spec/epm.ts index f60f451b98c4f..b7115748c92ea 100644 --- a/x-pack/plugins/fleet/server/types/rest_spec/epm.ts +++ b/x-pack/plugins/fleet/server/types/rest_spec/epm.ts @@ -73,6 +73,7 @@ export const EsAssetReferenceSchema = schema.object({ schema.literal('ml_model'), ]), deferred: schema.maybe(schema.boolean()), + version: schema.maybe(schema.string()), }); export const InstallationInfoSchema = schema.object({ @@ -191,8 +192,8 @@ export const PackageInfoSchema = schema format_version: schema.maybe(schema.string()), vars: schema.maybe(schema.arrayOf(schema.recordOf(schema.string(), schema.any()))), latestVersion: schema.maybe(schema.string()), - // sometimes package list response contains extra properties, e.g. installed_kibana }) + // sometimes package list response contains extra properties, e.g. installed_kibana .extendsDeep({ unknowns: 'allow', }); @@ -323,22 +324,17 @@ export const UpdatePackageResponseSchema = schema.object({ response: schema.maybe(GetPackageInfoSchema.extends({}, { meta: { deprecated: true } })), }); -export const AssetReferenceSchema = schema.object({ - id: schema.string(), - type: schema.string(), - originId: schema.maybe(schema.string()), - deferred: schema.maybe(schema.boolean()), - version: schema.maybe(schema.string()), -}); +export const AssetReferenceSchema = schema.oneOf([ + KibanaAssetReferenceSchema, + EsAssetReferenceSchema, +]); export const InstallPackageResponseSchema = schema.object({ items: schema.arrayOf(AssetReferenceSchema), _meta: schema.object({ install_source: schema.string(), }), - response: schema.maybe( - schema.arrayOf(AssetReferenceSchema.extends({}, { meta: { deprecated: true } })) - ), + response: schema.maybe(schema.arrayOf(AssetReferenceSchema, { meta: { deprecated: true } })), }); export const InstallKibanaAssetsResponseSchema = schema.object({ @@ -375,9 +371,7 @@ export const BulkInstallPackagesFromRegistryResponseSchema = schema.object({ export const DeletePackageResponseSchema = schema.object({ items: schema.arrayOf(AssetReferenceSchema), - response: schema.maybe( - schema.arrayOf(AssetReferenceSchema.extends({}, { meta: { deprecated: true } })) - ), + response: schema.maybe(schema.arrayOf(AssetReferenceSchema, { meta: { deprecated: true } })), }); export const GetVerificationKeyIdResponseSchema = schema.object({