forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Workspace]Update details panel UI in workspace create page (opensear…
…ch-project#8375) (opensearch-project#8416) * Update details panel UI in workspace create page * Changeset file for PR opensearch-project#8375 created/updated * Fix details panel title not rendered --------- (cherry picked from commit 71ab7bb) Signed-off-by: Lin Wang <wonglam@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4460a3a
commit 26c817b
Showing
5 changed files
with
156 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
feat: | ||
- [Workspace]Update details panel UI in workspace create page ([#8375](/~https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8375)) |
118 changes: 118 additions & 0 deletions
118
src/plugins/workspace/public/components/workspace_creator/creator_details_panel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
EuiColorPicker, | ||
EuiDescribedFormGroup, | ||
EuiFieldText, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiFormControlLayout, | ||
EuiFormRow, | ||
EuiPanel, | ||
EuiText, | ||
} from '@elastic/eui'; | ||
import { EuiColorPickerOutput } from '@elastic/eui/src/components/color_picker/color_picker'; | ||
import { i18n } from '@osd/i18n'; | ||
import { WorkspaceDescriptionField, WorkspaceNameField } from '../workspace_form'; | ||
import { generateRightSidebarScrollProps, RightSidebarScrollField } from './utils'; | ||
|
||
interface CreatorDetailsPanelProps { | ||
color?: string; | ||
name?: string; | ||
description?: string; | ||
onColorChange: (text: string, output: EuiColorPickerOutput) => void; | ||
onNameChange: (name: string) => void; | ||
onDescriptionChange: (description: string) => void; | ||
} | ||
|
||
export const CreatorDetailsPanel = ({ | ||
color, | ||
name, | ||
description, | ||
onColorChange, | ||
onNameChange, | ||
onDescriptionChange, | ||
}: CreatorDetailsPanelProps) => { | ||
return ( | ||
<EuiPanel> | ||
<EuiText size="s"> | ||
<h2> | ||
{i18n.translate('workspace.creator.details.panel.title', { | ||
defaultMessage: 'Workspace details', | ||
})} | ||
</h2> | ||
</EuiText> | ||
<EuiDescribedFormGroup | ||
title={ | ||
<h4 {...generateRightSidebarScrollProps(RightSidebarScrollField.Name)}> | ||
{i18n.translate('workspace.creator.details.panel.fields.name.title', { | ||
defaultMessage: 'Workspace name', | ||
})} | ||
</h4> | ||
} | ||
description={i18n.translate('workspace.creator.details.panel.fields.name.description', { | ||
defaultMessage: | ||
'Use a unique name for the workspace. Valid characters are a-z, A-Z, 0-9, (), [], _ (underscore), - (hyphen) and (space). You can also select a color for the workspace icon.', | ||
})} | ||
> | ||
<EuiFlexGroup gutterSize="s"> | ||
<EuiFlexItem style={{ maxWidth: 64 }} grow={false}> | ||
<EuiFormRow | ||
label={i18n.translate('workspace.creator.details.panel.fields.color.label', { | ||
defaultMessage: 'Color', | ||
})} | ||
{...generateRightSidebarScrollProps(RightSidebarScrollField.Color)} | ||
> | ||
<EuiColorPicker | ||
color={color} | ||
onChange={onColorChange} | ||
compressed | ||
button={ | ||
<EuiFormControlLayout | ||
icon={{ | ||
type: 'arrowDown', | ||
side: 'right', | ||
}} | ||
style={{ color }} | ||
compressed | ||
> | ||
{/** Add empty value here to keep the same UI with name input. Use read only will render a different background */} | ||
<EuiFieldText icon={{ type: 'swatchInput', size: 'm' }} value="" compressed /> | ||
</EuiFormControlLayout> | ||
} | ||
/> | ||
</EuiFormRow> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<WorkspaceNameField | ||
onChange={onNameChange} | ||
value={name} | ||
placeholder={i18n.translate( | ||
'workspace.creator.details.panel.fields.name.placeholder', | ||
{ | ||
defaultMessage: 'Enter the name for the workspace', | ||
} | ||
)} | ||
showDescription={false} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiDescribedFormGroup> | ||
<EuiDescribedFormGroup | ||
title={ | ||
<h4 {...generateRightSidebarScrollProps(RightSidebarScrollField.Description)}> | ||
{i18n.translate('workspace.creator.details.panel.fields.description.title', { | ||
defaultMessage: 'Workspace description', | ||
})} | ||
</h4> | ||
} | ||
> | ||
<WorkspaceDescriptionField value={description} onChange={onDescriptionChange} /> | ||
</EuiDescribedFormGroup> | ||
</EuiPanel> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters