-
Notifications
You must be signed in to change notification settings - Fork 906
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]feat: add collaborator table to workspace detail page #8501
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8501 +/- ##
==========================================
- Coverage 60.93% 60.93% -0.01%
==========================================
Files 3767 3769 +2
Lines 89406 89498 +92
Branches 13994 14008 +14
==========================================
+ Hits 54478 54534 +56
- Misses 31526 31556 +30
- Partials 3402 3408 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
group: collaboratorId, | ||
}), | ||
})); | ||
const newPermissionSettings = [...permissionSettings, ...addedSettings]; |
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.
Shall we check duplicate records here?
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.
Yes, we change to use modal and the check interaction is to be confirmed with at least one owner, we could ignore this for now.
onChange(newPermissionSettings); | ||
handleSubmitPermissionSettings(newPermissionSettings as WorkspacePermissionSetting[]); |
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.
It seems we are telling parent component we are changing the permission settings through 2 callbacks. May I know the reason?
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.
The original reason is that we will split change and submit into two steps for now, one is changing data flow, one is submitting and refreshing. For now we won't refresh after submitting, let me combine them.
// const userPermissionExists = finalPermissionSettings.find( | ||
// (setting) => setting.type === WorkspacePermissionItemType.User | ||
// ); | ||
// const groupPermissionExists = finalPermissionSettings.find( | ||
// (setting) => setting.type === WorkspacePermissionItemType.Group | ||
// ); | ||
// if (!userPermissionExists) { | ||
// finalPermissionSettings.push({ | ||
// ...emptyUserPermission, | ||
// id: generateNextPermissionSettingsId(finalPermissionSettings), | ||
// } as typeof finalPermissionSettings[0]); | ||
// } | ||
// if (!groupPermissionExists) { | ||
// finalPermissionSettings.push({ | ||
// ...emptyUserGroupPermission, | ||
// id: generateNextPermissionSettingsId(finalPermissionSettings), | ||
// } as typeof finalPermissionSettings[0]); | ||
// } |
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.
// const userPermissionExists = finalPermissionSettings.find( | |
// (setting) => setting.type === WorkspacePermissionItemType.User | |
// ); | |
// const groupPermissionExists = finalPermissionSettings.find( | |
// (setting) => setting.type === WorkspacePermissionItemType.Group | |
// ); | |
// if (!userPermissionExists) { | |
// finalPermissionSettings.push({ | |
// ...emptyUserPermission, | |
// id: generateNextPermissionSettingsId(finalPermissionSettings), | |
// } as typeof finalPermissionSettings[0]); | |
// } | |
// if (!groupPermissionExists) { | |
// finalPermissionSettings.push({ | |
// ...emptyUserGroupPermission, | |
// id: generateNextPermissionSettingsId(finalPermissionSettings), | |
// } as typeof finalPermissionSettings[0]); | |
// } |
Better to remove the code instead of comment out.
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.
Oh sorry, I missed this change. 😂
cancelButtonText="Cancel" | ||
confirmButtonText="Confirm" | ||
> | ||
<EuiText> | ||
<p>Delete collaborator? The collaborators will not have access to the workspace.</p> |
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.
Nit: i18n
const basicSettings = { | ||
...setting, | ||
// This is used for table display and search match. | ||
displayedType: |
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 we use this method to get the displayedType? I do not think it is collaborator_table
's duty to generate the displayedType.
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.
Yes, but this method not been implemented. It only provides a virtual type. cc @wanglam
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.
I think we should call all displayedCollaboratorTypes.getDisplayedType
and use the first not undefined
result and display a —
if it's undefined. Forget to register default getDisplayedType
in my previous PR. We can call getDisplayedType
here first.
@@ -138,7 +138,7 @@ export const permissionModeOptions = [ | |||
inputDisplay: i18n.translate( | |||
'workspace.form.permissionSettingPanel.permissionModeOptions.readAndWrite', | |||
{ | |||
defaultMessage: 'Read & Write', | |||
defaultMessage: 'Read and write', |
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.
Nit: can we use WORKSPACE_ACCESS_LEVEL_NAMES
in src/plugins/workspace/public/constants.ts
instead?
@@ -16,7 +16,7 @@ import { WorkspaceFormProvider, WorkspaceOperationType } from '../workspace_form | |||
import { DataSourceConnectionType } from '../../../common/types'; | |||
import * as utilsExports from '../../utils'; | |||
import { IntlProvider } from 'react-intl'; | |||
|
|||
import { of } from 'rxjs'; |
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.
Nit: let's keep the empty line
import { of } from 'rxjs'; | |
import { of } from 'rxjs'; | |
<EuiConfirmModal | ||
title="Change access level" | ||
onCancel={() => modal.close()} | ||
onConfirm={async () => { |
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.
Is this async
necessary?
if (selection) { | ||
const modal = overlays.openModal( | ||
<EuiConfirmModal | ||
title="Change access level" |
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.
i18n
?
const [isPopoverOpen, setIsPopoverOpen] = useState(false); | ||
const { overlays } = useOpenSearchDashboards(); | ||
|
||
const accessLevelOptions = Object.keys(WORKSPACE_ACCESS_LEVEL_NAMES).map((level) => ({ |
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.
Nit: We can use Object.keys(WORKSPACE_ACCESS_LEVEL_NAMES) as WorkspaceCollaboratorAccessLevel[]
, then we don't need too many as WorkspaceCollaboratorAccessLevel
below.
confirmButtonText="Confirm" | ||
> | ||
<EuiText> | ||
<p> |
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.
Missing i18n here.
Signed-off-by: tygao <[email protected]>
Signed-off-by: tygao <[email protected]>
Signed-off-by: tygao <[email protected]>
Signed-off-by: tygao <[email protected]>
Signed-off-by: tygao <[email protected]>
Signed-off-by: tygao <[email protected]>
* feat: add collaborator table Signed-off-by: tygao <[email protected]> * Changeset file for PR #8501 created/updated * Changeset file for PR #8501 created/updated * remove extra comment and add test for button Signed-off-by: tygao <[email protected]> * combine onChange Signed-off-by: tygao <[email protected]> * update table Signed-off-by: tygao <[email protected]> * test: add tests for table Signed-off-by: tygao <[email protected]> * address comments Signed-off-by: tygao <[email protected]> --------- Signed-off-by: tygao <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 98df4dd) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…) (#8528) * feat: add collaborator table * Changeset file for PR #8501 created/updated * Changeset file for PR #8501 created/updated * remove extra comment and add test for button * combine onChange * update table * test: add tests for table * address comments --------- (cherry picked from commit 98df4dd) Signed-off-by: tygao <[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>
Description
add collaborator table to workspace detail page
Screenshot
Testing the changes
Go to workspace detail page, then test the related changes.
Changelog
Check List
yarn test:jest
yarn test:jest_integration