From 9f143c788c461c14b5ff79461866b34394185c7b Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Mon, 23 Aug 2021 16:44:13 +0200 Subject: [PATCH] SONAR-15135 Correct Azure DevOps onboarding error message --- .../project/AzureProjectCreateRenderer.tsx | 36 ++++++- .../AzureProjectCreateRenderer-test.tsx | 18 +++- .../AzureProjectCreateRenderer-test.tsx.snap | 99 ++++++++++++++----- .../resources/org/sonar/l10n/core.properties | 2 + 4 files changed, 124 insertions(+), 31 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx b/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx index 3c954c02665..c026d8988a4 100644 --- a/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx @@ -18,13 +18,18 @@ * 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 { Button } from '../../../components/controls/buttons'; import SearchBox from '../../../components/controls/SearchBox'; +import { Alert } from '../../../components/ui/Alert'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import { translate } from '../../../helpers/l10n'; import { getBaseUrl } from '../../../helpers/system'; +import { getGlobalSettingsUrl } from '../../../helpers/urls'; import { AzureProject, AzureRepository } from '../../../types/alm-integration'; import { AlmKeys, AlmSettingsInstance } from '../../../types/alm-settings'; +import { ALM_INTEGRATION } from '../../settings/components/AdditionalCategoryKeys'; import AzurePersonalAccessTokenForm from './AzurePersonalAccessTokenForm'; import AzureProjectsList from './AzureProjectsList'; import CreateProjectPageHeader from './CreateProjectPageHeader'; @@ -70,11 +75,16 @@ export default function AzureProjectCreateRenderer(props: AzureProjectCreateRend tokenValidationFailed } = props; + const settingIsValid = settings && settings.url; + const showCountError = !loading && !settings; + const showUrlError = !loading && settings && !settings.url; + return ( <> - - } title={ } /> -
@@ -158,7 +137,7 @@ exports[`should render correctly: project list 1`] = ` `; -exports[`should render correctly: token form 1`] = ` +exports[`should render correctly: setting missing url, admin 1`] = ` } /> - + + settings.page + , + } + } + /> + + +`; + +exports[`should render correctly: setting missing url, not admin 1`] = ` + + + + onboarding.create_project.azure.title + + } + /> + + onboarding.create_project.azure.no_url + + +`; + +exports[`should render correctly: token form 1`] = ` + + + + onboarding.create_project.azure.title + + } />