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] Add privacy levels to the workspace #8907

Merged
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9050233
Add privacy selector UI at create page
Kapian1234 Nov 18, 2024
1265b85
Merge branch 'main' of https://github.com/opensearch-project/OpenSear…
Kapian1234 Nov 20, 2024
4def508
Add privacy settings UI at collaborstors page
Kapian1234 Nov 21, 2024
4e07afd
Changeset file for PR #8907 created/updated
opensearch-changeset-bot[bot] Nov 21, 2024
3f68926
Add privacy settings panel at collaborstors page
Kapian1234 Nov 25, 2024
b78909d
Merge branch 'workspace_privacy_settings' of github.com:Kapian1234/Op…
Kapian1234 Nov 25, 2024
19503d3
Merge branch 'main' of https://github.com/opensearch-project/OpenSear…
Kapian1234 Nov 25, 2024
609c9df
Fix the height of cards at workspace create page
Kapian1234 Nov 25, 2024
c363739
Refactor workspace creator form with privacyType and setPrivacyType
wanglam Nov 26, 2024
1ef6afe
Resolve some issues
Kapian1234 Nov 26, 2024
b73a75f
Resolve conflicts
Kapian1234 Nov 26, 2024
72fa00f
Add privacy settings control at details page
Kapian1234 Nov 27, 2024
b0eec18
Add single star user check for add collaborators modal
wanglam Nov 26, 2024
2655936
Disable save button if the selected privay type remains unchanged at …
Kapian1234 Nov 28, 2024
f772a0d
Fix workspace creator UT
wanglam Nov 29, 2024
1a96f10
Fix failed snapshots
wanglam Nov 29, 2024
6e4084c
Add missing UT for workspace form utils
wanglam Nov 29, 2024
50f1fac
Update UT for useWorkspaceForm
wanglam Nov 29, 2024
ba1e995
Add unit tests for privacy settings at workspace create and details
Kapian1234 Dec 2, 2024
37c9c36
Merge branch 'workspace_privacy_settings' of github.com:Kapian1234/Op…
Kapian1234 Dec 2, 2024
e0fa159
/
Kapian1234 Dec 2, 2024
07a9c7b
Merge branch 'main' of https://github.com/opensearch-project/OpenSear…
Kapian1234 Dec 2, 2024
3fc95dc
Fix redirect to workspace landing page
wanglam Dec 2, 2024
5665ca0
Remove changes to configuration files
Kapian1234 Dec 3, 2024
36e4ae4
Merge branch 'workspace_privacy_settings' of github.com:Kapian1234/Op…
Kapian1234 Dec 3, 2024
af3a969
Remove changes to configuration files
Kapian1234 Dec 3, 2024
2a05ca5
Add unit test for notification toasts
Kapian1234 Dec 3, 2024
605f051
Add test id for privacy setting selector
wanglam Dec 3, 2024
e8cf49c
Add unit test for Collaborators Link at workspace details
Kapian1234 Dec 3, 2024
8ca020f
Merge branch 'workspace_privacy_settings' of github.com:Kapian1234/Op…
Kapian1234 Dec 3, 2024
0677938
Use constant for collaborators link
Kapian1234 Dec 4, 2024
2ceb182
Fix issues of spelling and importing path
Kapian1234 Dec 4, 2024
1124419
Remove the validation for the existence of an owner in permission set…
Kapian1234 Dec 5, 2024
f818188
Add test id for privacy setting button in collaborators page
wanglam Dec 5, 2024
f1ce768
Fix the discard operation
Kapian1234 Dec 5, 2024
7d77237
Add workspace privacy to summary card
Kapian1234 Dec 5, 2024
a601f3b
Add additional privacy description at workspace create page
Kapian1234 Dec 5, 2024
78026bd
Remove unit tests related to missing owner in permission settings
Kapian1234 Dec 6, 2024
59a75d4
Add permissionEnabled check for summary card
Kapian1234 Dec 10, 2024
4169d04
Resolve conflicts
Kapian1234 Dec 23, 2024
e756b01
Disallow * input for user groups
Kapian1234 Dec 24, 2024
a01b4be
Rename the converter and move options outside the function
Kapian1234 Dec 24, 2024
6a25d70
Add learn more flyout at collaborators page
Kapian1234 Dec 26, 2024
e0fdaef
Add links for flyout descriptions
Kapian1234 Dec 27, 2024
d731207
Merge branch 'main' into workspace_privacy_settings
SuZhou-Joe Dec 30, 2024
2e90a46
Fix unit tests and update snapshots
Kapian1234 Dec 30, 2024
07bf56e
Merge branch 'workspace_privacy_settings' of github.com:Kapian1234/Op…
Kapian1234 Dec 30, 2024
94f793e
Remove the scss file for WorkspacePrivacyFlyout
Kapian1234 Jan 2, 2025
41575ae
Remove workspace privacy flyout
Kapian1234 Jan 3, 2025
01f0c85
Address some issues
Kapian1234 Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React from 'react';
import { EuiPage, EuiPanel } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiPage, EuiPanel } from '@elastic/eui';
import { i18n } from '@osd/i18n';

import { useObservable } from 'react-use';
Expand All @@ -25,6 +25,7 @@ import {
} from '../workspace_form';
import { WorkspaceAttributeWithPermission } from '../../../../../core/types';
import { WorkspaceClient } from '../../workspace_client';
import { WorkspaceCollaboratorPrivacySettingPanel } from '../workspace_form/workspace_collaborator_privacy_setting_panel';

export const WorkspaceCollaborators = () => {
const {
Expand Down Expand Up @@ -116,13 +117,23 @@ export const WorkspaceCollaborators = () => {
]}
setMountPoint={application?.setAppRightControls}
/>
<EuiPanel>
<WorkspaceCollaboratorTable
permissionSettings={permissionSettings}
displayedCollaboratorTypes={displayedCollaboratorTypes}
handleSubmitPermissionSettings={handleSubmitPermissionSettings}
/>
</EuiPanel>
<EuiFlexGroup direction="column">
<EuiFlexItem>
Kapian1234 marked this conversation as resolved.
Show resolved Hide resolved
<WorkspaceCollaboratorPrivacySettingPanel
permissionSettings={permissionSettings}
handleSubmitPermissionSettings={handleSubmitPermissionSettings}
/>
</EuiFlexItem>
<EuiFlexItem>
<EuiPanel>
<WorkspaceCollaboratorTable
permissionSettings={permissionSettings}
displayedCollaboratorTypes={displayedCollaboratorTypes}
handleSubmitPermissionSettings={handleSubmitPermissionSettings}
/>
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPage>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const WorkspaceCreator = (props: WorkspaceCreatorProps) => {
navigationUI: NavigationPublicPluginStart['ui'];
}>();
const [isFormSubmitting, setIsFormSubmitting] = useState(false);
const [goToCollaborators, setGoToCollaborators] = useState(false);
const isPermissionEnabled = application?.capabilities.workspaces.permissionEnabled;

const { isOnlyAllowEssential, availableUseCases } = useFormAvailableUseCases({
Expand Down Expand Up @@ -145,7 +146,7 @@ export const WorkspaceCreator = (props: WorkspaceCreatorProps) => {
?.features[0].id;
// Redirect page after one second, leave one second time to show create successful toast.
window.setTimeout(() => {
if (isPermissionEnabled) {
if (isPermissionEnabled && goToCollaborators) {
Kapian1234 marked this conversation as resolved.
Show resolved Hide resolved
navigateToAppWithinWorkspace(
{ application, http },
newWorkspaceId,
Expand Down Expand Up @@ -186,6 +187,7 @@ export const WorkspaceCreator = (props: WorkspaceCreatorProps) => {
isFormSubmitting,
availableUseCases,
isPermissionEnabled,
goToCollaborators,
]
);

Expand Down Expand Up @@ -225,6 +227,8 @@ export const WorkspaceCreator = (props: WorkspaceCreatorProps) => {
availableUseCases={availableUseCases}
defaultValues={defaultWorkspaceFormValues}
isSubmitting={isFormSubmitting}
goToCollaborators={goToCollaborators}
onGoToCollaboratorsChange={setGoToCollaborators}
/>
)}
</EuiPageContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ import { generateRightSidebarScrollProps, RightSidebarScrollField } from './util
import { CreatorDetailsPanel } from './creator_details_panel';

import './workspace_creator_form.scss';
import { WorkspacePrivacySettingPanel } from '../workspace_form/workspace_privacy_setting_panel';

interface WorkspaceCreatorFormProps extends WorkspaceFormProps {
isSubmitting: boolean;
goToCollaborators: boolean;
onGoToCollaboratorsChange: (value: boolean) => void;
}

export const WorkspaceCreatorForm = (props: WorkspaceCreatorFormProps) => {
Expand All @@ -42,6 +45,7 @@ export const WorkspaceCreatorForm = (props: WorkspaceCreatorFormProps) => {
handleColorChange,
handleUseCaseChange,
setSelectedDataSourceConnections,
setPermissionSettings,
} = useWorkspaceForm(props);

const isDashboardAdmin = application?.capabilities?.dashboards?.isDashboardAdmin ?? false;
Expand Down Expand Up @@ -110,6 +114,15 @@ export const WorkspaceCreatorForm = (props: WorkspaceCreatorFormProps) => {
</EuiPanel>
</>
)}
<EuiSpacer size="m" />
{isDashboardAdmin && (
<WorkspacePrivacySettingPanel
Kapian1234 marked this conversation as resolved.
Show resolved Hide resolved
onPermissionChange={setPermissionSettings}
permissionSettings={formData.permissionSettings}
goToCollaborators={props.goToCollaborators}
onGoToCollaboratorsChange={props.onGoToCollaboratorsChange}
/>
)}
</EuiForm>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export enum WorkspacePermissionItemType {
Group = 'group',
}

export enum WorkspacePrivacyItemType {
PrivateToCollaborators = 'privat-to-collaborators',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Shall we use private-to-collaborators?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, there's a spelling mistake

AnyoneCanView = 'anyone-can-view',
AnyoneCanEdit = 'anyone-can-edit',
}

export const optionIdToWorkspacePermissionModesMap: {
[key: string]: WorkspacePermissionMode[];
} = {
Expand Down Expand Up @@ -102,6 +108,42 @@ export const detailsColorHelpText = i18n.translate(
}
);

export const privacyTypePrivateTitle = i18n.translate(
Kapian1234 marked this conversation as resolved.
Show resolved Hide resolved
'workspace.privacy.privateToCollaborators.title',
{
defaultMessage: 'Private to collaborators',
}
);

export const privacyTypeViewTitle = i18n.translate('workspace.privacy.anyoneCanView.title', {
defaultMessage: 'Anyone can view',
});

export const privacyTypeEditTitle = i18n.translate('workspace.privacy.anyoneCanEdit.title', {
defaultMessage: 'Anyone can edit',
});

export const privacyTypePrivateDescription = i18n.translate(
'workspace.privacy.privateToCollaborators.description',
{
defaultMessage: 'Only collaborators can access the workspace.',
}
);

export const privacyTypeViewDescription = i18n.translate(
'workspace.privacy.anyoneCanView.description',
{
defaultMessage: 'Anyone can view workspace assets.',
}
);

export const privacyTypeEditDescription = i18n.translate(
'workspace.privacy.anyoneCanEdit.description',
{
defaultMessage: 'Anyone can view and edit workspace assets.',
}
);

export const PERMISSION_TYPE_LABEL_ID = 'workspace-form-permission-type-label';
export const PERMISSION_COLLABORATOR_LABEL_ID = 'workspace-form-permission-collaborator-label';
export const PERMISSION_ACCESS_LEVEL_LABEL_ID = 'workspace-form-permission-access-level-label';
Expand Down
Loading
Loading