From 1e59824022415abdab28113b8c9407338a376f5a Mon Sep 17 00:00:00 2001 From: Philippe Perrin Date: Tue, 17 Aug 2021 17:49:30 +0200 Subject: [PATCH] SONAR-15303 Improve DevOps Platform configuration screen wording to reduce confusion around personal access token --- .../project/PersonalAccessTokenForm.tsx | 9 +- .../PersonalAccessTokenForm-test.tsx.snap | 4 +- .../AlmBindingDefinitionFormField.tsx | 89 +++--- .../components/almIntegration/AzureForm.tsx | 115 +++---- .../almIntegration/BitbucketCloudForm.tsx | 27 +- .../almIntegration/BitbucketForm.tsx | 61 +--- .../almIntegration/BitbucketServerForm.tsx | 11 +- .../components/almIntegration/GithubForm.tsx | 130 ++++---- .../components/almIntegration/GitlabForm.tsx | 106 ++++--- ...lmBindingDefinitionFormField-test.tsx.snap | 204 ++++++++----- .../__snapshots__/AzureForm-test.tsx.snap | 272 ++++++++--------- .../BitbucketCloudForm-test.tsx.snap | 31 ++ .../__snapshots__/BitbucketForm-test.tsx.snap | 228 +++----------- .../BitbucketServerForm-test.tsx.snap | 12 +- .../__snapshots__/GithubForm-test.tsx.snap | 284 +++++++++--------- .../__snapshots__/GitlabForm-test.tsx.snap | 250 +++++++-------- .../resources/org/sonar/l10n/core.properties | 16 +- 17 files changed, 890 insertions(+), 959 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/create/project/PersonalAccessTokenForm.tsx b/server/sonar-web/src/main/js/apps/create/project/PersonalAccessTokenForm.tsx index 114698ed515..a571ab12006 100644 --- a/server/sonar-web/src/main/js/apps/create/project/PersonalAccessTokenForm.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/PersonalAccessTokenForm.tsx @@ -53,12 +53,11 @@ function getPatUrl(alm: AlmKeys, url = '') { return `${url.replace(/\/$/, '')}/plugins/servlet/access-tokens/add`; } else if (alm === AlmKeys.BitbucketCloud) { return 'https://bitbucket.org/account/settings/app-passwords/new'; - } else { - // GitLab - return url.endsWith('/api/v4') - ? `${url.replace('/api/v4', '').replace(/\/$/, '')}/profile/personal_access_tokens` - : 'https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#creating-a-personal-access-token'; + } else if (alm === AlmKeys.GitLab) { + return 'https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html'; } + + return ''; } export default class PersonalAccessTokenForm extends React.PureComponent { diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/PersonalAccessTokenForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/PersonalAccessTokenForm-test.tsx.snap index f262c79b050..65a05306be2 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/PersonalAccessTokenForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/PersonalAccessTokenForm-test.tsx.snap @@ -372,7 +372,7 @@ exports[`should render correctly: gitlab 1`] = ` src="/images/alm/gitlab.svg" /> @@ -482,7 +482,7 @@ exports[`should render correctly: gitlab with non-standard api path 1`] = ` src="/images/alm/gitlab.svg" /> diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx index edee930408a..f07477bc8df 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx @@ -19,10 +19,10 @@ */ import * as React from 'react'; import { ButtonLink } from '../../../../components/controls/buttons'; -import HelpTooltip from '../../../../components/controls/HelpTooltip'; import MandatoryFieldMarker from '../../../../components/ui/MandatoryFieldMarker'; import { translate } from '../../../../helpers/l10n'; import { AlmBindingDefinitionBase } from '../../../../types/alm-settings'; +import '../../styles.css'; export interface AlmBindingDefinitionFormFieldProps { autoFocus?: boolean; @@ -54,51 +54,54 @@ export function AlmBindingDefinitionFormField -