From 47e63855d5b17ee17837e45a2ab77aa6b37e0b7d Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Tue, 10 Aug 2021 13:49:44 +0200 Subject: [PATCH] SONAR-13742 Add link to GitHub project on import screen --- .../src/main/js/app/styles/init/misc.css | 4 + .../project/GitHubProjectCreateRenderer.tsx | 43 ++++--- .../GitHubProjectCreateRenderer-test.tsx.snap | 106 ++++++++++++------ .../main/js/helpers/mocks/alm-integrations.ts | 2 +- .../resources/org/sonar/l10n/core.properties | 1 + 5 files changed, 108 insertions(+), 48 deletions(-) diff --git a/server/sonar-web/src/main/js/app/styles/init/misc.css b/server/sonar-web/src/main/js/app/styles/init/misc.css index 846bcbc807e..047066b05db 100644 --- a/server/sonar-web/src/main/js/app/styles/init/misc.css +++ b/server/sonar-web/src/main/js/app/styles/init/misc.css @@ -306,6 +306,10 @@ th.huge-spacer-right { max-width: 80% !important; } +.max-width-60 { + max-width: 60% !important; +} + .width-100 { width: 100% !important; } 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 045c6176e4e..35e82d7322a 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 @@ -30,6 +30,7 @@ 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 { colors } from '../../../app/theme'; import { getBaseUrl } from '../../../helpers/system'; import { getProjectUrl } from '../../../helpers/urls'; import { GithubOrganization, GithubRepository } from '../../../types/alm-integration'; @@ -109,25 +110,39 @@ function renderRepositoryList(props: GitHubProjectCreateRendererProps) { disabled={isDisabled(r)} value={r.key} onCheck={props.onSelectRepository}> -
-
+
+
{r.sqProjectKey ? ( - - - {r.name} - +
+ + + {r.name} + + + + {translate('onboarding.create_project.repository_imported')} + + + +
) : ( r.name )}
- {r.sqProjectKey && ( - - {translate('onboarding.create_project.repository_imported')} - - + {r.url && ( + e.stopPropagation()} + target="_blank" + href={r.url} + rel="noopener noreferrer"> + {translate('onboarding.create_project.see_on_github')} + )}
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 afc04e93bee..ea876a7498e 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 @@ -338,14 +338,23 @@ exports[`should render correctly: repositories 1`] = ` value="repo1" >
repository 1
+ + onboarding.create_project.see_on_github +
- - - repository 1 - + + + + repository 1 + + + + + onboarding.create_project.repository_imported + + + +
- - onboarding.create_project.repository_imported - - + onboarding.create_project.see_on_github +
repository 1
+ + onboarding.create_project.see_on_github +
= {}): key: 'key3456', name: 'repository 1', sqProjectKey: '', - url: 'owner/repo1', + url: 'https://github.com/owner/repo1', ...overrides }; } diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 152d00ca6f4..eb9027897b1 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3366,6 +3366,7 @@ onboarding.create_project.no_bbs_repos.filter=No repositories match your filter. onboarding.create_project.only_showing_X_first_repos=We're only displaying the first {0} repositories. If you're looking for a repository that's not in this list, use the search above. onboarding.create_project.import_selected_repo=Set up selected repository onboarding.create_project.go_to_project=Go to project +onboarding.create_project.see_on_github=See project on GitHub onboarding.create_project.search_prompt=Search for projects onboarding.create_project.set_up=Set up -- 2.39.5