]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13671 Add import feature box to gitlab settings
authorJeremy Davis <jeremy.davis@sonarsource.com>
Wed, 22 Jul 2020 12:14:13 +0000 (14:14 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 17 Aug 2020 20:06:22 +0000 (20:06 +0000)
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__/__snapshots__/BitbucketTab-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GitlabTab-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 46a7f3d3548cf58563861f2075b746ab38f33338..05010d67d832ec6b9a2d4afc2500ac40126f0be7 100644 (file)
@@ -78,7 +78,7 @@ export default function BitbucketTab(props: BitbucketTabProps) {
             active: definitions.length === 1,
             description: translate('settings.almintegration.feature.alm_repo_import.description'),
             inactiveReason: translateWithParameters(
-              'onboarding.create_project.too_many_bbs_instances_X',
+              'settings.almintegration.feature.alm_repo_import.bitbucket.wrong_count_x',
               definitions.length
             )
           }
index 0a98795b0dc57c7b2e1ebd926241ec8e30b03e27..82f4298b2895115069b4df2cc668c3155e22c990 100644 (file)
@@ -119,7 +119,7 @@ export default function GithubTab(props: GithubTabProps) {
                     </>
                   ) : (
                     translateWithParameters(
-                      'settings.almintegration.feature.alm_repo_import.github.too_many_instances_x',
+                      'settings.almintegration.feature.alm_repo_import.github.wrong_count_x',
                       definitions.length
                     )
                   )
index e334f5d398b847587a6b7676409a5cae915cd146..9533191c7b38ad33f00d8581703bed881d6befc2 100644 (file)
@@ -18,7 +18,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
-import { translate } from 'sonar-ui-common/helpers/l10n';
+import { FormattedMessage } from 'react-intl';
+import { Alert } from 'sonar-ui-common/components/ui/Alert';
+import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n';
 import { createGitlabConfiguration, updateGitlabConfiguration } from '../../../../api/alm-settings';
 import { AlmKeys, GitlabBindingDefinition } from '../../../../types/alm-settings';
 import { ALM_INTEGRATION } from '../AdditionalCategoryKeys';
@@ -56,6 +58,21 @@ export default function GitlabTab(props: GitlabTabProps) {
               translate('settings.almintegration.table.column.gitlab.url')
             ]}
             additionalColumnsKeys={['url']}
+            additionalTableInfo={
+              <Alert className="big-spacer-bottom width-50" variant="info">
+                <FormattedMessage
+                  defaultMessage={translate(
+                    'settings.almintegration.feature.alm_repo_import.disabled_if_multiple_gitlab_instances'
+                  )}
+                  id="settings.almintegration.feature.alm_repo_import.disabled_if_multiple_gitlab_instances"
+                  values={{
+                    feature: (
+                      <em>{translate('settings.almintegration.feature.alm_repo_import.title')}</em>
+                    )
+                  }}
+                />
+              </Alert>
+            }
             alm={AlmKeys.GitLab}
             createConfiguration={createGitlabConfiguration}
             defaultBinding={{ key: '', personalAccessToken: '', url: '' }}
@@ -66,6 +83,17 @@ export default function GitlabTab(props: GitlabTabProps) {
                 active: definitions.length > 0,
                 description: translate('settings.almintegration.feature.mr_decoration.description'),
                 inactiveReason: translate('settings.almintegration.feature.need_at_least_1_binding')
+              },
+              {
+                name: translate('settings.almintegration.feature.alm_repo_import.title'),
+                active: definitions.length === 1,
+                description: translate(
+                  'settings.almintegration.feature.alm_repo_import.description'
+                ),
+                inactiveReason: translateWithParameters(
+                  'settings.almintegration.feature.alm_repo_import.gitlab.wrong_count_x',
+                  definitions.length
+                )
               }
             ]}
             form={childProps => <GitlabForm {...childProps} />}
index c09ac23275d7a12bd07cab61154327d00c9c8c5e..d86ec2f33cd5cdf16782dda32fa0d647f11bd513 100644 (file)
@@ -62,7 +62,7 @@ exports[`should render correctly 1`] = `
         Object {
           "active": true,
           "description": "settings.almintegration.feature.alm_repo_import.description",
-          "inactiveReason": "onboarding.create_project.too_many_bbs_instances_X.1",
+          "inactiveReason": "settings.almintegration.feature.alm_repo_import.bitbucket.wrong_count_x.1",
           "name": "settings.almintegration.feature.alm_repo_import.title",
         },
       ]
index a039ff5b3eee111846afafdfa84252082f63507c..0337700998b74acedb4c657e753bc2f0ece430e9 100644 (file)
@@ -15,6 +15,24 @@ exports[`should render correctly: with branch support 1`] = `
         "url",
       ]
     }
+    additionalTableInfo={
+      <Alert
+        className="big-spacer-bottom width-50"
+        variant="info"
+      >
+        <FormattedMessage
+          defaultMessage="settings.almintegration.feature.alm_repo_import.disabled_if_multiple_gitlab_instances"
+          id="settings.almintegration.feature.alm_repo_import.disabled_if_multiple_gitlab_instances"
+          values={
+            Object {
+              "feature": <em>
+                settings.almintegration.feature.alm_repo_import.title
+              </em>,
+            }
+          }
+        />
+      </Alert>
+    }
     alm="gitlab"
     createConfiguration={[Function]}
     defaultBinding={
@@ -40,6 +58,12 @@ exports[`should render correctly: with branch support 1`] = `
           "inactiveReason": "settings.almintegration.feature.need_at_least_1_binding",
           "name": "settings.almintegration.feature.mr_decoration.title",
         },
+        Object {
+          "active": true,
+          "description": "settings.almintegration.feature.alm_repo_import.description",
+          "inactiveReason": "settings.almintegration.feature.alm_repo_import.gitlab.wrong_count_x.1",
+          "name": "settings.almintegration.feature.alm_repo_import.title",
+        },
       ]
     }
     form={[Function]}
index 12af10ee67c81a32ab967a4ff5a33bfa5bd721d6..e45d4af803539046164d0289305de6a9c714199a 100644 (file)
@@ -1081,10 +1081,12 @@ settings.almintegration.feature.alm_repo_import.title=Import repositories from y
 settings.almintegration.feature.alm_repo_import.description=Select repositories from your ALM, and import them into SonarQube.
 settings.almintegration.feature.alm_repo_import.disabled_if_multiple_bbs_instances=Connecting to multiple Bitbucket Server instances will deactivate the {feature} feature. Projects will have to be set up manually.
 settings.almintegration.feature.alm_repo_import.disabled_if_multiple_github_instances=Connecting to multiple GitHub instances will deactivate the {feature} feature. Projects will have to be set up manually.
-settings.almintegration.feature.alm_repo_import.github.too_many_instances_x=You must have exactly 1 GitHub instance configured in order to use this method. You currently have {0}.
+settings.almintegration.feature.alm_repo_import.disabled_if_multiple_gitlab_instances=Connecting to multiple GitLab instances will deactivate the {feature} feature. Projects will have to be set up manually.
+settings.almintegration.feature.alm_repo_import.bitbucket.wrong_count_x=You must have exactly 1 Bitbucket Server instance configured in order to use this method. You currently have {0}.
+settings.almintegration.feature.alm_repo_import.github.wrong_count_x=You must have exactly 1 GitHub instance configured in order to use this method. You currently have {0}.
+settings.almintegration.feature.alm_repo_import.gitlab.wrong_count_x=You must have exactly 1 GitLab instance configured in order to use this method. You currently have {0}.
 settings.almintegration.feature.alm_repo_import.github.requires_fields=Your configured instance must be provided with the App's {clientId} and {clientSecret}.
 
-
 settings.pr_decoration.binding.category=Pull Request Decoration
 settings.pr_decoration.binding.no_bindings=This feature must first be enabled in the global settings. {link}
 settings.pr_decoration.binding.title=Pull Request Decoration