diff --git a/src/plugins/workspace/public/components/workspace_detail/workspace_detail.test.tsx b/src/plugins/workspace/public/components/workspace_detail/workspace_detail.test.tsx index 861eb89b19ad..f6902d427b36 100644 --- a/src/plugins/workspace/public/components/workspace_detail/workspace_detail.test.tsx +++ b/src/plugins/workspace/public/components/workspace_detail/workspace_detail.test.tsx @@ -17,6 +17,7 @@ import { DataSourceConnectionType } from '../../../common/types'; import * as utilsExports from '../../utils'; import { IntlProvider } from 'react-intl'; import { of } from 'rxjs'; + // all applications const PublicAPPInfoMap = new Map([ ['alerting', { id: 'alerting', title: 'alerting' }], diff --git a/src/plugins/workspace/public/components/workspace_form/constants.ts b/src/plugins/workspace/public/components/workspace_form/constants.ts index 395b20ae6d1e..4e1da05cb0a8 100644 --- a/src/plugins/workspace/public/components/workspace_form/constants.ts +++ b/src/plugins/workspace/public/components/workspace_form/constants.ts @@ -6,6 +6,7 @@ import { i18n } from '@osd/i18n'; import { WorkspacePermissionMode } from '../../../common/constants'; import { PermissionModeId } from '../../../../../core/public'; +import { WORKSPACE_ACCESS_LEVEL_NAMES } from '../../constants'; export enum WorkspaceOperationType { Create = 'create', @@ -126,30 +127,15 @@ export const PERMISSION_ACCESS_LEVEL_LABEL_ID = 'workspace-form-permission-acces export const permissionModeOptions = [ { value: PermissionModeId.Read, - inputDisplay: i18n.translate( - 'workspace.form.permissionSettingPanel.permissionModeOptions.read', - { - defaultMessage: 'Read only', - } - ), + inputDisplay: WORKSPACE_ACCESS_LEVEL_NAMES.readOnly, }, { value: PermissionModeId.ReadAndWrite, - inputDisplay: i18n.translate( - 'workspace.form.permissionSettingPanel.permissionModeOptions.readAndWrite', - { - defaultMessage: 'Read and write', - } - ), + inputDisplay: WORKSPACE_ACCESS_LEVEL_NAMES.readAndWrite, }, { value: PermissionModeId.Owner, - inputDisplay: i18n.translate( - 'workspace.form.permissionSettingPanel.permissionModeOptions.owner', - { - defaultMessage: 'Admin', - } - ), + inputDisplay: WORKSPACE_ACCESS_LEVEL_NAMES.admin, }, ]; diff --git a/src/plugins/workspace/public/components/workspace_form/workspace_collaborator_table.tsx b/src/plugins/workspace/public/components/workspace_form/workspace_collaborator_table.tsx index 5edfe58f1a32..0b510cb1f597 100644 --- a/src/plugins/workspace/public/components/workspace_form/workspace_collaborator_table.tsx +++ b/src/plugins/workspace/public/components/workspace_form/workspace_collaborator_table.tsx @@ -267,26 +267,27 @@ const Actions = ({ const [isPopoverOpen, setIsPopoverOpen] = useState(false); const { overlays } = useOpenSearchDashboards(); - const accessLevelOptions = Object.keys(WORKSPACE_ACCESS_LEVEL_NAMES).map((level) => ({ - name: WORKSPACE_ACCESS_LEVEL_NAMES[level as WorkspaceCollaboratorAccessLevel], + const accessLevelOptions = (Object.keys( + WORKSPACE_ACCESS_LEVEL_NAMES + ) as WorkspaceCollaboratorAccessLevel[]).map((level) => ({ + name: WORKSPACE_ACCESS_LEVEL_NAMES[level], onClick: async () => { setIsPopoverOpen(false); if (selection) { const modal = overlays.openModal( modal.close()} - onConfirm={async () => { + onConfirm={() => { let newSettings = permissionSettings; selection.forEach(({ id }) => { newSettings = newSettings.map((item) => id === item.id ? { ...item, - modes: - accessLevelNameToWorkspacePermissionModesMap[ - level as WorkspaceCollaboratorAccessLevel - ], + modes: accessLevelNameToWorkspacePermissionModesMap[level], } : item ); @@ -299,9 +300,15 @@ const Actions = ({ >

- Do you want to change access level to {selection.length} collaborator - {`${selection.length > 1 ? 's' : ''}`} to{' '} - {`"${WORKSPACE_ACCESS_LEVEL_NAMES[level as WorkspaceCollaboratorAccessLevel]}"`}? + {i18n.translate('workspace.detail.collaborator.changeAccessLevel.confirmation', { + defaultMessage: + 'Do you want to change access level to {numCollaborators} collaborator{pluralSuffix} to "{accessLevel}"?', + values: { + numCollaborators: selection.length, + pluralSuffix: selection.length > 1 ? 's' : '', + accessLevel: WORKSPACE_ACCESS_LEVEL_NAMES[level], + }, + })}