From 30e075a1b601a9bd5564667b67b3112479d1eebc Mon Sep 17 00:00:00 2001 From: Ilya Nikokoshev Date: Thu, 21 Nov 2024 16:34:07 +0100 Subject: [PATCH] [Automatic Import] Correctly output icons in the manifest (#201139) ## Release Note Fixes a bug in Automatic Import where icons were not shown after the integration was installed. ## Summary Closes #201008. When implementing safe manifest output #192316 a bug crept in: the icons array was incorrectly output as a dictionary icons: src: /img/logoElastic.svg title: syslog_test3 Logo size: 32x32 type: image/svg+xml and the test was not smart enough to pick it up: expect(manifest.icons).toBeTruthy(); We fix the field and add better tests for it. --- .../integration_builder/build_integration.test.ts | 9 ++++++++- .../integration_builder/build_integration.ts | 14 ++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/integration_assistant/server/integration_builder/build_integration.test.ts b/x-pack/plugins/integration_assistant/server/integration_builder/build_integration.test.ts index 419e287e23bf7..d7ce89e2e8f63 100644 --- a/x-pack/plugins/integration_assistant/server/integration_builder/build_integration.test.ts +++ b/x-pack/plugins/integration_assistant/server/integration_builder/build_integration.test.ts @@ -277,6 +277,13 @@ describe('renderPackageManifestYAML', () => { expect(manifest.name).toBe(integration.name); expect(manifest.type).toBe('integration'); expect(manifest.description).toBe(integration.description); - expect(manifest.icons).toBeTruthy(); + expect(Array.isArray(manifest.icons)).toBe(true); + expect((manifest.icons as object[]).length).toBe(1); + expect((manifest.icons as object[])[0]).toEqual({ + src: '/img/logo.svg', + title: 'Sample Integration Logo', + size: '32x32', + type: 'image/svg+xml', + }); }); }); diff --git a/x-pack/plugins/integration_assistant/server/integration_builder/build_integration.ts b/x-pack/plugins/integration_assistant/server/integration_builder/build_integration.ts index 8743ada38bdb6..bf2e9b6b9d5a7 100644 --- a/x-pack/plugins/integration_assistant/server/integration_builder/build_integration.ts +++ b/x-pack/plugins/integration_assistant/server/integration_builder/build_integration.ts @@ -185,12 +185,14 @@ function createPackageManifestDict( }; if (package_logo !== undefined && package_logo !== '') { - data.icons = { - src: '/img/logo.svg', - title: `${package_title} Logo`, - size: '32x32', - type: 'image/svg+xml', - }; + data.icons = [ + { + src: '/img/logo.svg', + title: `${package_title} Logo`, + size: '32x32', + type: 'image/svg+xml', + }, + ]; } return data; }