diff options
author | Wojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com> | 2024-01-30 10:57:53 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-01-30 16:12:36 +0000 |
commit | eed8ff41542ace3fb83d15e3807097cadb1e1d01 (patch) | |
tree | 4e58efabb62618f7322c74ef4f9205462cbf488f | |
parent | e66362ba9f8310e5ac6e08cd9acff579b19a6ced (diff) | |
download | sonarqube-eed8ff41542ace3fb83d15e3807097cadb1e1d01.tar.gz sonarqube-eed8ff41542ace3fb83d15e3807097cadb1e1d01.zip |
SONAR-21163 Rename isBaseRole to baseRole in GitHub permission mapping endpoints to comply with Web API guidelines
4 files changed, 10 insertions, 12 deletions
diff --git a/server/sonar-web/src/main/js/api/mocks/GithubProvisioningServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/GithubProvisioningServiceMock.ts index 32e22935de3..afcd5fe884a 100644 --- a/server/sonar-web/src/main/js/api/mocks/GithubProvisioningServiceMock.ts +++ b/server/sonar-web/src/main/js/api/mocks/GithubProvisioningServiceMock.ts @@ -63,11 +63,11 @@ const defaultConfigurationStatus: GitHubConfigurationStatus = { const githubMappingMock = ( id: string, permissions: (keyof GitHubMapping['permissions'])[], - isBaseRole = false, + baseRole = false, ) => ({ id, githubRole: id, - isBaseRole, + baseRole, permissions: { user: permissions.includes('user'), codeViewer: permissions.includes('codeViewer'), diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/GitHubMappingModal.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/GitHubMappingModal.tsx index 6d2fca0333a..6291b5d9410 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/GitHubMappingModal.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/GitHubMappingModal.tsx @@ -72,12 +72,12 @@ function PermissionRow(props: Readonly<PermissionCellProps>) { <ContentCell scope="row" className="sw-whitespace-nowrap"> <div className="sw-flex sw-max-w-[330px] sw-items-center"> <b - className={mapping.isBaseRole ? 'sw-capitalize' : 'sw-truncate'} + className={mapping.baseRole ? 'sw-capitalize' : 'sw-truncate'} title={mapping.githubRole} > {mapping.githubRole} </b> - {!mapping.isBaseRole && ( + {!mapping.baseRole && ( <DestructiveIcon className="sw-ml-1" aria-label={translateWithParameters( @@ -133,9 +133,7 @@ export default function GitHubMappingModal({ mapping, setMapping, onClose }: Rea const value = customRoleInput.trim(); if ( !list?.some((el) => - el.isBaseRole - ? el.githubRole.toLowerCase() === value.toLowerCase() - : el.githubRole === value, + el.baseRole ? el.githubRole.toLowerCase() === value.toLowerCase() : el.githubRole === value, ) ) { setMapping([ @@ -153,7 +151,7 @@ export default function GitHubMappingModal({ mapping, setMapping, onClose }: Rea }; const haveEmptyCustomRoles = !!mapping?.some( - (el) => !el.isBaseRole && !Object.values(el.permissions).some(Boolean), + (el) => !el.baseRole && !Object.values(el.permissions).some(Boolean), ); const formBody = ( @@ -179,7 +177,7 @@ export default function GitHubMappingModal({ mapping, setMapping, onClose }: Rea } > {list - ?.filter((r) => r.isBaseRole) + ?.filter((r) => r.baseRole) .map((mapping) => ( <PermissionRow key={mapping.id} mapping={mapping} setMapping={setMapping} list={list} /> ))} @@ -226,7 +224,7 @@ export default function GitHubMappingModal({ mapping, setMapping, onClose }: Rea </TableRow> {list - ?.filter((r) => !r.isBaseRole) + ?.filter((r) => !r.baseRole) .map((mapping) => ( <PermissionRow key={mapping.id} mapping={mapping} setMapping={setMapping} list={list} /> ))} diff --git a/server/sonar-web/src/main/js/queries/identity-provider/github.ts b/server/sonar-web/src/main/js/queries/identity-provider/github.ts index 1fba6a530f7..d7b6152ec49 100644 --- a/server/sonar-web/src/main/js/queries/identity-provider/github.ts +++ b/server/sonar-web/src/main/js/queries/identity-provider/github.ts @@ -118,7 +118,7 @@ export function useGithubRolesMappingMutation() { const [maybeChangedRoles, newRoles] = partition(mapping, (m) => state[m.id]); const changedRoles = maybeChangedRoles.filter((item) => !isEqual(item, state[item.id])); const deletedRoles = Object.values(state).filter( - (m) => !m.isBaseRole && !mapping.some((cm) => m.id === cm.id), + (m) => !m.baseRole && !mapping.some((cm) => m.id === cm.id), ); return { diff --git a/server/sonar-web/src/main/js/types/provisioning.ts b/server/sonar-web/src/main/js/types/provisioning.ts index 4b818db08fe..594970d3b43 100644 --- a/server/sonar-web/src/main/js/types/provisioning.ts +++ b/server/sonar-web/src/main/js/types/provisioning.ts @@ -81,7 +81,7 @@ export interface GitHubConfigurationStatus { export interface GitHubMapping { readonly id: string; readonly githubRole: string; - readonly isBaseRole?: boolean; + readonly baseRole?: boolean; permissions: { user: boolean; codeViewer: boolean; |