From 462e4378100e8d5233e7379f9244da5609b7dd2c Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Mon, 16 Sep 2024 02:24:55 -0600 Subject: [PATCH] [ES|QL] exclude inactive integration data stream suggestions (#192953) ## Summary Close https://github.com/elastic/kibana/issues/187247 https://github.com/user-attachments/assets/9f56d941-016a-442a-a2cb-b2240b280b54 Co-authored-by: Stratoula Kalafateli --- packages/kbn-text-based-editor/src/helpers.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/kbn-text-based-editor/src/helpers.ts b/packages/kbn-text-based-editor/src/helpers.ts index f83d7a97342e6a..fb541c4fe39bee 100644 --- a/packages/kbn-text-based-editor/src/helpers.ts +++ b/packages/kbn-text-based-editor/src/helpers.ts @@ -249,20 +249,22 @@ const getIntegrations = async (core: CoreStart) => { // and this needs to be done in various places in the codebase which use the editor // https://github.com/elastic/kibana/issues/186061 const response = (await core.http - .get(INTEGRATIONS_API, { query: undefined, version: API_VERSION }) + .get(INTEGRATIONS_API, { query: { showOnlyActiveDataStreams: true }, version: API_VERSION }) .catch((error) => { // eslint-disable-next-line no-console console.error('Failed to fetch integrations', error); })) as IntegrationsResponse; return ( - response?.items?.map((source) => ({ - name: source.name, - hidden: false, - title: source.title, - dataStreams: source.dataStreams, - type: 'Integration', - })) ?? [] + response?.items + ?.filter(({ dataStreams }) => dataStreams.length) + .map((source) => ({ + name: source.name, + hidden: false, + title: source.title, + dataStreams: source.dataStreams, + type: 'Integration', + })) ?? [] ); };