From 09409dcf5f94288868ef025e6f9332caf5913ad4 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Thu, 1 Aug 2024 13:34:12 -0700 Subject: [PATCH 01/20] Support for MDS in integrations Signed-off-by: sumukhswamy --- .../added_integration_overview_page.tsx | 3 ++ .../components/added_integration_table.tsx | 17 ++++++- .../components/create_integration_helpers.ts | 12 ++++- .../integrations/components/integration.tsx | 50 ++++++++++++++++--- .../components/setup_integration.tsx | 31 +++++++++++- .../components/setup_integration_inputs.tsx | 30 +++++++++-- .../integrations/integrations_builder.ts | 10 +++- .../integrations/integrations_manager.ts | 10 +++- .../integrations/integrations_router.ts | 6 ++- 9 files changed, 150 insertions(+), 19 deletions(-) diff --git a/public/components/integrations/components/added_integration_overview_page.tsx b/public/components/integrations/components/added_integration_overview_page.tsx index 83b0d000b6..4609268096 100644 --- a/public/components/integrations/components/added_integration_overview_page.tsx +++ b/public/components/integrations/components/added_integration_overview_page.tsx @@ -33,6 +33,9 @@ export interface AddedIntegrationType { assets: any[]; addedBy: string; id: string; + dataSourceMDSId?: string; + dataSourceMDSLabel?: string; + references: []; } export function AddedIntegrationOverviewPage(props: AddedIntegrationOverviewPageProps) { diff --git a/public/components/integrations/components/added_integration_table.tsx b/public/components/integrations/components/added_integration_table.tsx index 9702dd9d4a..3a61e8961a 100644 --- a/public/components/integrations/components/added_integration_table.tsx +++ b/public/components/integrations/components/added_integration_table.tsx @@ -93,7 +93,9 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { sortable: true, truncateText: true, render: (value, record) => ( - - - + + {truncate(record.dataSourceMDSLabel || 'local cluster', { length: 100 })} + ), }); } @@ -155,11 +157,22 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { }; const entries = props.data.hits.map((integration) => { + console.log(integration); const id = integration.id; const templateName = integration.templateName; const creationDate = integration.creationDate; const name = integration.name; - return { id, templateName, creationDate, name, data: { templateName, name } }; + const dataSourceMDSLabel = integration.references + ? integration.references[0].dataSourceMDSLabel + : 'Local cluster'; + return { + id, + templateName, + creationDate, + name, + data: { templateName, name }, + dataSourceMDSLabel, + }; }); return ( diff --git a/public/components/integrations/components/create_integration_helpers.ts b/public/components/integrations/components/create_integration_helpers.ts index dcbc2da561..122a85c7bd 100644 --- a/public/components/integrations/components/create_integration_helpers.ts +++ b/public/components/integrations/components/create_integration_helpers.ts @@ -2,10 +2,10 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ -import { Color, VALID_INDEX_NAME } from '../../../../common/constants/integrations'; import { HttpSetup } from '../../../../../../src/core/public'; -import { coreRefs } from '../../../framework/core_refs'; +import { Color, VALID_INDEX_NAME } from '../../../../common/constants/integrations'; import { CONSOLE_PROXY, INTEGRATIONS_BASE } from '../../../../common/constants/shared'; +import { coreRefs } from '../../../framework/core_refs'; type ValidationResult = { ok: true } | { ok: false; errors: string[] }; @@ -18,6 +18,8 @@ interface AddIntegrationRequestParams { templateName: string; integration: IntegrationConfig; setToast: (title: string, color?: Color, text?: string | undefined) => void; + dataSourceMDSId: string | undefined; + dataSourceMDSLabel: string | undefined; name?: string; indexPattern?: string; workflows?: string[]; @@ -299,6 +301,8 @@ export async function addIntegrationRequest({ workflows, skipRedirect, dataSourceInfo, + dataSourceMDSId, + dataSourceMDSLabel, }: AddIntegrationRequestParams): Promise { const http = coreRefs.http!; if (addSample) { @@ -313,12 +317,16 @@ export async function addIntegrationRequest({ } const createReqBody: { + dataSourceMDSId: string | undefined; + dataSourceMDSLabel: string | undefined; name?: string; indexPattern?: string; workflows?: string[]; dataSource?: string; tableName?: string; } = { + dataSourceMDSId, + dataSourceMDSLabel, name, indexPattern, workflows, diff --git a/public/components/integrations/components/integration.tsx b/public/components/integrations/components/integration.tsx index d7b74dec0c..66f37311ab 100644 --- a/public/components/integrations/components/integration.tsx +++ b/public/components/integrations/components/integration.tsx @@ -5,7 +5,13 @@ /* eslint-disable react-hooks/exhaustive-deps */ import { + EuiButton, EuiLoadingSpinner, + EuiModal, + EuiModalBody, + EuiModalFooter, + EuiModalHeader, + EuiModalHeaderTitle, EuiOverlayMask, EuiPage, EuiPageBody, @@ -14,16 +20,16 @@ import { EuiTabs, } from '@elastic/eui'; import React, { useEffect, useState } from 'react'; -import { IntegrationOverview } from './integration_overview_panel'; -import { IntegrationDetails } from './integration_details_panel'; -import { IntegrationFields } from './integration_fields_panel'; -import { IntegrationAssets } from './integration_assets_panel'; -import { AvailableIntegrationProps } from './integration_types'; import { INTEGRATIONS_BASE } from '../../../../common/constants/shared'; -import { IntegrationScreenshots } from './integration_screenshots_panel'; import { useToast } from '../../../../public/components/common/toast'; import { coreRefs } from '../../../framework/core_refs'; import { addIntegrationRequest } from './create_integration_helpers'; +import { IntegrationAssets } from './integration_assets_panel'; +import { IntegrationDetails } from './integration_details_panel'; +import { IntegrationFields } from './integration_fields_panel'; +import { IntegrationOverview } from './integration_overview_panel'; +import { IntegrationScreenshots } from './integration_screenshots_panel'; +import { AvailableIntegrationProps } from './integration_types'; export function Integration(props: AvailableIntegrationProps) { const http = coreRefs.http!; @@ -35,6 +41,9 @@ export function Integration(props: AvailableIntegrationProps) { const [integrationMapping, setMapping] = useState(null); const [integrationAssets, setAssets] = useState([]); const [loading, setLoading] = useState(false); + const [isModalVisible, setIsModalVisible] = useState(false); + const closeModal = () => setIsModalVisible(false); + const showModal = () => setIsModalVisible(true); useEffect(() => { chrome.setBreadcrumbs([ @@ -131,6 +140,31 @@ export function Integration(props: AvailableIntegrationProps) { )); }; + const mdsSelectorModal = () => { + if (isModalVisible) { + return ( + + + +

Modal title

+
+
+ + + This modal has the following setup: + + + + + + Close + + +
+ ); + } + }; + if (Object.keys(integration).length === 0) { return ( @@ -142,6 +176,10 @@ export function Integration(props: AvailableIntegrationProps) { +
+ showModal()}>Show Modal + {mdsSelectorModal()} +
{ diff --git a/public/components/integrations/components/setup_integration.tsx b/public/components/integrations/components/setup_integration.tsx index 1d8df5abbf..643bab8a31 100644 --- a/public/components/integrations/components/setup_integration.tsx +++ b/public/components/integrations/components/setup_integration.tsx @@ -50,6 +50,10 @@ export interface IntegrationConfigProps { dataSourceEnabled: boolean; dataSourceManagement: DataSourceManagementPluginSetup; savedObjectsMDSClient: SavedObjectsStart; + handleSelectedDataSourceChange: ( + dataSourceMDSId: string | undefined, + dataSourceMDSLabel: string | undefined + ) => void; } type SetupCallout = { show: true; title: string; color?: Color; text?: string } | { show: false }; @@ -138,12 +142,16 @@ const addIntegration = async ({ integration, setLoading, setCalloutLikeToast, + dataSourceMDSId, + dataSourceMDSLabel, setIsInstalling, }: { config: IntegrationSetupInputs; integration: IntegrationConfig; setLoading: (loading: boolean) => void; setCalloutLikeToast: (title: string, color?: Color, text?: string) => void; + dataSourceMDSId: string | undefined; + dataSourceMDSLabel: string | undefined; setIsInstalling?: (isInstalling: boolean, success?: boolean) => void; }) => { setLoading(true); @@ -163,6 +171,8 @@ const addIntegration = async ({ templateName: integration.name, integration, setToast: setCalloutLikeToast, + dataSourceMDSId, + dataSourceMDSLabel, name: config.displayName, indexPattern: config.connectionDataSource, skipRedirect: setIsInstalling ? true : false, @@ -180,7 +190,6 @@ const addIntegration = async ({ const assets: { data: ParsedIntegrationAsset[] } = await http.get( `${INTEGRATIONS_BASE}/repository/${integration.name}/assets` ); - for (const query of assets.data.filter( (a: ParsedIntegrationAsset): a is ParsedIntegrationAsset & { type: 'query' } => a.type === 'query' @@ -205,6 +214,8 @@ const addIntegration = async ({ templateName: integration.name, integration, setToast: setCalloutLikeToast, + dataSourceMDSId, + dataSourceMDSLabel, name: config.displayName, indexPattern: `flint_${config.connectionDataSource}_${ config.connectionDatabaseName ?? 'default' @@ -245,6 +256,8 @@ export function SetupBottomBar({ loading, setLoading, setSetupCallout, + dataSourceMDSId, + dataSourceMDSLabel, unsetIntegration, setIsInstalling, }: { @@ -253,6 +266,8 @@ export function SetupBottomBar({ loading: boolean; setLoading: (loading: boolean) => void; setSetupCallout: (setupCallout: SetupCallout) => void; + dataSourceMDSId: string | undefined; + dataSourceMDSLabel: string | undefined; unsetIntegration?: () => void; setIsInstalling?: (isInstalling: boolean, success?: boolean) => void; }) { @@ -306,6 +321,8 @@ export function SetupBottomBar({ setIsInstalling(newLoading); }, setCalloutLikeToast, + dataSourceMDSId, + dataSourceMDSLabel, setIsInstalling, }); } else { @@ -314,6 +331,8 @@ export function SetupBottomBar({ config, setLoading, setCalloutLikeToast, + dataSourceMDSId, + dataSourceMDSLabel, setIsInstalling, }); } @@ -384,6 +403,8 @@ export function SetupIntegrationForm({ const [setupCallout, setSetupCallout] = useState({ show: false } as SetupCallout); const [showLoading, setShowLoading] = useState(false); + const [dataSourceMDSId, setDataSourceMDSId] = useState(''); + const [dataSourceMDSLabel, setDataSourceMDSLabel] = useState(''); useEffect(() => { const getTemplate = async () => { @@ -397,6 +418,11 @@ export function SetupIntegrationForm({ const updateConfig = (updates: Partial) => setConfig(Object.assign({}, integConfig, updates)); + const handleSelectedDataSourceChange = (id: string | undefined, label: string | undefined) => { + setDataSourceMDSId(id); + setDataSourceMDSLabel(label); + }; + const IntegrationInputFormComponent = forceConnection?.type === 'securityLake' || integConfig.connectionType === 'securityLake' ? SetupIntegrationInputsForSecurityLake @@ -416,6 +442,7 @@ export function SetupIntegrationForm({ notifications={notifications} dataSourceEnabled={dataSourceEnabled} savedObjectsMDSClient={savedObjectsMDSClient} + handleSelectedDataSourceChange={handleSelectedDataSourceChange} /> )} @@ -428,6 +455,8 @@ export function SetupIntegrationForm({ loading={showLoading} setLoading={setShowLoading} setSetupCallout={setSetupCallout} + dataSourceMDSId={dataSourceMDSId} + dataSourceMDSLabel={dataSourceMDSLabel} unsetIntegration={unsetIntegration} setIsInstalling={setIsInstalling} /> diff --git a/public/components/integrations/components/setup_integration_inputs.tsx b/public/components/integrations/components/setup_integration_inputs.tsx index a9b9437f3e..6a5e28ef10 100644 --- a/public/components/integrations/components/setup_integration_inputs.tsx +++ b/public/components/integrations/components/setup_integration_inputs.tsx @@ -19,6 +19,7 @@ import { NotificationsStart, SavedObjectsStart } from '../../../../../../src/cor import { DataSourceManagementPluginSetup } from '../../../../../../src/plugins/data_source_management/public'; import { CONSOLE_PROXY, DATACONNECTIONS_BASE } from '../../../../common/constants/shared'; import { IntegrationConnectionType } from '../../../../common/types/integrations'; +import { dataSourceFilterFn } from '../../../../common/utils/shared'; import { coreRefs } from '../../../framework/core_refs'; import { IntegrationConfigProps, IntegrationSetupInputs } from './setup_integration'; @@ -76,8 +77,10 @@ const integrationConnectionSelectorItems: Array<{ ]; const suggestDataSources = async ( - type: IntegrationConnectionType + type: IntegrationConnectionType, + dataSourceMDSId?: string ): Promise> => { + console.log(dataSourceMDSId); const http = coreRefs.http!; try { if (type === 'index') { @@ -86,6 +89,7 @@ const suggestDataSources = async ( query: { path: '_data_stream/ss4o_*', method: 'GET', + dataSourceMDSId, }, }); return ( @@ -94,7 +98,9 @@ const suggestDataSources = async ( }) ?? [] ); } else if (type === 's3' || type === 'securityLake') { - const result = (await http.get(DATACONNECTIONS_BASE)) as Array<{ + const result = (await http.get( + `${DATACONNECTIONS_BASE}/dataSourceMDSId=${dataSourceMDSId ?? ''}` + )) as Array<{ name: string; connector: string; }>; @@ -196,6 +202,7 @@ export function IntegrationConnectionInputs({ notifications, savedObjectsMDSClient, lockConnectionType, + handleSelectedDataSourceChange, }: { config: IntegrationSetupInputs; updateConfig: (updates: Partial) => void; @@ -204,9 +211,20 @@ export function IntegrationConnectionInputs({ dataSourceEnabled: boolean; dataSourceManagement: DataSourceManagementPluginSetup; savedObjectsMDSClient: SavedObjectsStart; + handleSelectedDataSourceChange: ( + dataSourceMDSId: string | undefined, + dataSourceMDSLabel: string | undefined + ) => void; lockConnectionType?: boolean; }) { + const [dataSourceMDSId, setDataSourceMDSId] = useState(''); const connectionType = INTEGRATION_CONNECTION_DATA_SOURCE_TYPES.get(config.connectionType)!; + const onSelectedDataSource = (e) => { + const dataConnectionId = e[0] ? e[0].id : undefined; + setDataSourceMDSId(dataConnectionId); + const dataConnectionLabel = e[0] ? e[0].label : undefined; + handleSelectedDataSourceChange(dataConnectionId, dataConnectionLabel); + }; let DataSourceSelector; if (dataSourceEnabled) { @@ -219,14 +237,14 @@ export function IntegrationConnectionInputs({ useEffect(() => { const updateDataSources = async () => { - const data = await suggestDataSources(config.connectionType); + const data = await suggestDataSources(config.connectionType, dataSourceMDSId); setDataSourceSuggestions(data); setIsSuggestionsLoading(false); }; setIsSuggestionsLoading(true); updateDataSources(); - }, [config.connectionType]); + }, [config.connectionType, dataSourceMDSId]); return ( <> @@ -242,6 +260,8 @@ export function IntegrationConnectionInputs({ disabled={false} fullWidth={false} removePrepend={true} + onSelectedDataSource={onSelectedDataSource} + dataSourceFilter={dataSourceFilterFn} /> @@ -438,6 +458,7 @@ export function SetupIntegrationFormInputs(props: IntegrationConfigProps) { dataSourceManagement, notifications, savedObjectsMDSClient, + handleSelectedDataSourceChange, } = props; return ( @@ -475,6 +496,7 @@ export function SetupIntegrationFormInputs(props: IntegrationConfigProps) { notifications={notifications} dataSourceEnabled={dataSourceEnabled} savedObjectsMDSClient={savedObjectsMDSClient} + handleSelectedDataSourceChange={handleSelectedDataSourceChange} /> {config.connectionType === 's3' ? ( <> diff --git a/server/adaptors/integrations/integrations_builder.ts b/server/adaptors/integrations/integrations_builder.ts index 41b0dc53f9..d7c50a235d 100644 --- a/server/adaptors/integrations/integrations_builder.ts +++ b/server/adaptors/integrations/integrations_builder.ts @@ -4,14 +4,16 @@ */ import { v4 as uuidv4 } from 'uuid'; +import { SavedObjectsBulkCreateObject } from '../../../../../src/core/public'; import { SavedObjectsClientContract } from '../../../../../src/core/server'; import { IntegrationReader } from './repository/integration_reader'; -import { SavedObjectsBulkCreateObject } from '../../../../../src/core/public'; import { deepCheck } from './repository/utils'; interface BuilderOptions { name: string; indexPattern: string; + dataSourceMDSId: string | undefined; + dataSourceMDSLabel: string | undefined; workflows?: string[]; dataSource?: string; tableName?: string; @@ -195,6 +197,12 @@ export class IntegrationInstanceBuilder { dataSource: options.indexPattern, creationDate: new Date().toISOString(), assets: refs, + references: [ + { + dataSourceMDSId: options.dataSourceMDSId, + dataSourceMDSLabel: options.dataSourceMDSLabel, + }, + ], }); } } diff --git a/server/adaptors/integrations/integrations_manager.ts b/server/adaptors/integrations/integrations_manager.ts index e24ccfae1e..7dd7d19624 100644 --- a/server/adaptors/integrations/integrations_manager.ts +++ b/server/adaptors/integrations/integrations_manager.ts @@ -4,12 +4,12 @@ */ import path from 'path'; -import { addRequestToMetric } from '../../common/metrics/metrics_helper'; import { SavedObject, SavedObjectsClientContract } from '../../../../../src/core/server/types'; +import { addRequestToMetric } from '../../common/metrics/metrics_helper'; import { IntegrationInstanceBuilder } from './integrations_builder'; -import { TemplateManager } from './repository/repository'; import { FileSystemDataAdaptor } from './repository/fs_data_adaptor'; import { IndexDataAdaptor } from './repository/index_data_adaptor'; +import { TemplateManager } from './repository/repository'; export class IntegrationsManager { client: SavedObjectsClientContract; @@ -157,6 +157,8 @@ export class IntegrationsManager { templateName: string, name: string, indexPattern: string, + dataSourceMDSId: string | undefined, + dataSourceMDSLabel: string | undefined, workflows?: string[], dataSource?: string, tableName?: string @@ -173,11 +175,15 @@ export class IntegrationsManager { const result = await this.instanceBuilder.build(template, { name, indexPattern, + dataSourceMDSId, + dataSourceMDSLabel, workflows, dataSource, tableName, }); + console.log(dataSourceMDSId, dataSourceMDSLabel); const test = await this.client.create('integration-instance', result); + console.log(test); return Promise.resolve({ ...result, id: test.id }); } catch (err) { addRequestToMetric('integrations', 'create', err); diff --git a/server/routes/integrations/integrations_router.ts b/server/routes/integrations/integrations_router.ts index 68eed60d91..d48077af35 100644 --- a/server/routes/integrations/integrations_router.ts +++ b/server/routes/integrations/integrations_router.ts @@ -7,11 +7,11 @@ import { schema } from '@osd/config-schema'; import * as mime from 'mime'; import sanitize from 'sanitize-filename'; import { IRouter } from '../../../../../src/core/server'; -import { INTEGRATIONS_BASE } from '../../../common/constants/shared'; import { OpenSearchDashboardsResponse, OpenSearchDashboardsResponseFactory, } from '../../../../../src/core/server/http/router'; +import { INTEGRATIONS_BASE } from '../../../common/constants/shared'; import { IntegrationsManager } from '../../adaptors/integrations/integrations_manager'; /** @@ -71,6 +71,8 @@ export function registerIntegrationsRoute(router: IRouter) { templateName: schema.string(), }), body: schema.object({ + dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })), + dataSourceMDSLabel: schema.maybe(schema.string({ defaultValue: '' })), name: schema.string(), indexPattern: schema.string(), workflows: schema.maybe(schema.arrayOf(schema.string())), @@ -86,6 +88,8 @@ export function registerIntegrationsRoute(router: IRouter) { request.params.templateName, request.body.name, request.body.indexPattern, + request.body.dataSourceMDSId, + request.body.dataSourceMDSLabel, request.body.workflows, request.body.dataSource, request.body.tableName From 2553b6f95b2e42c80f59a6b57e031559eff0c8b0 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Fri, 9 Aug 2024 11:18:47 -0700 Subject: [PATCH 02/20] added changes for mds support in integrations Signed-off-by: sumukhswamy --- .../added_integration_table.test.tsx.snap | 204 ++++++++++++++++++ .../setup_integration.test.tsx.snap | 4 + .../components/__tests__/testing_constants.ts | 6 + .../components/added_integration.tsx | 35 ++- .../added_integration_overview_page.tsx | 4 +- .../components/added_integration_table.tsx | 24 ++- .../components/create_integration_helpers.ts | 34 +-- .../integrations/components/integration.tsx | 131 +++++++---- .../components/integration_overview_panel.tsx | 7 +- .../components/integration_types.ts | 20 +- .../components/setup_integration.tsx | 46 ++-- .../components/setup_integration_inputs.tsx | 3 +- public/components/integrations/home.tsx | 12 ++ .../integrations/__test__/builder.test.ts | 14 +- .../integrations/integrations_manager.ts | 2 - server/adaptors/integrations/types.ts | 1 + server/routes/dsl.ts | 74 ++++++- 17 files changed, 527 insertions(+), 94 deletions(-) diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap index 0deff9fa09..d87e057619 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap @@ -80,6 +80,12 @@ exports[`Added Integration Table View Test Renders added integration table view }, "id": "ad7e6e30-0b99-11ee-b27c-c9863222e9bf", "name": "nginx", + "references": Array [ + Object { + "dataSourceMDSId": "f4cf2c60-2f4d-11ef-bf2d-65348e7e70ea", + "dataSourceMDSLabel": "dataSource", + }, + ], "status": "active", "templateName": "nginx", }, @@ -148,6 +154,7 @@ exports[`Added Integration Table View Test Renders added integration table view "name": "nginx", "templateName": "nginx", }, + "dataSourceMDSLabel": "dataSource", "id": "ad7e6e30-0b99-11ee-b27c-c9863222e9bf", "name": "nginx", "templateName": "nginx", @@ -185,6 +192,19 @@ exports[`Added Integration Table View Test Renders added integration table view ], "type": "field_value_selection", }, + Object { + "field": "dataSourceMDSLabel", + "multiSelect": false, + "name": "Data Source Name", + "options": Array [ + Object { + "name": "dataSource", + "value": "dataSource", + "view": "dataSource", + }, + ], + "type": "field_value_selection", + }, ], } } @@ -212,6 +232,19 @@ exports[`Added Integration Table View Test Renders added integration table view ], "type": "field_value_selection", }, + Object { + "field": "dataSourceMDSLabel", + "multiSelect": false, + "name": "Data Source Name", + "options": Array [ + Object { + "name": "dataSource", + "value": "dataSource", + "view": "dataSource", + }, + ], + "type": "field_value_selection", + }, ] } onChange={[Function]} @@ -354,6 +387,19 @@ exports[`Added Integration Table View Test Renders added integration table view ], "type": "field_value_selection", }, + Object { + "field": "dataSourceMDSLabel", + "multiSelect": false, + "name": "Data Source Name", + "options": Array [ + Object { + "name": "dataSource", + "value": "dataSource", + "view": "dataSource", + }, + ], + "type": "field_value_selection", + }, ] } onChange={[Function]} @@ -539,6 +585,163 @@ exports[`Added Integration Table View Test Renders added integration table view + + + Data Source Name + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + id="field_value_selection_1" + isOpen={false} + ownFocus={true} + panelClassName="euiFilterGroup__popoverPanel" + panelPaddingSize="none" + > +
+
+ + + + + +
+
+
+
@@ -597,6 +800,7 @@ exports[`Added Integration Table View Test Renders added integration table view "name": "nginx", "templateName": "nginx", }, + "dataSourceMDSLabel": "dataSource", "id": "ad7e6e30-0b99-11ee-b27c-c9863222e9bf", "name": "nginx", "templateName": "nginx", diff --git a/public/components/integrations/components/__tests__/__snapshots__/setup_integration.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/setup_integration.test.tsx.snap index 5f1305706a..06a46802d4 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/setup_integration.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/setup_integration.test.tsx.snap @@ -42,6 +42,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] = "enabledWorkflows": Array [], } } + handleSelectedDataSourceChange={[Function]} integration={ Object { "assets": Array [], @@ -255,6 +256,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] = "enabledWorkflows": Array [], } } + handleSelectedDataSourceChange={[Function]} integration={ Object { "assets": Array [], @@ -935,6 +937,8 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] = "enabledWorkflows": Array [], } } + dataSourceMDSId="" + dataSourceMDSLabel="" integration={ Object { "assets": Array [], diff --git a/public/components/integrations/components/__tests__/testing_constants.ts b/public/components/integrations/components/__tests__/testing_constants.ts index ae6220e74a..e1f80811c6 100644 --- a/public/components/integrations/components/__tests__/testing_constants.ts +++ b/public/components/integrations/components/__tests__/testing_constants.ts @@ -169,6 +169,12 @@ export const addedIntegrationData: AddedIntegrationsTableProps = { }, ], id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', + references: [ + { + dataSourceMDSId: 'f4cf2c60-2f4d-11ef-bf2d-65348e7e70ea', + dataSourceMDSLabel: 'dataSource', + }, + ], }, ], }, diff --git a/public/components/integrations/components/added_integration.tsx b/public/components/integrations/components/added_integration.tsx index 99d3e35509..c399d37a33 100644 --- a/public/components/integrations/components/added_integration.tsx +++ b/public/components/integrations/components/added_integration.tsx @@ -22,14 +22,16 @@ import { EuiTableFieldDataColumnType, EuiText, } from '@elastic/eui'; -import React, { useEffect, useState } from 'react'; import truncate from 'lodash/truncate'; -import { PanelTitle } from '../../trace_analytics/components/common/helper_functions'; +import React, { useEffect, useState } from 'react'; +import { DataSourceViewConfig } from '../../../../../../src/plugins/data_source_management/public'; import { ASSET_FILTER_OPTIONS } from '../../../../common/constants/integrations'; import { INTEGRATIONS_BASE } from '../../../../common/constants/shared'; +import { dataSourceFilterFn } from '../../../../common/utils/shared'; +import { useToast } from '../../../../public/components/common/toast'; import { DeleteModal } from '../../common/helpers/delete_modal'; +import { PanelTitle } from '../../trace_analytics/components/common/helper_functions'; import { AddedIntegrationProps } from './integration_types'; -import { useToast } from '../../../../public/components/common/toast'; export const IntegrationHealthBadge = ({ status }: { status?: string }) => { switch (status) { @@ -45,7 +47,14 @@ export const IntegrationHealthBadge = ({ status }: { status?: string }) => { }; export function AddedIntegration(props: AddedIntegrationProps) { - const { http, integrationInstanceId, chrome } = props; + const { + http, + integrationInstanceId, + chrome, + dataSourceEnabled, + dataSourceManagement, + setActionMenu, + } = props; const { setToast } = useToast(); @@ -74,6 +83,8 @@ export function AddedIntegration(props: AddedIntegrationProps) { const [isModalVisible, setIsModalVisible] = useState(false); const [modalLayout, setModalLayout] = useState(); + const DataSourceMenu = dataSourceManagement?.ui?.getDataSourceMenu(); + const activateDeleteModal = (integrationName?: string) => { setModalLayout( + {dataSourceEnabled && ( + + )} diff --git a/public/components/integrations/components/added_integration_overview_page.tsx b/public/components/integrations/components/added_integration_overview_page.tsx index 4609268096..7e53009b00 100644 --- a/public/components/integrations/components/added_integration_overview_page.tsx +++ b/public/components/integrations/components/added_integration_overview_page.tsx @@ -17,7 +17,7 @@ export interface AddedIntegrationsTableProps { data: AddedIntegrationsList; setData: React.Dispatch>; http: HttpStart; - dataSourceEnabled: string; + dataSourceEnabled: boolean; } export interface AddedIntegrationsList { @@ -33,8 +33,6 @@ export interface AddedIntegrationType { assets: any[]; addedBy: string; id: string; - dataSourceMDSId?: string; - dataSourceMDSLabel?: string; references: []; } diff --git a/public/components/integrations/components/added_integration_table.tsx b/public/components/integrations/components/added_integration_table.tsx index 3a61e8961a..15af4c2db6 100644 --- a/public/components/integrations/components/added_integration_table.tsx +++ b/public/components/integrations/components/added_integration_table.tsx @@ -134,8 +134,18 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { ); setIsModalVisible(true); }; - const integTemplateNames = [...new Set(props.data.hits.map((i) => i.templateName))].sort(); + const mdsLabels = [ + ...new Set( + props.data.hits.flatMap((hit) => + hit.references.length > 0 + ? hit.references.map((ref) => ref.dataSourceMDSLabel || 'Local cluster') + : [] + ) + ), + ].sort(); + + console.log(mdsLabels); const search = { box: { @@ -153,11 +163,21 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { view: name, })), }, + { + type: 'field_value_selection' as const, + field: 'dataSourceMDSLabel', + name: 'Data Source Name', + multiSelect: false, + options: mdsLabels.map((name) => ({ + name, + value: name, + view: name, + })), + }, ], }; const entries = props.data.hits.map((integration) => { - console.log(integration); const id = integration.id; const templateName = integration.templateName; const creationDate = integration.creationDate; diff --git a/public/components/integrations/components/create_integration_helpers.ts b/public/components/integrations/components/create_integration_helpers.ts index 122a85c7bd..2e24bff858 100644 --- a/public/components/integrations/components/create_integration_helpers.ts +++ b/public/components/integrations/components/create_integration_helpers.ts @@ -4,7 +4,7 @@ */ import { HttpSetup } from '../../../../../../src/core/public'; import { Color, VALID_INDEX_NAME } from '../../../../common/constants/integrations'; -import { CONSOLE_PROXY, INTEGRATIONS_BASE } from '../../../../common/constants/shared'; +import { CONSOLE_PROXY, DSL_BASE, INTEGRATIONS_BASE } from '../../../../common/constants/shared'; import { coreRefs } from '../../../framework/core_refs'; type ValidationResult = { ok: true } | { ok: false; errors: string[] }; @@ -133,13 +133,13 @@ export const checkDataSourceName = ( export const fetchDataSourceMappings = async ( targetDataSource: string, - http: HttpSetup + http: HttpSetup, + dataSourceMDSId?: string ): Promise<{ [key: string]: { properties: Properties } } | null> => { return http - .post(CONSOLE_PROXY, { + .post(`${DSL_BASE}/integrations/mapping`, { query: { - path: `${targetDataSource}/_mapping`, - method: 'GET', + dataSourceMDSId, }, }) .then((response) => { @@ -206,7 +206,8 @@ export const doExistingDataSourceValidation = async ( const createComponentMapping = async ( componentName: string, - payload: ComponentMappingPayload + payload: ComponentMappingPayload, + dataSourceMDSId?: string ): Promise<{ [key: string]: { properties: Properties } } | null> => { const http = coreRefs.http!; const version = payload.template.mappings._meta.version; @@ -215,6 +216,7 @@ const createComponentMapping = async ( query: { path: `_component_template/ss4o_${componentName}-${version}-template`, method: 'POST', + dataSourceId: dataSourceMDSId, }, }); }; @@ -223,7 +225,8 @@ const createIndexMapping = async ( componentName: string, payload: ComponentMappingPayload, dataSourceName: string, - integration: IntegrationConfig + integration: IntegrationConfig, + dataSourceMDSId?: string ): Promise<{ [key: string]: { properties: Properties } } | null> => { const http = coreRefs.http!; const version = payload.template.mappings._meta.version; @@ -233,6 +236,7 @@ const createIndexMapping = async ( query: { path: `_index_template/ss4o_${componentName}-${integration.name}-${version}-sample`, method: 'POST', + dataSourceId: dataSourceMDSId, }, }); }; @@ -241,7 +245,8 @@ const createIndexPatternMappings = async ( targetDataSource: string, integrationTemplateId: string, integration: IntegrationConfig, - setToast: (title: string, color?: Color, text?: string | undefined) => void + setToast: (title: string, color?: Color, text?: string | undefined) => void, + dataSourceMDSId?: string ): Promise => { // TODO the nested methods still need the dataSource -> indexPattern rename applied, sub-methods // here still have old naming convention @@ -264,21 +269,21 @@ const createIndexPatternMappings = async ( if (key === integration.type) { return Promise.resolve(); } - return createComponentMapping(key, mapping as ComponentMappingPayload); + return createComponentMapping(key, mapping as ComponentMappingPayload, dataSourceMDSId); }) ); // In order to see our changes, we need to manually provoke a refresh - await http.post(CONSOLE_PROXY, { + await http.post(`${DSL_BASE}/integrations/refresh`, { query: { - path: '_refresh', - method: 'GET', + dataSourceMDSId, }, }); await createIndexMapping( integration.type, mappings[integration.type], targetDataSource, - integration + integration, + dataSourceMDSId ); } catch (err) { error = err.message; @@ -310,7 +315,8 @@ export async function addIntegrationRequest({ `ss4o_${integration.type}-${templateName}-*-sample`, templateName, integration, - setToast + setToast, + dataSourceMDSId ); name = `${templateName}-sample`; indexPattern = `ss4o_${integration.type}-${templateName}-sample-sample`; diff --git a/public/components/integrations/components/integration.tsx b/public/components/integrations/components/integration.tsx index 66f37311ab..26370d1d90 100644 --- a/public/components/integrations/components/integration.tsx +++ b/public/components/integrations/components/integration.tsx @@ -19,8 +19,10 @@ import { EuiTab, EuiTabs, } from '@elastic/eui'; -import React, { useEffect, useState } from 'react'; +import React, { ComponentType, useEffect, useState } from 'react'; +import { DataSourceSelectorProps } from '../../../../../../src/plugins/data_source_management/public/components/data_source_selector/data_source_selector'; import { INTEGRATIONS_BASE } from '../../../../common/constants/shared'; +import { dataSourceFilterFn } from '../../../../common/utils/shared'; import { useToast } from '../../../../public/components/common/toast'; import { coreRefs } from '../../../framework/core_refs'; import { addIntegrationRequest } from './create_integration_helpers'; @@ -33,7 +35,14 @@ import { AvailableIntegrationProps } from './integration_types'; export function Integration(props: AvailableIntegrationProps) { const http = coreRefs.http!; - const { integrationTemplateId, chrome } = props; + const { + integrationTemplateId, + chrome, + notifications, + dataSourceEnabled, + dataSourceManagement, + savedObjectsMDSClient, + } = props; const { setToast } = useToast(); const [integration, setIntegration] = useState({} as IntegrationConfig); @@ -44,6 +53,8 @@ export function Integration(props: AvailableIntegrationProps) { const [isModalVisible, setIsModalVisible] = useState(false); const closeModal = () => setIsModalVisible(false); const showModal = () => setIsModalVisible(true); + const [dataSourceMDSId, setDataSourceMDSId] = useState(''); + const [dataSourceMDSLabel, setDataSourceMDSLabel] = useState(''); useEffect(() => { chrome.setBreadcrumbs([ @@ -126,6 +137,21 @@ export function Integration(props: AvailableIntegrationProps) { setSelectedTabId(id); }; + let DataSourceSelector: + | ComponentType + | React.JSX.IntrinsicAttributes + | null; + if (dataSourceEnabled) { + DataSourceSelector = dataSourceManagement.ui.DataSourceSelector; + } + + const onSelectedDataSource = (e) => { + const dataConnectionId = e[0] ? e[0].id : undefined; + setDataSourceMDSId(dataConnectionId); + const dataConnectionLabel = e[0] ? e[0].label : undefined; + setDataSourceMDSLabel(dataConnectionLabel); + }; + const renderTabs = () => { return tabs.map((tab, index) => ( { - if (isModalVisible) { - return ( - - - -

Modal title

-
-
- - - This modal has the following setup: - - - - - - Close - - -
- ); - } - }; + let modal = <>; + + if (isModalVisible) { + modal = ( + + + +

Select Data Source

+
+
+ + + + + + + + Close + + { + setLoading(true); + await addIntegrationRequest({ + addSample: true, + templateName: integration.name, + integration, + setToast, + dataSourceMDSId, + dataSourceMDSLabel, + }); + setLoading(false); + closeModal(); + }} + isLoading={loading} + fill + > + Add + + +
+ ); + } if (Object.keys(integration).length === 0) { return ( @@ -176,24 +228,26 @@ export function Integration(props: AvailableIntegrationProps) { -
- showModal()}>Show Modal - {mdsSelectorModal()} -
{ window.location.hash = `#/available/${integration.name}/setup`; }} setUpSample={async () => { - setLoading(true); - await addIntegrationRequest({ - addSample: true, - templateName: integration.name, - integration, - setToast, - }); - setLoading(false); + if (dataSourceEnabled) { + showModal(); + } else { + setLoading(true); + await addIntegrationRequest({ + addSample: true, + templateName: integration.name, + integration, + setToast, + dataSourceMDSId, + dataSourceMDSLabel, + }); + setLoading(false); + } }} loading={loading} /> @@ -211,6 +265,7 @@ export function Integration(props: AvailableIntegrationProps) { : IntegrationFields({ integration, integrationMapping })}
+ {modal}
); } diff --git a/public/components/integrations/components/integration_overview_panel.tsx b/public/components/integrations/components/integration_overview_panel.tsx index 1eb301f193..313ed293a2 100644 --- a/public/components/integrations/components/integration_overview_panel.tsx +++ b/public/components/integrations/components/integration_overview_panel.tsx @@ -6,12 +6,11 @@ import { EuiButton, EuiFlexGroup, - EuiPageHeader, - EuiPageHeaderSection, - EuiSpacer, EuiFlexItem, EuiPageContentHeaderSection, - EuiText, + EuiPageHeader, + EuiPageHeaderSection, + EuiSpacer } from '@elastic/eui'; import React from 'react'; diff --git a/public/components/integrations/components/integration_types.ts b/public/components/integrations/components/integration_types.ts index a42bd87d2e..47c348edc4 100644 --- a/public/components/integrations/components/integration_types.ts +++ b/public/components/integrations/components/integration_types.ts @@ -3,7 +3,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { ChromeStart, HttpStart } from '../../../../../../src/core/public'; +import { + ChromeStart, + HttpStart, + MountPoint, + NotificationsStart, + SavedObjectsStart, +} from '../../../../../../src/core/public'; +import { DataSourceManagementPluginSetup } from '../../../../../../src/plugins/data_source_management/public'; export interface AvailableIntegrationOverviewPageProps { http: HttpStart; @@ -13,7 +20,7 @@ export interface AvailableIntegrationOverviewPageProps { export interface AddedIntegrationOverviewPageProps { http: HttpStart; chrome: ChromeStart; - dataSourceEnabled: string; + dataSourceEnabled: boolean; } export interface AvailableIntegrationProps { @@ -25,10 +32,19 @@ export interface AddedIntegrationProps { http: HttpStart; chrome: ChromeStart; integrationInstanceId: string; + notifications: NotificationsStart; + dataSourceEnabled: boolean; + dataSourceManagement: DataSourceManagementPluginSetup; + savedObjectsMDSClient: SavedObjectsStart; + setActionMenu: (menuMount: MountPoint | undefined) => void; } export interface AvailableIntegrationProps { http: HttpStart; chrome: ChromeStart; integrationTemplateId: string; + notifications: NotificationsStart; + dataSourceEnabled: boolean; + dataSourceManagement: DataSourceManagementPluginSetup; + savedObjectsMDSClient: SavedObjectsStart; } diff --git a/public/components/integrations/components/setup_integration.tsx b/public/components/integrations/components/setup_integration.tsx index 643bab8a31..e9ec2a7ae8 100644 --- a/public/components/integrations/components/setup_integration.tsx +++ b/public/components/integrations/components/setup_integration.tsx @@ -22,8 +22,9 @@ import React, { useEffect, useState } from 'react'; import { NotificationsStart, SavedObjectsStart } from '../../../../../../src/core/public'; import { DataSourceManagementPluginSetup } from '../../../../../../src/plugins/data_source_management/public'; import { Color } from '../../../../common/constants/integrations'; -import { CONSOLE_PROXY, INTEGRATIONS_BASE } from '../../../../common/constants/shared'; +import { INTEGRATIONS_BASE } from '../../../../common/constants/shared'; import { IntegrationConnectionType } from '../../../../common/types/integrations'; +import { SQLService } from '../../../../public/services/requests/sql'; import { coreRefs } from '../../../framework/core_refs'; import { addIntegrationRequest } from './create_integration_helpers'; import { SetupIntegrationFormInputs } from './setup_integration_inputs'; @@ -58,10 +59,13 @@ export interface IntegrationConfigProps { type SetupCallout = { show: true; title: string; color?: Color; text?: string } | { show: false }; +const sqlService = new SQLService(coreRefs.http!); + const runQuery = async ( query: string, datasource: string, - sessionId: string | null + sessionId: string | undefined, + dataSourceMDSId?: string ): Promise> => { // Used for polling const sleep = (ms: number) => { @@ -69,24 +73,22 @@ const runQuery = async ( }; try { - const http = coreRefs.http!; - const queryResponse: { queryId: string; sessionId: string } = await http.post(CONSOLE_PROXY, { - body: JSON.stringify({ query, datasource, lang: 'sql', sessionId }), - query: { - path: '_plugins/_async_query', - method: 'POST', + const queryResponse: { queryId: string; sessionId: string } = await sqlService.fetch( + { + query, + datasource, + lang: 'sql', + sessionId, }, - }); + dataSourceMDSId + ); + let poll: { status: string; error?: string } = { status: 'undefined' }; - const [queryId, newSessionId] = [queryResponse.queryId, queryResponse.sessionId]; + const { queryId, sessionId: newSessionId } = queryResponse; + while (!poll.error) { - poll = await http.post(CONSOLE_PROXY, { - body: '{}', - query: { - path: '_plugins/_async_query/' + queryId, - method: 'GET', - }, - }); + poll = await sqlService.fetchWithJobId({ queryId }, dataSourceMDSId); + if (poll.status.toLowerCase() === 'success') { return { ok: true, @@ -104,6 +106,7 @@ const runQuery = async ( } await sleep(3000); } + return { ok: false, error: new Error(poll.error) }; } catch (err) { console.error(err); @@ -155,7 +158,7 @@ const addIntegration = async ({ setIsInstalling?: (isInstalling: boolean, success?: boolean) => void; }) => { setLoading(true); - let sessionId: string | null = null; + let sessionId: string | undefined; if (config.connectionType === 'index') { let enabledWorkflows: string[] | undefined; @@ -200,7 +203,12 @@ const addIntegration = async ({ } const queryStr = prepareQuery(query.query, config); - const result = await runQuery(queryStr, config.connectionDataSource, sessionId); + const result = await runQuery( + queryStr, + config.connectionDataSource, + sessionId, + dataSourceMDSId + ); if (!result.ok) { setLoading(false); setCalloutLikeToast('Failed to add integration', 'danger', result.error.message); diff --git a/public/components/integrations/components/setup_integration_inputs.tsx b/public/components/integrations/components/setup_integration_inputs.tsx index 6a5e28ef10..9a0a0accd7 100644 --- a/public/components/integrations/components/setup_integration_inputs.tsx +++ b/public/components/integrations/components/setup_integration_inputs.tsx @@ -80,7 +80,6 @@ const suggestDataSources = async ( type: IntegrationConnectionType, dataSourceMDSId?: string ): Promise> => { - console.log(dataSourceMDSId); const http = coreRefs.http!; try { if (type === 'index') { @@ -89,7 +88,7 @@ const suggestDataSources = async ( query: { path: '_data_stream/ss4o_*', method: 'GET', - dataSourceMDSId, + dataSourceId: dataSourceMDSId ?? '', }, }); return ( diff --git a/public/components/integrations/home.tsx b/public/components/integrations/home.tsx index e30215a639..0b99dfeba9 100644 --- a/public/components/integrations/home.tsx +++ b/public/components/integrations/home.tsx @@ -7,6 +7,7 @@ import React from 'react'; import { HashRouter, Route, RouteComponentProps, Switch } from 'react-router-dom'; import { ChromeBreadcrumb, + MountPoint, NotificationsStart, SavedObjectsStart, } from '../../../../../src/core/public'; @@ -26,6 +27,7 @@ interface HomeProps extends RouteComponentProps, AppAnalyticsCoreDeps { dataSourceEnabled: boolean; dataSourceManagement: DataSourceManagementPluginSetup; savedObjectsMDSClient: SavedObjectsStart; + setActionMenu: (menuMount: MountPoint | undefined) => void; } export const Home = (props: HomeProps) => { @@ -36,6 +38,7 @@ export const Home = (props: HomeProps) => { dataSourceManagement, savedObjectsMDSClient, notifications, + setActionMenu, } = props; const commonProps = { @@ -69,6 +72,11 @@ export const Home = (props: HomeProps) => { )} /> @@ -79,6 +87,10 @@ export const Home = (props: HomeProps) => { )} /> diff --git a/server/adaptors/integrations/__test__/builder.test.ts b/server/adaptors/integrations/__test__/builder.test.ts index ca596e213b..44199370ea 100644 --- a/server/adaptors/integrations/__test__/builder.test.ts +++ b/server/adaptors/integrations/__test__/builder.test.ts @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { TEST_INTEGRATION_CONFIG } from '../../../../test/constants'; import { SavedObjectsClientContract } from '../../../../../../src/core/server'; +import { TEST_INTEGRATION_CONFIG } from '../../../../test/constants'; import { IntegrationInstanceBuilder } from '../integrations_builder'; import { IntegrationReader } from '../repository/integration_reader'; import * as mockUtils from '../repository/utils'; @@ -83,6 +83,12 @@ describe('IntegrationInstanceBuilder', () => { templateName: 'sample', dataSource: 'instance-datasource', creationDate: expect.any(String), + references: [ + { + dataSourceMDSId: undefined, + dataSourceMDSLabel: undefined, + }, + ], assets: [ { assetType: 'dashboard', @@ -307,6 +313,12 @@ describe('IntegrationInstanceBuilder', () => { tags: undefined, creationDate: expect.any(String), assets: refs, + references: [ + { + dataSourceMDSId: undefined, + dataSourceMDSLabel: undefined, + }, + ], }; const instance = await builder.buildInstance( diff --git a/server/adaptors/integrations/integrations_manager.ts b/server/adaptors/integrations/integrations_manager.ts index 7dd7d19624..0fd9ad196b 100644 --- a/server/adaptors/integrations/integrations_manager.ts +++ b/server/adaptors/integrations/integrations_manager.ts @@ -181,9 +181,7 @@ export class IntegrationsManager { dataSource, tableName, }); - console.log(dataSourceMDSId, dataSourceMDSLabel); const test = await this.client.create('integration-instance', result); - console.log(test); return Promise.resolve({ ...result, id: test.id }); } catch (err) { addRequestToMetric('integrations', 'create', err); diff --git a/server/adaptors/integrations/types.ts b/server/adaptors/integrations/types.ts index 95a7895041..fda11c7763 100644 --- a/server/adaptors/integrations/types.ts +++ b/server/adaptors/integrations/types.ts @@ -113,6 +113,7 @@ interface IntegrationInstance { dataSource: string; creationDate: string; assets: AssetReference[]; + references: []; } interface IntegrationInstanceResult extends IntegrationInstance { diff --git a/server/routes/dsl.ts b/server/routes/dsl.ts index 0560ae049f..43bec95f1f 100644 --- a/server/routes/dsl.ts +++ b/server/routes/dsl.ts @@ -3,17 +3,17 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { schema } from '@osd/config-schema'; import { RequestParams } from '@elastic/elasticsearch'; +import { schema } from '@osd/config-schema'; import { IRouter } from '../../../../src/core/server'; -import { DSLFacet } from '../services/facets/dsl_facet'; import { DSL_BASE, - DSL_SEARCH, DSL_CAT, DSL_MAPPING, + DSL_SEARCH, DSL_SETTINGS, } from '../../common/constants/shared'; +import { DSLFacet } from '../services/facets/dsl_facet'; export function registerDslRoute( { router }: { router: IRouter; facet: DSLFacet }, @@ -236,4 +236,72 @@ export function registerDslRoute( } } ); + + router.post( + { + path: `${DSL_BASE}/integrations/refresh`, + validate: { + body: schema.any(), + query: schema.object({ + dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })), + }), + }, + }, + async (context, request, response) => { + const dataSourceMDSId = request.query.dataSourceMDSId; + try { + let resp; + if (dataSourceEnabled && dataSourceMDSId) { + const client = await context.dataSource.opensearch.legacy.getClient(dataSourceMDSId); + resp = await client.callAPI('indices.refresh'); + } else { + resp = await context.core.opensearch.legacy.client.callAsCurrentUser('indices.refresh'); + } + return response.ok({ + body: resp, + }); + } catch (error) { + if (error.statusCode !== 404) console.error(error); + return response.custom({ + statusCode: error.statusCode || 500, + body: error.message, + }); + } + } + ); + + router.post( + { + path: `${DSL_BASE}/integrations/mapping`, + validate: { + body: schema.any(), + query: schema.object({ + dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })), + }), + }, + }, + async (context, request, response) => { + const dataSourceMDSId = request.query.dataSourceMDSId; + try { + let resp; + if (dataSourceEnabled && dataSourceMDSId) { + const client = await context.dataSource.opensearch.legacy.getClient(dataSourceMDSId); + resp = await client.callAPI('indices.getMapping'); + } else { + resp = await context.core.opensearch.legacy.client.callAsCurrentUser( + 'indices.getMapping' + ); + } + return response.ok({ + body: resp, + }); + } catch (error) { + if (error.statusCode !== 404) console.error(error); + return response.custom({ + statusCode: error.statusCode || 500, + body: error.message, + }); + } + } + ); } From 5bf68f4091385c3d704990496468b6c8eb19ad43 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Fri, 9 Aug 2024 12:35:32 -0700 Subject: [PATCH 03/20] fixed case for Local cluster Signed-off-by: sumukhswamy --- .../integrations/components/added_integration_table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/components/integrations/components/added_integration_table.tsx b/public/components/integrations/components/added_integration_table.tsx index 15af4c2db6..76cdd92dd4 100644 --- a/public/components/integrations/components/added_integration_table.tsx +++ b/public/components/integrations/components/added_integration_table.tsx @@ -94,7 +94,7 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { truncateText: true, render: (value, record) => ( - {truncate(record.dataSourceMDSLabel || 'local cluster', { length: 100 })} + {truncate(record.dataSourceMDSLabel || 'Local cluster', { length: 100 })} ), }); From 77c697db7488d8e084ef6fccac01a2ead1bfb3dd Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 12 Aug 2024 11:23:09 -0700 Subject: [PATCH 04/20] addressed comments for undefined variables Signed-off-by: sumukhswamy --- .../integrations/components/added_integration_table.tsx | 2 -- .../integrations/components/setup_integration.tsx | 7 ++----- .../integrations/components/setup_integration_inputs.tsx | 5 +---- server/adaptors/integrations/integrations_manager.ts | 4 ++-- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/public/components/integrations/components/added_integration_table.tsx b/public/components/integrations/components/added_integration_table.tsx index 76cdd92dd4..5d37cac00f 100644 --- a/public/components/integrations/components/added_integration_table.tsx +++ b/public/components/integrations/components/added_integration_table.tsx @@ -145,8 +145,6 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { ), ].sort(); - console.log(mdsLabels); - const search = { box: { incremental: true, diff --git a/public/components/integrations/components/setup_integration.tsx b/public/components/integrations/components/setup_integration.tsx index e9ec2a7ae8..6d2c26c68c 100644 --- a/public/components/integrations/components/setup_integration.tsx +++ b/public/components/integrations/components/setup_integration.tsx @@ -51,10 +51,7 @@ export interface IntegrationConfigProps { dataSourceEnabled: boolean; dataSourceManagement: DataSourceManagementPluginSetup; savedObjectsMDSClient: SavedObjectsStart; - handleSelectedDataSourceChange: ( - dataSourceMDSId: string | undefined, - dataSourceMDSLabel: string | undefined - ) => void; + handleSelectedDataSourceChange: (dataSourceMDSId?: string, dataSourceMDSLabel?: string) => void; } type SetupCallout = { show: true; title: string; color?: Color; text?: string } | { show: false }; @@ -426,7 +423,7 @@ export function SetupIntegrationForm({ const updateConfig = (updates: Partial) => setConfig(Object.assign({}, integConfig, updates)); - const handleSelectedDataSourceChange = (id: string | undefined, label: string | undefined) => { + const handleSelectedDataSourceChange = (id?: string, label?: string) => { setDataSourceMDSId(id); setDataSourceMDSLabel(label); }; diff --git a/public/components/integrations/components/setup_integration_inputs.tsx b/public/components/integrations/components/setup_integration_inputs.tsx index 9a0a0accd7..df71adc2fe 100644 --- a/public/components/integrations/components/setup_integration_inputs.tsx +++ b/public/components/integrations/components/setup_integration_inputs.tsx @@ -210,10 +210,7 @@ export function IntegrationConnectionInputs({ dataSourceEnabled: boolean; dataSourceManagement: DataSourceManagementPluginSetup; savedObjectsMDSClient: SavedObjectsStart; - handleSelectedDataSourceChange: ( - dataSourceMDSId: string | undefined, - dataSourceMDSLabel: string | undefined - ) => void; + handleSelectedDataSourceChange: (dataSourceMDSId?: string, dataSourceMDSLabel?: string) => void; lockConnectionType?: boolean; }) { const [dataSourceMDSId, setDataSourceMDSId] = useState(''); diff --git a/server/adaptors/integrations/integrations_manager.ts b/server/adaptors/integrations/integrations_manager.ts index 0fd9ad196b..5ac26edb88 100644 --- a/server/adaptors/integrations/integrations_manager.ts +++ b/server/adaptors/integrations/integrations_manager.ts @@ -157,8 +157,8 @@ export class IntegrationsManager { templateName: string, name: string, indexPattern: string, - dataSourceMDSId: string | undefined, - dataSourceMDSLabel: string | undefined, + dataSourceMDSId?: string, + dataSourceMDSLabel?: string, workflows?: string[], dataSource?: string, tableName?: string From f12d658d290913315fe2e7d4ebe42239f55ce132 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 12 Aug 2024 13:58:10 -0700 Subject: [PATCH 05/20] updated snapshots Signed-off-by: sumukhswamy --- .../added_integration_table.test.tsx.snap | 1709 +++++++++++++++++ .../added_integration_table.test.tsx | 14 +- .../components/__tests__/testing_constants.ts | 90 + 3 files changed, 1810 insertions(+), 3 deletions(-) diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap index d87e057619..c879630075 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap @@ -1704,3 +1704,1712 @@ exports[`Added Integration Table View Test Renders added integration table view `; + +exports[`Added Integration Table View Test Renders added integration table view using dummy data 2`] = ` + + + +
+ +
+ + +
+ +
+ + + +
+
+ + + + +
+ + + + + +
+
+
+
+
+
+
+
+
+ +
+ + +
+ + + Type + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + id="field_value_selection_0" + isOpen={false} + ownFocus={true} + panelClassName="euiFilterGroup__popoverPanel" + panelPaddingSize="none" + > +
+
+ + + + + +
+
+
+
+ + + Data Source Name + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + id="field_value_selection_1" + isOpen={false} + ownFocus={true} + panelClassName="euiFilterGroup__popoverPanel" + panelPaddingSize="none" + > +
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + +
+
+ +
+ +
+ +
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + Integration Name + + + + + + + + + + + + Source + + + + + + + + + + + + Date Added + + + + + + + + + + + + Actions + + + + + +
+
+ Integration Name +
+
+ + + nginx + + +
+
+
+ Source +
+
+ + + nginx + + +
+
+
+ Date Added +
+
+ +
+ 2023-06-15T16:28:36.370Z +
+
+
+
+
+ Actions +
+
+ + + + + + + +
+
+
+
+ +
+ +
+ + + +
+ +
+ + + : + 10 + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + isOpen={false} + ownFocus={true} + panelPaddingSize="none" + > +
+
+ + + +
+
+
+
+
+ +
+ + + +
+
+
+
+
+
+ +
+ +
+ +
+ + + +`; diff --git a/public/components/integrations/components/__tests__/added_integration_table.test.tsx b/public/components/integrations/components/__tests__/added_integration_table.test.tsx index 95e9c2bd11..726e881920 100644 --- a/public/components/integrations/components/__tests__/added_integration_table.test.tsx +++ b/public/components/integrations/components/__tests__/added_integration_table.test.tsx @@ -3,12 +3,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +import { waitFor } from '@testing-library/react'; import { configure, mount } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; -import { waitFor } from '@testing-library/react'; -import { AddedIntegrationsTable } from '../added_integration_table'; -import { addedIntegrationData } from './testing_constants'; import React from 'react'; +import { AddedIntegrationsTable } from '../added_integration_table'; +import { addedIntegrationData, addedIntegrationDataWithoutMDS } from './testing_constants'; describe('Added Integration Table View Test', () => { configure({ adapter: new Adapter() }); @@ -20,4 +20,12 @@ describe('Added Integration Table View Test', () => { expect(wrapper).toMatchSnapshot(); }); }); + + it('Renders added integration table view using dummy data when MDS is disabled', async () => { + const wrapper = mount(); + + await waitFor(() => { + expect(wrapper).toMatchSnapshot(); + }); + }); }); diff --git a/public/components/integrations/components/__tests__/testing_constants.ts b/public/components/integrations/components/__tests__/testing_constants.ts index e1f80811c6..c1755f4d3e 100644 --- a/public/components/integrations/components/__tests__/testing_constants.ts +++ b/public/components/integrations/components/__tests__/testing_constants.ts @@ -181,6 +181,96 @@ export const addedIntegrationData: AddedIntegrationsTableProps = { loading: false, }; +export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { + setData: () => {}, + http: httpClientMock, + data: { + hits: [ + { + name: 'nginx', + templateName: 'nginx', + dataSource: { sourceType: 'logs', dataset: 'nginx', namespace: 'prod' }, + creationDate: '2023-06-15T16:28:36.370Z', + status: 'active', + addedBy: 'admin', + assets: [ + { + assetType: 'index-pattern', + assetId: '3fc41705-8a23-49f4-926c-2819e0d7306d', + status: 'available', + isDefaultAsset: false, + description: 'ss4o_logs-nginx-prod', + }, + { + assetType: 'search', + assetId: 'a0415ddd-047d-4c02-8769-d14bfb70f525', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Nginx Access Logs', + }, + { + assetType: 'visualization', + assetId: 'a17cd453-fb2f-4c24-81db-aedfc8682829', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Response codes over time', + }, + { + assetType: 'search', + assetId: '3e47dfed-d9ff-4c1b-b425-04ffc8ed3fa9', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Nginx Error Logs', + }, + { + assetType: 'visualization', + assetId: '641c2a03-eead-4900-94ee-e12d2fef8383', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Errors over time', + }, + { + assetType: 'visualization', + assetId: 'ce61594d-8307-4358-9b7e-71101b3ed722', + status: 'available', + isDefaultAsset: false, + description: 'Data Volume', + }, + { + assetType: 'visualization', + assetId: '452bd6e3-3b50-407f-88f2-c35a29c56051', + status: 'available', + isDefaultAsset: false, + description: 'Top Paths', + }, + { + assetType: 'visualization', + assetId: '14a1ddab-08c1-4aba-ba3b-88bae36f7e50', + status: 'available', + isDefaultAsset: false, + description: 'Requests per Minute', + }, + { + assetType: 'dashboard', + assetId: '179bad58-c840-4c6c-9fd8-1667c14bd03a', + status: 'available', + isDefaultAsset: true, + description: '[NGINX Core Logs 1.0] Overview', + }, + ], + id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', + references: [ + { + dataSourceMDSId: '', + dataSourceMDSLabel: '', + }, + ], + }, + ], + }, + loading: false, +}; + export const testIntegrationInstanceData = { data: { id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', From ec78b7b8da98dc6c58f67925add1e5cbe2100eaa Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 12 Aug 2024 15:39:31 -0700 Subject: [PATCH 06/20] changed the refrences object in integrations instance Signed-off-by: sumukhswamy --- .../added_integration_table.test.tsx.snap | 11 ++++++----- .../components/__tests__/testing_constants.ts | 5 +++-- .../integrations/components/added_integration.tsx | 4 ++-- .../components/added_integration_table.tsx | 6 ++---- server/adaptors/integrations/__test__/builder.test.ts | 10 ++++++---- server/adaptors/integrations/integrations_builder.ts | 5 +++-- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap index c879630075..7de916bd6f 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap @@ -82,8 +82,9 @@ exports[`Added Integration Table View Test Renders added integration table view "name": "nginx", "references": Array [ Object { - "dataSourceMDSId": "f4cf2c60-2f4d-11ef-bf2d-65348e7e70ea", - "dataSourceMDSLabel": "dataSource", + "id": "f4cf2c60-2f4d-11ef-bf2d-65348e7e70ea", + "name": "dataSource", + "type": "data-source", }, ], "status": "active", @@ -1705,7 +1706,7 @@ exports[`Added Integration Table View Test Renders added integration table view `; -exports[`Added Integration Table View Test Renders added integration table view using dummy data 2`] = ` +exports[`Added Integration Table View Test Renders added integration table view using dummy data when MDS is disabled 1`] = ` - hit.references.length > 0 - ? hit.references.map((ref) => ref.dataSourceMDSLabel || 'Local cluster') - : [] + hit.references.length > 0 ? hit.references.map((ref) => ref.name || 'Local cluster') : [] ) ), ].sort(); @@ -181,7 +179,7 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { const creationDate = integration.creationDate; const name = integration.name; const dataSourceMDSLabel = integration.references - ? integration.references[0].dataSourceMDSLabel + ? integration.references[0].name : 'Local cluster'; return { id, diff --git a/server/adaptors/integrations/__test__/builder.test.ts b/server/adaptors/integrations/__test__/builder.test.ts index 44199370ea..8d05a3f516 100644 --- a/server/adaptors/integrations/__test__/builder.test.ts +++ b/server/adaptors/integrations/__test__/builder.test.ts @@ -85,8 +85,9 @@ describe('IntegrationInstanceBuilder', () => { creationDate: expect.any(String), references: [ { - dataSourceMDSId: undefined, - dataSourceMDSLabel: undefined, + id: undefined, + name: undefined, + type: 'data-source', }, ], assets: [ @@ -315,8 +316,9 @@ describe('IntegrationInstanceBuilder', () => { assets: refs, references: [ { - dataSourceMDSId: undefined, - dataSourceMDSLabel: undefined, + id: undefined, + name: undefined, + type: 'data-source', }, ], }; diff --git a/server/adaptors/integrations/integrations_builder.ts b/server/adaptors/integrations/integrations_builder.ts index d7c50a235d..ae8936851e 100644 --- a/server/adaptors/integrations/integrations_builder.ts +++ b/server/adaptors/integrations/integrations_builder.ts @@ -199,8 +199,9 @@ export class IntegrationInstanceBuilder { assets: refs, references: [ { - dataSourceMDSId: options.dataSourceMDSId, - dataSourceMDSLabel: options.dataSourceMDSLabel, + id: options.dataSourceMDSId, + name: options.dataSourceMDSLabel, + type: 'data-source', }, ], }); From 9b55ab011ed53b92dbea18914aa8cbbc52678c99 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 12 Aug 2024 15:49:29 -0700 Subject: [PATCH 07/20] addressed pr comments Signed-off-by: sumukhswamy --- .../integrations/components/__tests__/testing_constants.ts | 5 +++-- .../components/added_integration_overview_page.tsx | 2 +- server/adaptors/integrations/types.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/components/integrations/components/__tests__/testing_constants.ts b/public/components/integrations/components/__tests__/testing_constants.ts index fa7eb117be..751dee16b5 100644 --- a/public/components/integrations/components/__tests__/testing_constants.ts +++ b/public/components/integrations/components/__tests__/testing_constants.ts @@ -262,8 +262,9 @@ export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', references: [ { - dataSourceMDSId: '', - dataSourceMDSLabel: '', + id: '', + name: '', + tye: 'data-source', }, ], }, diff --git a/public/components/integrations/components/added_integration_overview_page.tsx b/public/components/integrations/components/added_integration_overview_page.tsx index 7e53009b00..d406d570b2 100644 --- a/public/components/integrations/components/added_integration_overview_page.tsx +++ b/public/components/integrations/components/added_integration_overview_page.tsx @@ -33,7 +33,7 @@ export interface AddedIntegrationType { assets: any[]; addedBy: string; id: string; - references: []; + references?: []; } export function AddedIntegrationOverviewPage(props: AddedIntegrationOverviewPageProps) { diff --git a/server/adaptors/integrations/types.ts b/server/adaptors/integrations/types.ts index fda11c7763..0f229526f9 100644 --- a/server/adaptors/integrations/types.ts +++ b/server/adaptors/integrations/types.ts @@ -113,7 +113,7 @@ interface IntegrationInstance { dataSource: string; creationDate: string; assets: AssetReference[]; - references: []; + references?: []; } interface IntegrationInstanceResult extends IntegrationInstance { From 24cb4d9fb9688a92486fd11192f0181ba494d801 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 12 Aug 2024 16:07:00 -0700 Subject: [PATCH 08/20] updated snapshots Signed-off-by: sumukhswamy --- .../__snapshots__/added_integration_table.test.tsx.snap | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap index 7de916bd6f..c340b6de06 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap @@ -1788,8 +1788,9 @@ exports[`Added Integration Table View Test Renders added integration table view "name": "nginx", "references": Array [ Object { - "dataSourceMDSId": "", - "dataSourceMDSLabel": "", + "id": "", + "name": "", + "tye": "data-source", }, ], "status": "active", @@ -1860,7 +1861,7 @@ exports[`Added Integration Table View Test Renders added integration table view "name": "nginx", "templateName": "nginx", }, - "dataSourceMDSLabel": undefined, + "dataSourceMDSLabel": "", "id": "ad7e6e30-0b99-11ee-b27c-c9863222e9bf", "name": "nginx", "templateName": "nginx", @@ -2507,7 +2508,7 @@ exports[`Added Integration Table View Test Renders added integration table view "name": "nginx", "templateName": "nginx", }, - "dataSourceMDSLabel": undefined, + "dataSourceMDSLabel": "", "id": "ad7e6e30-0b99-11ee-b27c-c9863222e9bf", "name": "nginx", "templateName": "nginx", From 047109c103cfc724dfe930d041e53cd9e18c63e2 Mon Sep 17 00:00:00 2001 From: Jialiang Liang Date: Thu, 15 Aug 2024 14:01:29 -0400 Subject: [PATCH 09/20] [Page Header] New page header for metrics (#2050) * Move the save button to the header control bar Signed-off-by: Ryan Liang * Update snapshots Signed-off-by: Ryan Liang * Fix the save button and correct its size + position Signed-off-by: Ryan Liang * Fix the date picker location Signed-off-by: Ryan Liang * Rename the navigation in coreRef and switch to use compressed date picker Signed-off-by: Ryan Liang * Fix the popover Signed-off-by: Ryan Liang * Rename the button Signed-off-by: Ryan Liang * Update to latest mockup Signed-off-by: Ryan Liang * Update snapshots Signed-off-by: Ryan Liang * Fix the ui issues Signed-off-by: Ryan Liang * Dummy metrics Signed-off-by: Ryan Liang * Remove dummy Signed-off-by: Ryan Liang * update snapshots Signed-off-by: Ryan Liang * minor changes to match mocks Signed-off-by: Shenoy Pratik --------- Signed-off-by: Ryan Liang Signed-off-by: Shenoy Pratik Co-authored-by: Shenoy Pratik Signed-off-by: sumukhswamy --- public/components/metrics/top_menu/metrics_export_panel.tsx | 2 +- public/components/metrics/top_menu/top_menu.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/components/metrics/top_menu/metrics_export_panel.tsx b/public/components/metrics/top_menu/metrics_export_panel.tsx index ce8cb3e51c..7ac52a7a1f 100644 --- a/public/components/metrics/top_menu/metrics_export_panel.tsx +++ b/public/components/metrics/top_menu/metrics_export_panel.tsx @@ -6,8 +6,8 @@ import { EuiCompressedComboBox, EuiCompressedFieldText, - EuiFlexGroup, EuiCompressedFormRow, + EuiFlexGroup, EuiFlexItem, EuiForm, EuiHorizontalRule, diff --git a/public/components/metrics/top_menu/top_menu.tsx b/public/components/metrics/top_menu/top_menu.tsx index 92c7adf89d..c1da763684 100644 --- a/public/components/metrics/top_menu/top_menu.tsx +++ b/public/components/metrics/top_menu/top_menu.tsx @@ -5,10 +5,10 @@ import { EuiCompressedFieldText, - EuiFlexGroup, - EuiFlexItem, EuiCompressedSelect, EuiCompressedSuperDatePicker, + EuiFlexGroup, + EuiFlexItem, } from '@elastic/eui'; import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; From 618955f6f53db27f90535bf49ec4b4a16d446198 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Fri, 16 Aug 2024 16:23:23 -0700 Subject: [PATCH 10/20] Updated event analytics and integrations components Signed-off-by: sumukhswamy --- .../__snapshots__/save_panel.test.tsx.snap | 2 +- .../added_integration_table.test.tsx.snap | 86 +++---------------- .../components/__tests__/testing_constants.ts | 14 --- .../components/added_integration_table.tsx | 19 ++-- .../components/create_integration_helpers.ts | 8 +- .../integrations/components/integration.tsx | 4 +- .../components/setup_integration.tsx | 12 +-- .../components/setup_integration_inputs.tsx | 2 +- .../integrations/__test__/builder.test.ts | 14 --- .../integrations/integrations_builder.ts | 19 ++-- 10 files changed, 47 insertions(+), 133 deletions(-) diff --git a/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap b/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap index ff2d388153..747f819c8c 100644 --- a/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap +++ b/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap @@ -624,7 +624,7 @@ exports[`Saved query table component Renders saved query table 1`] = ` showLabel={true} >
- - - Data Source Name - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - id="field_value_selection_1" - isOpen={false} - ownFocus={true} - panelClassName="euiFilterGroup__popoverPanel" - panelPaddingSize="none" - > -
-
- - - - - -
-
-
-
@@ -1861,13 +1689,6 @@ exports[`Added Integration Table View Test Renders added integration table view ], "type": "field_value_selection", }, - Object { - "field": "dataSourceMDSLabel", - "multiSelect": false, - "name": "Data Source Name", - "options": undefined, - "type": "field_value_selection", - }, ], } } @@ -1895,13 +1716,6 @@ exports[`Added Integration Table View Test Renders added integration table view ], "type": "field_value_selection", }, - Object { - "field": "dataSourceMDSLabel", - "multiSelect": false, - "name": "Data Source Name", - "options": undefined, - "type": "field_value_selection", - }, ] } onChange={[Function]} @@ -2044,13 +1858,6 @@ exports[`Added Integration Table View Test Renders added integration table view ], "type": "field_value_selection", }, - Object { - "field": "dataSourceMDSLabel", - "multiSelect": false, - "name": "Data Source Name", - "options": undefined, - "type": "field_value_selection", - }, ] } onChange={[Function]} @@ -2236,158 +2043,6 @@ exports[`Added Integration Table View Test Renders added integration table view
- - - Data Source Name - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - id="field_value_selection_1" - isOpen={false} - ownFocus={true} - panelClassName="euiFilterGroup__popoverPanel" - panelPaddingSize="none" - > -
-
- - - - - -
-
-
-
diff --git a/public/components/integrations/components/added_integration_table.tsx b/public/components/integrations/components/added_integration_table.tsx index ff350033ba..47abcbde61 100644 --- a/public/components/integrations/components/added_integration_table.tsx +++ b/public/components/integrations/components/added_integration_table.tsx @@ -140,7 +140,7 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { mdsLabels = [ ...new Set( props.data.hits.flatMap((hit) => - hit.references.length > 0 ? hit.references.map((ref) => ref.name || 'Local cluster') : [] + hit.references?.length > 0 ? hit.references.map((ref) => ref.name || 'Local cluster') : [] ) ), ].sort(); @@ -162,17 +162,21 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) { view: name, })), }, - { - type: 'field_value_selection' as const, - field: 'dataSourceMDSLabel', - name: 'Data Source Name', - multiSelect: false, - options: mdsLabels?.map((name) => ({ - name, - value: name, - view: name, - })), - }, + ...(dataSourceEnabled + ? [ + { + type: 'field_value_selection' as const, + field: 'dataSourceMDSLabel', + name: 'Data Source Name', + multiSelect: false, + options: mdsLabels?.map((name) => ({ + name, + value: name, + view: name, + })), + }, + ] + : []), ], }; From 8611d53fa707ac71508a3912483206e613b862d4 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 12 Aug 2024 13:58:10 -0700 Subject: [PATCH 12/20] updated snapshots Signed-off-by: sumukhswamy --- .../added_integration_table.test.tsx.snap | 1709 +++++++++++++++++ .../components/__tests__/testing_constants.ts | 90 + 2 files changed, 1799 insertions(+) diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap index e6f1520b51..37cd26cc09 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap @@ -3008,3 +3008,1712 @@ exports[`Added Integration Table View Test Renders added integration table view `; + +exports[`Added Integration Table View Test Renders added integration table view using dummy data 2`] = ` + + + +
+ +
+ + +
+ +
+ + + +
+
+ + + + +
+ + + + + +
+
+
+
+
+
+
+
+
+ +
+ + +
+ + + Type + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + id="field_value_selection_0" + isOpen={false} + ownFocus={true} + panelClassName="euiFilterGroup__popoverPanel" + panelPaddingSize="none" + > +
+
+ + + + + +
+
+
+
+ + + Data Source Name + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + id="field_value_selection_1" + isOpen={false} + ownFocus={true} + panelClassName="euiFilterGroup__popoverPanel" + panelPaddingSize="none" + > +
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + +
+
+ +
+ +
+ +
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + Integration Name + + + + + + + + + + + + Source + + + + + + + + + + + + Date Added + + + + + + + + + + + + Actions + + + + + +
+
+ Integration Name +
+
+ + + nginx + + +
+
+
+ Source +
+
+ + + nginx + + +
+
+
+ Date Added +
+
+ +
+ 2023-06-15T16:28:36.370Z +
+
+
+
+
+ Actions +
+
+ + + + + + + +
+
+
+
+ +
+ +
+ + + +
+ +
+ + + : + 10 + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + isOpen={false} + ownFocus={true} + panelPaddingSize="none" + > +
+
+ + + +
+
+
+
+
+ +
+ + + +
+
+
+
+
+
+ +
+ +
+ +
+ + + +`; diff --git a/public/components/integrations/components/__tests__/testing_constants.ts b/public/components/integrations/components/__tests__/testing_constants.ts index 465bc9ae90..03f23a6545 100644 --- a/public/components/integrations/components/__tests__/testing_constants.ts +++ b/public/components/integrations/components/__tests__/testing_constants.ts @@ -259,6 +259,96 @@ export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { loading: false, }; +export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { + setData: () => {}, + http: httpClientMock, + data: { + hits: [ + { + name: 'nginx', + templateName: 'nginx', + dataSource: { sourceType: 'logs', dataset: 'nginx', namespace: 'prod' }, + creationDate: '2023-06-15T16:28:36.370Z', + status: 'active', + addedBy: 'admin', + assets: [ + { + assetType: 'index-pattern', + assetId: '3fc41705-8a23-49f4-926c-2819e0d7306d', + status: 'available', + isDefaultAsset: false, + description: 'ss4o_logs-nginx-prod', + }, + { + assetType: 'search', + assetId: 'a0415ddd-047d-4c02-8769-d14bfb70f525', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Nginx Access Logs', + }, + { + assetType: 'visualization', + assetId: 'a17cd453-fb2f-4c24-81db-aedfc8682829', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Response codes over time', + }, + { + assetType: 'search', + assetId: '3e47dfed-d9ff-4c1b-b425-04ffc8ed3fa9', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Nginx Error Logs', + }, + { + assetType: 'visualization', + assetId: '641c2a03-eead-4900-94ee-e12d2fef8383', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Errors over time', + }, + { + assetType: 'visualization', + assetId: 'ce61594d-8307-4358-9b7e-71101b3ed722', + status: 'available', + isDefaultAsset: false, + description: 'Data Volume', + }, + { + assetType: 'visualization', + assetId: '452bd6e3-3b50-407f-88f2-c35a29c56051', + status: 'available', + isDefaultAsset: false, + description: 'Top Paths', + }, + { + assetType: 'visualization', + assetId: '14a1ddab-08c1-4aba-ba3b-88bae36f7e50', + status: 'available', + isDefaultAsset: false, + description: 'Requests per Minute', + }, + { + assetType: 'dashboard', + assetId: '179bad58-c840-4c6c-9fd8-1667c14bd03a', + status: 'available', + isDefaultAsset: true, + description: '[NGINX Core Logs 1.0] Overview', + }, + ], + id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', + references: [ + { + dataSourceMDSId: '', + dataSourceMDSLabel: '', + }, + ], + }, + ], + }, + loading: false, +}; + export const testIntegrationInstanceData = { data: { id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', From 97e7c940df37e246aafea094f17eedda0592cc96 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 19 Aug 2024 14:46:46 -0700 Subject: [PATCH 13/20] updated snapshots Signed-off-by: sumukhswamy --- .../added_integration_table.test.tsx.snap | 1709 ----------------- .../components/__tests__/testing_constants.ts | 90 - 2 files changed, 1799 deletions(-) diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap index 37cd26cc09..e6f1520b51 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap @@ -3008,1712 +3008,3 @@ exports[`Added Integration Table View Test Renders added integration table view `; - -exports[`Added Integration Table View Test Renders added integration table view using dummy data 2`] = ` - - - -
- -
- - -
- -
- - - -
-
- - - - -
- - - - - -
-
-
-
-
-
-
-
-
- -
- - -
- - - Type - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - id="field_value_selection_0" - isOpen={false} - ownFocus={true} - panelClassName="euiFilterGroup__popoverPanel" - panelPaddingSize="none" - > -
-
- - - - - -
-
-
-
- - - Data Source Name - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - id="field_value_selection_1" - isOpen={false} - ownFocus={true} - panelClassName="euiFilterGroup__popoverPanel" - panelPaddingSize="none" - > -
-
- - - - - -
-
-
-
-
-
-
-
-
-
-
-
- -
- - -
-
- -
- -
- -
- - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - Integration Name - - - - - - - - - - - - Source - - - - - - - - - - - - Date Added - - - - - - - - - - - - Actions - - - - - -
-
- Integration Name -
-
- - - nginx - - -
-
-
- Source -
-
- - - nginx - - -
-
-
- Date Added -
-
- -
- 2023-06-15T16:28:36.370Z -
-
-
-
-
- Actions -
-
- - - - - - - -
-
-
-
- -
- -
- - - -
- -
- - - : - 10 - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="none" - > -
-
- - - -
-
-
-
-
- -
- - - -
-
-
-
-
-
- -
- -
- -
- - - -`; diff --git a/public/components/integrations/components/__tests__/testing_constants.ts b/public/components/integrations/components/__tests__/testing_constants.ts index 03f23a6545..465bc9ae90 100644 --- a/public/components/integrations/components/__tests__/testing_constants.ts +++ b/public/components/integrations/components/__tests__/testing_constants.ts @@ -259,96 +259,6 @@ export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { loading: false, }; -export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { - setData: () => {}, - http: httpClientMock, - data: { - hits: [ - { - name: 'nginx', - templateName: 'nginx', - dataSource: { sourceType: 'logs', dataset: 'nginx', namespace: 'prod' }, - creationDate: '2023-06-15T16:28:36.370Z', - status: 'active', - addedBy: 'admin', - assets: [ - { - assetType: 'index-pattern', - assetId: '3fc41705-8a23-49f4-926c-2819e0d7306d', - status: 'available', - isDefaultAsset: false, - description: 'ss4o_logs-nginx-prod', - }, - { - assetType: 'search', - assetId: 'a0415ddd-047d-4c02-8769-d14bfb70f525', - status: 'available', - isDefaultAsset: false, - description: '[NGINX Core Logs 1.0] Nginx Access Logs', - }, - { - assetType: 'visualization', - assetId: 'a17cd453-fb2f-4c24-81db-aedfc8682829', - status: 'available', - isDefaultAsset: false, - description: '[NGINX Core Logs 1.0] Response codes over time', - }, - { - assetType: 'search', - assetId: '3e47dfed-d9ff-4c1b-b425-04ffc8ed3fa9', - status: 'available', - isDefaultAsset: false, - description: '[NGINX Core Logs 1.0] Nginx Error Logs', - }, - { - assetType: 'visualization', - assetId: '641c2a03-eead-4900-94ee-e12d2fef8383', - status: 'available', - isDefaultAsset: false, - description: '[NGINX Core Logs 1.0] Errors over time', - }, - { - assetType: 'visualization', - assetId: 'ce61594d-8307-4358-9b7e-71101b3ed722', - status: 'available', - isDefaultAsset: false, - description: 'Data Volume', - }, - { - assetType: 'visualization', - assetId: '452bd6e3-3b50-407f-88f2-c35a29c56051', - status: 'available', - isDefaultAsset: false, - description: 'Top Paths', - }, - { - assetType: 'visualization', - assetId: '14a1ddab-08c1-4aba-ba3b-88bae36f7e50', - status: 'available', - isDefaultAsset: false, - description: 'Requests per Minute', - }, - { - assetType: 'dashboard', - assetId: '179bad58-c840-4c6c-9fd8-1667c14bd03a', - status: 'available', - isDefaultAsset: true, - description: '[NGINX Core Logs 1.0] Overview', - }, - ], - id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', - references: [ - { - dataSourceMDSId: '', - dataSourceMDSLabel: '', - }, - ], - }, - ], - }, - loading: false, -}; - export const testIntegrationInstanceData = { data: { id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', From 98290d7f782a417abf0ae96e8c8d2936279a634c Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 12 Aug 2024 13:58:10 -0700 Subject: [PATCH 14/20] updated snapshots Signed-off-by: sumukhswamy --- .../added_integration_table.test.tsx.snap | 1709 +++++++++++++++++ .../components/__tests__/testing_constants.ts | 90 + 2 files changed, 1799 insertions(+) diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap index e6f1520b51..c1ad03f1f6 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap @@ -3008,3 +3008,1712 @@ exports[`Added Integration Table View Test Renders added integration table view `; + +exports[`Added Integration Table View Test Renders added integration table view using dummy data 2`] = ` + + + +
+ +
+ + +
+ +
+ + + +
+
+ + + + +
+ + + + + +
+
+
+
+
+
+
+
+
+ +
+ + +
+ + + Type + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + id="field_value_selection_0" + isOpen={false} + ownFocus={true} + panelClassName="euiFilterGroup__popoverPanel" + panelPaddingSize="none" + > +
+
+ + + + + +
+
+
+
+ + + Data Source Name + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + id="field_value_selection_1" + isOpen={false} + ownFocus={true} + panelClassName="euiFilterGroup__popoverPanel" + panelPaddingSize="none" + > +
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + +
+
+ +
+ +
+ +
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + Integration Name + + + + + + + + + + + + Source + + + + + + + + + + + + Date Added + + + + + + + + + + + + Actions + + + + + +
+
+ Integration Name +
+
+ + + nginx + + +
+
+
+ Source +
+
+ + + nginx + + +
+
+
+ Date Added +
+
+ +
+ 2023-06-15T16:28:36.370Z +
+
+
+
+
+ Actions +
+
+ + + + + + + +
+
+
+
+ +
+ +
+ + + +
+ +
+ + + : + 10 + + } + closePopover={[Function]} + display="inlineBlock" + hasArrow={true} + isOpen={false} + ownFocus={true} + panelPaddingSize="none" + > +
+
+ + + +
+
+
+
+
+ +
+ + + +
+
+
+
+
+
+ +
+ +
+ +
+ + + +`; diff --git a/public/components/integrations/components/__tests__/testing_constants.ts b/public/components/integrations/components/__tests__/testing_constants.ts index 465bc9ae90..03f23a6545 100644 --- a/public/components/integrations/components/__tests__/testing_constants.ts +++ b/public/components/integrations/components/__tests__/testing_constants.ts @@ -259,6 +259,96 @@ export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { loading: false, }; +export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { + setData: () => {}, + http: httpClientMock, + data: { + hits: [ + { + name: 'nginx', + templateName: 'nginx', + dataSource: { sourceType: 'logs', dataset: 'nginx', namespace: 'prod' }, + creationDate: '2023-06-15T16:28:36.370Z', + status: 'active', + addedBy: 'admin', + assets: [ + { + assetType: 'index-pattern', + assetId: '3fc41705-8a23-49f4-926c-2819e0d7306d', + status: 'available', + isDefaultAsset: false, + description: 'ss4o_logs-nginx-prod', + }, + { + assetType: 'search', + assetId: 'a0415ddd-047d-4c02-8769-d14bfb70f525', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Nginx Access Logs', + }, + { + assetType: 'visualization', + assetId: 'a17cd453-fb2f-4c24-81db-aedfc8682829', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Response codes over time', + }, + { + assetType: 'search', + assetId: '3e47dfed-d9ff-4c1b-b425-04ffc8ed3fa9', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Nginx Error Logs', + }, + { + assetType: 'visualization', + assetId: '641c2a03-eead-4900-94ee-e12d2fef8383', + status: 'available', + isDefaultAsset: false, + description: '[NGINX Core Logs 1.0] Errors over time', + }, + { + assetType: 'visualization', + assetId: 'ce61594d-8307-4358-9b7e-71101b3ed722', + status: 'available', + isDefaultAsset: false, + description: 'Data Volume', + }, + { + assetType: 'visualization', + assetId: '452bd6e3-3b50-407f-88f2-c35a29c56051', + status: 'available', + isDefaultAsset: false, + description: 'Top Paths', + }, + { + assetType: 'visualization', + assetId: '14a1ddab-08c1-4aba-ba3b-88bae36f7e50', + status: 'available', + isDefaultAsset: false, + description: 'Requests per Minute', + }, + { + assetType: 'dashboard', + assetId: '179bad58-c840-4c6c-9fd8-1667c14bd03a', + status: 'available', + isDefaultAsset: true, + description: '[NGINX Core Logs 1.0] Overview', + }, + ], + id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', + references: [ + { + dataSourceMDSId: '', + dataSourceMDSLabel: '', + }, + ], + }, + ], + }, + loading: false, +}; + export const testIntegrationInstanceData = { data: { id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', From 072e8575186b54e6f1101fbd532467eb78c0955c Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 19 Aug 2024 15:19:30 -0700 Subject: [PATCH 15/20] updated the remote and local for snapshots Signed-off-by: sumukhswamy --- .../added_integration_table.test.tsx.snap | 1709 ----------------- .../components/__tests__/testing_constants.ts | 90 - 2 files changed, 1799 deletions(-) diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap index c1ad03f1f6..e6f1520b51 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration_table.test.tsx.snap @@ -3008,1712 +3008,3 @@ exports[`Added Integration Table View Test Renders added integration table view `; - -exports[`Added Integration Table View Test Renders added integration table view using dummy data 2`] = ` - - - -
- -
- - -
- -
- - - -
-
- - - - -
- - - - - -
-
-
-
-
-
-
-
-
- -
- - -
- - - Type - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - id="field_value_selection_0" - isOpen={false} - ownFocus={true} - panelClassName="euiFilterGroup__popoverPanel" - panelPaddingSize="none" - > -
-
- - - - - -
-
-
-
- - - Data Source Name - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - id="field_value_selection_1" - isOpen={false} - ownFocus={true} - panelClassName="euiFilterGroup__popoverPanel" - panelPaddingSize="none" - > -
-
- - - - - -
-
-
-
-
-
-
-
-
-
-
-
- -
- - -
-
- -
- -
- -
- - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - Integration Name - - - - - - - - - - - - Source - - - - - - - - - - - - Date Added - - - - - - - - - - - - Actions - - - - - -
-
- Integration Name -
-
- - - nginx - - -
-
-
- Source -
-
- - - nginx - - -
-
-
- Date Added -
-
- -
- 2023-06-15T16:28:36.370Z -
-
-
-
-
- Actions -
-
- - - - - - - -
-
-
-
- -
- -
- - - -
- -
- - - : - 10 - - } - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="none" - > -
-
- - - -
-
-
-
-
- -
- - - -
-
-
-
-
-
- -
- -
- -
- - - -`; diff --git a/public/components/integrations/components/__tests__/testing_constants.ts b/public/components/integrations/components/__tests__/testing_constants.ts index 03f23a6545..465bc9ae90 100644 --- a/public/components/integrations/components/__tests__/testing_constants.ts +++ b/public/components/integrations/components/__tests__/testing_constants.ts @@ -259,96 +259,6 @@ export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { loading: false, }; -export const addedIntegrationDataWithoutMDS: AddedIntegrationsTableProps = { - setData: () => {}, - http: httpClientMock, - data: { - hits: [ - { - name: 'nginx', - templateName: 'nginx', - dataSource: { sourceType: 'logs', dataset: 'nginx', namespace: 'prod' }, - creationDate: '2023-06-15T16:28:36.370Z', - status: 'active', - addedBy: 'admin', - assets: [ - { - assetType: 'index-pattern', - assetId: '3fc41705-8a23-49f4-926c-2819e0d7306d', - status: 'available', - isDefaultAsset: false, - description: 'ss4o_logs-nginx-prod', - }, - { - assetType: 'search', - assetId: 'a0415ddd-047d-4c02-8769-d14bfb70f525', - status: 'available', - isDefaultAsset: false, - description: '[NGINX Core Logs 1.0] Nginx Access Logs', - }, - { - assetType: 'visualization', - assetId: 'a17cd453-fb2f-4c24-81db-aedfc8682829', - status: 'available', - isDefaultAsset: false, - description: '[NGINX Core Logs 1.0] Response codes over time', - }, - { - assetType: 'search', - assetId: '3e47dfed-d9ff-4c1b-b425-04ffc8ed3fa9', - status: 'available', - isDefaultAsset: false, - description: '[NGINX Core Logs 1.0] Nginx Error Logs', - }, - { - assetType: 'visualization', - assetId: '641c2a03-eead-4900-94ee-e12d2fef8383', - status: 'available', - isDefaultAsset: false, - description: '[NGINX Core Logs 1.0] Errors over time', - }, - { - assetType: 'visualization', - assetId: 'ce61594d-8307-4358-9b7e-71101b3ed722', - status: 'available', - isDefaultAsset: false, - description: 'Data Volume', - }, - { - assetType: 'visualization', - assetId: '452bd6e3-3b50-407f-88f2-c35a29c56051', - status: 'available', - isDefaultAsset: false, - description: 'Top Paths', - }, - { - assetType: 'visualization', - assetId: '14a1ddab-08c1-4aba-ba3b-88bae36f7e50', - status: 'available', - isDefaultAsset: false, - description: 'Requests per Minute', - }, - { - assetType: 'dashboard', - assetId: '179bad58-c840-4c6c-9fd8-1667c14bd03a', - status: 'available', - isDefaultAsset: true, - description: '[NGINX Core Logs 1.0] Overview', - }, - ], - id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', - references: [ - { - dataSourceMDSId: '', - dataSourceMDSLabel: '', - }, - ], - }, - ], - }, - loading: false, -}; - export const testIntegrationInstanceData = { data: { id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf', From 99d752126cf09619b139ee5639b572b00c97441c Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Mon, 19 Aug 2024 17:29:02 -0700 Subject: [PATCH 16/20] updated snapshots Signed-off-by: sumukhswamy --- .../__snapshots__/associated_objects_tab.test.tsx.snap | 1 - .../save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap | 2 +- .../__tests__/__snapshots__/saved_query_table.test.tsx.snap | 1 - .../__tests__/__snapshots__/added_integration.test.tsx.snap | 1 - .../__snapshots__/added_integration_table.test.tsx.snap | 1 - 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap b/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap index b16211759a..22617bef6e 100644 --- a/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap +++ b/public/components/datasources/components/__tests__/__snapshots__/associated_objects_tab.test.tsx.snap @@ -1181,7 +1181,6 @@ exports[`AssociatedObjectsTab Component renders correctly with associated object config={ Object { "cache": 60000, - "compressed": undefined, "field": "accelerations", "multiSelect": true, "name": "Accelerations", diff --git a/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap b/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap index 747f819c8c..ff2d388153 100644 --- a/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap +++ b/public/components/event_analytics/explorer/save_panel/__tests__/__snapshots__/save_panel.test.tsx.snap @@ -624,7 +624,7 @@ exports[`Saved query table component Renders saved query table 1`] = ` showLabel={true} >
- -
- - - -
- -
- - - } - closePopover={[Function]} - data-test-subj="global-filter-button" - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="none" - withTitle={true} - > -
-
- - - - - -
-
-
-
-
-
- -
- - - + Add filter - - } - closePopover={[Function]} - data-test-subj="addfilter" - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="m" - withTitle={true} - > -
-
- - - -
-
-
-
-
-
-
-
-
-`; \ No newline at end of file +`; diff --git a/public/components/trace_analytics/components/services/__tests__/__snapshots__/services.test.tsx.snap b/public/components/trace_analytics/components/services/__tests__/__snapshots__/services.test.tsx.snap index 994194edee..cf0a8c08d2 100644 --- a/public/components/trace_analytics/components/services/__tests__/__snapshots__/services.test.tsx.snap +++ b/public/components/trace_analytics/components/services/__tests__/__snapshots__/services.test.tsx.snap @@ -229,140 +229,6 @@ exports[`Services component renders empty services page 1`] = ` startTime="now-5m" traceColumnAction={[Function]} > - - - Data Prepper - - } - className="eui-textTruncate" - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="s" - > -
-
- - - - - -
-
-
-
-
-
- -
- -
- - -
- - -
- - - - - - -
-
- - -
- - -
- - - + Add filter - - } - closePopover={[Function]} - data-test-subj="addfilter" - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="m" - withTitle={true} - > -
-
- - - -
-
-
-
- @@ -2072,18 +1759,6 @@ exports[`Services component renders empty services page 1`] = ` - @@ -2128,18 +1803,6 @@ exports[`Services component renders empty services page 1`] = ` className="euiButtonGroup euiButtonGroup--small euiButtonGroup--text" disabled={false} > - - Errors - - - - - - - - -
-
- - -
- } - iconType={false} - isCustom={true} - startDateControl={
} - > -
- -
- - -
-
- -
- -
- - -
- - -
- - - - - - - -
-
-
- - -
- - - -
- -
- - - } - closePopover={[Function]} - data-test-subj="global-filter-button" - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="none" - withTitle={true} - > -
-
- - - - - -
-
-
-
-
-
- -
- - - + Add filter - - } - closePopover={[Function]} - data-test-subj="addfilter" - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="m" - withTitle={true} - > -
-
- - - - -
-
-
- -
-
- -
- -
- - -
- - -
- - - - - - - -
-
-
- - -
- - - -
- -
- - - } - closePopover={[Function]} - data-test-subj="global-filter-button" - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="none" - withTitle={true} - > -
-
- - - - - -
-
-
-
-
-
- -
- - - + Add filter - - } - closePopover={[Function]} - data-test-subj="addfilter" - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="m" - withTitle={true} - > -
-
- - - - -
-
-
- - - - @@ -2156,141 +1991,6 @@ exports[`Traces component renders jaeger traces page 1`] = ` startTime="now-5m" traceIdColumnAction={[Function]} > - - - Jaeger - - } - className="eui-textTruncate" - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="s" - > -
-
- - - - - -
-
-
-
- - - @@ -4080,143 +3749,6 @@ exports[`Traces component renders traces page 1`] = ` startTime="now-5m" traceIdColumnAction={[Function]} > - - - Data Prepper - - } - className="eui-textTruncate" - closePopover={[Function]} - display="inlineBlock" - hasArrow={true} - isOpen={false} - ownFocus={true} - panelPaddingSize="s" - > -
-
- - - - - -
-
-
- - - - @@ -5765,4 +5266,4 @@ exports[`Traces component renders traces page 1`] = ` -`; \ No newline at end of file +`; From b260b895a064ecca49d4b20c0c17cb3b514f70d9 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Sun, 25 Aug 2024 13:59:42 -0700 Subject: [PATCH 20/20] updated missing import Signed-off-by: sumukhswamy --- .../integrations/components/integration_overview_panel.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/components/integrations/components/integration_overview_panel.tsx b/public/components/integrations/components/integration_overview_panel.tsx index 313ed293a2..47698e7e74 100644 --- a/public/components/integrations/components/integration_overview_panel.tsx +++ b/public/components/integrations/components/integration_overview_panel.tsx @@ -10,7 +10,8 @@ import { EuiPageContentHeaderSection, EuiPageHeader, EuiPageHeaderSection, - EuiSpacer + EuiSpacer, + EuiText, } from '@elastic/eui'; import React from 'react';