Skip to content

Commit

Permalink
[Workspace] Add privacy levels to the workspace (#8907)
Browse files Browse the repository at this point in the history
* Add privacy selector UI at create page

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add privacy settings UI at collaborstors page

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Changeset file for PR #8907 created/updated

* Add privacy settings panel at collaborstors page

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Fix the height of cards at workspace create page

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Refactor workspace creator form with privacyType and setPrivacyType

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Resolve some issues

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add privacy settings control at details page

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add single star user check for add collaborators modal

Signed-off-by: Lin Wang <wonglam@amazon.com>

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

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Fix workspace creator UT

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix failed snapshots

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add missing UT for workspace form utils

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Update UT for useWorkspaceForm

Signed-off-by: Lin Wang <wonglam@amazon.com>

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

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* /

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Fix redirect to workspace landing page

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Remove changes to configuration files

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Remove changes to configuration files

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add unit test for notification toasts

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add test id for privacy setting selector

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add unit test for Collaborators Link at workspace details

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Use constant for collaborators link

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Fix issues of spelling and importing path

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

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

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add test id for privacy setting button in collaborators page

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix the discard operation

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add workspace privacy to summary card

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add additional privacy description at workspace create page

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Remove unit tests related to missing owner in permission settings

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add permissionEnabled check for summary card

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Disallow * input for user groups

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Rename the converter and move options outside the function

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Add learn more flyout at collaborators page

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Fix unit tests and update snapshots

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Remove the scss file for WorkspacePrivacyFlyout

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

* Address some issues

Signed-off-by: Kapian1234 <wanjinch@amazon.com>

---------

Signed-off-by: Kapian1234 <wanjinch@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Lin Wang <wonglam@amazon.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
4 people authored Jan 8, 2025
1 parent ea7911f commit 8d98654
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 8d98654

Please sign in to comment.