Skip to content

[Workchat] Hide disabled integrations when creating a new tool #221306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useIntegrationDelete } from '../../../hooks/use_integration_delete';
import { useIntegrationConfigurationForm } from '../../../hooks/use_integration_configuration_form';
import { appPaths } from '../../../app_paths';
import { toolLabels } from '../i18n';
import { integrationTypeToLabel } from '../utils';
import { integrationTypeToLabel, isIntegrationDisabled } from '../utils';

interface IntegrationEditViewProps {
integrationId: string | undefined;
Expand Down Expand Up @@ -87,10 +87,12 @@ export const IntegrationEditView: React.FC<IntegrationEditViewProps> = ({ integr

const integrationTypes = [
{ value: '', text: 'Pick a type' },
...Object.values(IntegrationType).map((type) => ({
value: type,
text: integrationTypeToLabel(type),
})),
...Object.values(IntegrationType)
.filter((type) => !isIntegrationDisabled(type))
.map((type) => ({
value: type,
text: integrationTypeToLabel(type),
})),
];

const onDeleteSuccess = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
import { i18n } from '@kbn/i18n';
import { css } from '@emotion/css';
import { IntegrationListView } from './integration_list_view';
import { getIntegrationIcon } from '../utils';
import { getIntegrationIcon, isIntegrationDisabled } from '../utils';
import { useNavigation } from '../../../hooks/use_navigation';
import { appPaths } from '../../../app_paths';

Expand All @@ -44,7 +44,7 @@ const integrationCards: Record<IntegrationType, IntegrationCardData> = {
defaultMessage:
'Choose an existing index to connect and start using it in your workflows without re-importing your data',
}),
disabled: false,
disabled: isIntegrationDisabled(IntegrationType.index_source),
},
[IntegrationType.external_server]: {
title: i18n.translate('workchatApp.integrations.listView.externalServerCard', {
Expand All @@ -54,7 +54,7 @@ const integrationCards: Record<IntegrationType, IntegrationCardData> = {
description: i18n.translate('workchatApp.integrations.listView.externalServerDescription', {
defaultMessage: 'Connect to external servers for data processing.',
}),
disabled: false,
disabled: isIntegrationDisabled(IntegrationType.external_server),
},
[IntegrationType.salesforce]: {
title: i18n.translate('workchatApp.integrations.listView.salesforceCard', {
Expand All @@ -65,7 +65,7 @@ const integrationCards: Record<IntegrationType, IntegrationCardData> = {
defaultMessage:
'Connect your Salesforce account to bring in customer records, case data, and account insights for use in workflows',
}),
disabled: false,
disabled: isIntegrationDisabled(IntegrationType.salesforce),
},
[IntegrationType.google_drive]: {
title: i18n.translate('workchatApp.integrations.listView.googleDriveCard', {
Expand All @@ -75,7 +75,7 @@ const integrationCards: Record<IntegrationType, IntegrationCardData> = {
description: i18n.translate('workchatApp.integrations.listView.googleDriveDescription', {
defaultMessage: 'Search and summarize content from your Drive files',
}),
disabled: true,
disabled: isIntegrationDisabled(IntegrationType.google_drive),
},
[IntegrationType.sharepoint]: {
title: i18n.translate('workchatApp.integrations.listView.sharepointCard', {
Expand All @@ -85,7 +85,7 @@ const integrationCards: Record<IntegrationType, IntegrationCardData> = {
description: i18n.translate('workchatApp.integrations.listView.sharepointDescription', {
defaultMessage: 'Connect internal documents and sites for enterprise-wide search.',
}),
disabled: true,
disabled: isIntegrationDisabled(IntegrationType.sharepoint),
},
[IntegrationType.slack]: {
title: i18n.translate('workchatApp.integrations.listView.slackCard', {
Expand All @@ -95,7 +95,7 @@ const integrationCards: Record<IntegrationType, IntegrationCardData> = {
description: i18n.translate('workchatApp.integrations.listView.slackDescription', {
defaultMessage: 'Search conversations and surface relevant team discussions.',
}),
disabled: true,
disabled: isIntegrationDisabled(IntegrationType.slack),
},
[IntegrationType.confluence]: {
title: i18n.translate('workchatApp.integrations.listView.confluenceCard', {
Expand All @@ -105,7 +105,7 @@ const integrationCards: Record<IntegrationType, IntegrationCardData> = {
description: i18n.translate('workchatApp.integrations.listView.confluenceDescription', {
defaultMessage: 'Tap into your internal knowledge base for accurate answers.',
}),
disabled: true,
disabled: isIntegrationDisabled(IntegrationType.confluence),
},
[IntegrationType.jira]: {
title: i18n.translate('workchatApp.integrations.listView.jiraCard', {
Expand All @@ -115,7 +115,7 @@ const integrationCards: Record<IntegrationType, IntegrationCardData> = {
description: i18n.translate('workchatApp.integrations.listView.jiraDescription', {
defaultMessage: 'Bring in issue tracking, tickets, and project context.',
}),
disabled: true,
disabled: isIntegrationDisabled(IntegrationType.jira),
},
[IntegrationType.github]: {
title: i18n.translate('workchatApp.integrations.listView.githubCard', {
Expand All @@ -125,7 +125,7 @@ const integrationCards: Record<IntegrationType, IntegrationCardData> = {
description: i18n.translate('workchatApp.integrations.listView.githubDescription', {
defaultMessage: 'Search repos, issues, and documentation for engineering insights.',
}),
disabled: true,
disabled: isIntegrationDisabled(IntegrationType.github),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@ export const getIntegrationIcon = (type: IntegrationType) => {
return '';
}
};

export const isIntegrationDisabled = (type: IntegrationType) => {
switch (type) {
case IntegrationType.google_drive:
case IntegrationType.sharepoint:
case IntegrationType.slack:
case IntegrationType.confluence:
case IntegrationType.jira:
case IntegrationType.github:
return true;
default:
return false;
}
};