diff options
author | Wouter Admiraal <wouter.admiraal@sonarsource.com> | 2022-07-14 11:05:30 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-07-15 20:02:52 +0000 |
commit | d1b0f4f844124a8626af208fc13ff2087ee83075 (patch) | |
tree | 5e776a817a55cc5c4566e558580f1a14d0ad7978 | |
parent | ffcdb2e52f520482ff2c97f15e3db62566c2600f (diff) | |
download | sonarqube-d1b0f4f844124a8626af208fc13ff2087ee83075.tar.gz sonarqube-d1b0f4f844124a8626af208fc13ff2087ee83075.zip |
SONAR-15105 Add download scripts for Other CI tutorials
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx | 21 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-test.tsx | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelectionRenderer-test.tsx | 22 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/__tests__/__snapshots__/TutorialSelectionRenderer-test.tsx.snap | 34 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/manual/commands/DownloadBuildWrapper.tsx | 62 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/manual/commands/DownloadScanner.tsx | 54 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap | 106 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/BuildToolForm.tsx) | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/DoneNextSteps.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/OtherTutorial.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/ManualTutorial.tsx) | 10 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/ProjectAnalysisStep.tsx) | 13 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/TokenStep.tsx) | 8 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/BuildToolForm-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/BuildToolForm-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/DoneNextSteps-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/DoneNextSteps-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ManualTutorial-test.tsx) | 13 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/ProjectAnalysisStep-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ProjectAnalysisStep-test.tsx) | 10 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/TokenStep-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/TokenStep-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/BuildToolForm-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/BuildToolForm-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/ManualTutorial-test.tsx.snap) | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/ProjectAnalysisStep-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/ProjectAnalysisStep-test.tsx.snap) | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/TokenStep-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/TokenStep-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/AnalysisCommand.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/AnalysisCommand.tsx) | 21 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/ClangGCCCommand.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/ClangGCCCommand.tsx) | 17 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/DotNet.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNet.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetCore.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetCore.tsx) | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetExecute.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetFramework.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadBuildWrapper.tsx | 88 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx | 105 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecBuildWrapper.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecScanner.tsx) | 7 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaGradle.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaMaven.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/Other.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/Other.tsx) | 7 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/AnalysisCommand-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/AnalysisCommand-test.tsx) | 9 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/CLangGCCCommand-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/CLangGCCCommand-test.tsx) | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DotNet-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DotNetExecute-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetExecute-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DotNetFramework-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetFramework-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DotnetCore-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotnetCore-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadBuildWrapper-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DownloadBuildWrapper-test.tsx) | 13 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadScanner-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DownloadScanner-test.tsx) | 13 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecBuildWrapper-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecBuildWrapper-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecScanner-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecScanner-test.tsx) | 5 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/JavaGradle-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/JavaMaven-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/Other-test.tsx (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx) | 1 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap) | 3 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/CLangGCCCommand-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/CLangGCCCommand-test.tsx.snap) | 5 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNet-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNet-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotnetCore-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotnetCore-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadBuildWrapper-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DownloadBuildWrapper-test.tsx.snap) | 64 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap | 279 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap) | 78 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/Other-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap) | 3 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/tutorials/types.ts | 2 | ||||
-rw-r--r-- | sonar-core/src/main/resources/org/sonar/l10n/core.properties | 7 |
64 files changed, 791 insertions, 307 deletions
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 b0302f3d681..2370fa05b45 100644 --- a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx @@ -30,7 +30,7 @@ import BitbucketPipelinesTutorial from './bitbucket-pipelines/BitbucketPipelines import GitHubActionTutorial from './github-action/GitHubActionTutorial'; import GitLabCITutorial from './gitlabci/GitLabCITutorial'; import JenkinsTutorial from './jenkins/JenkinsTutorial'; -import ManualTutorial from './manual/ManualTutorial'; +import OtherTutorial from './other/OtherTutorial'; import { TutorialModes } from './types'; export interface TutorialSelectionRendererProps { @@ -59,7 +59,7 @@ function renderButton( className={`button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-${mode}`} // Currently, OtherCI is the same tutorial as Manual. We might update it to its own stand-alone // tutorial in the future. - onClick={() => onSelectTutorial(mode === TutorialModes.OtherCI ? TutorialModes.Manual : mode)} + onClick={() => onSelectTutorial(mode)} type="button"> {icon} <div className="medium big-spacer-top"> @@ -186,11 +186,11 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender </div> <p className="big-spacer-bottom spacer-top"> - {translate('onboarding.tutorial.choose_method.locally.description')} + {translate('onboarding.tutorial.choose_method.local.description')} </p> <div> {renderButton( - TutorialModes.Manual, + TutorialModes.Local, props.onSelectTutorial, <img alt="" // Should be ignored by screen readers @@ -203,8 +203,17 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender </> )} - {selectedTutorial === TutorialModes.Manual && ( - <ManualTutorial component={component} currentUser={currentUser} /> + {selectedTutorial === TutorialModes.Local && ( + <OtherTutorial + component={component} + baseUrl={baseUrl} + isLocal={true} + currentUser={currentUser} + /> + )} + + {selectedTutorial === TutorialModes.OtherCI && ( + <OtherTutorial component={component} baseUrl={baseUrl} currentUser={currentUser} /> )} {selectedTutorial === TutorialModes.BitbucketPipelines && ( diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-test.tsx b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-test.tsx index 5e3e0c73a79..5cbf3a11a69 100644 --- a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-test.tsx @@ -74,10 +74,10 @@ it('should handle selection', () => { const wrapper = shallowRender({ router: mockRouter({ push }) }); const instance = wrapper.instance(); - instance.handleSelectTutorial(TutorialModes.Manual); + instance.handleSelectTutorial(TutorialModes.Local); expect(push).toHaveBeenLastCalledWith( expect.objectContaining({ - query: { selectedTutorial: TutorialModes.Manual } + query: { selectedTutorial: TutorialModes.Local } }) ); 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 6f2839a61da..b9200fbe082 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 @@ -47,7 +47,7 @@ it.each([ it('should render correctly', () => { expect(shallowRender()).toMatchSnapshot('selection'); expect(shallowRender({ loading: true })).toMatchSnapshot('loading'); - expect(shallowRender({ selectedTutorial: TutorialModes.Manual })).toMatchSnapshot( + expect(shallowRender({ selectedTutorial: TutorialModes.Local })).toMatchSnapshot( 'manual tutorial' ); expect( @@ -89,8 +89,8 @@ it('should allow mode selection for Bitbucket', () => { click(wrapper.find('button.tutorial-mode-jenkins')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Jenkins); - click(wrapper.find('button.tutorial-mode-manual')); - expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Manual); + click(wrapper.find('button.tutorial-mode-local')); + expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Local); }); it('should allow mode selection for Github', () => { @@ -103,8 +103,8 @@ it('should allow mode selection for Github', () => { click(wrapper.find('button.tutorial-mode-jenkins')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Jenkins); - click(wrapper.find('button.tutorial-mode-manual')); - expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Manual); + click(wrapper.find('button.tutorial-mode-local')); + expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Local); click(wrapper.find('button.tutorial-mode-github-actions')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.GitHubActions); @@ -126,8 +126,8 @@ it('should allow mode selection for GitLab', () => { click(wrapper.find('button.tutorial-mode-gitlab-ci')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.GitLabCI); - click(wrapper.find('button.tutorial-mode-manual')); - expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Manual); + click(wrapper.find('button.tutorial-mode-local')); + expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Local); }); it('should allow mode selection for Bitbucket pipepline', () => { @@ -143,8 +143,8 @@ it('should allow mode selection for Bitbucket pipepline', () => { click(wrapper.find('button.tutorial-mode-bitbucket-pipelines')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.BitbucketPipelines); - click(wrapper.find('button.tutorial-mode-manual')); - expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Manual); + click(wrapper.find('button.tutorial-mode-local')); + expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Local); }); it('should allow mode selection for Azure DevOps', () => { @@ -157,8 +157,8 @@ it('should allow mode selection for Azure DevOps', () => { click(wrapper.find('button.tutorial-mode-azure-pipelines')); expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.AzurePipelines); - click(wrapper.find('button.tutorial-mode-manual')); - expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Manual); + click(wrapper.find('button.tutorial-mode-local')); + expect(onSelectTutorial).toHaveBeenLastCalledWith(TutorialModes.Local); }); function shallowRender(props: Partial<TutorialSelectionRendererProps> = {}) { 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 c8591f265ee..28cd916f7a1 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 @@ -52,11 +52,11 @@ exports[`should render correctly for azure 1`] = ` <p className="big-spacer-bottom spacer-top" > - onboarding.tutorial.choose_method.locally.description + onboarding.tutorial.choose_method.local.description </p> <div> <button - className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-manual" + className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-local" onClick={[Function]} type="button" > @@ -68,7 +68,7 @@ exports[`should render correctly for azure 1`] = ` <div className="medium big-spacer-top" > - onboarding.tutorial.choose_method.manual + onboarding.tutorial.choose_method.local </div> </button> </div> @@ -128,11 +128,11 @@ exports[`should render correctly for bitbucket server 1`] = ` <p className="big-spacer-bottom spacer-top" > - onboarding.tutorial.choose_method.locally.description + onboarding.tutorial.choose_method.local.description </p> <div> <button - className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-manual" + className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-local" onClick={[Function]} type="button" > @@ -144,7 +144,7 @@ exports[`should render correctly for bitbucket server 1`] = ` <div className="medium big-spacer-top" > - onboarding.tutorial.choose_method.manual + onboarding.tutorial.choose_method.local </div> </button> </div> @@ -237,11 +237,11 @@ exports[`should render correctly for github 1`] = ` <p className="big-spacer-bottom spacer-top" > - onboarding.tutorial.choose_method.locally.description + onboarding.tutorial.choose_method.local.description </p> <div> <button - className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-manual" + className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-local" onClick={[Function]} type="button" > @@ -253,7 +253,7 @@ exports[`should render correctly for github 1`] = ` <div className="medium big-spacer-top" > - onboarding.tutorial.choose_method.manual + onboarding.tutorial.choose_method.local </div> </button> </div> @@ -329,11 +329,11 @@ exports[`should render correctly for gitlab 1`] = ` <p className="big-spacer-bottom spacer-top" > - onboarding.tutorial.choose_method.locally.description + onboarding.tutorial.choose_method.local.description </p> <div> <button - className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-manual" + className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-local" onClick={[Function]} type="button" > @@ -345,7 +345,7 @@ exports[`should render correctly for gitlab 1`] = ` <div className="medium big-spacer-top" > - onboarding.tutorial.choose_method.manual + onboarding.tutorial.choose_method.local </div> </button> </div> @@ -547,7 +547,8 @@ exports[`should render correctly: loading 1`] = ` exports[`should render correctly: manual tutorial 1`] = ` <Fragment> - <ManualTutorial + <OtherTutorial + baseUrl="http://localhost:9000" component={ Object { "breadcrumbs": Array [], @@ -582,6 +583,7 @@ exports[`should render correctly: manual tutorial 1`] = ` "scmAccounts": Array [], } } + isLocal={true} /> </Fragment> `; @@ -703,11 +705,11 @@ exports[`should render correctly: selection 1`] = ` <p className="big-spacer-bottom spacer-top" > - onboarding.tutorial.choose_method.locally.description + onboarding.tutorial.choose_method.local.description </p> <div> <button - className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-manual" + className="button button-huge display-flex-column big-spacer-right big-spacer-bottom tutorial-mode-local" onClick={[Function]} type="button" > @@ -719,7 +721,7 @@ exports[`should render correctly: selection 1`] = ` <div className="medium big-spacer-top" > - onboarding.tutorial.choose_method.manual + onboarding.tutorial.choose_method.local </div> </button> </div> diff --git a/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx b/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx index b145f9c2de9..57925ce1208 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx @@ -42,7 +42,7 @@ const CI_SEARCH_MAP = { [TutorialModes.GitHubActions]: 'gh-actions', [TutorialModes.GitLabCI]: 'gitlab', [TutorialModes.BitbucketPipelines]: 'bitbucket', - [TutorialModes.Manual]: 'otherci', + [TutorialModes.Local]: 'otherci', [TutorialModes.OtherCI]: 'otherci' }; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DownloadBuildWrapper.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DownloadBuildWrapper.tsx deleted file mode 100644 index 34e64454f73..00000000000 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DownloadBuildWrapper.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 { translate } from '../../../../helpers/l10n'; -import { getBaseUrl } from '../../../../helpers/system'; -import { OSs } from '../../types'; - -export interface DownloadBuildWrapperProps { - os: OSs; -} - -const filenames: { [x in OSs]: string } = { - win: 'build-wrapper-win-x86.zip', - linux: 'build-wrapper-linux-x86.zip', - mac: 'build-wrapper-macosx-x86.zip' -}; - -export default function DownloadBuildWrapper(props: DownloadBuildWrapperProps) { - const { os } = props; - return ( - <div className="spacer-bottom"> - <h4 className="spacer-bottom">{translate('onboarding.analysis.build_wrapper.header', os)}</h4> - <p className="spacer-bottom markdown"> - <FormattedMessage - defaultMessage={translate('onboarding.analysis.build_wrapper.text')} - id="onboarding.analysis.build_wrapper.text" - values={{ - env_var: <code>{os === 'win' ? '%PATH%' : 'PATH'}</code> - }} - /> - </p> - <p> - <a - className="button" - download={filenames[os]} - href={`${getBaseUrl()}/static/cpp/${filenames[os]}`} - rel="noopener noreferrer" - target="_blank"> - {translate('download_verb')} - </a> - </p> - </div> - ); -} diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DownloadScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/DownloadScanner.tsx deleted file mode 100644 index d5583a9ef2f..00000000000 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DownloadScanner.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 { translate } from '../../../../helpers/l10n'; -import { OSs } from '../../types'; - -interface Props { - os: OSs; -} - -export default function DownloadScanner(props: Props) { - const { os } = props; - return ( - <div> - <h4 className="spacer-bottom">{translate('onboarding.analysis.sq_scanner.header', os)}</h4> - <p className="spacer-bottom markdown"> - <FormattedMessage - defaultMessage={translate('onboarding.analysis.sq_scanner.text')} - id="onboarding.analysis.sq_scanner.text" - values={{ - dir: <code>bin</code>, - env_var: <code>{os === OSs.Windows ? '%PATH%' : 'PATH'}</code>, - link: ( - <a - href="https://redirect.sonarsource.com/doc/download-scanner.html" - rel="noopener noreferrer" - target="_blank"> - {translate('onboarding.analysis.sq_scanner.docs_link')} - </a> - ) - }} - /> - </p> - </div> - ); -} diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap deleted file mode 100644 index 6b24f51e05c..00000000000 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap +++ /dev/null @@ -1,106 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Shoud renders for "linux" correctly 1`] = ` -<div> - <h4 - className="spacer-bottom" - > - onboarding.analysis.sq_scanner.header.linux - </h4> - <p - className="spacer-bottom markdown" - > - <FormattedMessage - defaultMessage="onboarding.analysis.sq_scanner.text" - id="onboarding.analysis.sq_scanner.text" - values={ - Object { - "dir": <code> - bin - </code>, - "env_var": <code> - PATH - </code>, - "link": <a - href="https://redirect.sonarsource.com/doc/download-scanner.html" - rel="noopener noreferrer" - target="_blank" - > - onboarding.analysis.sq_scanner.docs_link - </a>, - } - } - /> - </p> -</div> -`; - -exports[`Shoud renders for "mac" correctly 1`] = ` -<div> - <h4 - className="spacer-bottom" - > - onboarding.analysis.sq_scanner.header.mac - </h4> - <p - className="spacer-bottom markdown" - > - <FormattedMessage - defaultMessage="onboarding.analysis.sq_scanner.text" - id="onboarding.analysis.sq_scanner.text" - values={ - Object { - "dir": <code> - bin - </code>, - "env_var": <code> - PATH - </code>, - "link": <a - href="https://redirect.sonarsource.com/doc/download-scanner.html" - rel="noopener noreferrer" - target="_blank" - > - onboarding.analysis.sq_scanner.docs_link - </a>, - } - } - /> - </p> -</div> -`; - -exports[`Shoud renders for "win" correctly 1`] = ` -<div> - <h4 - className="spacer-bottom" - > - onboarding.analysis.sq_scanner.header.win - </h4> - <p - className="spacer-bottom markdown" - > - <FormattedMessage - defaultMessage="onboarding.analysis.sq_scanner.text" - id="onboarding.analysis.sq_scanner.text" - values={ - Object { - "dir": <code> - bin - </code>, - "env_var": <code> - %PATH% - </code>, - "link": <a - href="https://redirect.sonarsource.com/doc/download-scanner.html" - rel="noopener noreferrer" - target="_blank" - > - onboarding.analysis.sq_scanner.docs_link - </a>, - } - } - /> - </p> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/BuildToolForm.tsx b/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx index 86418844305..98e104205a5 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/BuildToolForm.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import RadioToggle from '../../../components/controls/RadioToggle'; import { translate } from '../../../helpers/l10n'; +import RadioToggle from '../../controls/RadioToggle'; import { withCLanguageFeature } from '../../hoc/withCLanguageFeature'; import GithubCFamilyExampleRepositories from '../components/GithubCFamilyExampleRepositories'; import RenderOptions from '../components/RenderOptions'; @@ -97,7 +97,7 @@ export class BuildToolForm extends React.PureComponent<Props, State> { <GithubCFamilyExampleRepositories className="big-spacer-top abs-width-600" os={config.os} - ci={TutorialModes.Manual} + ci={TutorialModes.Local} /> )} </> diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/DoneNextSteps.tsx b/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx index df037f76a29..df037f76a29 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/DoneNextSteps.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/ManualTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/other/OtherTutorial.tsx index 42254d34eae..171a395ac91 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/ManualTutorial.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/OtherTutorial.tsx @@ -33,6 +33,8 @@ export enum Steps { interface Props { component: Component; currentUser: LoggedInUser; + baseUrl: string; + isLocal?: boolean; } interface State { @@ -40,7 +42,7 @@ interface State { token?: string; } -export default class ManualTutorial extends React.PureComponent<Props, State> { +export default class OtherTutorial extends React.PureComponent<Props, State> { state: State = { step: Steps.TOKEN }; handleTokenDone = (token: string) => { @@ -52,7 +54,7 @@ export default class ManualTutorial extends React.PureComponent<Props, State> { }; render() { - const { component, currentUser } = this.props; + const { component, baseUrl, currentUser, isLocal = false } = this.props; const { step, token } = this.state; return ( @@ -77,9 +79,11 @@ export default class ManualTutorial extends React.PureComponent<Props, State> { <ProjectAnalysisStep component={component} + baseUrl={baseUrl} + isLocal={isLocal} open={step === Steps.ANALYSIS} - stepNumber={2} token={token} + stepNumber={2} /> </> ); diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/ProjectAnalysisStep.tsx b/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx index 1bf5d9c3fd7..98ebbf37097 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/ProjectAnalysisStep.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx @@ -29,7 +29,9 @@ interface Props { component: Component; onFinish?: (projectKey?: string) => void; open: boolean; + baseUrl: string; stepNumber: number; + isLocal: boolean; token?: string; } @@ -49,6 +51,7 @@ export default class ProjectAnalysisStep extends React.PureComponent<Props, Stat }; renderForm = () => { + const { component, baseUrl, isLocal, token } = this.props; return ( <div className="boxed-group-inner"> <div className="display-flex-column"> @@ -57,9 +60,11 @@ export default class ProjectAnalysisStep extends React.PureComponent<Props, Stat {this.state.config && ( <div className="big-spacer-top"> <AnalysisCommand - component={this.props.component} + component={component} + baseUrl={baseUrl} + isLocal={isLocal} languageConfig={this.state.config} - token={this.props.token} + token={token} /> </div> )} @@ -74,7 +79,9 @@ export default class ProjectAnalysisStep extends React.PureComponent<Props, Stat return ( <Step finished={false} - onOpen={() => {}} + onOpen={() => { + /* noop */ + }} open={this.props.open} renderForm={this.renderForm} renderResult={this.renderResult} diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/TokenStep.tsx b/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx index 80052f5a3f2..d6d90862506 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/TokenStep.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx @@ -21,9 +21,6 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; import { generateToken, getTokens, revokeToken } from '../../../api/user-tokens'; -import { Button, DeleteButton, SubmitButton } from '../../../components/controls/buttons'; -import Radio from '../../../components/controls/Radio'; -import AlertSuccessIcon from '../../../components/icons/AlertSuccessIcon'; import { translate } from '../../../helpers/l10n'; import { computeTokenExpirationDate, @@ -33,8 +30,11 @@ import { import { TokenExpiration, TokenType, UserToken } from '../../../types/token'; import { LoggedInUser } from '../../../types/users'; import DocumentationTooltip from '../../common/DocumentationTooltip'; +import { Button, DeleteButton, SubmitButton } from '../../controls/buttons'; +import Radio from '../../controls/Radio'; import Select from '../../controls/Select'; import AlertErrorIcon from '../../icons/AlertErrorIcon'; +import AlertSuccessIcon from '../../icons/AlertSuccessIcon'; import Step from '../components/Step'; import { getUniqueTokenName } from '../utils'; @@ -43,10 +43,10 @@ interface Props { projectKey: string; finished: boolean; initialTokenName?: string; + stepNumber: number; open: boolean; onContinue: (token: string) => void; onOpen: VoidFunction; - stepNumber: number; } interface State { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/BuildToolForm-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/BuildToolForm-test.tsx index 36dc3ce673d..36dc3ce673d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/BuildToolForm-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/BuildToolForm-test.tsx 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/other/__tests__/DoneNextSteps-test.tsx index a15d9696cba..a15d9696cba 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/DoneNextSteps-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/DoneNextSteps-test.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ManualTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-test.tsx index a33e452fd6f..39e677189f1 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ManualTutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-test.tsx @@ -21,7 +21,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockComponent } from '../../../../helpers/mocks/component'; import { mockLoggedInUser } from '../../../../helpers/testMocks'; -import ManualTutorial from '../ManualTutorial'; +import OtherTutorial from '../OtherTutorial'; import ProjectAnalysisStep from '../ProjectAnalysisStep'; import TokenStep from '../TokenStep'; @@ -44,8 +44,13 @@ it('allows to navigate between steps', () => { expect(wrapper.find(ProjectAnalysisStep).props().open).toBe(false); }); -function shallowRender(props: Partial<ManualTutorial['props']> = {}) { - return shallow<ManualTutorial>( - <ManualTutorial component={mockComponent()} currentUser={mockLoggedInUser()} {...props} /> +function shallowRender(props: Partial<OtherTutorial['props']> = {}) { + return shallow<OtherTutorial>( + <OtherTutorial + component={mockComponent()} + baseUrl="http://example.com" + currentUser={mockLoggedInUser()} + {...props} + /> ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ProjectAnalysisStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/ProjectAnalysisStep-test.tsx index 7a9f039df1b..4ea98b25ae3 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ProjectAnalysisStep-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/ProjectAnalysisStep-test.tsx @@ -27,5 +27,13 @@ it('should render correctly', () => { }); function shallowRender() { - return shallow(<ProjectAnalysisStep component={mockComponent()} open={true} stepNumber={1} />); + return shallow( + <ProjectAnalysisStep + component={mockComponent()} + isLocal={true} + baseUrl="http://example.com" + open={true} + stepNumber={2} + /> + ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/TokenStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/TokenStep-test.tsx index 77a80a10529..77a80a10529 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/TokenStep-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/TokenStep-test.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/BuildToolForm-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/BuildToolForm-test.tsx.snap index 4f1c17201a7..4f1c17201a7 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/BuildToolForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/BuildToolForm-test.tsx.snap 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/other/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap index 31694bcce7b..31694bcce7b 100644 --- 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/other/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/ManualTutorial-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-test.tsx.snap index 108c0ead8cd..39298e06e95 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/ManualTutorial-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-test.tsx.snap @@ -40,6 +40,7 @@ exports[`renders correctly: default 1`] = ` stepNumber={1} /> <ProjectAnalysisStep + baseUrl="http://example.com" component={ Object { "breadcrumbs": Array [], @@ -62,6 +63,7 @@ exports[`renders correctly: default 1`] = ` "tags": Array [], } } + isLocal={false} open={false} stepNumber={2} /> diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/ProjectAnalysisStep-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/ProjectAnalysisStep-test.tsx.snap index 0380c578d47..81839635ad0 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/ProjectAnalysisStep-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/ProjectAnalysisStep-test.tsx.snap @@ -7,7 +7,7 @@ exports[`should render correctly 1`] = ` open={true} renderForm={[Function]} renderResult={[Function]} - stepNumber={1} + stepNumber={2} stepTitle="onboarding.analysis.header" /> `; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/TokenStep-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/TokenStep-test.tsx.snap index 2c05c134d6a..2c05c134d6a 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/TokenStep-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/TokenStep-test.tsx.snap diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/AnalysisCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/AnalysisCommand.tsx index fc5cb8e7017..3b47235be27 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/AnalysisCommand.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/AnalysisCommand.tsx @@ -29,12 +29,14 @@ import Other from './Other'; export interface AnalysisCommandProps { component: Component; + baseUrl: string; + isLocal: boolean; languageConfig: ManualTutorialConfig; token?: string; } export default function AnalysisCommand(props: AnalysisCommandProps) { - const { component, languageConfig, token } = props; + const { component, baseUrl, isLocal, languageConfig, token } = props; if (!token) { return null; @@ -54,12 +56,25 @@ export default function AnalysisCommand(props: AnalysisCommandProps) { case BuildTools.CFamily: return languageConfig.os !== undefined ? ( - <ClangGCCCustom os={languageConfig.os} host={host} component={component} token={token} /> + <ClangGCCCustom + os={languageConfig.os} + baseUrl={baseUrl} + host={host} + component={component} + isLocal={isLocal} + token={token} + /> ) : null; case BuildTools.Other: return languageConfig.os !== undefined ? ( - <Other host={host} os={languageConfig.os} component={component} token={token} /> + <Other + host={host} + os={languageConfig.os} + component={component} + isLocal={isLocal} + token={token} + /> ) : 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/other/commands/ClangGCCCommand.tsx index 438f62acc6c..db6ad94b881 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/ClangGCCCommand.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/ClangGCCCommand.tsx @@ -28,21 +28,30 @@ import ExecScanner from './ExecScanner'; export interface ClangGCCCustomProps { component: Component; + baseUrl: string; + isLocal: boolean; host: string; os: OSs; token: string; } export default function ClangGCCCustom(props: ClangGCCCustomProps) { - const { os, host, component, token } = props; + const { os, baseUrl, host, component, isLocal, token } = props; return ( <div> - <DownloadBuildWrapper os={os} /> - <DownloadScanner os={os} /> + <DownloadBuildWrapper isLocal={isLocal} baseUrl={baseUrl} os={os} /> + <DownloadScanner isLocal={isLocal} os={os} token={token} /> <ExecBuildWrapper os={os} /> <CompilationInfo /> - <ExecScanner host={host} component={component} os={os} token={token} cfamily={true} /> + <ExecScanner + host={host} + isLocal={isLocal} + component={component} + os={os} + token={token} + cfamily={true} + /> </div> ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNet.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNet.tsx index b0dfd6f743c..b0dfd6f743c 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNet.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNet.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetCore.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetCore.tsx index 2c8304d070c..c89fb8d9fd5 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetCore.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetCore.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Alert } from '../../../../components/ui/Alert'; import { translate } from '../../../../helpers/l10n'; import CodeSnippet from '../../../common/CodeSnippet'; +import { Alert } from '../../../ui/Alert'; import { DotNetProps } from './DotNet'; import DotNetExecute from './DotNetExecute'; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetExecute.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx index b2840c55b8e..b2840c55b8e 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetExecute.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetFramework.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx index daab033765a..daab033765a 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNetFramework.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadBuildWrapper.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadBuildWrapper.tsx new file mode 100644 index 00000000000..ab989bb4c87 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadBuildWrapper.tsx @@ -0,0 +1,88 @@ +/* + * 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 { translate } from '../../../../helpers/l10n'; +import { getBaseUrl } from '../../../../helpers/system'; +import CodeSnippet from '../../../common/CodeSnippet'; +import { OSs } from '../../types'; + +export interface DownloadBuildWrapperProps { + isLocal: boolean; + os: OSs; + baseUrl: string; +} + +const FILENAMES: { [x in OSs]: string } = { + win: 'build-wrapper-win-x86', + linux: 'build-wrapper-linux-x86', + mac: 'build-wrapper-macosx-x86' +}; + +export default function DownloadBuildWrapper(props: DownloadBuildWrapperProps) { + const { os, isLocal, baseUrl } = props; + return ( + <div className="spacer-bottom"> + <h4 className="spacer-bottom">{translate('onboarding.analysis.build_wrapper.header', os)}</h4> + {isLocal ? ( + <> + <p className="spacer-bottom markdown"> + <FormattedMessage + defaultMessage={translate('onboarding.analysis.build_wrapper.text')} + id="onboarding.analysis.build_wrapper.text" + values={{ + env_var: <code>{os === 'win' ? '%PATH%' : 'PATH'}</code> + }} + /> + </p> + <p> + <a + className="button" + download={`${FILENAMES[os]}.zip`} + href={`${getBaseUrl()}/static/cpp/${FILENAMES[os]}.zip`} + rel="noopener noreferrer" + target="_blank"> + {translate('download_verb')} + </a> + </p> + </> + ) : ( + <CodeSnippet snippet={getRemoteDownloadSnippet(os, baseUrl)} /> + )} + </div> + ); +} + +function getRemoteDownloadSnippet(os: OSs, baseUrl: string) { + if (os === OSs.Windows) { + return `$env:SONAR_DIRECTORY = [System.IO.Path]::Combine($(get-location).Path,".sonar") +rm "$env:SONAR_DIRECTORY/build-wrapper-win-x86" -Force -Recurse -ErrorAction SilentlyContinue +New-Item -path $env:SONAR_DIRECTORY/build-wrapper-win-x86 -type directory +(New-Object System.Net.WebClient).DownloadFile("${baseUrl}/static/cpp/build-wrapper-win-x86.zip", "$env:SONAR_DIRECTORY/build-wrapper-win-x86.zip") +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory("$env:SONAR_DIRECTORY/build-wrapper-win-x86.zip", "$env:SONAR_DIRECTORY") +$env:Path += ";$env:SONAR_DIRECTORY/build-wrapper-win-x86" +`; + } + return `curl --create-dirs -sSLo $HOME/.sonar/${FILENAMES[os]}.zip ${baseUrl}/static/cpp/${FILENAMES[os]}.zip +unzip -o $HOME/.sonar/${FILENAMES[os]}.zip -d $HOME/.sonar/ +export PATH=$HOME/.sonar/${FILENAMES[os]}:$PATH +`; +} diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx new file mode 100644 index 00000000000..ba9866a8b58 --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx @@ -0,0 +1,105 @@ +/* + * 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 { translate } from '../../../../helpers/l10n'; +import CodeSnippet from '../../../common/CodeSnippet'; +import { ClipboardButton } from '../../../controls/clipboard'; +import { OSs } from '../../types'; + +export interface DownloadScannerProps { + isLocal: boolean; + os: OSs; + token: string; +} + +export default function DownloadScanner(props: DownloadScannerProps) { + const { os, isLocal, token } = props; + + return ( + <div> + <h4 className="spacer-bottom">{translate('onboarding.analysis.sq_scanner.header', os)}</h4> + {isLocal ? ( + <p className="spacer-bottom markdown"> + <FormattedMessage + defaultMessage={translate('onboarding.analysis.sq_scanner.text')} + id="onboarding.analysis.sq_scanner.text" + values={{ + dir: <code>bin</code>, + env_var: <code>{os === OSs.Windows ? '%PATH%' : 'PATH'}</code>, + link: ( + <a + href="https://redirect.sonarsource.com/doc/download-scanner.html" + rel="noopener noreferrer" + target="_blank"> + {translate('onboarding.analysis.sq_scanner.docs_link')} + </a> + ) + }} + /> + </p> + ) : ( + <> + <CodeSnippet snippet={getRemoteDownloadSnippet(os)} /> + <h4 className="spacer-bottom big-spacer-top"> + {translate('onboarding.analysis.sq_scanner.sonar_token_env.header')} + </h4> + <ul className="list-styled"> + <li className="markdown"> + {translate('onboarding.analysis.sq_scanner.sonar_token_env.var_name')}:{' '} + <code>SONAR_TOKEN</code> + <ClipboardButton className="spacer-left" copyValue="SONAR_TOKEN" /> + </li> + <li className="markdown"> + {translate('onboarding.analysis.sq_scanner.sonar_token_env.var_value')}:{' '} + <code>{token}</code> + <ClipboardButton className="spacer-left" copyValue={token} /> + </li> + </ul> + </> + )} + </div> + ); +} + +function getRemoteDownloadSnippet(os: OSs) { + if (os === OSs.Windows) { + return `$env:SONAR_SCANNER_VERSION = "4.7.0.2747" +$env:SONAR_DIRECTORY = [System.IO.Path]::Combine($(get-location).Path,".sonar") +$env:SONAR_SCANNER_HOME = "$env:SONAR_DIRECTORY/sonar-scanner-$env:SONAR_SCANNER_VERSION-windows" +rm $env:SONAR_SCANNER_HOME -Force -Recurse -ErrorAction SilentlyContinue +New-Item -path $env:SONAR_SCANNER_HOME -type directory +(New-Object System.Net.WebClient).DownloadFile("https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$env:SONAR_SCANNER_VERSION-windows.zip", "$env:SONAR_DIRECTORY/sonar-scanner.zip") +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory("$env:SONAR_DIRECTORY/sonar-scanner.zip", "$env:SONAR_DIRECTORY") +rm ./.sonar/sonar-scanner.zip -Force -ErrorAction SilentlyContinue +$env:Path += ";$env:SONAR_SCANNER_HOME/bin" +$env:SONAR_SCANNER_OPTS="-server" +`; + } + const suffix = os === OSs.MacOS ? 'macosx' : 'linux'; + return `export SONAR_SCANNER_VERSION=4.7.0.2747 +export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-${suffix} +curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-${suffix}.zip +unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ +export PATH=$SONAR_SCANNER_HOME/bin:$PATH +export SONAR_SCANNER_OPTS="-server" +`; +} diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecBuildWrapper.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx index a359e2bae1a..a359e2bae1a 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecBuildWrapper.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx index 3bcb8b538bf..32cb66a4e71 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/ExecScanner.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx @@ -31,13 +31,14 @@ import DoneNextSteps from '../DoneNextSteps'; export interface ExecScannerProps { component: Component; host: string; + isLocal: boolean; os: OSs; token: string; cfamily?: boolean; } export default function ExecScanner(props: ExecScannerProps) { - const { host, os, component, token, cfamily } = props; + const { host, os, isLocal, component, token, cfamily } = props; const q = quote(os); const command = [ @@ -46,12 +47,12 @@ export default function ExecScanner(props: ExecScannerProps) { '-D' + q('sonar.sources=.'), cfamily ? '-D' + q('sonar.cfamily.build-wrapper-output=bw-output') : undefined, '-D' + q(`sonar.host.url=${host}`), - '-D' + q(`sonar.login=${token}`) + isLocal ? '-D' + q(`sonar.login=${token}`) : undefined ]; return ( <div> - <h4 className="huge-spacer-top spacer-bottom"> + <h4 className="big-spacer-top spacer-bottom"> {translate('onboarding.analysis.sq_scanner.execute')} </h4> <InstanceMessage message={translate('onboarding.analysis.sq_scanner.execute.text')}> diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaGradle.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx index b640f69b70a..b640f69b70a 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaGradle.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaMaven.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx index f56b9be740e..f56b9be740e 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaMaven.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/Other.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/Other.tsx index 982ffdf6376..2656e640bbf 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/Other.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/Other.tsx @@ -25,18 +25,19 @@ import ExecScanner from './ExecScanner'; export interface OtherProps { component: Component; + isLocal: boolean; host: string; os: OSs; token: string; } export default function Other(props: OtherProps) { - const { host, os, component, token } = props; + const { host, os, component, isLocal, token } = props; return ( <div> - <DownloadScanner os={os} /> - <ExecScanner host={host} os={os} component={component} token={token} /> + <DownloadScanner isLocal={isLocal} os={os} token={token} /> + <ExecScanner host={host} isLocal={isLocal} os={os} component={component} token={token} /> </div> ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/AnalysisCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/AnalysisCommand-test.tsx index dfff76642a7..058b1004aa2 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/AnalysisCommand-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/AnalysisCommand-test.tsx @@ -50,6 +50,13 @@ it('renders correctly', () => { function shallowRender(props: Partial<AnalysisCommandProps> = {}) { return shallow<AnalysisCommandProps>( - <AnalysisCommand component={mockComponent()} languageConfig={{}} token="myToken" {...props} /> + <AnalysisCommand + component={mockComponent()} + baseUrl="http://example.com" + isLocal={true} + languageConfig={{}} + token="myToken" + {...props} + /> ); } 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/other/commands/__tests__/CLangGCCCommand-test.tsx index 72b5b8de1e5..b1ecce6b02d 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/other/commands/__tests__/CLangGCCCommand-test.tsx @@ -28,6 +28,8 @@ it('should render correctly', () => { shallow( <ClangGCCCommand os={OSs.Linux} + baseUrl="http://example.com" + isLocal={true} host="host" component={mockComponent({ key: 'projectKey' })} token="token" 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/other/commands/__tests__/DotNet-test.tsx index 1b40ad0419e..1b40ad0419e 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/other/commands/__tests__/DotNet-test.tsx 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/other/commands/__tests__/DotNetExecute-test.tsx index d4f29a12a55..d4f29a12a55 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/other/commands/__tests__/DotNetExecute-test.tsx 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/other/commands/__tests__/DotNetFramework-test.tsx index 12932520c37..12932520c37 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/other/commands/__tests__/DotNetFramework-test.tsx 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/other/commands/__tests__/DotnetCore-test.tsx index f40ad7f077f..f40ad7f077f 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/other/commands/__tests__/DotnetCore-test.tsx diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DownloadBuildWrapper-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadBuildWrapper-test.tsx index 770f55cb747..7887e6aafbb 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DownloadBuildWrapper-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadBuildWrapper-test.tsx @@ -20,8 +20,15 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { OSs } from '../../../types'; -import DownloadBuildWrapper from '../DownloadBuildWrapper'; +import DownloadBuildWrapper, { DownloadBuildWrapperProps } from '../DownloadBuildWrapper'; -it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('Shoud renders for %p correctly', os => { - expect(shallow(<DownloadBuildWrapper os={os} />)).toMatchSnapshot(); +it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('should render correctly for %p', os => { + expect(shallowRender({ os, isLocal: false })).toMatchSnapshot('remote'); + expect(shallowRender({ os })).toMatchSnapshot('local'); }); + +function shallowRender(props: Partial<DownloadBuildWrapperProps> = {}) { + return shallow<DownloadBuildWrapperProps>( + <DownloadBuildWrapper baseUrl="http://example.com" isLocal={true} os={OSs.Linux} {...props} /> + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DownloadScanner-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadScanner-test.tsx index a0376e87df3..5590f7eef97 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DownloadScanner-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadScanner-test.tsx @@ -20,8 +20,15 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { OSs } from '../../../types'; -import DownloadScanner from '../DownloadScanner'; +import DownloadScanner, { DownloadScannerProps } from '../DownloadScanner'; -it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('Shoud renders for %p correctly', os => { - expect(shallow(<DownloadScanner os={os} />)).toMatchSnapshot(); +it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('should render correctly for %p', os => { + expect(shallowRender({ isLocal: false, os })).toMatchSnapshot('remote'); + expect(shallowRender({ os })).toMatchSnapshot('local'); }); + +function shallowRender(props: Partial<DownloadScannerProps> = {}) { + return shallow<DownloadScannerProps>( + <DownloadScanner isLocal={true} os={OSs.Linux} token="token" {...props} /> + ); +} diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecBuildWrapper-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecBuildWrapper-test.tsx index c3dce885e4d..c3dce885e4d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecBuildWrapper-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecBuildWrapper-test.tsx 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/other/commands/__tests__/ExecScanner-test.tsx index b32b9e0c513..dbea16d6b08 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/other/commands/__tests__/ExecScanner-test.tsx @@ -31,10 +31,15 @@ it('should render correctly for cfamily', () => { expect(shallowRender({ cfamily: true })).toMatchSnapshot(); }); +it('should render correctly for remote execution', () => { + expect(shallowRender({ isLocal: false })).toMatchSnapshot(); +}); + function shallowRender(props: Partial<ExecScannerProps> = {}) { return shallow<ExecScannerProps>( <ExecScanner host="host" + isLocal={true} os={OSs.Linux} component={mockComponent({ key: 'projectKey' })} token="token" 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/other/commands/__tests__/JavaGradle-test.tsx index 02ced39618e..02ced39618e 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/other/commands/__tests__/JavaGradle-test.tsx 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/other/commands/__tests__/JavaMaven-test.tsx index 808712fe5eb..808712fe5eb 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/other/commands/__tests__/JavaMaven-test.tsx 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/other/commands/__tests__/Other-test.tsx index e0d005e1499..0beb634c1f9 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/other/commands/__tests__/Other-test.tsx @@ -31,6 +31,7 @@ function shallowRender(props: Partial<OtherProps> = {}) { return shallow<OtherProps>( <Other host="host" + isLocal={true} os={OSs.Linux} component={mockComponent({ key: 'projectKey' })} token="token" 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/other/commands/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap index c33c2b7b140..e09a721a914 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/other/commands/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap @@ -31,6 +31,7 @@ exports[`renders correctly: .NET 1`] = ` exports[`renders correctly: CFamily 1`] = ` <ClangGCCCustom + baseUrl="http://example.com" component={ Object { "breadcrumbs": Array [], @@ -54,6 +55,7 @@ exports[`renders correctly: CFamily 1`] = ` } } host="HOST" + isLocal={true} os="linux" token="myToken" /> @@ -144,6 +146,7 @@ exports[`renders correctly: other 1`] = ` } } host="HOST" + isLocal={true} os="win" token="myToken" /> 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/other/commands/__tests__/__snapshots__/CLangGCCCommand-test.tsx.snap index 4e542d9dd0a..02c9c2f09f7 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/other/commands/__tests__/__snapshots__/CLangGCCCommand-test.tsx.snap @@ -3,10 +3,14 @@ exports[`should render correctly 1`] = ` <div> <DownloadBuildWrapper + baseUrl="http://example.com" + isLocal={true} os="linux" /> <DownloadScanner + isLocal={true} os="linux" + token="token" /> <ExecBuildWrapper os="linux" @@ -37,6 +41,7 @@ exports[`should render correctly 1`] = ` } } host="host" + isLocal={true} os="linux" token="token" /> 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/other/commands/__tests__/__snapshots__/DotNet-test.tsx.snap index b88033c45f5..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/other/commands/__tests__/__snapshots__/DotNet-test.tsx.snap 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/other/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap index a921c78ff66..a921c78ff66 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/other/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap 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/other/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap index 13edb7d7370..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/other/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap 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/other/commands/__tests__/__snapshots__/DotnetCore-test.tsx.snap index 73c108fd1a2..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/other/commands/__tests__/__snapshots__/DotnetCore-test.tsx.snap diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DownloadBuildWrapper-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadBuildWrapper-test.tsx.snap index 2a444920a62..04909947045 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DownloadBuildWrapper-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadBuildWrapper-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": local 1`] = ` <div className="spacer-bottom" > @@ -38,7 +38,25 @@ exports[`Shoud renders for "linux" correctly 1`] = ` </div> `; -exports[`Shoud renders for "mac" correctly 1`] = ` +exports[`should render correctly for "linux": remote 1`] = ` +<div + className="spacer-bottom" +> + <h4 + className="spacer-bottom" + > + onboarding.analysis.build_wrapper.header.linux + </h4> + <CodeSnippet + snippet="curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip http://example.com/static/cpp/build-wrapper-linux-x86.zip +unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ +export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH +" + /> +</div> +`; + +exports[`should render correctly for "mac": local 1`] = ` <div className="spacer-bottom" > @@ -76,7 +94,25 @@ exports[`Shoud renders for "mac" correctly 1`] = ` </div> `; -exports[`Shoud renders for "win" correctly 1`] = ` +exports[`should render correctly for "mac": remote 1`] = ` +<div + className="spacer-bottom" +> + <h4 + className="spacer-bottom" + > + onboarding.analysis.build_wrapper.header.mac + </h4> + <CodeSnippet + snippet="curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-macosx-x86.zip http://example.com/static/cpp/build-wrapper-macosx-x86.zip +unzip -o $HOME/.sonar/build-wrapper-macosx-x86.zip -d $HOME/.sonar/ +export PATH=$HOME/.sonar/build-wrapper-macosx-x86:$PATH +" + /> +</div> +`; + +exports[`should render correctly for "win": local 1`] = ` <div className="spacer-bottom" > @@ -113,3 +149,25 @@ exports[`Shoud renders for "win" correctly 1`] = ` </p> </div> `; + +exports[`should render correctly for "win": remote 1`] = ` +<div + className="spacer-bottom" +> + <h4 + className="spacer-bottom" + > + onboarding.analysis.build_wrapper.header.win + </h4> + <CodeSnippet + snippet="$env:SONAR_DIRECTORY = [System.IO.Path]::Combine($(get-location).Path,\\".sonar\\") +rm \\"$env:SONAR_DIRECTORY/build-wrapper-win-x86\\" -Force -Recurse -ErrorAction SilentlyContinue +New-Item -path $env:SONAR_DIRECTORY/build-wrapper-win-x86 -type directory +(New-Object System.Net.WebClient).DownloadFile(\\"http://example.com/static/cpp/build-wrapper-win-x86.zip\\", \\"$env:SONAR_DIRECTORY/build-wrapper-win-x86.zip\\") +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory(\\"$env:SONAR_DIRECTORY/build-wrapper-win-x86.zip\\", \\"$env:SONAR_DIRECTORY\\") +$env:Path += \\";$env:SONAR_DIRECTORY/build-wrapper-win-x86\\" +" + /> +</div> +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap new file mode 100644 index 00000000000..60bf449f25b --- /dev/null +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap @@ -0,0 +1,279 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly for "linux": local 1`] = ` +<div> + <h4 + className="spacer-bottom" + > + onboarding.analysis.sq_scanner.header.linux + </h4> + <p + className="spacer-bottom markdown" + > + <FormattedMessage + defaultMessage="onboarding.analysis.sq_scanner.text" + id="onboarding.analysis.sq_scanner.text" + values={ + Object { + "dir": <code> + bin + </code>, + "env_var": <code> + PATH + </code>, + "link": <a + href="https://redirect.sonarsource.com/doc/download-scanner.html" + rel="noopener noreferrer" + target="_blank" + > + onboarding.analysis.sq_scanner.docs_link + </a>, + } + } + /> + </p> +</div> +`; + +exports[`should render correctly for "linux": remote 1`] = ` +<div> + <h4 + className="spacer-bottom" + > + onboarding.analysis.sq_scanner.header.linux + </h4> + <CodeSnippet + snippet="export SONAR_SCANNER_VERSION=4.7.0.2747 +export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux +curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip +unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ +export PATH=$SONAR_SCANNER_HOME/bin:$PATH +export SONAR_SCANNER_OPTS=\\"-server\\" +" + /> + <h4 + className="spacer-bottom big-spacer-top" + > + onboarding.analysis.sq_scanner.sonar_token_env.header + </h4> + <ul + className="list-styled" + > + <li + className="markdown" + > + onboarding.analysis.sq_scanner.sonar_token_env.var_name + : + + <code> + SONAR_TOKEN + </code> + <ClipboardButton + className="spacer-left" + copyValue="SONAR_TOKEN" + /> + </li> + <li + className="markdown" + > + onboarding.analysis.sq_scanner.sonar_token_env.var_value + : + + <code> + token + </code> + <ClipboardButton + className="spacer-left" + copyValue="token" + /> + </li> + </ul> +</div> +`; + +exports[`should render correctly for "mac": local 1`] = ` +<div> + <h4 + className="spacer-bottom" + > + onboarding.analysis.sq_scanner.header.mac + </h4> + <p + className="spacer-bottom markdown" + > + <FormattedMessage + defaultMessage="onboarding.analysis.sq_scanner.text" + id="onboarding.analysis.sq_scanner.text" + values={ + Object { + "dir": <code> + bin + </code>, + "env_var": <code> + PATH + </code>, + "link": <a + href="https://redirect.sonarsource.com/doc/download-scanner.html" + rel="noopener noreferrer" + target="_blank" + > + onboarding.analysis.sq_scanner.docs_link + </a>, + } + } + /> + </p> +</div> +`; + +exports[`should render correctly for "mac": remote 1`] = ` +<div> + <h4 + className="spacer-bottom" + > + onboarding.analysis.sq_scanner.header.mac + </h4> + <CodeSnippet + snippet="export SONAR_SCANNER_VERSION=4.7.0.2747 +export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-macosx +curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-macosx.zip +unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ +export PATH=$SONAR_SCANNER_HOME/bin:$PATH +export SONAR_SCANNER_OPTS=\\"-server\\" +" + /> + <h4 + className="spacer-bottom big-spacer-top" + > + onboarding.analysis.sq_scanner.sonar_token_env.header + </h4> + <ul + className="list-styled" + > + <li + className="markdown" + > + onboarding.analysis.sq_scanner.sonar_token_env.var_name + : + + <code> + SONAR_TOKEN + </code> + <ClipboardButton + className="spacer-left" + copyValue="SONAR_TOKEN" + /> + </li> + <li + className="markdown" + > + onboarding.analysis.sq_scanner.sonar_token_env.var_value + : + + <code> + token + </code> + <ClipboardButton + className="spacer-left" + copyValue="token" + /> + </li> + </ul> +</div> +`; + +exports[`should render correctly for "win": local 1`] = ` +<div> + <h4 + className="spacer-bottom" + > + onboarding.analysis.sq_scanner.header.win + </h4> + <p + className="spacer-bottom markdown" + > + <FormattedMessage + defaultMessage="onboarding.analysis.sq_scanner.text" + id="onboarding.analysis.sq_scanner.text" + values={ + Object { + "dir": <code> + bin + </code>, + "env_var": <code> + %PATH% + </code>, + "link": <a + href="https://redirect.sonarsource.com/doc/download-scanner.html" + rel="noopener noreferrer" + target="_blank" + > + onboarding.analysis.sq_scanner.docs_link + </a>, + } + } + /> + </p> +</div> +`; + +exports[`should render correctly for "win": remote 1`] = ` +<div> + <h4 + className="spacer-bottom" + > + onboarding.analysis.sq_scanner.header.win + </h4> + <CodeSnippet + snippet="$env:SONAR_SCANNER_VERSION = \\"4.7.0.2747\\" +$env:SONAR_DIRECTORY = [System.IO.Path]::Combine($(get-location).Path,\\".sonar\\") +$env:SONAR_SCANNER_HOME = \\"$env:SONAR_DIRECTORY/sonar-scanner-$env:SONAR_SCANNER_VERSION-windows\\" +rm $env:SONAR_SCANNER_HOME -Force -Recurse -ErrorAction SilentlyContinue +New-Item -path $env:SONAR_SCANNER_HOME -type directory +(New-Object System.Net.WebClient).DownloadFile(\\"https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$env:SONAR_SCANNER_VERSION-windows.zip\\", \\"$env:SONAR_DIRECTORY/sonar-scanner.zip\\") +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory(\\"$env:SONAR_DIRECTORY/sonar-scanner.zip\\", \\"$env:SONAR_DIRECTORY\\") +rm ./.sonar/sonar-scanner.zip -Force -ErrorAction SilentlyContinue +$env:Path += \\";$env:SONAR_SCANNER_HOME/bin\\" +$env:SONAR_SCANNER_OPTS=\\"-server\\" +" + /> + <h4 + className="spacer-bottom big-spacer-top" + > + onboarding.analysis.sq_scanner.sonar_token_env.header + </h4> + <ul + className="list-styled" + > + <li + className="markdown" + > + onboarding.analysis.sq_scanner.sonar_token_env.var_name + : + + <code> + SONAR_TOKEN + </code> + <ClipboardButton + className="spacer-left" + copyValue="SONAR_TOKEN" + /> + </li> + <li + className="markdown" + > + onboarding.analysis.sq_scanner.sonar_token_env.var_value + : + + <code> + token + </code> + <ClipboardButton + className="spacer-left" + copyValue="token" + /> + </li> + </ul> +</div> +`; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap index 68e585ff320..68e585ff320 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap 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/other/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap index c979aedbd8a..5b50e97c353 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/other/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap @@ -3,7 +3,7 @@ exports[`should render correctly for "linux" 1`] = ` <div> <h4 - className="huge-spacer-top spacer-bottom" + className="big-spacer-top spacer-bottom" > onboarding.analysis.sq_scanner.execute </h4> @@ -73,7 +73,7 @@ exports[`should render correctly for "linux" 1`] = ` exports[`should render correctly for "mac" 1`] = ` <div> <h4 - className="huge-spacer-top spacer-bottom" + className="big-spacer-top spacer-bottom" > onboarding.analysis.sq_scanner.execute </h4> @@ -143,7 +143,7 @@ exports[`should render correctly for "mac" 1`] = ` exports[`should render correctly for "win" 1`] = ` <div> <h4 - className="huge-spacer-top spacer-bottom" + className="big-spacer-top spacer-bottom" > onboarding.analysis.sq_scanner.execute </h4> @@ -213,7 +213,7 @@ exports[`should render correctly for "win" 1`] = ` exports[`should render correctly for cfamily 1`] = ` <div> <h4 - className="huge-spacer-top spacer-bottom" + className="big-spacer-top spacer-bottom" > onboarding.analysis.sq_scanner.execute </h4> @@ -279,3 +279,73 @@ exports[`should render correctly for cfamily 1`] = ` /> </div> `; + +exports[`should render correctly for remote execution 1`] = ` +<div> + <h4 + className="big-spacer-top spacer-bottom" + > + onboarding.analysis.sq_scanner.execute + </h4> + <InstanceMessage + message="onboarding.analysis.sq_scanner.execute.text" + > + <Component /> + </InstanceMessage> + <CodeSnippet + isOneLine={false} + snippet={ + Array [ + "sonar-scanner", + "-Dsonar.projectKey=projectKey", + "-Dsonar.sources=.", + undefined, + "-Dsonar.host.url=host", + undefined, + ] + } + /> + <p + className="big-spacer-top markdown" + > + <FormattedMessage + defaultMessage="onboarding.analysis.sq_scanner.docs" + id="onboarding.analysis.sq_scanner.docs" + values={ + Object { + "link": <Link + target="_blank" + to="/documentation/analysis/scan/sonarscanner/" + > + onboarding.analysis.sq_scanner.docs_link + </Link>, + } + } + /> + </p> + <DoneNextSteps + component={ + Object { + "breadcrumbs": Array [], + "key": "projectKey", + "name": "MyProject", + "qualifier": "TRK", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + } + } + /> +</div> +`; 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/other/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap index fc132dddb80..fc132dddb80 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/other/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap 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/other/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap index 970c7f620cc..970c7f620cc 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/other/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap 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/other/commands/__tests__/__snapshots__/Other-test.tsx.snap index bea3152d2d9..ffbf9f32605 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/other/commands/__tests__/__snapshots__/Other-test.tsx.snap @@ -3,7 +3,9 @@ exports[`renders correctly 1`] = ` <div> <DownloadScanner + isLocal={true} os="linux" + token="token" /> <ExecScanner component={ @@ -29,6 +31,7 @@ exports[`renders correctly 1`] = ` } } host="host" + isLocal={true} os="linux" token="token" /> 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 8a483896316..f34c3e012b4 100644 --- a/server/sonar-web/src/main/js/components/tutorials/types.ts +++ b/server/sonar-web/src/main/js/components/tutorials/types.ts @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ export enum TutorialModes { - Manual = 'manual', + Local = 'local', Jenkins = 'jenkins', BitbucketPipelines = 'bitbucket-pipelines', GitLabCI = 'gitlab-ci', 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 08aaf512328..43a38d5a5c9 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3563,6 +3563,9 @@ onboarding.analysis.sq_scanner.execute.text.custom=Run the following commands in onboarding.analysis.sq_scanner.docs=Please visit the {link} for more details. onboarding.analysis.sq_scanner.docs_use_case=Please visit the {link} for more details, and the {useCaseLink} to know more about this use case. onboarding.analysis.sq_scanner.docs_link=official documentation of the Scanner +onboarding.analysis.sq_scanner.sonar_token_env.header=Configure a SONAR_TOKEN environment variable in your CI settings +onboarding.analysis.sq_scanner.sonar_token_env.var_name=Add an environment variable called +onboarding.analysis.sq_scanner.sonar_token_env.var_value=Give it the following value onboarding.analysis.sqscanner.docs.gradle.title=official documentation of the Scanner for Gradle onboarding.analysis.sqscanner.docs.gradle.example_project.title=live Gradle-based example project @@ -3593,8 +3596,8 @@ onboarding.tutorial.cfamily.examples_repositories_description=Check out our C an onboarding.tutorial.choose_method=How do you want to analyze your repository? onboarding.tutorial.choose_method.devops_platform.description=Do you want to integrate with your favorite CI? Choose one of the following tutorials. -onboarding.tutorial.choose_method.locally.description=Are you just testing or have an advanced use-case? Analyze your project locally. -onboarding.tutorial.choose_method.manual=Locally +onboarding.tutorial.choose_method.local.description=Are you just testing or have an advanced use-case? Analyze your project locally. +onboarding.tutorial.choose_method.local=Locally onboarding.tutorial.choose_method.other-ci=Other CI onboarding.tutorial.choose_method.jenkins=With Jenkins onboarding.tutorial.choose_method.github-actions=With GitHub Actions |