Skip to content

Commit

Permalink
update empty permissions when permission is disabled for workspace de…
Browse files Browse the repository at this point in the history
…tail page

Signed-off-by: tygao <[email protected]>
  • Loading branch information
raintygao committed Dec 11, 2024
1 parent 956889a commit 58e4cbb
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/plugins/workspace/public/components/workspace_detail_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ export const WorkspaceDetailApp = (props: WorkspaceDetailPropsWithOnAppLeave) =>

result = await workspaceClient.update(currentWorkspace.id, attributes, {
dataSources: selectedDataSourceIds,
permissions: convertPermissionSettingsToPermissions(permissionSettings),
// If user updates workspace when permission is disabled, the permission settings will be cleared
...(isPermissionEnabled
? {
permissions: convertPermissionSettingsToPermissions(permissionSettings),
}
: {}),
});
setIsFormSubmitting(false);
if (result?.success) {
Expand All @@ -141,7 +146,13 @@ export const WorkspaceDetailApp = (props: WorkspaceDetailPropsWithOnAppLeave) =>
return;
}
},
[isFormSubmitting, currentWorkspace, notifications?.toasts, workspaceClient]
[
isFormSubmitting,
currentWorkspace,
notifications?.toasts,
workspaceClient,
isPermissionEnabled,
]
);

if (!workspaces || !application || !http || !savedObjects || !currentWorkspaceFormData) {
Expand Down

0 comments on commit 58e4cbb

Please sign in to comment.