From: Wouter Admiraal Date: Tue, 15 Jun 2021 07:43:43 +0000 (+0200) Subject: SONAR-14934 Improve the manual tutorial X-Git-Tag: 9.0.0.45539~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dee4f363b8bdebe59126a5464e1ebc4fc3202932;p=sonarqube.git SONAR-14934 Improve the manual tutorial --- diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavProjectBindingErrorNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavProjectBindingErrorNotif.tsx index e420188b893..0308b9ede48 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavProjectBindingErrorNotif.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavProjectBindingErrorNotif.tsx @@ -23,6 +23,7 @@ import { Link } from 'react-router'; import { Alert } from 'sonar-ui-common/components/ui/Alert'; import { translate } from 'sonar-ui-common/helpers/l10n'; import { PULL_REQUEST_DECORATION_BINDING_CATEGORY } from '../../../../apps/settings/components/AdditionalCategoryKeys'; +import { getProjectSettingsUrl } from '../../../../helpers/urls'; export interface ComponentNavProjectBindingErrorNotifProps { component: T.Component; @@ -36,11 +37,7 @@ export function ComponentNavProjectBindingErrorNotif( if (component.configuration?.showSettings) { action = ( - + {translate('component_navigation.pr_deco.action.check_project_settings')} ); diff --git a/server/sonar-web/src/main/js/app/styles/init/type.css b/server/sonar-web/src/main/js/app/styles/init/type.css index b03a9fcd4df..0ce0bb1a647 100644 --- a/server/sonar-web/src/main/js/app/styles/init/type.css +++ b/server/sonar-web/src/main/js/app/styles/init/type.css @@ -179,6 +179,10 @@ small, font-size: var(--hugeFontSize); } +.gigantic { + font-size: var(--giganticFontSize); +} + .zero-font-size { font-size: 0 !important; } diff --git a/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx b/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx index 52ff4f36c77..670a81e7d42 100644 --- a/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx @@ -22,6 +22,7 @@ import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router'; import { Alert } from 'sonar-ui-common/components/ui/Alert'; import { translate } from 'sonar-ui-common/helpers/l10n'; +import { getGlobalSettingsUrl } from '../../../helpers/urls'; import { AlmKeys } from '../../../types/alm-settings'; import { ALM_INTEGRATION } from '../../settings/components/AdditionalCategoryKeys'; @@ -42,13 +43,7 @@ export default function WrongBindingCountAlert(props: WrongBindingCountAlertProp values={{ alm: translate('onboarding.alm', alm), url: ( - - {translate('settings.page')} - + {translate('settings.page')} ) }} /> diff --git a/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx b/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx index b3044c5f82e..00d96a02c90 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx @@ -22,6 +22,7 @@ import { sortBy } from 'lodash'; import * as React from 'react'; import { connect } from 'react-redux'; import { IndexLink } from 'react-router'; +import { getGlobalSettingsUrl, getProjectSettingsUrl } from '../../../helpers/urls'; import { getAppState, getSettingsAppAllCategories, Store } from '../../../store/rootReducer'; import { getCategoryName } from '../utils'; import { ADDITIONAL_CATEGORIES } from './AdditionalCategories'; @@ -37,7 +38,6 @@ export interface CategoriesListProps { export function CategoriesList(props: CategoriesListProps) { const { branchesEnabled, categories, component, defaultCategory, selectedCategory } = props; - const pathname = component ? '/project/settings' : '/settings'; const categoriesWithName = categories .filter(key => !CATEGORY_OVERRIDES[key.toLowerCase()]) @@ -60,24 +60,25 @@ export function CategoriesList(props: CategoriesListProps) { return ( ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AllCategoriesList-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AllCategoriesList-test.tsx.snap index 161cb051782..bc199c6498d 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AllCategoriesList-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AllCategoriesList-test.tsx.snap @@ -12,10 +12,9 @@ exports[`should render correctly: branches disabled 1`] = ` title="CAT_2_NAME" to={ Object { - "pathname": "/settings", + "pathname": "/admin/settings", "query": Object { "category": "cat_2", - "id": undefined, }, } } @@ -31,10 +30,9 @@ exports[`should render correctly: branches disabled 1`] = ` title="general" to={ Object { - "pathname": "/settings", + "pathname": "/admin/settings", "query": Object { "category": undefined, - "id": undefined, }, } } @@ -57,10 +55,9 @@ exports[`should render correctly: global mode 1`] = ` title="CAT_1_NAME" to={ Object { - "pathname": "/settings", + "pathname": "/admin/settings", "query": Object { "category": "cat_1", - "id": undefined, }, } } @@ -76,10 +73,9 @@ exports[`should render correctly: global mode 1`] = ` title="CAT_2_NAME" to={ Object { - "pathname": "/settings", + "pathname": "/admin/settings", "query": Object { "category": "cat_2", - "id": undefined, }, } } @@ -95,10 +91,9 @@ exports[`should render correctly: global mode 1`] = ` title="general" to={ Object { - "pathname": "/settings", + "pathname": "/admin/settings", "query": Object { "category": undefined, - "id": undefined, }, } } @@ -185,10 +180,9 @@ exports[`should render correctly: selected category 1`] = ` title="CAT_1_NAME" to={ Object { - "pathname": "/settings", + "pathname": "/admin/settings", "query": Object { "category": "cat_1", - "id": undefined, }, } } @@ -204,10 +198,9 @@ exports[`should render correctly: selected category 1`] = ` title="CAT_2_NAME" to={ Object { - "pathname": "/settings", + "pathname": "/admin/settings", "query": Object { "category": "cat_2", - "id": undefined, }, } } @@ -223,10 +216,9 @@ exports[`should render correctly: selected category 1`] = ` title="general" to={ Object { - "pathname": "/settings", + "pathname": "/admin/settings", "query": Object { "category": undefined, - "id": undefined, }, } } diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx index 92aba7659fa..84567b02dbc 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx @@ -28,6 +28,7 @@ import DeferredSpinner from 'sonar-ui-common/components/ui/DeferredSpinner'; import MandatoryFieldMarker from 'sonar-ui-common/components/ui/MandatoryFieldMarker'; import MandatoryFieldsExplanation from 'sonar-ui-common/components/ui/MandatoryFieldsExplanation'; import { translate } from 'sonar-ui-common/helpers/l10n'; +import { getGlobalSettingsUrl } from '../../../../helpers/urls'; import { AlmSettingsInstance, ProjectAlmBindingConfigurationErrors, @@ -216,14 +217,7 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe )} values={{ link: ( - + {translate( 'settings.pr_decoration.binding.check_configuration.failure.check_global_settings.link' )} diff --git a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx index b0c4eeacdfc..5d0847a1b69 100644 --- a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx @@ -40,6 +40,29 @@ export interface TutorialSelectionRendererProps { selectedTutorial?: TutorialModes; } +const DEFAULT_ICON_SIZE = 80; +const GH_ACTION_ICON_SIZE = 64; + +function renderButton( + mode: TutorialModes, + onSelectTutorial: (mode: TutorialModes) => void, + icon: React.ReactNode +) { + return ( + + ); +} + export default function TutorialSelectionRenderer(props: TutorialSelectionRendererProps) { const { almBinding, @@ -84,100 +107,82 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender -
- - - {showAzurePipelines && ( - - )} + )} - {showBitbucketPipelines && ( - - )} + )} - {showGitHubActions && ( - - )} + )} - {showGitLabCICD && ( - - )} + )} - {showJenkins && ( - + )} + + {renderButton( + TutorialModes.OtherCI, + props.onSelectTutorial, + + … + )}
diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelectionRenderer-test.tsx b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelectionRenderer-test.tsx index 74460e6a4a4..70c2829493a 100644 --- a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelectionRenderer-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelectionRenderer-test.tsx @@ -102,10 +102,10 @@ it('should allow mode selection for Github', () => { click(wrapper.find('button.tutorial-mode-manual')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Manual); - click(wrapper.find('button.tutorial-mode-github')); + click(wrapper.find('button.tutorial-mode-github-actions')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.GitHubActions); - click(wrapper.find('button.azure-pipelines')); + click(wrapper.find('button.tutorial-mode-azure-pipelines')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.AzurePipelines); }); @@ -119,7 +119,7 @@ it('should allow mode selection for GitLab', () => { click(wrapper.find('button.tutorial-mode-jenkins')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Jenkins); - click(wrapper.find('button.tutorial-mode-gitlab')); + click(wrapper.find('button.tutorial-mode-gitlab-ci')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.GitLabCI); click(wrapper.find('button.tutorial-mode-manual')); @@ -136,7 +136,7 @@ it('should allow mode selection for Bitbucket pipepline', () => { click(wrapper.find('button.tutorial-mode-jenkins')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Jenkins); - click(wrapper.find('button.bitbucket-pipelines')); + click(wrapper.find('button.tutorial-mode-bitbucket-pipelines')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.BitbucketPipelines); click(wrapper.find('button.tutorial-mode-manual')); @@ -150,7 +150,7 @@ it('should allow mode selection for Azure DevOps', () => { projectBinding: mockProjectAzureBindingResponse() }); - click(wrapper.find('button.azure-pipelines')); + click(wrapper.find('button.tutorial-mode-azure-pipelines')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.AzurePipelines); click(wrapper.find('button.tutorial-mode-manual')); diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/__snapshots__/TutorialSelectionRenderer-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/__tests__/__snapshots__/TutorialSelectionRenderer-test.tsx.snap index 5fe73834477..0422dc2c2ae 100644 --- a/server/sonar-web/src/main/js/components/tutorials/__tests__/__snapshots__/TutorialSelectionRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/__snapshots__/TutorialSelectionRenderer-test.tsx.snap @@ -15,10 +15,10 @@ exports[`should render correctly for azure 1`] = `
+ @@ -69,10 +91,10 @@ exports[`should render correctly for bitbucket server 1`] = `
+ @@ -123,10 +167,10 @@ exports[`should render correctly for github 1`] = `
+ @@ -210,10 +276,10 @@ exports[`should render correctly for gitlab 1`] = `
+ @@ -499,10 +587,10 @@ exports[`should render correctly: selection 1`] = `
+ diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/DoneNextSteps.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/DoneNextSteps.tsx new file mode 100644 index 00000000000..729bd9cbfb7 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/manual/DoneNextSteps.tsx @@ -0,0 +1,115 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 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 { translate } from 'sonar-ui-common/helpers/l10n'; +import { PULL_REQUEST_DECORATION_BINDING_CATEGORY } from '../../../apps/settings/components/AdditionalCategoryKeys'; +import { getProjectSettingsUrl } from '../../../helpers/urls'; + +export interface DoneNextStepsProps { + component: T.Component; +} + +export default function DoneNextSteps({ component }: DoneNextStepsProps) { + const tutorialsLink = ( + + {translate( + 'onboarding.analysis.auto_refresh_after_analysis.set_up_pr_deco_and_ci.see_tutorials' + )} + + ); + const isProjectAdmin = component.configuration?.showSettings; + + return ( + <> +
+ +

+ {translate('onboarding.analysis.auto_refresh_after_analysis.done')}{' '} + {translate('onboarding.analysis.auto_refresh_after_analysis.auto_refresh')} +

+

+ {isProjectAdmin ? ( + + {translate( + 'onboarding.analysis.auto_refresh_after_analysis.set_up_pr_deco_and_ci.project_settings' + )} + + ), + link_see_tutorials: tutorialsLink + }} + /> + ) : ( + + )} +

+

+ + {translate( + 'onboarding.analysis.auto_refresh_after_analysis.check_these_links.branches' + )} + + ), + link_pr_analysis: ( + + {translate( + 'onboarding.analysis.auto_refresh_after_analysis.check_these_links.pr_analysis' + )} + + ) + }} + /> +

+ + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/DoneNextSteps-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/DoneNextSteps-test.tsx new file mode 100644 index 00000000000..9c391389bd5 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/DoneNextSteps-test.tsx @@ -0,0 +1,35 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 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 { shallow } from 'enzyme'; +import * as React from 'react'; +import { mockComponent } from '../../../../helpers/testMocks'; +import DoneNextSteps, { DoneNextStepsProps } from '../DoneNextSteps'; + +it('should render correctly', () => { + expect(shallowRender()).toMatchSnapshot('default'); + expect( + shallowRender({ component: mockComponent({ configuration: { showSettings: true } }) }) + ).toMatchSnapshot('project admin'); +}); + +function shallowRender(props: Partial = {}) { + return shallow(); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap new file mode 100644 index 00000000000..0b6489a943d --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap @@ -0,0 +1,158 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly: default 1`] = ` + +
+

+ + onboarding.analysis.auto_refresh_after_analysis.done + + + onboarding.analysis.auto_refresh_after_analysis.auto_refresh +

+

+ + onboarding.analysis.auto_refresh_after_analysis.set_up_pr_deco_and_ci.see_tutorials + , + } + } + /> +

+

+ + onboarding.analysis.auto_refresh_after_analysis.check_these_links.branches + , + "link_pr_analysis": + onboarding.analysis.auto_refresh_after_analysis.check_these_links.pr_analysis + , + } + } + /> +

+
+`; + +exports[`should render correctly: project admin 1`] = ` + +
+

+ + onboarding.analysis.auto_refresh_after_analysis.done + + + onboarding.analysis.auto_refresh_after_analysis.auto_refresh +

+

+ + onboarding.analysis.auto_refresh_after_analysis.set_up_pr_deco_and_ci.project_settings + , + "link_see_tutorials": + onboarding.analysis.auto_refresh_after_analysis.set_up_pr_deco_and_ci.see_tutorials + , + } + } + /> +

+

+ + onboarding.analysis.auto_refresh_after_analysis.check_these_links.branches + , + "link_pr_analysis": + onboarding.analysis.auto_refresh_after_analysis.check_these_links.pr_analysis + , + } + } + /> +

+
+`; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/AnalysisCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/AnalysisCommand.tsx index e679a08c2fc..1cb28a011d1 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/AnalysisCommand.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/AnalysisCommand.tsx @@ -40,26 +40,25 @@ export default function AnalysisCommand(props: AnalysisCommandProps) { } const host = getHostUrl(); - const projectKey = component.key; switch (languageConfig.buildTool) { case BuildTools.Maven: - return ; + return ; case BuildTools.Gradle: - return ; + return ; case BuildTools.DotNet: - return ; + return ; case BuildTools.CFamily: return languageConfig.os !== undefined ? ( - + ) : null; case BuildTools.Other: return languageConfig.os !== undefined ? ( - + ) : null; default: diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/ClangGCCCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/ClangGCCCommand.tsx index 1fc693c4cc0..a49fed27b0d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/ClangGCCCommand.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/ClangGCCCommand.tsx @@ -25,21 +25,21 @@ import ExecBuildWrapper from './ExecBuildWrapper'; import ExecScanner from './ExecScanner'; export interface ClangGCCCustomProps { + component: T.Component; host: string; os: OSs; - projectKey: string; token: string; } export default function ClangGCCCustom(props: ClangGCCCustomProps) { - const { os, host, projectKey, token } = props; + const { os, host, component, token } = props; return (
- +
); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNet.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNet.tsx index 03956c08f93..1ba53cf6225 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNet.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNet.tsx @@ -23,8 +23,8 @@ import DotNetCore from './DotNetCore'; import DotNetFramework from './DotNetFramework'; export interface DotNetProps { + component: T.Component; host: string; - projectKey: string; token: string; } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetCore.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetCore.tsx index d667ced97e2..9d74fe62b43 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetCore.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetCore.tsx @@ -26,10 +26,10 @@ import { DotNetProps } from './DotNet'; import DotNetExecute from './DotNetExecute'; export default function DotNetCore(props: DotNetProps) { - const { host, projectKey, token } = props; + const { host, component, token } = props; const commands = [ - `dotnet sonarscanner begin /k:"${projectKey}" /d:sonar.host.url="${host}" /d:sonar.login="${token}"`, + `dotnet sonarscanner begin /k:"${component.key}" /d:sonar.host.url="${host}" /d:sonar.login="${token}"`, 'dotnet build', `dotnet sonarscanner end /d:sonar.login="${token}"` ]; @@ -46,7 +46,7 @@ export default function DotNetCore(props: DotNetProps) { {translate('onboarding.analysis.dotnetcore.global.text.path')} - + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetExecute.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetExecute.tsx index ec2e272d8a8..56091251a9a 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetExecute.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetExecute.tsx @@ -24,12 +24,14 @@ import { Link } from 'react-router'; import { translate } from 'sonar-ui-common/helpers/l10n'; import CodeSnippet from '../../../common/CodeSnippet'; import InstanceMessage from '../../../common/InstanceMessage'; +import DoneNextSteps from '../DoneNextSteps'; export interface DotNetExecuteProps { commands: string[]; + component: T.Component; } -export default function DotNetExecute({ commands }: DotNetExecuteProps) { +export default function DotNetExecute({ commands, component }: DotNetExecuteProps) { return ( <>

@@ -55,6 +57,7 @@ export default function DotNetExecute({ commands }: DotNetExecuteProps) { }} />

+ ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetFramework.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetFramework.tsx index 0ead421f64b..2542db69702 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetFramework.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetFramework.tsx @@ -24,10 +24,10 @@ import { DotNetProps } from './DotNet'; import DotNetExecute from './DotNetExecute'; export default function DotNetFramework(props: DotNetProps) { - const { host, projectKey, token } = props; + const { host, component, token } = props; const commands = [ - `SonarScanner.MSBuild.exe begin /k:"${projectKey}" /d:sonar.host.url="${host}" /d:sonar.login="${token}"`, + `SonarScanner.MSBuild.exe begin /k:"${component.key}" /d:sonar.host.url="${host}" /d:sonar.login="${token}"`, 'MsBuild.exe /t:Rebuild', `SonarScanner.MSBuild.exe end /d:sonar.login="${token}"` ]; @@ -57,7 +57,7 @@ export default function DotNetFramework(props: DotNetProps) {

- + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecScanner.tsx index cc595bb0d03..a3c2083ec34 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecScanner.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecScanner.tsx @@ -25,22 +25,23 @@ import CodeSnippet from '../../../common/CodeSnippet'; import InstanceMessage from '../../../common/InstanceMessage'; import { OSs } from '../../types'; import { quote } from '../../utils'; +import DoneNextSteps from '../DoneNextSteps'; export interface ExecScannerProps { + component: T.Component; host: string; os: OSs; - projectKey: string; token: string; cfamily?: boolean; } export default function ExecScanner(props: ExecScannerProps) { - const { host, os, projectKey, token, cfamily } = props; + const { host, os, component, token, cfamily } = props; const q = quote(os); const command = [ os === OSs.Windows ? 'sonar-scanner.bat' : 'sonar-scanner', - '-D' + q(`sonar.projectKey=${projectKey}`), + '-D' + q(`sonar.projectKey=${component.key}`), '-D' + q('sonar.sources=.'), cfamily ? '-D' + q('sonar.cfamily.build-wrapper-output=bw-output') : undefined, '-D' + q(`sonar.host.url=${host}`), @@ -69,9 +70,7 @@ export default function ExecScanner(props: ExecScannerProps) { }} />

-

- {translate('onboarding.analysis.auto_refresh_after_analysis')} -

+ ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaGradle.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaGradle.tsx index 16fc994a8f4..773148047c2 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaGradle.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaGradle.tsx @@ -23,20 +23,21 @@ import { Link } from 'react-router'; import { translate } from 'sonar-ui-common/helpers/l10n'; import CodeSnippet from '../../../common/CodeSnippet'; import InstanceMessage from '../../../common/InstanceMessage'; +import DoneNextSteps from '../DoneNextSteps'; export interface JavaGradleProps { + component: T.Component; host: string; - projectKey: string; token: string; } export default function JavaGradle(props: JavaGradleProps) { - const { host, projectKey, token } = props; + const { host, component, token } = props; const config = 'plugins {\n id "org.sonarqube" version "3.3"\n}'; const command = [ './gradlew sonarqube', - `-Dsonar.projectKey=${projectKey}`, + `-Dsonar.projectKey=${component.key}`, `-Dsonar.host.url=${host}`, `-Dsonar.login=${token}` ]; @@ -91,9 +92,7 @@ export default function JavaGradle(props: JavaGradleProps) { }} />

-

- {translate('onboarding.analysis.auto_refresh_after_analysis')} -

+ ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaMaven.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaMaven.tsx index 7a9b4b6849d..d6e00ac2fbf 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaMaven.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaMaven.tsx @@ -23,18 +23,19 @@ import { Link } from 'react-router'; import { translate } from 'sonar-ui-common/helpers/l10n'; import CodeSnippet from '../../../common/CodeSnippet'; import InstanceMessage from '../../../common/InstanceMessage'; +import DoneNextSteps from '../DoneNextSteps'; export interface JavaMavenProps { + component: T.Component; host: string; - projectKey: string; token: string; } export default function JavaMaven(props: JavaMavenProps) { - const { host, projectKey, token } = props; + const { host, component, token } = props; const command = [ 'mvn sonar:sonar', - `-Dsonar.projectKey=${projectKey}`, + `-Dsonar.projectKey=${component.key}`, `-Dsonar.host.url=${host}`, `-Dsonar.login=${token}` ]; @@ -59,9 +60,7 @@ export default function JavaMaven(props: JavaMavenProps) { }} />

-

- {translate('onboarding.analysis.auto_refresh_after_analysis')} -

+ ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/Other.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/Other.tsx index 7db9c3880bb..ac53a410e21 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/Other.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/Other.tsx @@ -23,19 +23,19 @@ import DownloadScanner from './DownloadScanner'; import ExecScanner from './ExecScanner'; export interface OtherProps { + component: T.Component; host: string; os: OSs; - projectKey: string; token: string; } export default function Other(props: OtherProps) { - const { host, os, projectKey, token } = props; + const { host, os, component, token } = props; return (
- +
); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/CLangGCCCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/CLangGCCCommand-test.tsx index d35ea6ba31e..574c5fbb785 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/CLangGCCCommand-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/CLangGCCCommand-test.tsx @@ -19,11 +19,19 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../../helpers/testMocks'; import { OSs } from '../../../types'; import ClangGCCCommand from '../ClangGCCCommand'; -it('Shoud renders correctly', () => { +it('should render correctly', () => { expect( - shallow() + shallow( + + ) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx index dd5408d54eb..86e50f914ba 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx @@ -19,8 +19,11 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../../helpers/testMocks'; import DotNet from '../DotNet'; -it('Should renders correctly', () => { - expect(shallow()).toMatchSnapshot(); +it('should render correctly', () => { + expect( + shallow() + ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetExecute-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetExecute-test.tsx index 5a3693177d5..563cae7b1ab 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetExecute-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetExecute-test.tsx @@ -19,8 +19,11 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../../helpers/testMocks'; import DotNetExecute from '../DotNetExecute'; -it('Should renders correctly', () => { - expect(shallow()).toMatchSnapshot(); +it('should render correctly', () => { + expect( + shallow() + ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetFramework-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetFramework-test.tsx index a6c1d5c3dbf..e2cfce486d8 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetFramework-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetFramework-test.tsx @@ -19,10 +19,13 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../../helpers/testMocks'; import DotNetFramework from '../DotNetFramework'; -it('Should renders correctly', () => { +it('should render correctly', () => { expect( - shallow() + shallow( + + ) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotnetCore-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotnetCore-test.tsx index 1de261193b9..ecf1c268cee 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotnetCore-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotnetCore-test.tsx @@ -19,10 +19,13 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../../helpers/testMocks'; import DotNetCore from '../DotNetCore'; -it('Should renders correctly', () => { +it('should render correctly', () => { expect( - shallow() + shallow( + + ) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecScanner-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecScanner-test.tsx index 02c3feefe19..9f9ccd1d23b 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecScanner-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecScanner-test.tsx @@ -19,19 +19,26 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../../helpers/testMocks'; import { OSs } from '../../../types'; import ExecScanner, { ExecScannerProps } from '../ExecScanner'; -it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('Shoud renders for %p correctly', os => { +it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('should render correctly for %p', os => { expect(shallowRender({ os })).toMatchSnapshot(); }); -it('Should render for cfamily', () => { +it('should render correctly for cfamily', () => { expect(shallowRender({ cfamily: true })).toMatchSnapshot(); }); function shallowRender(props: Partial = {}) { return shallow( - + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx index 917f279493b..e9f868da12a 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx @@ -19,10 +19,13 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../../helpers/testMocks'; import JavaGradle from '../JavaGradle'; it('renders correctly', () => { expect( - shallow() + shallow( + + ) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx index eddbb1df1e8..054fa94df61 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx @@ -19,10 +19,13 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../../helpers/testMocks'; import JavaMaven from '../JavaMaven'; it('renders correctly', () => { expect( - shallow() + shallow( + + ) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx index 751a95f8cd5..db6f85490ed 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx @@ -19,6 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../../helpers/testMocks'; import { OSs } from '../../../types'; import Other, { OtherProps } from '../Other'; @@ -28,6 +29,12 @@ it('renders correctly', () => { function shallowRender(props: Partial = {}) { return shallow( - + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap index 2df0e23b2b8..c33c2b7b140 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap @@ -2,17 +2,59 @@ exports[`renders correctly: .NET 1`] = ` `; exports[`renders correctly: CFamily 1`] = ` `; @@ -21,25 +63,88 @@ exports[`renders correctly: Empty CFamily 1`] = `""`; exports[`renders correctly: gradle 1`] = ` `; exports[`renders correctly: maven 1`] = ` `; exports[`renders correctly: other 1`] = ` `; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/CLangGCCCommand-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/CLangGCCCommand-test.tsx.snap index 7539b8cf22d..b4cb5128d1b 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/CLangGCCCommand-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/CLangGCCCommand-test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Shoud renders correctly 1`] = ` +exports[`should render correctly 1`] = `
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNet-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNet-test.tsx.snap index a322725aec2..b88033c45f5 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNet-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNet-test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Should renders correctly 1`] = ` +exports[`should render correctly 1`] = ` diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap index bc623435f01..7ff51cbcb67 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Should renders correctly 1`] = ` +exports[`should render correctly 1`] = `

+ `; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap index 986272b490d..13edb7d7370 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Should renders correctly 1`] = ` +exports[`should render correctly 1`] = `

`; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotnetCore-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotnetCore-test.tsx.snap index 5621eab6cad..73c108fd1a2 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotnetCore-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotnetCore-test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Should renders correctly 1`] = ` +exports[`should render correctly 1`] = `

`; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap index 140fe68ea6a..b48bd7b66eb 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Shoud renders for "linux" correctly 1`] = ` +exports[`should render correctly for "linux" 1`] = `

-

- onboarding.analysis.auto_refresh_after_analysis -

+

`; -exports[`Shoud renders for "mac" correctly 1`] = ` +exports[`should render correctly for "mac" 1`] = `

-

- onboarding.analysis.auto_refresh_after_analysis -

+

`; -exports[`Shoud renders for "win" correctly 1`] = ` +exports[`should render correctly for "win" 1`] = `

-

- onboarding.analysis.auto_refresh_after_analysis -

+

`; -exports[`Should render for cfamily 1`] = ` +exports[`should render correctly for cfamily 1`] = `

-

- onboarding.analysis.auto_refresh_after_analysis -

+

`; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap index b93775bcc24..9737f0a58df 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap @@ -76,10 +76,29 @@ exports[`renders correctly 1`] = ` } />

-

- onboarding.analysis.auto_refresh_after_analysis -

+
`; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap index 2482e1d3457..aafc6e3517e 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap @@ -44,10 +44,29 @@ exports[`renders correctly 1`] = ` } />

-

- onboarding.analysis.auto_refresh_after_analysis -

+ `; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap index 2d3b3086434..bea3152d2d9 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap @@ -6,9 +6,30 @@ exports[`renders correctly 1`] = ` os="linux" /> diff --git a/server/sonar-web/src/main/js/components/tutorials/types.ts b/server/sonar-web/src/main/js/components/tutorials/types.ts index 364d8886ab5..cd79f043667 100644 --- a/server/sonar-web/src/main/js/components/tutorials/types.ts +++ b/server/sonar-web/src/main/js/components/tutorials/types.ts @@ -23,7 +23,8 @@ export enum TutorialModes { BitbucketPipelines = 'bitbucket-pipelines', GitLabCI = 'gitlab-ci', GitHubActions = 'github-actions', - AzurePipelines = 'azure-pipelines' + AzurePipelines = 'azure-pipelines', + OtherCI = 'other-ci' } export enum BuildTools { diff --git a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts index bed9b1df8fb..de610e43f4e 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { AlmKeys } from '../../types/alm-settings'; import { ComponentQualifier } from '../../types/component'; import { IssueType } from '../../types/issues'; import { @@ -25,7 +26,9 @@ import { getComponentIssuesUrl, getComponentOverviewUrl, getComponentSecurityHotspotsUrl, + getGlobalSettingsUrl, getIssuesUrl, + getProjectSettingsUrl, getQualityGatesUrl, getQualityGateUrl, stripTrailingSlash @@ -67,7 +70,7 @@ describe('#getComponentIssuesUrl', () => { }); }); -describe('getComponentSecurityHotspotsUrl', () => { +describe('#getComponentSecurityHotspotsUrl', () => { it('should work with no extra parameters', () => { expect(getComponentSecurityHotspotsUrl(SIMPLE_COMPONENT_KEY, {})).toEqual({ pathname: '/security_hotspots', @@ -88,7 +91,7 @@ describe('getComponentSecurityHotspotsUrl', () => { }); }); -describe('getComponentOverviewUrl', () => { +describe('#getComponentOverviewUrl', () => { it('should return a portfolio url for a portfolio', () => { expect(getComponentOverviewUrl(SIMPLE_COMPONENT_KEY, ComponentQualifier.Portfolio)).toEqual({ pathname: '/portfolio', @@ -142,7 +145,7 @@ describe('#getQualityGate(s)Url', () => { }); }); -describe('getIssuesUrl', () => { +describe('#getIssuesUrl', () => { it('should work as expected', () => { const type = IssueType.Bug; expect(getIssuesUrl({ type })).toEqual({ @@ -151,3 +154,29 @@ describe('getIssuesUrl', () => { }); }); }); + +describe('#getGlobalSettingsUrl', () => { + it('should work as expected', () => { + expect(getGlobalSettingsUrl('foo')).toEqual({ + pathname: '/admin/settings', + query: { category: 'foo' } + }); + expect(getGlobalSettingsUrl('foo', { alm: AlmKeys.GitHub })).toEqual({ + pathname: '/admin/settings', + query: { category: 'foo', alm: AlmKeys.GitHub } + }); + }); +}); + +describe('#getProjectSettingsUrl', () => { + it('should work as expected', () => { + expect(getProjectSettingsUrl('foo')).toEqual({ + pathname: '/project/settings', + query: { id: 'foo' } + }); + expect(getProjectSettingsUrl('foo', 'bar')).toEqual({ + pathname: '/project/settings', + query: { id: 'foo', category: 'bar' } + }); + }); +}); diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts index 1adb6ee8ec6..992c0f76a90 100644 --- a/server/sonar-web/src/main/js/helpers/urls.ts +++ b/server/sonar-web/src/main/js/helpers/urls.ts @@ -221,6 +221,23 @@ export function getQualityGatesUrl(): Location { }; } +export function getGlobalSettingsUrl( + category?: string, + query?: T.Dict +): Location { + return { + pathname: '/admin/settings', + query: { category, ...query } + }; +} + +export function getProjectSettingsUrl(id: string, category?: string): Location { + return { + pathname: '/project/settings', + query: { id, category } + }; +} + /** * Generate URL for the rules page */ 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 8653a010414..496f4b491c4 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3366,7 +3366,15 @@ onboarding.tutorial.env_variables.field=Value onboarding.tutorial.env_variables.token_generator.value=an existing token, or a newly generated one: onboarding.analysis.header=Run analysis on your project -onboarding.analysis.auto_refresh_after_analysis=Once the analysis is completed, this page will automatically refresh and you will be able to browse the analysis results. +onboarding.analysis.auto_refresh_after_analysis.done=Is my analysis done? +onboarding.analysis.auto_refresh_after_analysis.auto_refresh=If your analysis is successful, this page will automatically refresh in a few moments. +onboarding.analysis.auto_refresh_after_analysis.set_up_pr_deco_and_ci.admin=You can set up Pull Request Decoration under the {link_project_settings}. To set up analysis with your favorite CI tool, {link_see_tutorials}. +onboarding.analysis.auto_refresh_after_analysis.set_up_pr_deco_and_ci=You can request from a project administrator to set up Pull Request Decoration. To set up analysis with your favorite CI tool, {link_see_tutorials}. +onboarding.analysis.auto_refresh_after_analysis.set_up_pr_deco_and_ci.project_settings=project settings +onboarding.analysis.auto_refresh_after_analysis.set_up_pr_deco_and_ci.see_tutorials=see the tutorials +onboarding.analysis.auto_refresh_after_analysis.check_these_links=Check these useful links while you wait: {link_branches}, {link_pr_analysis}. +onboarding.analysis.auto_refresh_after_analysis.check_these_links.pr_analysis=Pull Request Analysis +onboarding.analysis.auto_refresh_after_analysis.check_these_links.branches=Branch Analysis onboarding.build=What option best describes your build? onboarding.build.maven=Maven @@ -3400,7 +3408,7 @@ onboarding.analysis.build_wrapper.docs=Please visit the {link} of the Build Wra onboarding.analysis.build_wrapper.docs_link=official documentation -onboarding.analysis.java.maven.header=Execute the Scanner for Maven from your computer +onboarding.analysis.java.maven.header=Execute the Scanner for Maven onboarding.analysis.java.maven.header.ci=Execute the Scanner for Maven from your CI onboarding.analysis.java.maven.text=Running a {instance} analysis with Maven is straighforward. You just need to run the following command in your project's folder. onboarding.analysis.java.maven.docs_link=official documentation of the Scanner for Maven @@ -3409,7 +3417,7 @@ onboarding.analysis.java.maven.text.custom.ci=Run the following command in the p onboarding.analysis.java.maven.header.sonarcloud=Execute the Scanner for Maven from Travis onboarding.analysis.java.maven.text.sonarcloud=Add the following lines to your .travis.yml file: -onboarding.analysis.java.gradle.header=Execute the Scanner for Gradle from your computer +onboarding.analysis.java.gradle.header=Execute the Scanner for Gradle onboarding.analysis.java.gradle.header.ci=Execute the Scanner for Gradle from your CI onboarding.analysis.java.gradle.text.1=Running an analysis with Gradle is straighforward. You just need to declare the {plugin_code} plugin in your {filename} file: onboarding.analysis.java.gradle.text.2=and run the following command: @@ -3421,7 +3429,7 @@ onboarding.analysis.java.gradle.text.2.sonarcloud=and add the following lines to onboarding.analysis.msbuild.header=Download and unzip the Scanner for .NET onboarding.analysis.msbuild.text=Visit the {link} to download the latest version, and add the executable's directory to the {code} environment variable -onboarding.analysis.msbuild.execute=Execute the Scanner for .NET from your computer +onboarding.analysis.msbuild.execute=Execute the Scanner for .NET onboarding.analysis.msbuild.execute.text=Running a {instance} analysis is straighforward. You just need to execute the following commands at the root of your solution. onboarding.analysis.msbuild.docs_link=official documentation of the Scanner for .NET @@ -3429,7 +3437,7 @@ onboarding.analysis.sq_scanner.header.linux=Download and unzip the Scanner for L onboarding.analysis.sq_scanner.header.win=Download and unzip the Scanner for Windows onboarding.analysis.sq_scanner.header.mac=Download and unzip the Scanner for macOS onboarding.analysis.sq_scanner.text=Visit the {link} to download the latest version, and add the {dir} directory to the {env_var} environment variable -onboarding.analysis.sq_scanner.execute=Execute the Scanner from your computer +onboarding.analysis.sq_scanner.execute=Execute the Scanner onboarding.analysis.sq_scanner.execute.text=Running a {instance} analysis is straighforward. You just need to execute the following commands in your project's folder. onboarding.analysis.sq_scanner.execute.text.custom=Run the following commands in your project's folder. onboarding.analysis.sq_scanner.docs=Please visit the {link} for more details. @@ -3453,12 +3461,13 @@ onboarding.tutorial.ci_outro.refresh.why=If the page doesn't refresh after a whi onboarding.tutorial.other.project_key.sentence=Create a {file} file in your repository and paste the following code: onboarding.tutorial.choose_method=How do you want to analyze your repository? -onboarding.tutorial.choose_method.manual=Manually +onboarding.tutorial.choose_method.manual=Locally +onboarding.tutorial.choose_method.other-ci=Other CI onboarding.tutorial.choose_method.jenkins=With Jenkins -onboarding.tutorial.choose_method.github_action=With GitHub Actions -onboarding.tutorial.choose_method.gitlab_ci=With GitLab CI -onboarding.tutorial.choose_method.azure_pipelines=With Azure Pipelines -onboarding.tutorial.choose_method.bitbucket_pipelines=With Bitbucket Pipelines +onboarding.tutorial.choose_method.github-actions=With GitHub Actions +onboarding.tutorial.choose_method.gitlab-ci=With GitLab CI +onboarding.tutorial.choose_method.azure-pipelines=With Azure Pipelines +onboarding.tutorial.choose_method.bitbucket-pipelines=With Bitbucket Pipelines onboarding.tutorial.with.yaml.maven.pom=Update your {pom} file with the following properties: