Skip to content

Commit

Permalink
Add workspace icon in workspace creator (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Wang <[email protected]>
  • Loading branch information
wanglam authored Sep 2, 2024
1 parent d5a7b4f commit 9bd3052
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('WorkspaceFormSummaryPanel', () => {
title: 'Use Case 1',
description: 'This is Use Case 1',
features: [],
icon: 'wsAnalytics',
},
{
id: 'useCase2',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
EuiLink,
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { WorkspaceFormDataState } from '../forms';
import { WorkspaceFormDataState } from '../workspace_form';
import { WorkspaceUseCase } from '../../types';
import { RightSidebarScrollField, RIGHT_SIDEBAR_SCROLL_KEY } from './utils';

Expand All @@ -33,7 +33,7 @@ const SCROLL_FIELDS = {
}
),
[RightSidebarScrollField.Color]: i18n.translate('workspace.form.summary.panel.color.title', {
defaultMessage: 'Accent color',
defaultMessage: 'Workspace icon',
}),
[RightSidebarScrollField.DataSource]: i18n.translate(
'workspace.form.summary.panel.dataSources.title',
Expand Down Expand Up @@ -164,9 +164,11 @@ export const WorkspaceFormSummaryPanel = ({
<FieldSummaryItem field={RightSidebarScrollField.Color}>
{formData.color && (
<EuiFlexGroup gutterSize="xs" alignItems="center">
<EuiFlexItem grow={false}>
<EuiIcon type="swatchInput" color={formData.color} />
</EuiFlexItem>
{useCase?.icon && (
<EuiFlexItem grow={false}>
<EuiIcon type={useCase.icon} color={formData.color} />
</EuiFlexItem>
)}
<EuiFlexItem>
<EuiText size="xs">{formData.color}</EuiText>
</EuiFlexItem>
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/workspace/public/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,15 @@ describe('workspace utils: convertNavGroupToWorkspaceUseCase', () => {
title: 'Foo',
description: 'Foo description',
navLinks: [{ id: 'bar', title: 'Bar' }],
icon: 'wsAnalytics',
})
).toEqual({
id: 'foo',
title: 'Foo',
description: 'Foo description',
features: [{ id: 'bar', title: 'Bar' }],
systematic: false,
icon: 'wsAnalytics',
});

expect(
Expand Down

0 comments on commit 9bd3052

Please sign in to comment.