Skip to content
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

[Workspace]Refactor use case selector in workspace creation page #8413

Merged
Show file tree
Hide file tree
Changes from 12 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
2 changes: 2 additions & 0 deletions changelogs/fragments/8413.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [Workspace]Refactor use case selector in workspace creation page ([#8413](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8413))
14 changes: 9 additions & 5 deletions src/core/utils/default_nav_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ const defaultNavGroups = {
all: {
id: ALL_USE_CASE_ID,
title: i18n.translate('core.ui.group.all.title', {
defaultMessage: 'Analytics (All)',
defaultMessage: 'Analytics',
}),
description: i18n.translate('core.ui.group.all.description', {
defaultMessage: 'This is a use case contains all the features.',
defaultMessage:
'If you aren’t sure where to start with OpenSearch, or if you have needs that cut across multiple use cases.',
}),
order: 3000,
icon: 'wsAnalytics',
Expand All @@ -52,7 +53,8 @@ const defaultNavGroups = {
defaultMessage: 'Observability',
}),
description: i18n.translate('core.ui.group.observability.description', {
defaultMessage: 'Gain visibility into your applications and infrastructure.',
defaultMessage:
'Gain visibility into system health, performance, and reliability through monitoring of logs, metrics and traces.',
}),
order: 4000,
icon: 'wsObservability',
Expand All @@ -63,7 +65,8 @@ const defaultNavGroups = {
defaultMessage: 'Security Analytics',
}),
description: i18n.translate('core.ui.group.security.analytics.description', {
defaultMessage: 'Enhance your security posture with advanced analytics.',
defaultMessage:
'Detect and investigate potential security threats and vulnerabilities across your systems and data.',
}),
order: 5000,
icon: 'wsSecurityAnalytics',
Expand All @@ -86,7 +89,8 @@ const defaultNavGroups = {
defaultMessage: 'Search',
}),
description: i18n.translate('core.ui.group.search.description', {
defaultMessage: 'Discover and query your data with ease.',
defaultMessage:
"Quickly find and explore relevant information across your organization's data sources.",
}),
order: 6000,
icon: 'wsSearch',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('Setup use case overview', () => {
"titleElement": "h4",
"titleSize": "s",
},
"description": "Gain visibility into your applications and infrastructure.",
"description": "Gain visibility into system health, performance, and reliability through monitoring of logs, metrics and traces.",
"getIcon": [Function],
"id": "observability",
"kind": "card",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
EuiFormControlLayout,
EuiFormRow,
EuiPanel,
EuiSpacer,
EuiText,
} from '@elastic/eui';
import { EuiColorPickerOutput } from '@elastic/eui/src/components/color_picker/color_picker';
Expand Down Expand Up @@ -46,6 +47,7 @@ export const CreatorDetailsPanel = ({
})}
</h2>
</EuiText>
<EuiSpacer size="m" />
<EuiDescribedFormGroup
title={
<h4 {...generateRightSidebarScrollProps(RightSidebarScrollField.Name)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export { WorkspaceCancelModal } from './workspace_cancel_modal';
export { WorkspaceNameField, WorkspaceDescriptionField } from './fields';
export { ConnectionTypeIcon } from './connection_type_icon';
export { DataSourceConnectionTable } from './data_source_connection_table';
export { WorkspaceUseCaseFlyout } from './workspace_use_case_flyout';

export { WorkspaceFormSubmitData, WorkspaceFormProps, WorkspaceFormDataState } from './types';
export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ export interface WorkspaceFormProps {
}

export interface AvailableUseCaseItem
extends Pick<WorkspaceUseCase, 'id' | 'title' | 'features' | 'description' | 'systematic'> {
extends Pick<
WorkspaceUseCase,
'id' | 'title' | 'features' | 'description' | 'systematic' | 'icon'
> {
disabled?: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React from 'react';
import { fireEvent, render, waitFor } from '@testing-library/react';
import { fireEvent, render, waitFor, within } from '@testing-library/react';
import { DEFAULT_NAV_GROUPS } from '../../../../../core/public';
import { WorkspaceUseCase, WorkspaceUseCaseProps } from './workspace_use_case';
import { WorkspaceFormErrors } from './types';
Expand Down Expand Up @@ -76,13 +76,13 @@ describe('WorkspaceUseCase', () => {
],
});
await waitFor(() => {
expect(renderResult.getByText('Essentials')).toHaveClass(
expect(renderResult.getByText('Essentials').closest('label')).toHaveClass(
'euiCheckableCard__label-isDisabled'
);
});
});

it('should be able to toggle use case features', async () => {
it('should open flyout and expanded selected use cases', async () => {
const { renderResult } = setup({
availableUseCases: [
{
Expand All @@ -93,58 +93,46 @@ describe('WorkspaceUseCase', () => {
],
},
],
value: DEFAULT_NAV_GROUPS.observability.id,
});

fireEvent.click(renderResult.getByText('Learn more.'));

await waitFor(() => {
expect(renderResult.getByText('See more....')).toBeInTheDocument();
expect(renderResult.queryByText('Feature 1')).toBe(null);
expect(renderResult.queryByText('Feature 2')).toBe(null);
expect(within(renderResult.getByRole('dialog')).getByText('Use cases')).toBeInTheDocument();
expect(
within(renderResult.getByRole('dialog')).getByText('Observability')
).toBeInTheDocument();
expect(within(renderResult.getByRole('dialog')).getByText('Feature 1')).toBeInTheDocument();
expect(within(renderResult.getByRole('dialog')).getByText('Feature 2')).toBeInTheDocument();
});
});

fireEvent.click(renderResult.getByText('See more....'));
it('should close flyout after close button clicked', async () => {
const { renderResult } = setup({});

fireEvent.click(renderResult.getByText('Learn more.'));
await waitFor(() => {
expect(renderResult.getByText('See less....')).toBeInTheDocument();
expect(renderResult.getByText('Feature 1')).toBeInTheDocument();
expect(renderResult.getByText('Feature 2')).toBeInTheDocument();
expect(within(renderResult.getByRole('dialog')).getByText('Use cases')).toBeInTheDocument();
});

fireEvent.click(renderResult.getByText('See less....'));
fireEvent.click(renderResult.getByTestId('euiFlyoutCloseButton'));

await waitFor(() => {
expect(renderResult.getByText('See more....')).toBeInTheDocument();
expect(renderResult.queryByText('Feature 1')).toBe(null);
expect(renderResult.queryByText('Feature 2')).toBe(null);
expect(renderResult.queryByText('dialog')).toBeNull();
});
});

it('should show static all use case features', async () => {
it('should render "(all features)" suffix for "all use case"', () => {
const { renderResult } = setup({
availableUseCases: [
{
...DEFAULT_NAV_GROUPS.all,
features: [
{ id: 'feature1', title: 'Feature 1' },
{ id: 'feature2', title: 'Feature 2' },
],
features: [],
},
],
});

fireEvent.click(renderResult.getByText('See more....'));

await waitFor(() => {
expect(renderResult.getByText('Discover')).toBeInTheDocument();
expect(renderResult.getByText('Dashboards')).toBeInTheDocument();
expect(renderResult.getByText('Visualize')).toBeInTheDocument();
expect(
renderResult.getByText('Observability services, metrics, traces, and more')
).toBeInTheDocument();
expect(
renderResult.getByText('Security analytics threat alerts, findings, correlations, and more')
).toBeInTheDocument();
expect(
renderResult.getByText('Search studio, relevance tuning, vector search, and more')
).toBeInTheDocument();
});
expect(renderResult.getByText('(all features)')).toBeInTheDocument();
});
});
Loading
Loading