summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2021-06-30 14:46:18 +0200
committersonartech <sonartech@sonarsource.com>2021-07-01 20:03:19 +0000
commita14676204f59098a9e8983da4ecc21bbaf81ac14 (patch)
treeb67c87f123197032e98c2ae23e1a478af2d8640b
parente0d3b1c6711e8fb677462c5b5be936a21a801ab3 (diff)
downloadsonarqube-a14676204f59098a9e8983da4ecc21bbaf81ac14.tar.gz
sonarqube-a14676204f59098a9e8983da4ecc21bbaf81ac14.zip
SONAR-15050 Add link on GitHub on-boarding page.
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitHubProjectCreateRenderer-test.tsx.snap27
2 files changed, 39 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx b/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx
index 5a3c552f146..045c6176e4e 100644
--- a/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx
@@ -26,11 +26,14 @@ import Radio from 'sonar-ui-common/components/controls/Radio';
import SearchBox from 'sonar-ui-common/components/controls/SearchBox';
import SearchSelect from 'sonar-ui-common/components/controls/SearchSelect';
import CheckIcon from 'sonar-ui-common/components/icons/CheckIcon';
+import QualifierIcon from 'sonar-ui-common/components/icons/QualifierIcon';
import { Alert } from 'sonar-ui-common/components/ui/Alert';
import DeferredSpinner from 'sonar-ui-common/components/ui/DeferredSpinner';
import { translate } from 'sonar-ui-common/helpers/l10n';
import { getBaseUrl } from '../../../helpers/system';
+import { getProjectUrl } from '../../../helpers/urls';
import { GithubOrganization, GithubRepository } from '../../../types/alm-integration';
+import { ComponentQualifier } from '../../../types/component';
import CreateProjectPageHeader from './CreateProjectPageHeader';
export interface GitHubProjectCreateRendererProps {
@@ -107,7 +110,19 @@ function renderRepositoryList(props: GitHubProjectCreateRendererProps) {
value={r.key}
onCheck={props.onSelectRepository}>
<div className="big overflow-hidden" title={r.name}>
- <div className="text-ellipsis">{r.name}</div>
+ <div className="display-flex-start text-ellipsis">
+ {r.sqProjectKey ? (
+ <Link className="display-flex-center" to={getProjectUrl(r.sqProjectKey)}>
+ <QualifierIcon
+ className="spacer-right"
+ qualifier={ComponentQualifier.Project}
+ />
+ {r.name}
+ </Link>
+ ) : (
+ r.name
+ )}
+ </div>
{r.sqProjectKey && (
<em className="notice text-muted-2 small display-flex-center">
{translate('onboarding.create_project.repository_imported')}
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitHubProjectCreateRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitHubProjectCreateRenderer-test.tsx.snap
index dfbc0251719..afc04e93bee 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitHubProjectCreateRenderer-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitHubProjectCreateRenderer-test.tsx.snap
@@ -342,7 +342,7 @@ exports[`should render correctly: repositories 1`] = `
title="repository 1"
>
<div
- className="text-ellipsis"
+ className="display-flex-start text-ellipsis"
>
repository 1
</div>
@@ -361,9 +361,28 @@ exports[`should render correctly: repositories 1`] = `
title="repository 1"
>
<div
- className="text-ellipsis"
+ className="display-flex-start text-ellipsis"
>
- repository 1
+ <Link
+ className="display-flex-center"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/dashboard",
+ "query": Object {
+ "branch": undefined,
+ "id": "repo2",
+ },
+ }
+ }
+ >
+ <QualifierIcon
+ className="spacer-right"
+ qualifier="TRK"
+ />
+ repository 1
+ </Link>
</div>
<em
className="notice text-muted-2 small display-flex-center"
@@ -389,7 +408,7 @@ exports[`should render correctly: repositories 1`] = `
title="repository 1"
>
<div
- className="text-ellipsis"
+ className="display-flex-start text-ellipsis"
>
repository 1
</div>