From 1f49b327aaa013239ddaa45398b032fabc92e07a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 19 Dec 2024 07:40:26 +0000 Subject: [PATCH] [Workspace] refactor: Remove permission validation in workspace form (#9065) * refactor: remove permission verification in workspace form Signed-off-by: tygao * Changeset file for PR #9065 created/updated * remove extra import in test Signed-off-by: tygao --------- Signed-off-by: tygao Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Co-authored-by: Yulong Ruan (cherry picked from commit c61c7cd390aa243f214e0efaee0662c308d84f42) Signed-off-by: github-actions[bot] --- changelogs/fragments/9065.yml | 2 + .../public/components/workspace_form/types.ts | 7 - .../workspace_form/use_workspace_form.test.ts | 44 +--- .../workspace_form/use_workspace_form.ts | 8 +- .../components/workspace_form/utils.test.ts | 240 ++++-------------- .../public/components/workspace_form/utils.ts | 117 +-------- .../workspace_form_error_callout.test.tsx | 83 ------ .../workspace_form_error_callout.tsx | 64 ----- 8 files changed, 53 insertions(+), 512 deletions(-) create mode 100644 changelogs/fragments/9065.yml diff --git a/changelogs/fragments/9065.yml b/changelogs/fragments/9065.yml new file mode 100644 index 000000000000..09b962ea32d2 --- /dev/null +++ b/changelogs/fragments/9065.yml @@ -0,0 +1,2 @@ +refactor: +- Remove permission validation in workspace form ([#9065](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9065)) \ No newline at end of file diff --git a/src/plugins/workspace/public/components/workspace_form/types.ts b/src/plugins/workspace/public/components/workspace_form/types.ts index 7cc6dbb4c300..d27124cf57f8 100644 --- a/src/plugins/workspace/public/components/workspace_form/types.ts +++ b/src/plugins/workspace/public/components/workspace_form/types.ts @@ -46,13 +46,6 @@ export enum WorkspaceFormErrorCode { InvalidWorkspaceName, WorkspaceNameMissing, UseCaseMissing, - InvalidPermissionType, - InvalidPermissionModes, - PermissionUserIdMissing, - PermissionUserGroupMissing, - DuplicateUserIdPermissionSetting, - DuplicateUserGroupPermissionSetting, - PermissionSettingOwnerMissing, InvalidDataSource, DuplicateDataSource, InvalidColor, diff --git a/src/plugins/workspace/public/components/workspace_form/use_workspace_form.test.ts b/src/plugins/workspace/public/components/workspace_form/use_workspace_form.test.ts index 19b9299c52dc..a014ca26302c 100644 --- a/src/plugins/workspace/public/components/workspace_form/use_workspace_form.test.ts +++ b/src/plugins/workspace/public/components/workspace_form/use_workspace_form.test.ts @@ -4,10 +4,8 @@ */ import { renderHook, act } from '@testing-library/react-hooks'; - import { applicationServiceMock } from '../../../../../core/public/mocks'; -import { WorkspacePermissionMode } from '../../../common/constants'; -import { WorkspaceOperationType, WorkspacePermissionItemType } from './constants'; +import { WorkspaceOperationType } from './constants'; import { WorkspaceFormSubmitData, WorkspaceFormErrorCode } from './types'; import { useWorkspaceForm } from './use_workspace_form'; import { waitFor } from '@testing-library/dom'; @@ -81,46 +79,6 @@ describe('useWorkspaceForm', () => { ); expect(onSubmitMock).not.toHaveBeenCalled(); }); - it('should return "Add workspace owner." and not call onSubmit', async () => { - const { renderResult, onSubmitMock } = setup({ - defaultValues: { - id: 'foo', - name: 'test-workspace-name', - }, - permissionEnabled: true, - }); - expect(renderResult.result.current.formErrors).toEqual({}); - - act(() => { - renderResult.result.current.setPermissionSettings([ - { - id: 0, - modes: [WorkspacePermissionMode.LibraryWrite, WorkspacePermissionMode.Write], - type: WorkspacePermissionItemType.User, - }, - { - id: 1, - modes: [WorkspacePermissionMode.LibraryWrite, WorkspacePermissionMode.Write], - type: WorkspacePermissionItemType.Group, - }, - ]); - }); - act(() => { - renderResult.result.current.handleFormSubmit({ preventDefault: jest.fn() }); - }); - - expect(renderResult.result.current.formErrors).toEqual( - expect.objectContaining({ - permissionSettings: { - overall: { - code: WorkspaceFormErrorCode.PermissionSettingOwnerMissing, - message: 'Add a workspace owner.', - }, - }, - }) - ); - expect(onSubmitMock).not.toHaveBeenCalled(); - }); it('should call onSubmit with workspace name and features', async () => { const { renderResult, onSubmitMock } = setup({ defaultValues: { diff --git a/src/plugins/workspace/public/components/workspace_form/use_workspace_form.ts b/src/plugins/workspace/public/components/workspace_form/use_workspace_form.ts index d9e4a24f3399..1b1bd250b2cd 100644 --- a/src/plugins/workspace/public/components/workspace_form/use_workspace_form.ts +++ b/src/plugins/workspace/public/components/workspace_form/use_workspace_form.ts @@ -25,7 +25,6 @@ export const useWorkspaceForm = ({ application, defaultValues, onSubmit, - permissionEnabled, onAppLeave, }: WorkspaceFormProps) => { const applications = useApplications(application); @@ -109,10 +108,7 @@ export const useWorkspaceForm = ({ (item.type === WorkspacePermissionItemType.User && !!item.userId) || (item.type === WorkspacePermissionItemType.Group && !!item.group) ); - const currentFormErrors: WorkspaceFormErrors = validateWorkspaceForm( - currentFormData, - !!permissionEnabled - ); + const currentFormErrors: WorkspaceFormErrors = validateWorkspaceForm(currentFormData); setFormErrors(currentFormErrors); if (getNumberOfErrors(currentFormErrors) > 0) { return; @@ -125,7 +121,7 @@ export const useWorkspaceForm = ({ setIsEditing(false); } }, - [onSubmit, permissionEnabled] + [onSubmit] ); const handleSubmitPermissionSettings = async (settings: WorkspacePermissionSetting[]) => { diff --git a/src/plugins/workspace/public/components/workspace_form/utils.test.ts b/src/plugins/workspace/public/components/workspace_form/utils.test.ts index aee0a1e1ca56..0b52544e3dd2 100644 --- a/src/plugins/workspace/public/components/workspace_form/utils.test.ts +++ b/src/plugins/workspace/public/components/workspace_form/utils.test.ts @@ -160,198 +160,72 @@ describe('convertPermissionsToPermissionSettings', () => { describe('validateWorkspaceForm', () => { it('should return error if name is empty', () => { - expect(validateWorkspaceForm({}, false).name).toEqual({ + expect(validateWorkspaceForm({}).name).toEqual({ code: WorkspaceFormErrorCode.WorkspaceNameMissing, message: 'Name is required. Enter a name.', }); }); it('should return error if name is empty string', () => { - expect(validateWorkspaceForm({ name: '' }, false).name).toEqual({ + expect(validateWorkspaceForm({ name: '' }).name).toEqual({ code: WorkspaceFormErrorCode.WorkspaceNameMissing, message: 'Name is required. Enter a name.', }); }); it('should return error if name is blank string', () => { - expect(validateWorkspaceForm({ name: ' ' }, false).name).toEqual({ + expect(validateWorkspaceForm({ name: ' ' }).name).toEqual({ code: WorkspaceFormErrorCode.WorkspaceNameMissing, message: 'Name is required. Enter a name.', }); }); it('should return error if name is invalid', () => { - expect(validateWorkspaceForm({ name: '~' }, false).name).toEqual({ + expect(validateWorkspaceForm({ name: '~' }).name).toEqual({ code: WorkspaceFormErrorCode.InvalidWorkspaceName, message: 'Name is invalid. Enter a valid name.', }); }); it('should return error if color is invalid', () => { - expect(validateWorkspaceForm({ color: 'QWERTY' }, false).color).toEqual({ + expect(validateWorkspaceForm({ color: 'QWERTY' }).color).toEqual({ code: WorkspaceFormErrorCode.InvalidColor, message: 'Color is invalid. Choose a valid color.', }); }); it('should return error if use case is empty', () => { - expect(validateWorkspaceForm({}, false).features).toEqual({ + expect(validateWorkspaceForm({}).features).toEqual({ code: WorkspaceFormErrorCode.UseCaseMissing, message: 'Use case is required. Select a use case.', }); }); - it('should return error if permission setting type is invalid', () => { - expect( - validateWorkspaceForm( - { - name: 'test', - permissionSettings: [{ id: 0 }], - }, - true - ).permissionSettings?.fields - ).toEqual({ - 0: { code: WorkspaceFormErrorCode.InvalidPermissionType, message: 'Invalid type' }, - }); - }); - it('should return error if permission setting modes is invalid', () => { - expect( - validateWorkspaceForm( - { - name: 'test', - permissionSettings: [{ id: 0, type: WorkspacePermissionItemType.User, modes: [] }], - }, - true - ).permissionSettings?.fields - ).toEqual({ - 0: { - code: WorkspaceFormErrorCode.InvalidPermissionModes, - message: 'Invalid permission modes', - }, - }); - }); - - it('should return error if permission setting is duplicate', () => { - expect( - validateWorkspaceForm( - { - name: 'test', - permissionSettings: [ - { - id: 0, - type: WorkspacePermissionItemType.User, - modes: [WorkspacePermissionMode.LibraryRead], - userId: 'foo', - }, - { - id: 1, - type: WorkspacePermissionItemType.User, - modes: [WorkspacePermissionMode.LibraryRead], - userId: 'foo', - }, - ], - }, - true - ).permissionSettings?.fields - ).toEqual({ - 1: { - code: WorkspaceFormErrorCode.DuplicateUserIdPermissionSetting, - message: 'User must be unique. Enter a unique user.', - }, - }); - expect( - validateWorkspaceForm( - { - name: 'test', - permissionSettings: [ - { - id: 0, - type: WorkspacePermissionItemType.Group, - modes: [WorkspacePermissionMode.LibraryRead], - group: 'foo', - }, - { - id: 1, - type: WorkspacePermissionItemType.Group, - modes: [WorkspacePermissionMode.LibraryRead], - group: 'foo', - }, - ], - }, - true - ).permissionSettings?.fields - ).toEqual({ - 1: { - code: WorkspaceFormErrorCode.DuplicateUserGroupPermissionSetting, - message: 'User group must be unique. Enter a unique user group.', - }, - }); - }); - - it('should return error if owner is missing in permission settings', () => { - expect( - validateWorkspaceForm( - { - name: 'test', - }, - true - ).permissionSettings?.overall - ).toEqual({ - code: WorkspaceFormErrorCode.PermissionSettingOwnerMissing, - message: 'Add a workspace owner.', - }); - - expect( - validateWorkspaceForm( - { - name: 'test', - permissionSettings: [ - { - id: 0, - type: WorkspacePermissionItemType.User, - modes: [WorkspacePermissionMode.LibraryRead], - userId: 'foo', - }, - ], - }, - true - ).permissionSettings?.overall - ).toEqual({ - code: WorkspaceFormErrorCode.PermissionSettingOwnerMissing, - message: 'Add a workspace owner.', - }); - }); it('should return empty object for valid form data', () => { expect( - validateWorkspaceForm( - { - name: 'test', - permissionSettings: [ - { - id: 0, - type: WorkspacePermissionItemType.Group, - modes: [WorkspacePermissionMode.LibraryRead], - group: 'foo', - }, - ], - features: ['use-case-observability'], - }, - false - ) + validateWorkspaceForm({ + name: 'test', + permissionSettings: [ + { + id: 0, + type: WorkspacePermissionItemType.Group, + modes: [WorkspacePermissionMode.LibraryRead], + group: 'foo', + }, + ], + features: ['use-case-observability'], + }) ).toEqual({}); }); it('should return error if selected data source id is null', () => { expect( - validateWorkspaceForm( - { - name: 'test', - selectedDataSourceConnections: [ - { - id: '', - name: 'title', - connectionType: DataSourceConnectionType.OpenSearchConnection, - type: 'OpenSearch', - }, - ], - }, - false - ).selectedDataSourceConnections + validateWorkspaceForm({ + name: 'test', + selectedDataSourceConnections: [ + { + id: '', + name: 'title', + connectionType: DataSourceConnectionType.OpenSearchConnection, + type: 'OpenSearch', + }, + ], + }).selectedDataSourceConnections ).toEqual({ 0: { code: WorkspaceFormErrorCode.InvalidDataSource, message: 'Invalid data source' }, }); @@ -359,26 +233,23 @@ describe('validateWorkspaceForm', () => { it('should return error if selected data source id is duplicated', () => { expect( - validateWorkspaceForm( - { - name: 'test', - selectedDataSourceConnections: [ - { - id: 'id', - name: 'title1', - connectionType: DataSourceConnectionType.OpenSearchConnection, - type: 'OpenSearch', - }, - { - id: 'id', - name: 'title2', - connectionType: DataSourceConnectionType.OpenSearchConnection, - type: 'OpenSearch', - }, - ], - }, - false - ).selectedDataSourceConnections + validateWorkspaceForm({ + name: 'test', + selectedDataSourceConnections: [ + { + id: 'id', + name: 'title1', + connectionType: DataSourceConnectionType.OpenSearchConnection, + type: 'OpenSearch', + }, + { + id: 'id', + name: 'title2', + connectionType: DataSourceConnectionType.OpenSearchConnection, + type: 'OpenSearch', + }, + ], + }).selectedDataSourceConnections ).toEqual({ '1': { code: WorkspaceFormErrorCode.DuplicateDataSource, message: 'Duplicate data sources' }, }); @@ -420,25 +291,6 @@ describe('getNumberOfErrors', () => { }) ).toEqual(1); }); - - it('should return consistent permission settings errors count', () => { - expect( - getNumberOfErrors({ - permissionSettings: { - overall: { - code: WorkspaceFormErrorCode.PermissionSettingOwnerMissing, - message: '', - }, - fields: { - 1: { - code: WorkspaceFormErrorCode.DuplicateUserIdPermissionSetting, - message: '', - }, - }, - }, - }) - ).toEqual(2); - }); }); describe('getNumberOfChanges', () => { diff --git a/src/plugins/workspace/public/components/workspace_form/utils.ts b/src/plugins/workspace/public/components/workspace_form/utils.ts index 1233bfbc0d53..8ad471ff8627 100644 --- a/src/plugins/workspace/public/components/workspace_form/utils.ts +++ b/src/plugins/workspace/public/components/workspace_form/utils.ts @@ -202,114 +202,14 @@ export const convertPermissionsToPermissionSettings = (permissions: SavedObjectP return finalPermissionSettings; }; -const validateUserPermissionSetting = ( - setting: WorkspaceUserPermissionSetting, - previousPermissionSettings: Array> -) => { - if (!!setting.userId && hasSameUserIdOrGroup(previousPermissionSettings, setting)) { - return { - code: WorkspaceFormErrorCode.DuplicateUserIdPermissionSetting, - message: i18n.translate( - 'workspace.form.permission.invalidate.DuplicateUserIdPermissionSetting', - { - defaultMessage: 'User must be unique. Enter a unique user.', - } - ), - }; - } -}; - -const validateUserGroupPermissionSetting = ( - setting: WorkspaceUserGroupPermissionSetting, - previousPermissionSettings: Array> -) => { - if (!!setting.group && hasSameUserIdOrGroup(previousPermissionSettings, setting)) { - return { - code: WorkspaceFormErrorCode.DuplicateUserGroupPermissionSetting, - message: i18n.translate( - 'workspace.form.permission.invalidate.duplicateUserGroupPermissionSetting', - { - defaultMessage: 'User group must be unique. Enter a unique user group.', - } - ), - }; - } -}; - -const validatePermissionSettings = ( - permissionSettings?: Array< - Pick & Partial - > -) => { - const permissionSettingOwnerMissingError = { - code: WorkspaceFormErrorCode.PermissionSettingOwnerMissing, - message: i18n.translate('workspace.form.permission.setting.owner.missing', { - defaultMessage: 'Add a workspace owner.', - }), - }; - if (!permissionSettings) { - return { - overall: permissionSettingOwnerMissingError, - }; - } - - const permissionSettingsErrors: { [key: number]: WorkspaceFormError } = {}; - for (let i = 0; i < permissionSettings.length; i++) { - const setting = permissionSettings[i]; - if (!setting.type) { - permissionSettingsErrors[setting.id] = { - code: WorkspaceFormErrorCode.InvalidPermissionType, - message: i18n.translate('workspace.form.permission.invalidate.type', { - defaultMessage: 'Invalid type', - }), - }; - } else if (!setting.modes || setting.modes.length === 0) { - permissionSettingsErrors[setting.id] = { - code: WorkspaceFormErrorCode.InvalidPermissionModes, - message: i18n.translate('workspace.form.permission.invalidate.modes', { - defaultMessage: 'Invalid permission modes', - }), - }; - } else if (setting.type === WorkspacePermissionItemType.User) { - const validateResult = validateUserPermissionSetting( - setting as WorkspaceUserPermissionSetting, - permissionSettings.slice(0, i) - ); - if (validateResult) { - permissionSettingsErrors[setting.id] = validateResult; - } - } else if (setting.type === WorkspacePermissionItemType.Group) { - const validateResult = validateUserGroupPermissionSetting( - setting as WorkspaceUserGroupPermissionSetting, - permissionSettings.slice(0, i) - ); - if (validateResult) { - permissionSettingsErrors[setting.id] = validateResult; - } - } - } - return { - ...(!permissionSettings.some( - (setting) => setting.modes && getPermissionModeId(setting.modes) === PermissionModeId.Owner - ) - ? { overall: permissionSettingOwnerMissingError } - : {}), - ...(Object.keys(permissionSettingsErrors).length > 0 - ? { fields: permissionSettingsErrors } - : {}), - }; -}; export const isSelectedDataSourceConnectionsDuplicated = ( selectedDataSourceConnections: DataSourceConnection[], row: DataSourceConnection ) => selectedDataSourceConnections.some((connection) => connection.id === row.id); -export const validateWorkspaceForm = ( - formData: Partial, - isPermissionEnabled: boolean -) => { +export const validateWorkspaceForm = (formData: Partial) => { const formErrors: WorkspaceFormErrors = {}; - const { name, permissionSettings, color, features, selectedDataSourceConnections } = formData; + const { name, color, features, selectedDataSourceConnections } = formData; if (name && name.trim()) { if (!isValidFormTextInput(name)) { formErrors.name = { @@ -343,9 +243,6 @@ export const validateWorkspaceForm = ( }), }; } - if (isPermissionEnabled) { - formErrors.permissionSettings = validatePermissionSettings(permissionSettings); - } if (selectedDataSourceConnections) { const dataSourcesErrors: { [key: number]: WorkspaceFormError } = {}; for (let i = 0; i < selectedDataSourceConnections.length; i++) { @@ -386,16 +283,6 @@ interface PermissionSettingLike Omit, 'type'> { type?: string; } -const isSamePermissionSetting = (a: PermissionSettingLike, b: PermissionSettingLike) => { - return ( - a.id === b.id && - a.type === b.type && - a.userId === b.userId && - a.group === b.group && - a.modes?.length === b.modes?.length && - a.modes?.every((mode) => b.modes?.includes(mode)) - ); -}; export const isWorkspacePermissionSetting = ( permissionSetting: PermissionSettingLike diff --git a/src/plugins/workspace/public/components/workspace_form/workspace_form_error_callout.test.tsx b/src/plugins/workspace/public/components/workspace_form/workspace_form_error_callout.test.tsx index 193eef5ab6fc..7875e5c4485e 100644 --- a/src/plugins/workspace/public/components/workspace_form/workspace_form_error_callout.test.tsx +++ b/src/plugins/workspace/public/components/workspace_form/workspace_form_error_callout.test.tsx @@ -74,89 +74,6 @@ describe('WorkspaceFormErrorCallout', () => { expect(renderResult.getByText('Use case: Select a use case.')).toBeInTheDocument(); }); - it('should combine user permission settings suggestions', () => { - const { renderResult } = setup({ - errors: { - permissionSettings: { - fields: { - 0: { - code: WorkspaceFormErrorCode.PermissionUserIdMissing, - message: '', - }, - 1: { - code: WorkspaceFormErrorCode.PermissionUserIdMissing, - message: '', - }, - 2: { - code: WorkspaceFormErrorCode.DuplicateUserIdPermissionSetting, - message: '', - }, - 3: { - code: WorkspaceFormErrorCode.DuplicateUserIdPermissionSetting, - message: '', - }, - }, - }, - }, - }); - - expect(renderResult.getByText('User: Enter a user.')).toBeInTheDocument(); - expect(renderResult.getAllByText('User: Enter a user.')).toHaveLength(1); - - expect(renderResult.getByText('User: Enter a unique user.')).toBeInTheDocument(); - expect(renderResult.getAllByText('User: Enter a unique user.')).toHaveLength(1); - }); - - it('should combine user group permission settings suggestions', () => { - const { renderResult } = setup({ - errors: { - permissionSettings: { - fields: { - 0: { - code: WorkspaceFormErrorCode.PermissionUserGroupMissing, - message: '', - }, - 1: { - code: WorkspaceFormErrorCode.PermissionUserGroupMissing, - message: '', - }, - 2: { - code: WorkspaceFormErrorCode.DuplicateUserGroupPermissionSetting, - message: '', - }, - 3: { - code: WorkspaceFormErrorCode.DuplicateUserGroupPermissionSetting, - message: '', - }, - }, - }, - }, - }); - - expect(renderResult.getByText('User Group: Enter a user group.')).toBeInTheDocument(); - expect(renderResult.getAllByText('User Group: Enter a user group.')).toHaveLength(1); - - expect(renderResult.getByText('User Group: Enter a unique user group.')).toBeInTheDocument(); - expect(renderResult.getAllByText('User Group: Enter a unique user group.')).toHaveLength(1); - }); - - it('should render permission settings overall suggestions', () => { - const { renderResult } = setup({ - errors: { - permissionSettings: { - overall: { - code: WorkspaceFormErrorCode.PermissionSettingOwnerMissing, - message: '', - }, - }, - }, - }); - - expect( - renderResult.getByText('Manage access and permissions: Add a workspace owner.') - ).toBeInTheDocument(); - }); - it('should render original message if code not recognized', () => { const { renderResult } = setup({ errors: { diff --git a/src/plugins/workspace/public/components/workspace_form/workspace_form_error_callout.tsx b/src/plugins/workspace/public/components/workspace_form/workspace_form_error_callout.tsx index 4dd9f9141da3..bf857025f63b 100644 --- a/src/plugins/workspace/public/components/workspace_form/workspace_form_error_callout.tsx +++ b/src/plugins/workspace/public/components/workspace_form/workspace_form_error_callout.tsx @@ -22,26 +22,6 @@ const getSuggestionFromErrorCode = (error: WorkspaceFormError) => { return i18n.translate('workspace.form.errorCallout.useCaseMissing', { defaultMessage: 'Select a use case.', }); - case WorkspaceFormErrorCode.PermissionUserIdMissing: - return i18n.translate('workspace.form.errorCallout.missingUser', { - defaultMessage: 'Enter a user.', - }); - case WorkspaceFormErrorCode.PermissionUserGroupMissing: - return i18n.translate('workspace.form.errorCallout.missingUserGroup', { - defaultMessage: 'Enter a user group.', - }); - case WorkspaceFormErrorCode.DuplicateUserIdPermissionSetting: - return i18n.translate('workspace.form.errorCallout.duplicateUserPermission', { - defaultMessage: 'Enter a unique user.', - }); - case WorkspaceFormErrorCode.DuplicateUserGroupPermissionSetting: - return i18n.translate('workspace.form.errorCallout.duplicateGroupPermission', { - defaultMessage: 'Enter a unique user group.', - }); - case WorkspaceFormErrorCode.PermissionSettingOwnerMissing: - return i18n.translate('workspace.form.errorCallout.permissionSettingOwnerMissing', { - defaultMessage: 'Add a workspace owner.', - }); case WorkspaceFormErrorCode.InvalidColor: return i18n.translate('workspace.form.errorCallout.invalidColor', { defaultMessage: 'Choose a valid color.', @@ -70,34 +50,6 @@ export interface WorkspaceFormErrorCalloutProps { } export const WorkspaceFormErrorCallout = ({ errors }: WorkspaceFormErrorCalloutProps) => { - const renderPermissionSettingSuggestion = (errorCode: WorkspaceFormErrorCode) => { - if (!errors.permissionSettings?.fields) { - return null; - } - const findingError = Object.values(errors.permissionSettings.fields).find( - (item) => item.code === errorCode - ); - - if (!findingError) { - return null; - } - - return ( - - ); - }; return ( @@ -126,22 +78,6 @@ export const WorkspaceFormErrorCallout = ({ errors }: WorkspaceFormErrorCalloutP message={getSuggestionFromErrorCode(errors.features)} /> )} - {renderPermissionSettingSuggestion(WorkspaceFormErrorCode.PermissionUserIdMissing)} - {renderPermissionSettingSuggestion( - WorkspaceFormErrorCode.DuplicateUserIdPermissionSetting - )} - {renderPermissionSettingSuggestion(WorkspaceFormErrorCode.PermissionUserGroupMissing)} - {renderPermissionSettingSuggestion( - WorkspaceFormErrorCode.DuplicateUserGroupPermissionSetting - )} - {errors.permissionSettings?.overall && ( - - )}