import ChevronsIcon from 'sonar-ui-common/components/icons/ChevronsIcon';
import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n';
import { getBaseUrl } from 'sonar-ui-common/helpers/urls';
-import DocumentationTooltip from '../../../components/common/DocumentationTooltip';
import { withAppState } from '../../../components/hoc/withAppState';
-import { ALM_DOCUMENTATION_PATHS } from '../../../helpers/constants';
import { AlmKeys } from '../../../types/alm-settings';
-import { ALM_INTEGRATION } from '../../settings/components/AdditionalCategoryKeys';
import { CreateProjectModes } from './types';
export interface CreateProjectModeSelectionProps {
const count = isBitbucket
? almCounts[AlmKeys.BitbucketServer] + almCounts[AlmKeys.BitbucketCloud]
: almCounts[alm];
- const disabled = count !== 1 || loadingBindings;
-
- const tooltipLinks = [];
- if (count === 0) {
- if (canAdmin) {
- tooltipLinks.push({
- href: `/admin/settings?category=${ALM_INTEGRATION}&alm=${alm}`,
- label: translateWithParameters(
- 'onboarding.create_project.set_up_x',
- translate('alm', alm, 'short')
- )
- });
- }
-
- tooltipLinks.push({
- href: ALM_DOCUMENTATION_PATHS[alm],
- label: translateWithParameters(
- 'onboarding.create_project.help_set_up_x',
- translate('alm', alm, 'short')
- )
- });
- }
+ const hasConfig = count > 0;
+ const hasTooManyConfig = count > 1;
+ const disabled = loadingBindings || hasTooManyConfig || (!hasConfig && !canAdmin);
return (
<div className="big-spacer-left display-flex-column">
)}
{!loadingBindings && disabled && (
- <div className="text-muted small spacer-top" style={{ lineHeight: 1.5 }}>
- {translate('onboarding.create_project.alm_not_configured')}
- <DocumentationTooltip
- className="little-spacer-left"
- content={
- count === 0
- ? translate('onboarding.create_project.zero_alm_instances', alm)
- : `${translate('onboarding.create_project.too_many_alm_instances', alm)}
- ${translateWithParameters(
- 'onboarding.create_project.alm_instances_count_X',
- count
- )}`
- }
- links={count === 0 ? tooltipLinks : undefined}
- />
- </div>
+ <p className="text-muted small spacer-top" style={{ lineHeight: 1.5 }}>
+ {!hasConfig && translate('onboarding.create_project.alm_not_configured')}
+ {hasTooManyConfig &&
+ translateWithParameters(
+ 'onboarding.create_project.too_many_alm_instances_X',
+ translate('alm', alm)
+ )}
+ </p>
)}
</button>
</div>
export function CreateProjectModeSelection(props: CreateProjectModeSelectionProps) {
return (
<>
- <header className="huge-spacer-top big-spacer-bottom padded">
- <h1 className="text-center huge big-spacer-bottom">
- {translate('my_account.create_new.TRK')}
- </h1>
- <p className="text-center big">{translate('onboarding.create_project.select_method')}</p>
+ <header className="padded huge-spacer-top display-flex-column display-flex-center">
+ <div className="abs-width-800 huge-spacer-bottom">
+ <h1 className="text-center big-spacer-bottom">
+ {translate('onboarding.create_project.select_method')}
+ </h1>
+ <p className="text-center spacer-bottom">
+ {translate('onboarding.create_project.select_method.description1')}
+ </p>
+ <p className="text-center">
+ {translate('onboarding.create_project.select_method.description2')}
+ </p>
+ </div>
</header>
<div className="create-project-modes huge-spacer-top display-flex-justify-center">
exports[`should render correctly: default 1`] = `
<Fragment>
<header
- className="huge-spacer-top big-spacer-bottom padded"
+ className="padded huge-spacer-top display-flex-column display-flex-center"
>
- <h1
- className="text-center huge big-spacer-bottom"
- >
- my_account.create_new.TRK
- </h1>
- <p
- className="text-center big"
+ <div
+ className="abs-width-800 huge-spacer-bottom"
>
- onboarding.create_project.select_method
- </p>
+ <h1
+ className="text-center big-spacer-bottom"
+ >
+ onboarding.create_project.select_method
+ </h1>
+ <p
+ className="text-center spacer-bottom"
+ >
+ onboarding.create_project.select_method.description1
+ </p>
+ <p
+ className="text-center"
+ >
+ onboarding.create_project.select_method.description2
+ </p>
+ </div>
</header>
<div
className="create-project-modes huge-spacer-top display-flex-justify-center"
>
onboarding.create_project.select_method.azure
</div>
- <div
+ <p
className="text-muted small spacer-top"
style={
Object {
}
>
onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.zero_alm_instances.azure"
- links={
- Array [
- Object {
- "href": "/documentation/analysis/azuredevops-integration/",
- "label": "onboarding.create_project.help_set_up_x.alm.azure.short",
- },
- ]
- }
- />
- </div>
+ </p>
</button>
</div>
<div
>
onboarding.create_project.select_method.github
</div>
- <div
+ <p
className="text-muted small spacer-top"
style={
Object {
}
>
onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.zero_alm_instances.github"
- links={
- Array [
- Object {
- "href": "/documentation/analysis/github-integration/",
- "label": "onboarding.create_project.help_set_up_x.alm.github.short",
- },
- ]
- }
- />
- </div>
+ </p>
</button>
</div>
<div
>
onboarding.create_project.select_method.gitlab
</div>
- <div
+ <p
className="text-muted small spacer-top"
style={
Object {
}
>
onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.zero_alm_instances.gitlab"
- links={
- Array [
- Object {
- "href": "/documentation/analysis/gitlab-integration/",
- "label": "onboarding.create_project.help_set_up_x.alm.gitlab.short",
- },
- ]
- }
- />
- </div>
+ </p>
</button>
</div>
</div>
exports[`should render correctly: invalid configs, admin 1`] = `
<Fragment>
<header
- className="huge-spacer-top big-spacer-bottom padded"
+ className="padded huge-spacer-top display-flex-column display-flex-center"
>
- <h1
- className="text-center huge big-spacer-bottom"
- >
- my_account.create_new.TRK
- </h1>
- <p
- className="text-center big"
+ <div
+ className="abs-width-800 huge-spacer-bottom"
>
- onboarding.create_project.select_method
- </p>
+ <h1
+ className="text-center big-spacer-bottom"
+ >
+ onboarding.create_project.select_method
+ </h1>
+ <p
+ className="text-center spacer-bottom"
+ >
+ onboarding.create_project.select_method.description1
+ </p>
+ <p
+ className="text-center"
+ >
+ onboarding.create_project.select_method.description2
+ </p>
+ </div>
</header>
<div
className="create-project-modes huge-spacer-top display-flex-justify-center"
className="big-spacer-left display-flex-column"
>
<button
- className="button button-huge display-flex-column create-project-mode-type-alm disabled"
- disabled={true}
+ className="button button-huge display-flex-column create-project-mode-type-alm"
+ disabled={false}
onClick={[Function]}
type="button"
>
>
onboarding.create_project.select_method.azure
</div>
+ </button>
+ </div>
+ <div
+ className="big-spacer-left display-flex-column"
+ >
+ <button
+ className="button button-huge display-flex-column create-project-mode-type-alm"
+ disabled={false}
+ onClick={[Function]}
+ type="button"
+ >
+ <img
+ alt=""
+ height={80}
+ src="/images/alm/bitbucket.svg"
+ />
<div
- className="text-muted small spacer-top"
- style={
- Object {
- "lineHeight": 1.5,
- }
- }
+ className="medium big-spacer-top abs-height-50 display-flex-center"
>
- onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.zero_alm_instances.azure"
- links={
- Array [
- Object {
- "href": "/admin/settings?category=almintegration&alm=azure",
- "label": "onboarding.create_project.set_up_x.alm.azure.short",
- },
- Object {
- "href": "/documentation/analysis/azuredevops-integration/",
- "label": "onboarding.create_project.help_set_up_x.alm.azure.short",
- },
- ]
- }
- />
+ onboarding.create_project.select_method.bitbucket
</div>
</button>
</div>
<img
alt=""
height={80}
- src="/images/alm/bitbucket.svg"
+ src="/images/alm/github.svg"
/>
<div
className="medium big-spacer-top abs-height-50 display-flex-center"
>
- onboarding.create_project.select_method.bitbucket
+ onboarding.create_project.select_method.github
</div>
- <div
+ <p
className="text-muted small spacer-top"
style={
Object {
}
}
>
- onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.zero_alm_instances.bitbucket"
- links={
- Array [
- Object {
- "href": "/admin/settings?category=almintegration&alm=bitbucket",
- "label": "onboarding.create_project.set_up_x.alm.bitbucket.short",
- },
- Object {
- "href": "/documentation/analysis/bitbucket-integration/",
- "label": "onboarding.create_project.help_set_up_x.alm.bitbucket.short",
- },
- ]
- }
- />
+ onboarding.create_project.too_many_alm_instances_X.alm.github
+ </p>
+ </button>
+ </div>
+ <div
+ className="big-spacer-left display-flex-column"
+ >
+ <button
+ className="button button-huge display-flex-column create-project-mode-type-alm"
+ disabled={false}
+ onClick={[Function]}
+ type="button"
+ >
+ <img
+ alt=""
+ height={80}
+ src="/images/alm/gitlab.svg"
+ />
+ <div
+ className="medium big-spacer-top abs-height-50 display-flex-center"
+ >
+ onboarding.create_project.select_method.gitlab
+ </div>
+ </button>
+ </div>
+ </div>
+</Fragment>
+`;
+
+exports[`should render correctly: invalid configs, admin 2`] = `
+<Fragment>
+ <header
+ className="padded huge-spacer-top display-flex-column display-flex-center"
+ >
+ <div
+ className="abs-width-800 huge-spacer-bottom"
+ >
+ <h1
+ className="text-center big-spacer-bottom"
+ >
+ onboarding.create_project.select_method
+ </h1>
+ <p
+ className="text-center spacer-bottom"
+ >
+ onboarding.create_project.select_method.description1
+ </p>
+ <p
+ className="text-center"
+ >
+ onboarding.create_project.select_method.description2
+ </p>
+ </div>
+ </header>
+ <div
+ className="create-project-modes huge-spacer-top display-flex-justify-center"
+ >
+ <button
+ className="button button-huge display-flex-column create-project-mode-type-manual"
+ onClick={[Function]}
+ type="button"
+ >
+ <ChevronsIcon
+ size={80}
+ />
+ <div
+ className="medium big-spacer-top"
+ >
+ onboarding.create_project.select_method.manual
+ </div>
+ </button>
+ <div
+ className="big-spacer-left display-flex-column"
+ >
+ <button
+ className="button button-huge display-flex-column create-project-mode-type-alm"
+ disabled={false}
+ onClick={[Function]}
+ type="button"
+ >
+ <img
+ alt=""
+ height={80}
+ src="/images/alm/azure.svg"
+ />
+ <div
+ className="medium big-spacer-top abs-height-50 display-flex-center"
+ >
+ onboarding.create_project.select_method.azure
+ </div>
+ </button>
+ </div>
+ <div
+ className="big-spacer-left display-flex-column"
+ >
+ <button
+ className="button button-huge display-flex-column create-project-mode-type-alm"
+ disabled={false}
+ onClick={[Function]}
+ type="button"
+ >
+ <img
+ alt=""
+ height={80}
+ src="/images/alm/bitbucket.svg"
+ />
+ <div
+ className="medium big-spacer-top abs-height-50 display-flex-center"
+ >
+ onboarding.create_project.select_method.bitbucket
</div>
</button>
</div>
>
onboarding.create_project.select_method.github
</div>
- <div
+ <p
className="text-muted small spacer-top"
style={
Object {
}
}
>
- onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.too_many_alm_instances.github
- onboarding.create_project.alm_instances_count_X.2"
- />
- </div>
+ onboarding.create_project.too_many_alm_instances_X.alm.github
+ </p>
</button>
</div>
<div
className="big-spacer-left display-flex-column"
>
<button
- className="button button-huge display-flex-column create-project-mode-type-alm disabled"
- disabled={true}
+ className="button button-huge display-flex-column create-project-mode-type-alm"
+ disabled={false}
onClick={[Function]}
type="button"
>
>
onboarding.create_project.select_method.gitlab
</div>
- <div
- className="text-muted small spacer-top"
- style={
- Object {
- "lineHeight": 1.5,
- }
- }
- >
- onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.zero_alm_instances.gitlab"
- links={
- Array [
- Object {
- "href": "/admin/settings?category=almintegration&alm=gitlab",
- "label": "onboarding.create_project.set_up_x.alm.gitlab.short",
- },
- Object {
- "href": "/documentation/analysis/gitlab-integration/",
- "label": "onboarding.create_project.help_set_up_x.alm.gitlab.short",
- },
- ]
- }
- />
- </div>
</button>
</div>
</div>
exports[`should render correctly: invalid configs, not admin 1`] = `
<Fragment>
<header
- className="huge-spacer-top big-spacer-bottom padded"
+ className="padded huge-spacer-top display-flex-column display-flex-center"
>
- <h1
- className="text-center huge big-spacer-bottom"
- >
- my_account.create_new.TRK
- </h1>
- <p
- className="text-center big"
+ <div
+ className="abs-width-800 huge-spacer-bottom"
>
- onboarding.create_project.select_method
- </p>
+ <h1
+ className="text-center big-spacer-bottom"
+ >
+ onboarding.create_project.select_method
+ </h1>
+ <p
+ className="text-center spacer-bottom"
+ >
+ onboarding.create_project.select_method.description1
+ </p>
+ <p
+ className="text-center"
+ >
+ onboarding.create_project.select_method.description2
+ </p>
+ </div>
</header>
<div
className="create-project-modes huge-spacer-top display-flex-justify-center"
>
onboarding.create_project.select_method.azure
</div>
- <div
+ <p
className="text-muted small spacer-top"
style={
Object {
}
>
onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.zero_alm_instances.azure"
- links={
- Array [
- Object {
- "href": "/documentation/analysis/azuredevops-integration/",
- "label": "onboarding.create_project.help_set_up_x.alm.azure.short",
- },
- ]
- }
- />
- </div>
+ </p>
</button>
</div>
<div
>
onboarding.create_project.select_method.bitbucket
</div>
- <div
+ <p
className="text-muted small spacer-top"
style={
Object {
}
>
onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.zero_alm_instances.bitbucket"
- links={
- Array [
- Object {
- "href": "/documentation/analysis/bitbucket-integration/",
- "label": "onboarding.create_project.help_set_up_x.alm.bitbucket.short",
- },
- ]
- }
- />
- </div>
+ </p>
</button>
</div>
<div
>
onboarding.create_project.select_method.github
</div>
- <div
+ <p
className="text-muted small spacer-top"
style={
Object {
}
}
>
- onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.too_many_alm_instances.github
- onboarding.create_project.alm_instances_count_X.2"
- />
- </div>
+ onboarding.create_project.too_many_alm_instances_X.alm.github
+ </p>
</button>
</div>
<div
>
onboarding.create_project.select_method.gitlab
</div>
- <div
+ <p
className="text-muted small spacer-top"
style={
Object {
}
>
onboarding.create_project.alm_not_configured
- <DocumentationTooltip
- className="little-spacer-left"
- content="onboarding.create_project.zero_alm_instances.gitlab"
- links={
- Array [
- Object {
- "href": "/documentation/analysis/gitlab-integration/",
- "label": "onboarding.create_project.help_set_up_x.alm.gitlab.short",
- },
- ]
- }
- />
- </div>
+ </p>
</button>
</div>
</div>
exports[`should render correctly: loading instances 1`] = `
<Fragment>
<header
- className="huge-spacer-top big-spacer-bottom padded"
+ className="padded huge-spacer-top display-flex-column display-flex-center"
>
- <h1
- className="text-center huge big-spacer-bottom"
- >
- my_account.create_new.TRK
- </h1>
- <p
- className="text-center big"
+ <div
+ className="abs-width-800 huge-spacer-bottom"
>
- onboarding.create_project.select_method
- </p>
+ <h1
+ className="text-center big-spacer-bottom"
+ >
+ onboarding.create_project.select_method
+ </h1>
+ <p
+ className="text-center spacer-bottom"
+ >
+ onboarding.create_project.select_method.description1
+ </p>
+ <p
+ className="text-center"
+ >
+ onboarding.create_project.select_method.description2
+ </p>
+ </div>
</header>
<div
className="create-project-modes huge-spacer-top display-flex-justify-center"
my_account.set_notifications_for=Search a project by name
my_account.set_notifications_for.title=Add a project
my_account.create_new.TRK=Add a project
-my_account.create_new.VW=Create Portfolio
-my_account.create_new.APP=Create Application
my_account.add_project=Add Project
my_account.add_project.manual=Manually
my_account.add_project.azure=Azure DevOps
onboarding.project_analysis.description=We initialized your project on {instance}, now it's up to you to launch analyses!
onboarding.project_analysis.guide_to_integrate_pipelines=follow the guide to integrating with Pipelines
-onboarding.create_project.set_up_x=Set up {0}
-onboarding.create_project.help_set_up_x=Learn more on how to set up {0}
-
onboarding.create_project.setup_manually=Create a project
+onboarding.create_project.select_method=How do you want to create your project?
+onboarding.create_project.select_method.description1=Are you just testing or have an advanced use-case? Create a project manually.
+onboarding.create_project.select_method.description2=Do you want to benefit from all of SonarQube's features (like repository import and Pull Request decoration)? Create your project from your favorite DevOps platform.
onboarding.create_project.select_method.manual=Manually
onboarding.create_project.select_method.azure=From Azure DevOps
onboarding.create_project.select_method.bitbucket=From Bitbucket
onboarding.create_project.select_method.github=From GitHub
onboarding.create_project.select_method.gitlab=From GitLab
-onboarding.create_project.alm_not_configured=Currently not active
+onboarding.create_project.alm_not_configured=Contact admin for global configuration
onboarding.create_project.check_alm_supported=Checking if available
onboarding.create_project.project_key=Project key
onboarding.create_project.project_key.description=Up to 400 characters. Allowed characters are alphanumeric, '-' (dash), '_' (underscore), '.' (period) and ':' (colon), with at least one non-digit.
onboarding.create_project.pat_form.pat_required=Please enter a personal access token
onboarding.create_project.pat_form.list_repositories=List repositories
onboarding.create_project.select_method=How do you want to create your project?
-onboarding.create_project.too_many_alm_instances.azure=You must have exactly 1 Azure DevOps instance configured in order to use this method.
-onboarding.create_project.too_many_alm_instances.bitbucket=You must have exactly 1 Bitbucket instance configured in order to use this method.
-onboarding.create_project.too_many_alm_instances.github=You must have exactly 1 GitHub instance configured in order to use this method.
-onboarding.create_project.too_many_alm_instances.gitlab=You must have exactly 1 GitLab instance configured in order to use this method.
-onboarding.create_project.alm_instances_count_X=You currently have {0}.
-onboarding.create_project.zero_alm_instances.azure=You must first configure an Azure DevOps instance.
-onboarding.create_project.zero_alm_instances.bitbucket=You must first configure a Bitbucket instance.
-onboarding.create_project.zero_alm_instances.github=You must first configure a GitHub instance.
-onboarding.create_project.zero_alm_instances.gitlab=You must first configure a GitLab instance.
+onboarding.create_project.too_many_alm_instances_X=This method requires exactly one {0} configuration.
onboarding.create_project.wrong_binding_count=You must have exactly 1 {alm} instance configured in order to use this method, but none were found. Either create the project manually, or contact your system administrator.
onboarding.create_project.wrong_binding_count.admin=You must have exactly 1 {alm} instance configured in order to use this method. You can configure instances under {url}.
onboarding.create_project.enter_pat=Enter personal access token