]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-14269 Fix ALM configuration 'Learn more' links
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Thu, 17 Dec 2020 14:37:07 +0000 (15:37 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 21 Dec 2020 20:08:17 +0000 (20:08 +0000)
14 files changed:
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTab-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTabRenderer-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTab-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTabRenderer-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureTab-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketTab-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GithubTab-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GitlabTab-test.tsx.snap

index 5fbb9ffcdfa90f02ca0e16d45a040e05a131ba68..1969cac93c16ae0a22889c1944e72d1e60392769 100644 (file)
@@ -33,7 +33,7 @@ interface Props<B> {
   definitions: B[];
   definitionStatus: T.Dict<AlmSettingsBindingStatus>;
   form: (props: AlmBindingDefinitionFormChildrenProps<B>) => React.ReactNode;
-  help?: React.ReactNode;
+  help: React.ReactNode;
   loadingAlmDefinitions: boolean;
   loadingProjectCount: boolean;
   multipleAlmEnabled: boolean;
index 248e3bb89561219c5f44d5830883a47e38c1cca2..164a2f8e27dd8a76c951a53ee38853c5f742c4d4 100644 (file)
@@ -19,7 +19,6 @@
  */
 import * as React from 'react';
 import { FormattedMessage } from 'react-intl';
-import { Link } from 'react-router';
 import { Button } from 'sonar-ui-common/components/controls/buttons';
 import Tooltip from 'sonar-ui-common/components/controls/Tooltip';
 import DeferredSpinner from 'sonar-ui-common/components/ui/DeferredSpinner';
@@ -43,7 +42,7 @@ export interface AlmTabRendererProps<B> {
   defaultBinding: B;
   definitions: B[];
   form: (props: AlmBindingDefinitionFormChildrenProps<B>) => React.ReactNode;
-  help?: React.ReactNode;
+  help: React.ReactNode;
   loadingAlmDefinitions: boolean;
   loadingProjectCount: boolean;
   multipleAlmEnabled: boolean;
@@ -58,20 +57,6 @@ export interface AlmTabRendererProps<B> {
   success: boolean;
 }
 
-const renderDefaultHelp = (alm: AlmKeys) => (
-  <FormattedMessage
-    defaultMessage={translate(`settings.almintegration.${alm}.info`)}
-    id={`settings.almintegration.${alm}.info`}
-    values={{
-      link: (
-        <Link target="_blank" to="/documentation/analysis/pr-decoration/">
-          {translate('learn_more')}
-        </Link>
-      )
-    }}
-  />
-);
-
 export default function AlmTabRenderer<B extends AlmBindingDefinition>(
   props: AlmTabRendererProps<B>
 ) {
@@ -85,7 +70,7 @@ export default function AlmTabRenderer<B extends AlmBindingDefinition>(
     loadingProjectCount,
     multipleAlmEnabled,
     optionalFields,
-    help = renderDefaultHelp(alm)
+    help
   } = props;
 
   const preventCreation = loadingProjectCount || (!multipleAlmEnabled && definitions.length > 0);
index 55834019bff848f9805731afd6b7128806ff1aa7..faa33fcca4ba950f7275874b34a818338befb6d2 100644 (file)
@@ -18,6 +18,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
+import { Link } from 'react-router';
+import { translate } from 'sonar-ui-common/helpers/l10n';
 import { createAzureConfiguration, updateAzureConfiguration } from '../../../../api/alm-settings';
 import {
   AlmKeys,
@@ -56,6 +59,19 @@ export default function AzureTab(props: AzureTabProps) {
         definitions={definitions}
         definitionStatus={definitionStatus}
         form={childProps => <AzureForm {...childProps} />}
+        help={
+          <FormattedMessage
+            defaultMessage={translate(`settings.almintegration.azure.info`)}
+            id="settings.almintegration.azure.info"
+            values={{
+              link: (
+                <Link target="_blank" to="/documentation/analysis/azuredevops-integration/">
+                  {translate('learn_more')}
+                </Link>
+              )
+            }}
+          />
+        }
         loadingAlmDefinitions={loadingAlmDefinitions}
         loadingProjectCount={loadingProjectCount}
         multipleAlmEnabled={multipleAlmEnabled}
index fa0aa6c59502f8fd44a62a80aa67fa14543d6440..6c9b91c075e5cf4b72c91018c34e00614fd995e9 100644 (file)
@@ -75,7 +75,7 @@ export default function BitbucketTab(props: BitbucketTabProps) {
             </ul>
 
             <p className="big-spacer-top big-spacer-bottom">
-              <Link target="_blank" to="/documentation/analysis/pr-decoration/">
+              <Link target="_blank" to="/documentation/analysis/bitbucket-integration/">
                 {translate('learn_more')}
               </Link>
             </p>
index 214f0b872863d464c69fad5a01598dce24ca674c..b1e869b4b606c029a550399ae9aa3b097c77fb41 100644 (file)
@@ -18,6 +18,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
+import { Link } from 'react-router';
+import { translate } from 'sonar-ui-common/helpers/l10n';
 import { createGithubConfiguration, updateGithubConfiguration } from '../../../../api/alm-settings';
 import {
   AlmKeys,
@@ -71,6 +74,19 @@ export default function GithubTab(props: GithubTabProps) {
             definitions={definitions}
             definitionStatus={definitionStatus}
             form={childProps => <GithubForm {...childProps} />}
+            help={
+              <FormattedMessage
+                defaultMessage={translate(`settings.almintegration.github.info`)}
+                id="settings.almintegration.github.info"
+                values={{
+                  link: (
+                    <Link target="_blank" to="/documentation/analysis/github-integration/">
+                      {translate('learn_more')}
+                    </Link>
+                  )
+                }}
+              />
+            }
             loadingAlmDefinitions={loadingAlmDefinitions}
             loadingProjectCount={loadingProjectCount}
             multipleAlmEnabled={multipleAlmEnabled}
index 552891d9358a023222afd2a12e566c7b53ee74ea..4277260ec36017e5fed0a098c12e44ad21984e47 100644 (file)
@@ -18,6 +18,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
+import { Link } from 'react-router';
+import { translate } from 'sonar-ui-common/helpers/l10n';
 import { createGitlabConfiguration, updateGitlabConfiguration } from '../../../../api/alm-settings';
 import {
   AlmKeys,
@@ -64,6 +67,19 @@ export default function GitlabTab(props: GitlabTabProps) {
             definitions={definitions}
             definitionStatus={definitionStatus}
             form={childProps => <GitlabForm {...childProps} />}
+            help={
+              <FormattedMessage
+                defaultMessage={translate(`settings.almintegration.gitlab.info`)}
+                id="settings.almintegration.gitlab.info"
+                values={{
+                  link: (
+                    <Link target="_blank" to="/documentation/analysis/gitlab-integration/">
+                      {translate('learn_more')}
+                    </Link>
+                  )
+                }}
+              />
+            }
             loadingAlmDefinitions={loadingAlmDefinitions}
             loadingProjectCount={loadingProjectCount}
             multipleAlmEnabled={multipleAlmEnabled}
index acdc39b415a6b2b6a17177e6b43cbb2eec33502b..49628abc4b9b693ab9fa636f500cb11662891a40 100644 (file)
@@ -100,6 +100,7 @@ function shallowRender(props: Partial<AlmTab<AzureBindingDefinition>['props']> =
       definitions={[mockAzureBindingDefinition()]}
       definitionStatus={{}}
       form={jest.fn()}
+      help={<div />}
       loadingAlmDefinitions={false}
       loadingProjectCount={false}
       multipleAlmEnabled={true}
index 3ee492b76942cd942edfd5d14f14af8c4023ac5a..29e77d877ca04710dec0d617e0b351033841ff72 100644 (file)
@@ -97,6 +97,7 @@ function shallowRender<B extends AlmBindingDefinition>(
       definitions={[]}
       definitionStatus={{}}
       form={jest.fn()}
+      help={<div />}
       loadingAlmDefinitions={false}
       loadingProjectCount={false}
       multipleAlmEnabled={true}
index fc68bb972d1a7f7550f88e1f369569bffbbff6e7..9c8ed1fce1d7c7ee50f64a2d7ef88a922e7dd7a4 100644 (file)
@@ -20,6 +20,7 @@ exports[`should render correctly 1`] = `
     ]
   }
   form={[MockFunction]}
+  help={<div />}
   loadingAlmDefinitions={false}
   loadingProjectCount={false}
   multipleAlmEnabled={true}
index 57c0928fdcd939c70cb63a378659626e9bc2ecd4..39b1c424c4493888205d63b23d8b4a860d9af8d1 100644 (file)
@@ -44,24 +44,7 @@ exports[`should render correctly for multi-ALM binding: editing a definition 1`]
           "personalAccessToken": "asdf1234",
         }
       }
-      help={
-        <FormattedMessage
-          defaultMessage="settings.almintegration.azure.info"
-          id="settings.almintegration.azure.info"
-          values={
-            Object {
-              "link": <Link
-                onlyActiveOnIndex={false}
-                style={Object {}}
-                target="_blank"
-                to="/documentation/analysis/pr-decoration/"
-              >
-                learn_more
-              </Link>,
-            }
-          }
-        />
-      }
+      help={<div />}
       isSecondInstance={true}
       onCancel={[MockFunction]}
       onSubmit={[MockFunction]}
@@ -511,24 +494,7 @@ exports[`should render correctly with validation: create a first 1`] = `
           "url": "http://github.enterprise.com",
         }
       }
-      help={
-        <FormattedMessage
-          defaultMessage="settings.almintegration.github.info"
-          id="settings.almintegration.github.info"
-          values={
-            Object {
-              "link": <Link
-                onlyActiveOnIndex={false}
-                style={Object {}}
-                target="_blank"
-                to="/documentation/analysis/pr-decoration/"
-              >
-                learn_more
-              </Link>,
-            }
-          }
-        />
-      }
+      help={<div />}
       isSecondInstance={false}
       onCancel={[MockFunction]}
       onSubmit={[MockFunction]}
@@ -591,24 +557,7 @@ exports[`should render correctly with validation: create a second 1`] = `
           "url": "http://github.enterprise.com",
         }
       }
-      help={
-        <FormattedMessage
-          defaultMessage="settings.almintegration.github.info"
-          id="settings.almintegration.github.info"
-          values={
-            Object {
-              "link": <Link
-                onlyActiveOnIndex={false}
-                style={Object {}}
-                target="_blank"
-                to="/documentation/analysis/pr-decoration/"
-              >
-                learn_more
-              </Link>,
-            }
-          }
-        />
-      }
+      help={<div />}
       isSecondInstance={true}
       onCancel={[MockFunction]}
       onSubmit={[MockFunction]}
index 4f8aeff8b9a80b981e5c46da24924bc705c83f43..6740a5d328293f221331404a93b5559670461c0d 100644 (file)
@@ -24,6 +24,24 @@ exports[`should render correctly 1`] = `
       ]
     }
     form={[Function]}
+    help={
+      <FormattedMessage
+        defaultMessage="settings.almintegration.azure.info"
+        id="settings.almintegration.azure.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              target="_blank"
+              to="/documentation/analysis/azuredevops-integration/"
+            >
+              learn_more
+            </Link>,
+          }
+        }
+      />
+    }
     loadingAlmDefinitions={false}
     loadingProjectCount={false}
     multipleAlmEnabled={true}
index 2c9e37f15f9a8aef84e64780816b015b2c182e0b..a0b21c5d1fbf2553d280efa891ca4d664479c0b4 100644 (file)
@@ -52,7 +52,7 @@ exports[`should render correctly 1`] = `
             onlyActiveOnIndex={false}
             style={Object {}}
             target="_blank"
-            to="/documentation/analysis/pr-decoration/"
+            to="/documentation/analysis/bitbucket-integration/"
           >
             learn_more
           </Link>
index 0f9cfaacda42650d0aaf264e3dd1405eff17f43d..e8575a5557135dc4484893e4c083690c2dc39686 100644 (file)
@@ -31,6 +31,24 @@ exports[`should render correctly: with branch support 1`] = `
       ]
     }
     form={[Function]}
+    help={
+      <FormattedMessage
+        defaultMessage="settings.almintegration.github.info"
+        id="settings.almintegration.github.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              target="_blank"
+              to="/documentation/analysis/github-integration/"
+            >
+              learn_more
+            </Link>,
+          }
+        }
+      />
+    }
     loadingAlmDefinitions={false}
     loadingProjectCount={false}
     multipleAlmEnabled={true}
index 52116b546584341bc56012547d0d1a6b953cc21b..d9e0818ec211d96cd9f183c95dea47c5827259a6 100644 (file)
@@ -25,6 +25,24 @@ exports[`should render correctly: with URL 1`] = `
       ]
     }
     form={[Function]}
+    help={
+      <FormattedMessage
+        defaultMessage="settings.almintegration.gitlab.info"
+        id="settings.almintegration.gitlab.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              target="_blank"
+              to="/documentation/analysis/gitlab-integration/"
+            >
+              learn_more
+            </Link>,
+          }
+        }
+      />
+    }
     loadingAlmDefinitions={false}
     loadingProjectCount={false}
     multipleAlmEnabled={true}
@@ -71,6 +89,24 @@ exports[`should render correctly: with branch support 1`] = `
       ]
     }
     form={[Function]}
+    help={
+      <FormattedMessage
+        defaultMessage="settings.almintegration.gitlab.info"
+        id="settings.almintegration.gitlab.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              target="_blank"
+              to="/documentation/analysis/gitlab-integration/"
+            >
+              learn_more
+            </Link>,
+          }
+        }
+      />
+    }
     loadingAlmDefinitions={false}
     loadingProjectCount={false}
     multipleAlmEnabled={true}
@@ -110,6 +146,24 @@ exports[`should render correctly: with no definitions 1`] = `
     definitionStatus={Object {}}
     definitions={Array []}
     form={[Function]}
+    help={
+      <FormattedMessage
+        defaultMessage="settings.almintegration.gitlab.info"
+        id="settings.almintegration.gitlab.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              target="_blank"
+              to="/documentation/analysis/gitlab-integration/"
+            >
+              learn_more
+            </Link>,
+          }
+        }
+      />
+    }
     loadingAlmDefinitions={false}
     loadingProjectCount={false}
     multipleAlmEnabled={true}