Skip to content

Commit

Permalink
added changes for mds support in integrations
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy committed Aug 9, 2024
1 parent eb71171 commit 93eab4e
Show file tree
Hide file tree
Showing 17 changed files with 526 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
},
],
}
}
Expand Down Expand Up @@ -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]}
Expand Down Expand Up @@ -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]}
Expand Down Expand Up @@ -538,6 +584,163 @@ exports[`Added Integration Table View Test Renders added integration table view
</div>
</EuiPopover>
</FieldValueSelectionFilter>
<FieldValueSelectionFilter
config={
Object {
"field": "dataSourceMDSLabel",
"multiSelect": false,
"name": "Data Source Name",
"options": Array [
Object {
"name": "dataSource",
"value": "dataSource",
"view": "dataSource",
},
],
"type": "field_value_selection",
}
}
index={1}
onChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [],
"_indexedClauses": Object {
"field": Object {},
"group": Array [],
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
"printClause": [Function],
},
"text": "",
}
}
>
<EuiPopover
anchorPosition="downCenter"
button={
<EuiFilterButton
grow={true}
hasActiveFilters={false}
iconSide="right"
iconType="arrowDown"
onClick={[Function]}
>
Data Source Name
</EuiFilterButton>
}
closePopover={[Function]}
display="inlineBlock"
hasArrow={true}
id="field_value_selection_1"
isOpen={false}
ownFocus={true}
panelClassName="euiFilterGroup__popoverPanel"
panelPaddingSize="none"
>
<div
className="euiPopover euiPopover--anchorDownCenter"
id="field_value_selection_1"
>
<div
className="euiPopover__anchor"
>
<EuiFilterButton
grow={true}
hasActiveFilters={false}
iconSide="right"
iconType="arrowDown"
onClick={[Function]}
>
<EuiButtonEmpty
className="euiFilterButton euiFilterButton--hasIcon"
color="text"
iconSide="right"
iconType="arrowDown"
onClick={[Function]}
textProps={
Object {
"className": "",
}
}
type="button"
>
<button
className="euiButtonEmpty euiButtonEmpty--text euiFilterButton euiFilterButton--hasIcon"
disabled={false}
onClick={[Function]}
type="button"
>
<EuiButtonContent
className="euiButtonEmpty__content"
iconSide="right"
iconSize="m"
iconType="arrowDown"
textProps={
Object {
"className": "euiButtonEmpty__text",
}
}
>
<span
className="euiButtonContent euiButtonContent--iconRight euiButtonEmpty__content"
>
<EuiIcon
className="euiButtonContent__icon"
color="inherit"
size="m"
type="arrowDown"
>
<EuiIconBeaker
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
role="img"
style={null}
>
<svg
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
height={16}
role="img"
style={null}
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z"
/>
</svg>
</EuiIconBeaker>
</EuiIcon>
<span
className="euiButtonEmpty__text"
>
<span
className="euiFilterButton__textShift"
data-text="Data Source Name"
title="Data Source Name"
>
Data Source Name
</span>
</span>
</span>
</EuiButtonContent>
</button>
</EuiButtonEmpty>
</EuiFilterButton>
</div>
</div>
</EuiPopover>
</FieldValueSelectionFilter>
</div>
</EuiFilterGroup>
</EuiSearchFilters>
Expand Down Expand Up @@ -596,6 +799,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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
"enabledWorkflows": Array [],
}
}
handleSelectedDataSourceChange={[Function]}
integration={
Object {
"assets": Array [],
Expand Down Expand Up @@ -236,6 +237,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
"enabledWorkflows": Array [],
}
}
handleSelectedDataSourceChange={[Function]}
integration={
Object {
"assets": Array [],
Expand Down Expand Up @@ -904,6 +906,8 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
"enabledWorkflows": Array [],
}
}
dataSourceMDSId=""
dataSourceMDSLabel=""
integration={
Object {
"assets": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ export const addedIntegrationData: AddedIntegrationsTableProps = {
},
],
id: 'ad7e6e30-0b99-11ee-b27c-c9863222e9bf',
references: [
{
dataSourceMDSId: 'f4cf2c60-2f4d-11ef-bf2d-65348e7e70ea',
dataSourceMDSLabel: 'dataSource',
},
],
},
],
},
Expand Down
35 changes: 31 additions & 4 deletions public/components/integrations/components/added_integration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ import {
EuiText,
EuiTitle,
} 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) {
Expand All @@ -46,7 +48,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();

Expand Down Expand Up @@ -75,6 +84,8 @@ export function AddedIntegration(props: AddedIntegrationProps) {
const [isModalVisible, setIsModalVisible] = useState(false);
const [modalLayout, setModalLayout] = useState(<EuiOverlayMask />);

const DataSourceMenu = dataSourceManagement?.ui?.getDataSourceMenu<DataSourceViewConfig>();

const activateDeleteModal = (integrationName?: string) => {
setModalLayout(
<DeleteModal
Expand Down Expand Up @@ -119,6 +130,22 @@ export function AddedIntegration(props: AddedIntegrationProps) {

return (
<EuiPageHeader style={{ justifyContent: 'spaceBetween' }}>
{dataSourceEnabled && (
<DataSourceMenu
setMenuMountPoint={setActionMenu}
componentType={'DataSourceView'}
componentConfig={{
activeOption: [
{
id: data?.references?.[0]?.dataSourceMDSId,
label: data?.references?.[0]?.dataSourceMDSLabel,
},
],
fullWidth: true,
dataSourceFilter: dataSourceFilterFn,
}}
/>
)}
<EuiSpacer size="m" />
<EuiPageHeaderSection style={{ width: '100%', justifyContent: 'space-between' }}>
<EuiPageContentHeaderSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface AddedIntegrationsTableProps {
data: AddedIntegrationsList;
setData: React.Dispatch<React.SetStateAction<AddedIntegrationsList>>;
http: HttpStart;
dataSourceEnabled: string;
dataSourceEnabled: boolean;
}

export interface AddedIntegrationsList {
Expand All @@ -33,8 +33,6 @@ export interface AddedIntegrationType {
assets: any[];

Check warning on line 33 in public/components/integrations/components/added_integration_overview_page.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
addedBy: string;
id: string;
dataSourceMDSId?: string;
dataSourceMDSLabel?: string;
references: [];
}

Expand Down
Loading

0 comments on commit 93eab4e

Please sign in to comment.