/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * 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 { Dict } from '../../../types/types'; import { ALM_INTEGRATION } from '../../settings/components/AdditionalCategoryKeys'; import AzurePersonalAccessTokenForm from './AzurePersonalAccessTokenForm'; import AzureProjectsList from './AzureProjectsList'; import CreateProjectPageHeader from './CreateProjectPageHeader'; import WrongBindingCountAlert from './WrongBindingCountAlert'; export interface AzureProjectCreateRendererProps { canAdmin?: boolean; importing: boolean; loading: boolean; loadingRepositories: Dict; onImportRepository: () => void; onOpenProject: (key: string) => void; onPersonalAccessTokenCreate: (token: string) => void; onSearch: (query: string) => void; onSelectRepository: (repository: AzureRepository) => void; projects?: AzureProject[]; repositories: Dict; searching?: boolean; searchResults?: Dict; searchQuery?: string; selectedRepository?: AzureRepository; settings?: AlmSettingsInstance; showPersonalAccessTokenForm?: boolean; submittingToken?: boolean; tokenValidationFailed: boolean; } export default function AzureProjectCreateRenderer(props: AzureProjectCreateRendererProps) { const { canAdmin, importing, loading, loadingRepositories, projects, repositories, searching, searchResults, searchQuery, selectedRepository, settings, showPersonalAccessTokenForm, submittingToken, tokenValidationFailed } = props; const settingIsValid = settings && settings.url; const showCountError = !loading && !settings; const showUrlError = !loading && settings && !settings.url; return ( <> ) } title={ {translate('onboarding.create_project.azure.title')} } /> {loading && } {showUrlError && ( {canAdmin ? ( {translate('settings.page')} ) }} /> ) : ( translate('onboarding.create_project.azure.no_url') )} )} {showCountError && } {!loading && settings && settings.url && (showPersonalAccessTokenForm ? (
) : ( <>
))} ); }