Skip to content

Commit 8c90bfb

Browse files
[Workspace] Remove the restriction that workspace cannot be created without datasource (#10861)
* Remove the restriction that workspace cannot be created without datasource Signed-off-by: yubonluo <[email protected]> * Changeset file for PR #10861 created/updated * Changeset file for PR #10861 created/updated --------- Signed-off-by: yubonluo <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
1 parent d680b5e commit 8c90bfb

File tree

4 files changed

+3
-43
lines changed

4 files changed

+3
-43
lines changed

changelogs/fragments/10861.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
feat:
2+
- [Workspace] Remove the restriction that workspace cannot be created without datasource ([#10861](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/10861))

src/plugins/workspace/public/components/workspace_creator/workspace_create_action_panel.test.tsx

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ describe('WorkspaceCreateActionPanel', () => {
4040
}}
4141
application={mockApplication}
4242
isSubmitting={false}
43-
dataSourceEnabled
4443
/>
4544
);
4645
const createButton = screen.getByText('Create workspace');
@@ -58,55 +57,19 @@ describe('WorkspaceCreateActionPanel', () => {
5857
}}
5958
application={mockApplication}
6059
isSubmitting={false}
61-
dataSourceEnabled
6260
/>
6361
);
6462
const createButton = screen.getByText('Create workspace');
6563
expect(createButton.closest('button')).toBeDisabled();
6664
});
6765

68-
it('should disable the "Create Workspace" button when data source enabled and no data sources selected', () => {
69-
render(
70-
<WorkspaceCreateActionPanel
71-
formId={formId}
72-
formData={{
73-
...formData,
74-
selectedDataSourceConnections: [],
75-
}}
76-
application={mockApplication}
77-
isSubmitting={false}
78-
dataSourceEnabled
79-
/>
80-
);
81-
const createButton = screen.getByText('Create workspace');
82-
expect(createButton.closest('button')).toBeDisabled();
83-
});
84-
85-
it('should enable the "Create Workspace" button when no data sources selected but no data source enabled', () => {
86-
render(
87-
<WorkspaceCreateActionPanel
88-
formId={formId}
89-
formData={{
90-
...formData,
91-
selectedDataSourceConnections: [],
92-
}}
93-
application={mockApplication}
94-
isSubmitting={false}
95-
dataSourceEnabled={false}
96-
/>
97-
);
98-
const createButton = screen.getByText('Create workspace');
99-
expect(createButton.closest('button')).not.toBeDisabled();
100-
});
101-
10266
it('should enable the "Create Workspace" button when name and description are within the maximum length', () => {
10367
render(
10468
<WorkspaceCreateActionPanel
10569
formId={formId}
10670
formData={formData}
10771
application={mockApplication}
10872
isSubmitting={false}
109-
dataSourceEnabled
11073
/>
11174
);
11275
const createButton = screen.getByText('Create workspace');
@@ -120,7 +83,6 @@ describe('WorkspaceCreateActionPanel', () => {
12083
formData={formData}
12184
application={mockApplication}
12285
isSubmitting
123-
dataSourceEnabled
12486
/>
12587
);
12688
expect(screen.getByText('Create workspace').closest('button')).toBeDisabled();

src/plugins/workspace/public/components/workspace_creator/workspace_create_action_panel.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,20 @@ interface WorkspaceCreateActionPanelProps {
2424
formData: Pick<WorkspaceFormDataState, 'name' | 'description' | 'selectedDataSourceConnections'>;
2525
application: ApplicationStart;
2626
isSubmitting: boolean;
27-
dataSourceEnabled: boolean;
2827
}
2928

3029
export const WorkspaceCreateActionPanel = ({
3130
formId,
3231
formData,
3332
application,
3433
isSubmitting,
35-
dataSourceEnabled,
3634
}: WorkspaceCreateActionPanelProps) => {
3735
const [isCancelModalVisible, setIsCancelModalVisible] = useState(false);
3836
const closeCancelModal = useCallback(() => setIsCancelModalVisible(false), []);
3937
const showCancelModal = useCallback(() => setIsCancelModalVisible(true), []);
4038
const createButtonDisabled =
4139
(formData.name?.length ?? 0) > MAX_WORKSPACE_NAME_LENGTH ||
42-
(formData.description?.length ?? 0) > MAX_WORKSPACE_DESCRIPTION_LENGTH ||
43-
(dataSourceEnabled && formData.selectedDataSourceConnections.length === 0);
40+
(formData.description?.length ?? 0) > MAX_WORKSPACE_DESCRIPTION_LENGTH;
4441

4542
return (
4643
<>

src/plugins/workspace/public/components/workspace_creator/workspace_form_summary_panel.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ export const WorkspaceFormSummaryPanel = ({
211211
formId={formId}
212212
application={application}
213213
isSubmitting={isSubmitting}
214-
dataSourceEnabled={dataSourceEnabled}
215214
/>
216215
</EuiCard>
217216
);

0 commit comments

Comments
 (0)