]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20532 Add tooltip to disabled button
authorguillaume-peoch-sonarsource <guillaume.peoch@sonarsource.com>
Fri, 29 Sep 2023 09:46:44 +0000 (11:46 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 3 Oct 2023 20:02:47 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/settings/components/authentication/GithubAuthenticationTab.tsx
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 7bf81e1fc5df3507a9e9fc81e0a54aa43a3ba0b0..a7f7d6a993f1706065d73869403abd46d0b2649e 100644 (file)
@@ -23,6 +23,7 @@ import GitHubSynchronisationWarning from '../../../../app/components/GitHubSynch
 import DocLink from '../../../../components/common/DocLink';
 import ConfirmModal from '../../../../components/controls/ConfirmModal';
 import RadioCard from '../../../../components/controls/RadioCard';
+import Tooltip from '../../../../components/controls/Tooltip';
 import { Button, ResetButtonLink, SubmitButton } from '../../../../components/controls/buttons';
 import { Provider } from '../../../../components/hooks/useManageProvider';
 import DeleteIcon from '../../../../components/icons/DeleteIcon';
@@ -159,29 +160,45 @@ export default function GithubAuthenticationTab(props: GithubAuthenticationProps
             <div>
               <h5>{translateWithParameters('settings.authentication.github.appid_x', appId)}</h5>
               <p>{url}</p>
-              <Button
-                className="spacer-top"
-                onClick={toggleEnable}
-                disabled={githubProvisioningStatus}
+              <Tooltip
+                overlay={
+                  githubProvisioningStatus
+                    ? translate('settings.authentication.form.disable.tooltip')
+                    : null
+                }
               >
-                {enabled
-                  ? translate('settings.authentication.form.disable')
-                  : translate('settings.authentication.form.enable')}
-              </Button>
+                <Button
+                  className="spacer-top"
+                  onClick={toggleEnable}
+                  disabled={githubProvisioningStatus}
+                >
+                  {enabled
+                    ? translate('settings.authentication.form.disable')
+                    : translate('settings.authentication.form.enable')}
+                </Button>
+              </Tooltip>
             </div>
             <div>
               <Button className="spacer-right" onClick={handleCreateConfiguration}>
                 <EditIcon />
                 {translate('settings.authentication.form.edit')}
               </Button>
-              <Button
-                className="button-red"
-                disabled={enabled || isDeleting}
-                onClick={deleteConfiguration}
+              <Tooltip
+                overlay={
+                  enabled || isDeleting
+                    ? translate('settings.authentication.form.delete.tooltip')
+                    : null
+                }
               >
-                <DeleteIcon />
-                {translate('settings.authentication.form.delete')}
-              </Button>
+                <Button
+                  className="button-red"
+                  disabled={enabled || isDeleting}
+                  onClick={deleteConfiguration}
+                >
+                  <DeleteIcon />
+                  {translate('settings.authentication.form.delete')}
+                </Button>
+              </Tooltip>
             </div>
           </div>
           <div className="spacer-bottom big-padded bordered display-flex-space-between">
index 193f4c37ff1a0b5ce1aad4e11bd42ec66d855072..315b784af83b64af1900bb022500929a8f269fb6 100644 (file)
@@ -1479,11 +1479,13 @@ settings.authentication.help.link=documentation
 settings.authentication.form.create=Create configuration
 settings.authentication.form.edit=Edit
 settings.authentication.form.delete=Delete
+settings.authentication.form.delete.tooltip=You can only delete a configuration if it is disabled.
 settings.authentication.form.loading=Loading configuration
 settings.authentication.form.enabled=Enabled
 settings.authentication.form.not_enabled=This configuration is disabled
 settings.authentication.form.enable=Enable configuration
 settings.authentication.form.disable=Disable configuration
+settings.authentication.form.disable.tooltip=You can not disable this configuration while using Automatic Provisioning. You must be in Just-in-Time Provisioning mode to disable this configuration.
 settings.authentication.form.provisioning=Provisioning
 settings.authentication.form.provisioning_at_login=Just-in-Time user and group provisioning (default)
 settings.authentication.form.other_provisioning_enabled=Already enabled for another provider.  Only one identity provider can have automatic users and groups provisioning enabled.