]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-14942 Improve Pull Request Decoration form if no DevOps Platforms are configured
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Tue, 15 Jun 2021 08:52:57 +0000 (10:52 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 22 Jun 2021 20:03:13 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 84567b02dbc33bf07bdf23709b180e3fc86e5721..f5f60aef77433f602ef39348ab79122754e7ec2f 100644 (file)
@@ -92,17 +92,21 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe
     return (
       <div>
         <Alert className="spacer-top huge-spacer-bottom" variant="info">
-          <FormattedMessage
-            defaultMessage={translate('settings.pr_decoration.binding.no_bindings')}
-            id="settings.pr_decoration.binding.no_bindings"
-            values={{
-              link: (
-                <Link to="/documentation/analysis/pull-request/#pr-decoration">
-                  {translate('learn_more')}
-                </Link>
-              )
-            }}
-          />
+          {isSysAdmin ? (
+            <FormattedMessage
+              defaultMessage={translate('settings.pr_decoration.binding.no_bindings.admin')}
+              id="settings.pr_decoration.binding.no_bindings.admin"
+              values={{
+                link: (
+                  <Link to={getGlobalSettingsUrl(ALM_INTEGRATION)}>
+                    {translate('settings.pr_decoration.binding.no_bindings.link')}
+                  </Link>
+                )
+              }}
+            />
+          ) : (
+            translate('settings.pr_decoration.binding.no_bindings')
+          )}
         </Alert>
       </div>
     );
index c5d75501023f257153f3a0ae65935e5a94201778..fe8d6b8ba50b09ef11bff092455f32c617313a4a 100644 (file)
@@ -60,7 +60,8 @@ const configurationErrors: ProjectAlmBindingConfigurationErrors = {
 
 it.each([
   ['when loading', { loading: true }],
-  ['with no ALM instances', {}],
+  ['with no ALM instances (admin user)', { isSysAdmin: true }],
+  ['with no ALM instances (non-admin user)', {}],
   ['with a single ALM instance', { instances: [instances[0]] }],
   ['with an empty form', { instances }],
   [
index 0f8a8303629e09409bbbc4ee38dd99374fa84234..9325336b54a58ed78ea4aaa11c1d7d7175b87594 100644 (file)
@@ -909,23 +909,30 @@ exports[`should render correctly: with an empty form 1`] = `
 </div>
 `;
 
-exports[`should render correctly: with no ALM instances 1`] = `
+exports[`should render correctly: with no ALM instances (admin user) 1`] = `
 <div>
   <Alert
     className="spacer-top huge-spacer-bottom"
     variant="info"
   >
     <FormattedMessage
-      defaultMessage="settings.pr_decoration.binding.no_bindings"
-      id="settings.pr_decoration.binding.no_bindings"
+      defaultMessage="settings.pr_decoration.binding.no_bindings.admin"
+      id="settings.pr_decoration.binding.no_bindings.admin"
       values={
         Object {
           "link": <Link
             onlyActiveOnIndex={false}
             style={Object {}}
-            to="/documentation/analysis/pull-request/#pr-decoration"
+            to={
+              Object {
+                "pathname": "/admin/settings",
+                "query": Object {
+                  "category": "almintegration",
+                },
+              }
+            }
           >
-            learn_more
+            settings.pr_decoration.binding.no_bindings.link
           </Link>,
         }
       }
@@ -934,6 +941,17 @@ exports[`should render correctly: with no ALM instances 1`] = `
 </div>
 `;
 
+exports[`should render correctly: with no ALM instances (non-admin user) 1`] = `
+<div>
+  <Alert
+    className="spacer-top huge-spacer-bottom"
+    variant="info"
+  >
+    settings.pr_decoration.binding.no_bindings
+  </Alert>
+</div>
+`;
+
 exports[`should render select options correctly 1`] = `
 <React.Fragment>
   <span>
index 5cfc020d0172b24f353f1ac981d42310434a4d2a..7cda8e3cd0cb763239dfb0f099ef064613d28291 100644 (file)
@@ -1169,7 +1169,9 @@ settings.almintegration.feature.alm_repo_import.disabled.multiple=This feature i
 settings.almintegration.feature.alm_repo_import.disabled.no_url=This feature is disabled because your configured instance has no URL.
 
 settings.pr_decoration.binding.category=DevOps Platform Integration
-settings.pr_decoration.binding.no_bindings=This feature must first be enabled in the global settings. {link}
+settings.pr_decoration.binding.no_bindings=A system administrator needs to enable this feature in the global settings.
+settings.pr_decoration.binding.no_bindings.admin=Set up a {link} first before you and your team can enable Pull Request Decoration.
+settings.pr_decoration.binding.no_bindings.link=global configuration
 settings.pr_decoration.binding.title=DevOps Platform Integration
 settings.pr_decoration.binding.description=Display your Quality Gate status directly in your DevOps Platform. 
 settings.pr_decoration.binding.check_configuration=Check configuration