Skip to content

Commit

Permalink
added changes for mds under flag
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy committed Jul 24, 2024
1 parent 196dd35 commit 5b89f26
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@

import { EuiPage, EuiPageBody } from '@elastic/eui';
import React, { useEffect, useState } from 'react';
import { IntegrationHeader } from './integration_header';
import { AddedIntegrationsTable } from './added_integration_table';
import { HttpStart } from '../../../../../../src/core/public';
import { INTEGRATIONS_BASE } from '../../../../common/constants/shared';
import { AddedIntegrationsTable } from './added_integration_table';
import { IntegrationHeader } from './integration_header';
import { AddedIntegrationOverviewPageProps } from './integration_types';
import { HttpStart } from '../../../../../../src/core/public';

export interface AddedIntegrationsTableProps {
loading: boolean;
data: AddedIntegrationsList;
setData: React.Dispatch<React.SetStateAction<AddedIntegrationsList>>;
http: HttpStart;
dataSourceEnabled: string;
}

export interface AddedIntegrationsList {
Expand All @@ -35,7 +36,7 @@ export interface AddedIntegrationType {
}

export function AddedIntegrationOverviewPage(props: AddedIntegrationOverviewPageProps) {
const { chrome, http } = props;
const { chrome, http, dataSourceEnabled } = props;

const [data, setData] = useState<AddedIntegrationsList>({ hits: [] });

Expand All @@ -57,7 +58,13 @@ export function AddedIntegrationOverviewPage(props: AddedIntegrationOverviewPage
<EuiPage>
<EuiPageBody component="div">
{IntegrationHeader()}
{AddedIntegrationsTable({ data, setData, loading: false, http })}
{AddedIntegrationsTable({
data,
setData,
loading: false,
http,
dataSourceEnabled,
})}
</EuiPageBody>
</EuiPage>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ import {
} from '@elastic/eui';
import truncate from 'lodash/truncate';
import React, { useState } from 'react';
import { INTEGRATIONS_BASE } from '../../../../common/constants/shared';
import { DeleteModal } from '../../../../public/components/common/helpers/delete_modal';
import { useToast } from '../../../../public/components/common/toast';
import {
AddedIntegrationType,
AddedIntegrationsTableProps,
} from './added_integration_overview_page';
import { DeleteModal } from '../../../../public/components/common/helpers/delete_modal';
import { INTEGRATIONS_BASE } from '../../../../common/constants/shared';
import { useToast } from '../../../../public/components/common/toast';

export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) {
const { http } = props;
const { http, dataSourceEnabled } = props;

const { setToast } = useToast();

Expand Down Expand Up @@ -86,6 +86,18 @@ export function AddedIntegrationsTable(props: AddedIntegrationsTableProps) {
},
] as Array<EuiTableFieldDataColumnType<AddedIntegrationType>>;

if (dataSourceEnabled) {
tableColumns.splice(1, 0, {
field: 'dataSourceName',
name: 'Data Source Name',
sortable: true,
truncateText: true,
render: (value, record) => (
<EuiText data-test-subj={`${record.templateName}IntegrationDescription`}>- -</EuiText>
),
});
}

async function deleteAddedIntegration(integrationInstance: string, name: string) {
http
.delete(`${INTEGRATIONS_BASE}/store/${integrationInstance}`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ChromeBreadcrumb, ChromeStart, HttpStart } from '../../../../../../src/core/public';
import { ChromeStart, HttpStart } from '../../../../../../src/core/public';

export interface AvailableIntegrationOverviewPageProps {
http: HttpStart;
Expand All @@ -13,6 +13,7 @@ export interface AvailableIntegrationOverviewPageProps {
export interface AddedIntegrationOverviewPageProps {
http: HttpStart;
chrome: ChromeStart;
dataSourceEnabled: string;
}

export interface AvailableIntegrationProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import {
EuiText,
EuiTitle,
} from '@elastic/eui';
import React, { useState, useEffect } from 'react';
import { coreRefs } from '../../../framework/core_refs';
import React, { useEffect, useState } from 'react';
import { NotificationsStart, SavedObjectsStart } from '../../../../../../src/core/public';
import { DataSourceManagementPluginSetup } from '../../../../../../src/plugins/data_source_management/public';
import { CONSOLE_PROXY, DATACONNECTIONS_BASE } from '../../../../common/constants/shared';
import { IntegrationConfigProps, IntegrationSetupInputs } from './setup_integration';
import { IntegrationConnectionType } from '../../../../common/types/integrations';
import { coreRefs } from '../../../framework/core_refs';
import { IntegrationConfigProps, IntegrationSetupInputs } from './setup_integration';

// TODO support localization
const INTEGRATION_CONNECTION_DATA_SOURCE_TYPES: Map<
Expand Down Expand Up @@ -190,15 +192,27 @@ export function IntegrationConnectionInputs({
config,
updateConfig,
integration,
dataSourceEnabled,
dataSourceManagement,
notifications,
savedObjectsMDSClient,
lockConnectionType,
}: {
config: IntegrationSetupInputs;
updateConfig: (updates: Partial<IntegrationSetupInputs>) => void;
integration: IntegrationConfig;
notifications: NotificationsStart;
dataSourceEnabled: boolean;
dataSourceManagement: DataSourceManagementPluginSetup;
savedObjectsMDSClient: SavedObjectsStart;
lockConnectionType?: boolean;
}) {
const connectionType = INTEGRATION_CONNECTION_DATA_SOURCE_TYPES.get(config.connectionType)!;

let DataSourceSelector;
if (dataSourceEnabled) {
DataSourceSelector = dataSourceManagement.ui.DataSourceSelector;
}
const [dataSourceSuggestions, setDataSourceSuggestions] = useState(
[] as Array<{ label: string }>
);
Expand All @@ -217,6 +231,23 @@ export function IntegrationConnectionInputs({

return (
<>
{dataSourceEnabled && (
<>
<EuiFormRow
label="Data Source"
helpText="Select the type of remote data source to query from."
>
<DataSourceSelector
savedObjectsClient={savedObjectsMDSClient.client}
notifications={notifications}
disabled={false}
fullWidth={false}
removePrepend={true}
/>
</EuiFormRow>
<EuiSpacer />
</>
)}
<EuiFormRow
label="Connection Type"
helpText="Select the type of connection to use for queries."
Expand Down Expand Up @@ -398,7 +429,17 @@ export function IntegrationWorkflowsInputs({
}

export function SetupIntegrationFormInputs(props: IntegrationConfigProps) {
const { config, updateConfig, integration, setupCallout, lockConnectionType } = props;
const {
config,
updateConfig,
integration,
setupCallout,
lockConnectionType,
dataSourceEnabled,
dataSourceManagement,
notifications,
savedObjectsMDSClient,
} = props;

return (
<EuiForm>
Expand Down Expand Up @@ -431,6 +472,10 @@ export function SetupIntegrationFormInputs(props: IntegrationConfigProps) {
updateConfig={updateConfig}
integration={integration}
lockConnectionType={lockConnectionType}
dataSourceManagement={dataSourceManagement}
notifications={notifications}
dataSourceEnabled={dataSourceEnabled}
savedObjectsMDSClient={savedObjectsMDSClient}
/>
{config.connectionType === 's3' ? (
<>
Expand Down
41 changes: 34 additions & 7 deletions public/components/integrations/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,38 @@

import React from 'react';
import { HashRouter, Route, RouteComponentProps, Switch } from 'react-router-dom';
import {
ChromeBreadcrumb,
NotificationsStart,
SavedObjectsStart,
} from '../../../../../src/core/public';
import { DataSourceManagementPluginSetup } from '../../../../../src/plugins/data_source_management/public';
import { TraceAnalyticsCoreDeps } from '../trace_analytics/home';
import { ChromeBreadcrumb } from '../../../../../src/core/public';
import { AvailableIntegrationOverviewPage } from './components/available_integration_overview_page';
import { AddedIntegrationOverviewPage } from './components/added_integration_overview_page';
import { AddedIntegration } from './components/added_integration';
import { SetupIntegrationPage } from './components/setup_integration';
import { AddedIntegrationOverviewPage } from './components/added_integration_overview_page';
import { AvailableIntegrationOverviewPage } from './components/available_integration_overview_page';
import { Integration } from './components/integration';
import { SetupIntegrationPage } from './components/setup_integration';

export type AppAnalyticsCoreDeps = TraceAnalyticsCoreDeps;

interface HomeProps extends RouteComponentProps, AppAnalyticsCoreDeps {
parentBreadcrumbs: ChromeBreadcrumb[];
notifications: NotificationsStart;
dataSourceEnabled: boolean;
dataSourceManagement: DataSourceManagementPluginSetup;
savedObjectsMDSClient: SavedObjectsStart;
}

export const Home = (props: HomeProps) => {
const { http, chrome } = props;
const {
http,
chrome,
dataSourceEnabled,
dataSourceManagement,
savedObjectsMDSClient,
notifications,
} = props;

const commonProps = {
http,
Expand All @@ -39,7 +55,12 @@ export const Home = (props: HomeProps) => {
<Route
exact
path={['/', '/installed']}
render={() => <AddedIntegrationOverviewPage {...commonProps} />}
render={() => (
<AddedIntegrationOverviewPage
{...commonProps}
dataSourceEnabled={dataSourceEnabled}
/>
)}
/>
<Route
exact
Expand All @@ -65,7 +86,13 @@ export const Home = (props: HomeProps) => {
exact
path={'/available/:id/setup'}
render={(routerProps) => (
<SetupIntegrationPage integration={decodeURIComponent(routerProps.match.params.id)} />
<SetupIntegrationPage
integration={decodeURIComponent(routerProps.match.params.id)}
dataSourceManagement={dataSourceManagement}
notifications={notifications}
dataSourceEnabled={dataSourceEnabled}
savedObjectsMDSClient={savedObjectsMDSClient}
/>
)}
/>
</Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Compatible with OpenSearch and OpenSearch Dashboards version 2.16.0
* added changes for moving notebooks to .kibana ([#1937](https://github.com/opensearch-project/dashboards-observability/pull/1937))
* Register all plugins to NavGroups ([#1926](https://github.com/opensearch-project/dashboards-observability/pull/1926))
* Remove duplicate description for create s3 datasource flow ([#1915](https://github.com/opensearch-project/dashboards-observability/pull/1915))
* Multi-data Source Support for Integrations ([#1992](https://github.com/opensearch-project/dashboards-observability/pull/1992))

### Bug Fixes
* Add toast message for getting started / Fix Nav Bug for Traces ([#1977](https://github.com/opensearch-project/dashboards-observability/pull/1977))
Expand Down

0 comments on commit 5b89f26

Please sign in to comment.