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] Set the default color to first color from the palette #7627

Merged
merged 10 commits into from
Aug 12, 2024
Merged
2 changes: 2 additions & 0 deletions changelogs/fragments/7627.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Set default color ([#7627](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7627))
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
*/

import React, { useCallback } from 'react';
import { EuiPage, EuiPageBody, EuiPageHeader, EuiPageContent } from '@elastic/eui';
import {
EuiPage,
EuiPageBody,
EuiPageHeader,
EuiPageContent,
euiPaletteColorBlind,
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { useObservable } from 'react-use';
import { BehaviorSubject } from 'rxjs';
Expand Down Expand Up @@ -107,6 +113,7 @@ export const WorkspaceCreator = (props: WorkspaceCreatorProps) => {
permissionEnabled={isPermissionEnabled}
dataSourceManagement={dataSourceManagement}
availableUseCases={availableUseCases}
defaultValues={{ color: euiPaletteColorBlind()[0] }}
Kapian1234 marked this conversation as resolved.
Show resolved Hide resolved
/>
)}
</EuiPageContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export interface WorkspaceFormProps {
application: ApplicationStart;
savedObjects: SavedObjectsStart;
onSubmit?: (formData: WorkspaceFormSubmitData) => void;
defaultValues?: WorkspaceFormData;
defaultValues?: Partial<WorkspaceFormData>;
Kapian1234 marked this conversation as resolved.
Show resolved Hide resolved
operationType: WorkspaceOperationType;
permissionEnabled?: boolean;
detailTab?: DetailTab;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const useWorkspaceForm = ({
const numberOfChanges = defaultValuesRef.current
? getNumberOfChanges(formData, {
...defaultValuesRef.current,
name: defaultValuesRef.current.name || '',
Kapian1234 marked this conversation as resolved.
Show resolved Hide resolved
// The user form will insert some empty permission rows, should ignore these rows not treated as user new added.
permissionSettings: initialPermissionSettingsRef.current,
})
Expand Down
Loading