/* * 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 Tooltip from '../../../components/controls/Tooltip'; import CheckIcon from '../../../components/icons/CheckIcon'; import DetachIcon from '../../../components/icons/DetachIcon'; import QualifierIcon from '../../../components/icons/QualifierIcon'; import { Alert } from '../../../components/ui/Alert'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { formatMeasure } from '../../../helpers/measures'; import { getProjectUrl } from '../../../helpers/urls'; import { BitbucketCloudRepository } from '../../../types/alm-integration'; import { ComponentQualifier } from '../../../types/component'; import { CreateProjectModes } from './types'; export interface BitbucketCloudSearchFormProps { importingSlug?: string; isLastPage: boolean; loadingMore: boolean; onImport: (repositorySlug: string) => void; onLoadMore: () => void; onSearch: (searchQuery: string) => void; repositories?: BitbucketCloudRepository[]; searching: boolean; searchQuery: string; } function getRepositoryUrl(workspace: string, slug: string) { return `https://bitbucket.org/${workspace}/${slug}`; } export default function BitbucketCloudSearchForm(props: BitbucketCloudSearchFormProps) { const { importingSlug, isLastPage, loadingMore, repositories = [], searching, searchQuery } = props; if (repositories.length === 0 && searchQuery.length === 0 && !searching) { return ( {translate('onboarding.create_project.update_your_token')} ) }} /> ); } return (

{repositories.length === 0 ? (
{translate('no_results')}
) : ( {repositories.map(repository => ( {repository.sqProjectKey ? ( ) : ( )} ))}
{repository.sqProjectKey ? ( {repository.name} ) : ( repository.name )}
{repository.projectKey}
{translate('onboarding.create_project.bitbucketcloud.link')} {translate('onboarding.create_project.repository_imported')}
)}
); }