-
Notifications
You must be signed in to change notification settings - Fork 919
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] Add privacy levels to the workspace #8907
[Workspace] Add privacy levels to the workspace #8907
Conversation
Signed-off-by: Kapian1234 <[email protected]>
…ch-Dashboards into workspace_privacy_settings
Signed-off-by: Kapian1234 <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8907 +/- ##
==========================================
+ Coverage 60.93% 60.97% +0.03%
==========================================
Files 3809 3812 +3
Lines 91267 91348 +81
Branches 14413 14433 +20
==========================================
+ Hits 55616 55698 +82
+ Misses 32097 32096 -1
Partials 3554 3554
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Kapian1234 <[email protected]>
…enSearch-Dashboards into workspace_privacy_settings
…ch-Dashboards into workspace_privacy_settings
Signed-off-by: Kapian1234 <[email protected]>
src/plugins/workspace/public/components/workspace_collaborators/workspace_collaborators.tsx
Outdated
Show resolved
Hide resolved
.../workspace/public/components/workspace_form/workspace_collaborator_privacy_setting_panel.tsx
Outdated
Show resolved
Hide resolved
.../workspace/public/components/workspace_form/workspace_collaborator_privacy_setting_panel.tsx
Outdated
Show resolved
Hide resolved
.../workspace/public/components/workspace_form/workspace_collaborator_privacy_setting_panel.tsx
Show resolved
Hide resolved
.../workspace/public/components/workspace_form/workspace_collaborator_privacy_setting_panel.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_form/workspace_privacy_setting_panel.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_form/workspace_privacy_setting_panel.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_form/workspace_privacy_setting_panel.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_form/workspace_privacy_setting_panel.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_form/workspace_privacy_setting_panel.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_creator.tsx
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx
Show resolved
Hide resolved
Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: Kapian1234 <[email protected]>
Signed-off-by: Kapian1234 <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
…collaborators page Signed-off-by: Kapian1234 <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: Kapian1234 <[email protected]>
…enSearch-Dashboards into workspace_privacy_settings
Signed-off-by: Kapian1234 <[email protected]>
…ch-Dashboards into workspace_privacy_settings
Signed-off-by: Kapian1234 <[email protected]>
Signed-off-by: Kapian1234 <[email protected]>
Signed-off-by: Kapian1234 <[email protected]>
Signed-off-by: Kapian1234 <[email protected]>
@Kapian1234 Snapshot check failed in ci group 3, could you please fix that? |
Signed-off-by: Kapian1234 <[email protected]>
…enSearch-Dashboards into workspace_privacy_settings
paddingSize="l" | ||
initialIsOpen={true} | ||
> | ||
<EuiText className="workspace-privacy-flyout-description" size="s"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use style={{ whiteSpace: 'pre-line' }}
here? Then we can remove the src/plugins/workspace/public/components/workspace_form/workspace_privacy_flyout.scss
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some unit tests for this file?
Signed-off-by: Kapian1234 <[email protected]>
Signed-off-by: Kapian1234 <[email protected]>
src/plugins/workspace/public/components/add_collaborators_modal/add_collaborators_modal.tsx
Show resolved
Hide resolved
.../workspace/public/components/workspace_form/workspace_collaborator_privacy_setting_panel.tsx
Show resolved
Hide resolved
.../workspace/public/components/workspace_form/workspace_collaborator_privacy_setting_panel.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_form/workspace_privacy_setting_select.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: Kapian1234 <[email protected]>
@@ -190,6 +200,12 @@ export const WorkspaceFormSummaryPanel = ({ | |||
)} | |||
</FieldSummaryItem> | |||
)} | |||
{isPermissionEnabled && ( | |||
<FieldSummaryItem field={RightSidebarScrollField.PrivacyType}> | |||
{privacyType && <EuiText size="xs">{privacyType2TextMap[privacyType].title}</EuiText>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it actually check privacyType2TextMap[privacyType]
here?
{privacyType && <EuiText size="xs">{privacyType2TextMap[privacyType].title}</EuiText>} | |
{privacyType2TextMap[privacyType] && <EuiText size="xs">{privacyType2TextMap[privacyType].title}</EuiText>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a type-safe perspective, we don't need to perform any checks here. The privacyType
was defined as the WorkspacePrivacyItemType
type above. The privacyType2TextMap
is using WorkspacePrivacyItemType
as the map key. The privacyType2TextMap[privacyType]
must exist. Do you think if we should check privacyType2TextMap[privacyType]
exists here? It can be updated in the next collaborators' flyout PR.
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-8907-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 8d98654edee51417a640c2fcedf244dc267bddd4
# Push it to GitHub
git push --set-upstream origin backport/backport-8907-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
* 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 #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]> (cherry picked from commit 8d98654) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add privacy selector UI at create page * Add privacy settings UI at collaborstors page * Changeset file for PR #8907 created/updated * Add privacy settings panel at collaborstors page * Fix the height of cards at workspace create page * Refactor workspace creator form with privacyType and setPrivacyType * Resolve some issues * Add privacy settings control at details page * Add single star user check for add collaborators modal * Disable save button if the selected privay type remains unchanged at collaborators page * Fix workspace creator UT * Fix failed snapshots * Add missing UT for workspace form utils * Update UT for useWorkspaceForm * Add unit tests for privacy settings at workspace create and details * / * Fix redirect to workspace landing page * Remove changes to configuration files * Remove changes to configuration files * Add unit test for notification toasts * Add test id for privacy setting selector * Add unit test for Collaborators Link at workspace details * Use constant for collaborators link * Fix issues of spelling and importing path * Remove the validation for the existence of an owner in permission settings * Add test id for privacy setting button in collaborators page * Fix the discard operation * Add workspace privacy to summary card * Add additional privacy description at workspace create page * Remove unit tests related to missing owner in permission settings * Add permissionEnabled check for summary card * Disallow * input for user groups * Rename the converter and move options outside the function * Add learn more flyout at collaborators page * Fix unit tests and update snapshots * Remove the scss file for WorkspacePrivacyFlyout * Address some issues --------- (cherry picked from commit 8d98654) Signed-off-by: Kapian1234 <[email protected]> Signed-off-by: Lin Wang <[email protected]> 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> Co-authored-by: Lin Wang <[email protected]> Co-authored-by: SuZhou-Joe <[email protected]>
Description
Add workspace privacy settings to configure user permissions at workspace create, details and collaborators page;
Validate the collaborator input, a single '*' input is not allowed.
Issues Resolved
Screenshot
Workspace create
Collaborators
Workspace details
Disallow '*' as an input
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration