]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19084 Improve GitHub authentication settings
authorMathieu Suen <mathieu.suen@sonarsource.com>
Tue, 9 May 2023 09:41:11 +0000 (11:41 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 11 May 2023 20:03:14 +0000 (20:03 +0000)
server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubSettings.java
server/sonar-web/src/main/js/apps/settings/components/authentication/GithubAuthenticationTab.tsx
server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx
server/sonar-web/src/main/js/apps/settings/components/authentication/hook/useGithubConfiguration.ts
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 25b27bf72845eb04b418c978219073213a247cd4..f3fb6f07304625bc0d7c8ad374304919584a381e 100644 (file)
@@ -165,7 +165,7 @@ public class GitHubSettings {
         .index(index++)
         .build(),
       PropertyDefinition.builder(APP_ID)
-        .name("GitHub App ID")
+        .name("App ID")
         .description("The App ID is found on your GitHub App's page on GitHub at Settings > Developer Settings > GitHub Apps.")
         .category(CATEGORY)
         .subCategory(SUBCATEGORY)
index 8a64c40ea81c28adaa36f5505d8c3462723f490d..88055fb19d14d540b1daa6203452e5ed6ec52b1b 100644 (file)
@@ -36,7 +36,7 @@ import CheckIcon from '../../../../components/icons/CheckIcon';
 import DeleteIcon from '../../../../components/icons/DeleteIcon';
 import EditIcon from '../../../../components/icons/EditIcon';
 import { Alert } from '../../../../components/ui/Alert';
-import { translate } from '../../../../helpers/l10n';
+import { translate, translateWithParameters } from '../../../../helpers/l10n';
 import { AlmKeys } from '../../../../types/alm-settings';
 import { ExtendedSettingDefinition } from '../../../../types/settings';
 import { DOCUMENTATION_LINK_SUFFIXES } from './Authentication';
@@ -149,7 +149,7 @@ export default function GithubAuthenticationTab(props: GithubAuthenticationProps
         <>
           <div className="spacer-bottom big-padded bordered display-flex-space-between">
             <div>
-              <h5>{appId}</h5>
+              <h5>{translateWithParameters('settings.authentication.github.appid_x', appId)}</h5>
               <p>{url}</p>
               <p className="big-spacer-top big-spacer-bottom">
                 {enabled ? (
@@ -161,7 +161,11 @@ export default function GithubAuthenticationTab(props: GithubAuthenticationProps
                   translate('settings.authentication.form.not_enabled')
                 )}
               </p>
-              <Button className="spacer-top" onClick={handleToggleEnable}>
+              <Button
+                className="spacer-top"
+                onClick={handleToggleEnable}
+                disabled={githubProvisioningStatus}
+              >
                 {enabled
                   ? translate('settings.authentication.form.disable')
                   : translate('settings.authentication.form.enable')}
index dfb6e21e5b5d15fdf85bbd63d458e49a7cd3c7ca..26e4242cd892a9a72d32dcb5aa25bd528de220d0 100644 (file)
@@ -349,7 +349,8 @@ describe('Github tab', () => {
     await user.click(github.confirmProvisioningButton.get());
 
     expect(await github.githubProvisioningButton.find()).toBeChecked();
-    expect(await github.saveGithubProvisioning.find()).toBeDisabled();
+    expect(github.disableConfigButton.get()).toBeDisabled();
+    expect(github.saveGithubProvisioning.get()).toBeDisabled();
   });
 });
 
index a8eaa7eb5331eabe1cf6ec6acd430172218b1ce2..168325e60b20ee2f173ee4925fd86c0280279556 100644 (file)
@@ -74,7 +74,7 @@ export default function useGithubConfiguration(
   }, [hasGithubProvisioning]);
 
   const enabled = values[GITHUB_ENABLED_FIELD]?.value === 'true';
-  const appId = values[GITHUB_APP_ID_FIELD]?.value;
+  const appId = values[GITHUB_APP_ID_FIELD]?.value as string;
   const url = values[GITHUB_API_URL_FIELD]?.value;
 
   const reload = useCallback(async () => {
index a12defd8812eb043d58768ed7ad0a07b4ab3a027..58f7a67c6dcd2e90381987a4a28b993152c48ab8 100644 (file)
@@ -1273,7 +1273,7 @@ settings.almintegration.form.url.azure.help2=For Azure DevOps Services, provide
 settings.almintegration.form.url.bitbucket=Bitbucket Server URL
 settings.almintegration.form.url.bitbucket.help=Example: {example}
 settings.almintegration.form.url.github=GitHub API URL
-settings.almintegration.form.url.github.help1=Example for Github Enterprise:
+settings.almintegration.form.url.github.help1=Example for GitHub Enterprise:
 settings.almintegration.form.url.github.help2=If using GitHub.com:
 settings.almintegration.form.url.gitlab=GitLab API URL
 settings.almintegration.form.url.gitlab.help=Provide the GitLab API URL. For example:
@@ -1334,19 +1334,20 @@ settings.authentication.form.provisioning_at_login=Just-in-Time user and group p
 settings.authentication.form.other_provisioning_enabled=Only one provider can have automatic user and group provisioning.
 
 # GITHUB
-settings.authentication.form.create.github=New Github configuration
-settings.authentication.form.edit.github=Edit Github configuration
+settings.authentication.form.create.github=New GitHub configuration
+settings.authentication.form.edit.github=Edit GitHub configuration
+settings.authentication.github.appid_x=App ID: {0}
 settings.authentication.github.confirm.auto=Switch to automatic provisioning
 settings.authentication.github.confirm.jit=Switch to Just-in-Time provisioning
 settings.authentication.github.confirm.auto.description=After you switch to automatic provisioning, you will no longer be able to edit groups, users, and group memberships within SonarQube. Are you sure?
 settings.authentication.github.confirm.jit.description=Switching to Just-in-Time provisioning removes all information provided while automatic provisioning through SCIM was active. These changes cannot be reverted. Are you sure?
-settings.authentication.github.configuration=Github Configuration
-settings.authentication.github.form.not_configured=Github App is not configured
-settings.authentication.github.enable_first=Enable your Github configuration for more provisioning options.
+settings.authentication.github.configuration=GitHub Configuration
+settings.authentication.github.form.not_configured=GitHub App is not configured
+settings.authentication.github.enable_first=Enable your GitHub configuration for more provisioning options.
 settings.authentication.github.form.provisioning_with_github=Automatic user and group provisioning
 settings.authentication.github.form.provisioning_with_github.description=Users and groups are automatically provisioned from your GitHub organizations. Once activated, managed users and groups can only be modified from your GitHub organizations/teams. Existing local users and groups will be kept.
 settings.authentication.github.form.provisioning_with_github.description.doc=For more details, see {documentation}.
-settings.authentication.github.form.provisioning.disabled=Your current edition does not support provisioning with Github. See the {documentation} for more information.
+settings.authentication.github.form.provisioning.disabled=Your current edition does not support provisioning with GitHub. See the {documentation} for more information.
 settings.authentication.github.background_task.synchronisation_in_progress=Synchronisation is in progress. Started on {0}.
 settings.authentication.github.background_task.synchronisation_successful=Successful synchronisation on {0}.
 settings.authentication.github.background_task.synchronisation_failed=Synchronisation failed on {0}. {1}
@@ -3782,7 +3783,7 @@ onboarding.create_project.azure.no_results=No repositories match your search que
 onboarding.create_project.bitbucketcloud.title=Bitbucket Cloud project onboarding
 onboarding.create_project.bitbucketcloud.no_projects=No projects could be fetched from Bitbucket. Contact your system administrator, or {link}.
 onboarding.create_project.bitbucketcloud.link=See on Bitbucket
-onboarding.create_project.github.title=Github project onboarding
+onboarding.create_project.github.title=GitHub project onboarding
 onboarding.create_project.github.choose_organization=Choose organization
 onboarding.create_project.github.warning.title=Could not connect to GitHub
 onboarding.create_project.github.warning.message=Please contact an administrator to configure GitHub integration.