Skip to content

Commit

Permalink
[Workspace] Add privacy levels to the workspace (opensearch-project#8907
Browse files Browse the repository at this point in the history
)

* Add privacy selector UI at create page

Signed-off-by: Kapian1234 <[email protected]>

* Add privacy settings UI at collaborstors page

Signed-off-by: Kapian1234 <[email protected]>

* Changeset file for PR opensearch-project#8907 created/updated

* Add privacy settings panel at collaborstors page

Signed-off-by: Kapian1234 <[email protected]>

* Fix the height of cards at workspace create page

Signed-off-by: Kapian1234 <[email protected]>

* Refactor workspace creator form with privacyType and setPrivacyType

Signed-off-by: Lin Wang <[email protected]>

* Resolve some issues

Signed-off-by: Kapian1234 <[email protected]>

* Add privacy settings control at details page

Signed-off-by: Kapian1234 <[email protected]>

* Add single star user check for add collaborators modal

Signed-off-by: Lin Wang <[email protected]>

* Disable save button if the selected privay type remains unchanged at collaborators page

Signed-off-by: Kapian1234 <[email protected]>

* Fix workspace creator UT

Signed-off-by: Lin Wang <[email protected]>

* Fix failed snapshots

Signed-off-by: Lin Wang <[email protected]>

* Add missing UT for workspace form utils

Signed-off-by: Lin Wang <[email protected]>

* Update UT for useWorkspaceForm

Signed-off-by: Lin Wang <[email protected]>

* Add unit tests for privacy settings at workspace create and details

Signed-off-by: Kapian1234 <[email protected]>

* /

Signed-off-by: Kapian1234 <[email protected]>

* Fix redirect to workspace landing page

Signed-off-by: Lin Wang <[email protected]>

* Remove changes to configuration files

Signed-off-by: Kapian1234 <[email protected]>

* Remove changes to configuration files

Signed-off-by: Kapian1234 <[email protected]>

* Add unit test for notification toasts

Signed-off-by: Kapian1234 <[email protected]>

* Add test id for privacy setting selector

Signed-off-by: Lin Wang <[email protected]>

* Add unit test for Collaborators Link at workspace details

Signed-off-by: Kapian1234 <[email protected]>

* Use constant for collaborators link

Signed-off-by: Kapian1234 <[email protected]>

* Fix issues of spelling and importing path

Signed-off-by: Kapian1234 <[email protected]>

* Remove the validation for the existence of an owner in permission settings

Signed-off-by: Kapian1234 <[email protected]>

* Add test id for privacy setting button in collaborators page

Signed-off-by: Lin Wang <[email protected]>

* Fix the discard operation

Signed-off-by: Kapian1234 <[email protected]>

* Add workspace privacy to summary card

Signed-off-by: Kapian1234 <[email protected]>

* Add additional privacy description at workspace create page

Signed-off-by: Kapian1234 <[email protected]>

* Remove unit tests related to missing owner in permission settings

Signed-off-by: Kapian1234 <[email protected]>

* Add permissionEnabled check for summary card

Signed-off-by: Kapian1234 <[email protected]>

* Disallow * input for user groups

Signed-off-by: Kapian1234 <[email protected]>

* Rename the converter and move options outside the function

Signed-off-by: Kapian1234 <[email protected]>

* Add learn more flyout at collaborators page

Signed-off-by: Kapian1234 <[email protected]>

* Fix unit tests and update snapshots

Signed-off-by: Kapian1234 <[email protected]>

* Remove the scss file for WorkspacePrivacyFlyout

Signed-off-by: Kapian1234 <[email protected]>

* Address some issues

Signed-off-by: Kapian1234 <[email protected]>

---------

Signed-off-by: Kapian1234 <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Lin Wang <[email protected]>
Co-authored-by: SuZhou-Joe <[email protected]>
  • Loading branch information
4 people authored and AMoo-Miki committed Jan 10, 2025
1 parent 08ded92 commit 37f1536
Show file tree
Hide file tree
Showing 30 changed files with 2,542 additions and 1,172 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8907.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Add privacy levels to the workspace ([#8907](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8907))
4 changes: 4 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ export class DocLinksService {
// https://opensearch.org/docs/latest/dashboards/management/advanced-settings/
advancedSettings: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}management/advanced-settings/`,
},
workspace: {
// https://opensearch.org/docs/latest/dashboards/workspace/workspace-acl/
acl: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}workspace/workspace-acl/`,
},
},
noDocumentation: {
auditbeat: `${OPENSEARCH_WEBSITE_DOCS}tools/index/#downloads`,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,14 @@ describe('AddCollaboratorsModal', () => {
expect(addCollaboratorsButton).not.toBeDisabled();
});
});

it('should show "Invalid Collaborator ID format" for "*" collaborator id', async () => {
render(<AddCollaboratorsModal {...defaultProps} />);
const collaboratorInput = screen.getByLabelText(defaultProps.inputLabel);
fireEvent.change(collaboratorInput, { target: { value: '*' } });

expect(screen.queryByText('Invalid Collaborator ID format')).toBeNull();
fireEvent.click(screen.getByRole('button', { name: 'Add collaborators' }));
expect(screen.getByText('Invalid Collaborator ID format')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,26 @@ export const AddCollaboratorsModal = ({
const [isAdding, setIsAdding] = useState(false);

const handleAddCollaborators = async () => {
const singleStarIds = validInnerCollaborators.flatMap(({ id, collaboratorId }) =>
collaboratorId.trim() === '*' ? id : []
);
if (singleStarIds.length > 0) {
setErrors(
singleStarIds.reduce(
(previousErrors, id) => ({
...previousErrors,
[id]: i18n.translate('workspace.addCollaboratorsModal.errors.invalidUserFormat', {
defaultMessage: 'Invalid {inputLabel} format',
values: {
inputLabel,
},
}),
}),
{}
)
);
return;
}
const collaboratorId2IdsMap = validInnerCollaborators.reduce<{
[key: string]: number[];
}>((previousValue, collaborator) => {
Expand Down
Loading

0 comments on commit 37f1536

Please sign in to comment.