]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13834 SONAR-13939 SONAR-13938 Cleanup and update tutorials, remove organizations
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Thu, 8 Oct 2020 13:47:18 +0000 (15:47 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 15 Oct 2020 20:07:59 +0000 (20:07 +0000)
44 files changed:
server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsfileStep-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/MSBuild.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNet-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/MSBuild-test.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNet-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/MSBuild-test.tsx.snap [deleted file]
server/sonar-web/src/main/js/components/tutorials/manual/BuildToolForm.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/manual/LanguageForm.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/manual/ManualTutorial.tsx
server/sonar-web/src/main/js/components/tutorials/manual/ProjectAnalysisStep.tsx
server/sonar-web/src/main/js/components/tutorials/manual/__tests__/BuildToolForm-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/manual/__tests__/LanguageForm-test.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/BuildToolForm-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/LanguageForm-test.tsx.snap [deleted file]
server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/ManualTutorial-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/manual/commands/AnalysisCommand.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/DotNet.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaGradle.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/JavaMaven.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/MSBuildScanner.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/manual/commands/Other.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/SQScanner.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/AnalysisCommand-test.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/MSBuildScanner-test.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/SQScanner-test.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/DotNet-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/MSBuildScanner-test.tsx.snap [deleted file]
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/SQScanner-test.tsx.snap [deleted file]
server/sonar-web/src/main/js/components/tutorials/types.ts
server/sonar-web/src/main/js/components/tutorials/utils.ts
server/sonar-web/src/main/js/helpers/__tests__/almIntegrations-test.ts [deleted file]
server/sonar-web/src/main/js/helpers/almIntegrations.ts [deleted file]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 7873a2e9f515c1f5e08a7dbe331d1c039b29b43c..761272b087a925d1df3b65db5039946f359cdd55 100644 (file)
@@ -23,9 +23,10 @@ import { getBaseUrl } from 'sonar-ui-common/helpers/urls';
 import RenderOptions from '../components/RenderOptions';
 import SentenceWithHighlights from '../components/SentenceWithHighlights';
 import Step from '../components/Step';
+import { BuildTools } from '../types';
+import DotNet from './buildtool-steps/DotNet';
 import Gradle from './buildtool-steps/Gradle';
 import Maven from './buildtool-steps/Maven';
-import MSBuild from './buildtool-steps/MSBuild';
 import Other from './buildtool-steps/Other';
 
 export interface JenkinsfileStepProps {
@@ -33,19 +34,12 @@ export interface JenkinsfileStepProps {
   open: boolean;
 }
 
-export enum BuildTools {
-  Maven = 'maven',
-  Gradle = 'gradle',
-  MSBuild = 'msbuild',
-  Other = 'other'
-}
-
 const BUILDTOOL_COMPONENT_MAP: {
   [x in BuildTools]: React.ComponentType<{ component: T.Component }>;
 } = {
   [BuildTools.Maven]: Maven,
   [BuildTools.Gradle]: Gradle,
-  [BuildTools.MSBuild]: MSBuild,
+  [BuildTools.DotNet]: DotNet,
   [BuildTools.Other]: Other
 };
 
index d3dc2e7fbe19d74ea0cdc374e45d0c01e7dcacb2..5b34e3d0577ccb317ac74ecae265909f793581c5 100644 (file)
@@ -23,7 +23,8 @@ import * as React from 'react';
 import { mockComponent } from '../../../../helpers/testMocks';
 import RenderOptions from '../../components/RenderOptions';
 import Step from '../../components/Step';
-import JenkinsfileStep, { BuildTools, JenkinsfileStepProps } from '../JenkinsfileStep';
+import { BuildTools } from '../../types';
+import JenkinsfileStep, { JenkinsfileStepProps } from '../JenkinsfileStep';
 import { renderStepContent } from '../test-utils';
 
 it('should render correctly', () => {
@@ -49,9 +50,9 @@ it('should render correctly for Gradle', () => {
   expect(renderStepContent(wrapper)).toMatchSnapshot();
 });
 
-it('should render correctly for MSBuild', () => {
+it('should render correctly for .NET', () => {
   const wrapper = shallowRender();
-  selectBuildTool(wrapper, BuildTools.MSBuild);
+  selectBuildTool(wrapper, BuildTools.DotNet);
   expect(renderStepContent(wrapper)).toMatchSnapshot();
 });
 
index 2ef32e0829732076c3c28554f7ba496f77a284fd..205d7970239521c9c4d1c118ffd543d69fc54502 100644 (file)
@@ -1,6 +1,6 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`should render correctly for Gradle 1`] = `
+exports[`should render correctly for .NET 1`] = `
 <div
   className="boxed-group-inner"
 >
@@ -10,7 +10,7 @@ exports[`should render correctly for Gradle 1`] = `
     <li>
       onboarding.build
       <RenderOptions
-        checked="gradle"
+        checked="dotnet"
         name="buildtool"
         onCheck={[Function]}
         optionLabelKey="onboarding.build"
@@ -18,13 +18,13 @@ exports[`should render correctly for Gradle 1`] = `
           Array [
             "maven",
             "gradle",
-            "msbuild",
+            "dotnet",
             "other",
           ]
         }
       />
     </li>
-    <Gradle
+    <DotNet
       component={
         Object {
           "breadcrumbs": Array [],
@@ -122,7 +122,7 @@ exports[`should render correctly for Gradle 1`] = `
 </div>
 `;
 
-exports[`should render correctly for MSBuild 1`] = `
+exports[`should render correctly for Gradle 1`] = `
 <div
   className="boxed-group-inner"
 >
@@ -132,7 +132,7 @@ exports[`should render correctly for MSBuild 1`] = `
     <li>
       onboarding.build
       <RenderOptions
-        checked="msbuild"
+        checked="gradle"
         name="buildtool"
         onCheck={[Function]}
         optionLabelKey="onboarding.build"
@@ -140,13 +140,13 @@ exports[`should render correctly for MSBuild 1`] = `
           Array [
             "maven",
             "gradle",
-            "msbuild",
+            "dotnet",
             "other",
           ]
         }
       />
     </li>
-    <MSBuild
+    <Gradle
       component={
         Object {
           "breadcrumbs": Array [],
@@ -262,7 +262,7 @@ exports[`should render correctly for Maven 1`] = `
           Array [
             "maven",
             "gradle",
-            "msbuild",
+            "dotnet",
             "other",
           ]
         }
@@ -384,7 +384,7 @@ exports[`should render correctly for Other 1`] = `
           Array [
             "maven",
             "gradle",
-            "msbuild",
+            "dotnet",
             "other",
           ]
         }
@@ -515,7 +515,7 @@ exports[`should render correctly: initial content 1`] = `
           Array [
             "maven",
             "gradle",
-            "msbuild",
+            "dotnet",
             "other",
           ]
         }
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx
new file mode 100644 (file)
index 0000000..ba60c3c
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 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 HelpTooltip from 'sonar-ui-common/components/controls/HelpTooltip';
+import { Alert } from 'sonar-ui-common/components/ui/Alert';
+import CodeSnippet from '../../../common/CodeSnippet';
+import SentenceWithFilename from '../../components/SentenceWithFilename';
+import SentenceWithHighlights from '../../components/SentenceWithHighlights';
+
+export interface DotNetProps {
+  component: T.Component;
+}
+
+const jenkinsfileSnippet = (key: string) => `node {
+  stage('SCM') {
+    checkout scm
+  }
+  stage('SonarQube Analysis') {
+    def msbuildHome = tool 'Default MSBuild'
+    def scannerHome = tool 'SonarScanner for MSBuild'
+    withSonarQubeEnv() {
+      bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" begin /k:\\"${key}\\""
+      bat "\\"\${msbuildHome}\\\\MSBuild.exe\\" /t:Rebuild"
+      bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" end"
+    }
+  }
+}
+`;
+
+export default function DotNet({ component }: DotNetProps) {
+  return (
+    <li className="abs-width-600">
+      <SentenceWithFilename
+        filename="Jenkinsfile"
+        translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
+      />
+      <Alert className="spacer-top" variant="info">
+        <p className="text-middle">
+          <SentenceWithHighlights
+            highlightKeys={['default_msbuild', 'default_scanner', 'in_jenkins']}
+            translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace"
+          />
+          <HelpTooltip
+            className="little-spacer-left"
+            overlay={
+              <>
+                <p className="spacer-bottom">
+                  <SentenceWithHighlights
+                    highlightKeys={['path']}
+                    translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1"
+                  />
+                </p>
+                <p className="spacer-bottom">
+                  <SentenceWithHighlights
+                    highlightKeys={['path', 'name']}
+                    translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2"
+                  />
+                </p>
+                <p>
+                  <SentenceWithHighlights
+                    highlightKeys={['path', 'name']}
+                    translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3"
+                  />
+                </p>
+              </>
+            }
+          />
+        </p>
+      </Alert>
+      <CodeSnippet snippet={jenkinsfileSnippet(component.key)} />
+    </li>
+  );
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/MSBuild.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/MSBuild.tsx
deleted file mode 100644 (file)
index 3200d3e..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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 HelpTooltip from 'sonar-ui-common/components/controls/HelpTooltip';
-import { Alert } from 'sonar-ui-common/components/ui/Alert';
-import CodeSnippet from '../../../common/CodeSnippet';
-import SentenceWithFilename from '../../components/SentenceWithFilename';
-import SentenceWithHighlights from '../../components/SentenceWithHighlights';
-
-export interface MSBuildProps {
-  component: T.Component;
-}
-
-const jenkinsfileSnippet = (key: string) => `node {
-  stage('SCM') {
-    checkout scm
-  }
-  stage('SonarQube Analysis') {
-    def msbuildHome = tool 'Default MSBuild'
-    def scannerHome = tool 'SonarScanner for MSBuild'
-    withSonarQubeEnv() {
-      bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" begin /k:\\"${key}\\""
-      bat "\\"\${msbuildHome}\\\\MSBuild.exe\\" /t:Rebuild"
-      bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" end"
-    }
-  }
-}
-`;
-
-export default function MSBuild({ component }: MSBuildProps) {
-  return (
-    <li className="abs-width-600">
-      <SentenceWithFilename
-        filename="Jenkinsfile"
-        translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
-      />
-      <Alert className="spacer-top" variant="info">
-        <p className="text-middle">
-          <SentenceWithHighlights
-            highlightKeys={['default_msbuild', 'default_scanner', 'in_jenkins']}
-            translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.replace"
-          />
-          <HelpTooltip
-            className="little-spacer-left"
-            overlay={
-              <>
-                <p className="spacer-bottom">
-                  <SentenceWithHighlights
-                    highlightKeys={['path']}
-                    translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help1"
-                  />
-                </p>
-                <p className="spacer-bottom">
-                  <SentenceWithHighlights
-                    highlightKeys={['path', 'name']}
-                    translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help2"
-                  />
-                </p>
-                <p>
-                  <SentenceWithHighlights
-                    highlightKeys={['path', 'name']}
-                    translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help3"
-                  />
-                </p>
-              </>
-            }
-          />
-        </p>
-      </Alert>
-      <CodeSnippet snippet={jenkinsfileSnippet(component.key)} />
-    </li>
-  );
-}
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNet-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNet-test.tsx
new file mode 100644 (file)
index 0000000..44ea736
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+import { shallow } from 'enzyme';
+import * as React from 'react';
+import { mockComponent } from '../../../../../helpers/testMocks';
+import DotNet, { DotNetProps } from '../DotNet';
+
+it('should render correctly', () => {
+  expect(shallowRender()).toMatchSnapshot();
+});
+
+function shallowRender(props: Partial<DotNetProps> = {}) {
+  return shallow<DotNetProps>(<DotNet component={mockComponent()} {...props} />);
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/MSBuild-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/MSBuild-test.tsx
deleted file mode 100644 (file)
index a391815..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-import { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockComponent } from '../../../../../helpers/testMocks';
-import MSBuild, { MSBuildProps } from '../MSBuild';
-
-it('should render correctly', () => {
-  expect(shallowRender()).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<MSBuildProps> = {}) {
-  return shallow<MSBuildProps>(<MSBuild component={mockComponent()} {...props} />);
-}
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNet-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNet-test.tsx.snap
new file mode 100644 (file)
index 0000000..60f35c8
--- /dev/null
@@ -0,0 +1,91 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly 1`] = `
+<li
+  className="abs-width-600"
+>
+  <SentenceWithFilename
+    filename="Jenkinsfile"
+    translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
+  />
+  <Alert
+    className="spacer-top"
+    variant="info"
+  >
+    <p
+      className="text-middle"
+    >
+      <SentenceWithHighlights
+        highlightKeys={
+          Array [
+            "default_msbuild",
+            "default_scanner",
+            "in_jenkins",
+          ]
+        }
+        translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace"
+      />
+      <HelpTooltip
+        className="little-spacer-left"
+        overlay={
+          <React.Fragment>
+            <p
+              className="spacer-bottom"
+            >
+              <SentenceWithHighlights
+                highlightKeys={
+                  Array [
+                    "path",
+                  ]
+                }
+                translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1"
+              />
+            </p>
+            <p
+              className="spacer-bottom"
+            >
+              <SentenceWithHighlights
+                highlightKeys={
+                  Array [
+                    "path",
+                    "name",
+                  ]
+                }
+                translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2"
+              />
+            </p>
+            <p>
+              <SentenceWithHighlights
+                highlightKeys={
+                  Array [
+                    "path",
+                    "name",
+                  ]
+                }
+                translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3"
+              />
+            </p>
+          </React.Fragment>
+        }
+      />
+    </p>
+  </Alert>
+  <CodeSnippet
+    snippet="node {
+  stage('SCM') {
+    checkout scm
+  }
+  stage('SonarQube Analysis') {
+    def msbuildHome = tool 'Default MSBuild'
+    def scannerHome = tool 'SonarScanner for MSBuild'
+    withSonarQubeEnv() {
+      bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" begin /k:\\\\\\"my-project\\\\\\"\\"
+      bat \\"\\\\\\"\${msbuildHome}\\\\\\\\MSBuild.exe\\\\\\" /t:Rebuild\\"
+      bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" end\\"
+    }
+  }
+}
+"
+  />
+</li>
+`;
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/MSBuild-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/MSBuild-test.tsx.snap
deleted file mode 100644 (file)
index 822c34c..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<li
-  className="abs-width-600"
->
-  <SentenceWithFilename
-    filename="Jenkinsfile"
-    translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
-  />
-  <Alert
-    className="spacer-top"
-    variant="info"
-  >
-    <p
-      className="text-middle"
-    >
-      <SentenceWithHighlights
-        highlightKeys={
-          Array [
-            "default_msbuild",
-            "default_scanner",
-            "in_jenkins",
-          ]
-        }
-        translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.replace"
-      />
-      <HelpTooltip
-        className="little-spacer-left"
-        overlay={
-          <React.Fragment>
-            <p
-              className="spacer-bottom"
-            >
-              <SentenceWithHighlights
-                highlightKeys={
-                  Array [
-                    "path",
-                  ]
-                }
-                translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help1"
-              />
-            </p>
-            <p
-              className="spacer-bottom"
-            >
-              <SentenceWithHighlights
-                highlightKeys={
-                  Array [
-                    "path",
-                    "name",
-                  ]
-                }
-                translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help2"
-              />
-            </p>
-            <p>
-              <SentenceWithHighlights
-                highlightKeys={
-                  Array [
-                    "path",
-                    "name",
-                  ]
-                }
-                translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help3"
-              />
-            </p>
-          </React.Fragment>
-        }
-      />
-    </p>
-  </Alert>
-  <CodeSnippet
-    snippet="node {
-  stage('SCM') {
-    checkout scm
-  }
-  stage('SonarQube Analysis') {
-    def msbuildHome = tool 'Default MSBuild'
-    def scannerHome = tool 'SonarScanner for MSBuild'
-    withSonarQubeEnv() {
-      bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" begin /k:\\\\\\"my-project\\\\\\"\\"
-      bat \\"\\\\\\"\${msbuildHome}\\\\\\\\MSBuild.exe\\\\\\" /t:Rebuild\\"
-      bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" end\\"
-    }
-  }
-}
-"
-  />
-</li>
-`;
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/BuildToolForm.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/BuildToolForm.tsx
new file mode 100644 (file)
index 0000000..934edc0
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 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 RadioToggle from 'sonar-ui-common/components/controls/RadioToggle';
+import { translate } from 'sonar-ui-common/helpers/l10n';
+import RenderOptions from '../components/RenderOptions';
+import { BuildTools, ManualTutorialConfig, OSs } from '../types';
+
+interface Props {
+  component: T.Component;
+  config?: ManualTutorialConfig;
+  onDone: (config: ManualTutorialConfig) => void;
+}
+
+interface State {
+  config: ManualTutorialConfig;
+}
+
+export default class BuildToolForm extends React.PureComponent<Props, State> {
+  constructor(props: Props) {
+    super(props);
+    this.state = {
+      config: this.props.config || {}
+    };
+  }
+
+  handleBuildToolChange = (buildTool: BuildTools) => {
+    this.setState({ config: { buildTool } }, () => {
+      this.props.onDone(this.state.config);
+    });
+  };
+
+  handleOSChange = (os: OSs) => {
+    this.setState({ config: { buildTool: BuildTools.Other, os } }, () => {
+      this.props.onDone(this.state.config);
+    });
+  };
+
+  render() {
+    const { config } = this.state;
+    const buildTools = [BuildTools.Maven, BuildTools.Gradle, BuildTools.DotNet, BuildTools.Other];
+
+    return (
+      <>
+        <div>
+          <h4 className="spacer-bottom">{translate('onboarding.build')}</h4>
+          <RadioToggle
+            name="language"
+            onCheck={this.handleBuildToolChange}
+            options={buildTools.map(tool => ({
+              label: translate('onboarding.build', tool),
+              value: tool
+            }))}
+            value={config.buildTool}
+          />
+        </div>
+
+        {config.buildTool === BuildTools.Other && (
+          <RenderOptions
+            checked={config.os}
+            name="os"
+            onCheck={this.handleOSChange}
+            optionLabelKey="onboarding.build.other.os"
+            options={[OSs.Linux, OSs.Windows, OSs.MacOS]}
+            titleLabelKey="onboarding.build.other.os"
+          />
+        )}
+      </>
+    );
+  }
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/LanguageForm.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/LanguageForm.tsx
deleted file mode 100644 (file)
index 30701bc..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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 RadioToggle from 'sonar-ui-common/components/controls/RadioToggle';
-import { translate } from 'sonar-ui-common/helpers/l10n';
-import RenderOptions from '../components/RenderOptions';
-import { LanguageConfig } from '../types';
-import { isLanguageConfigured } from '../utils';
-
-interface Props {
-  component: T.Component;
-  config?: LanguageConfig;
-  onDone: (config: LanguageConfig) => void;
-  onReset: VoidFunction;
-  organization?: string;
-}
-
-type State = LanguageConfig;
-
-export interface RenderOSProps {
-  os: string | undefined;
-  setOS: (os: string) => void;
-}
-
-export function RenderOS(props: RenderOSProps) {
-  return (
-    <RenderOptions
-      checked={props.os}
-      name="os"
-      onCheck={props.setOS}
-      optionLabelKey="onboarding.language.os"
-      options={['linux', 'win', 'mac']}
-      titleLabelKey="onboarding.language.os"
-    />
-  );
-}
-
-export default class LanguageForm extends React.PureComponent<Props, State> {
-  constructor(props: Props) {
-    super(props);
-    this.state = {
-      ...(this.props.config || {}),
-      projectKey: props.component ? props.component.key : undefined
-    };
-  }
-
-  handleChange = () => {
-    if (isLanguageConfigured(this.state)) {
-      this.props.onDone(this.state);
-    } else {
-      this.props.onReset();
-    }
-  };
-
-  handleLanguageChange = (language: string) => {
-    this.setState({ language }, this.handleChange);
-  };
-
-  handleJavaBuildChange = (javaBuild: string) => {
-    this.setState({ javaBuild }, this.handleChange);
-  };
-
-  handleOSChange = (os: string) => {
-    this.setState({ os }, this.handleChange);
-  };
-
-  renderJavaBuild = () => (
-    <RenderOptions
-      checked={this.state.javaBuild}
-      name="java-build"
-      onCheck={this.handleJavaBuildChange}
-      optionLabelKey="onboarding.language.java.build_technology"
-      options={['maven', 'gradle']}
-      titleLabelKey="onboarding.language.java.build_technology"
-    />
-  );
-
-  render() {
-    const { language } = this.state;
-    const languages = ['java', 'dotnet', 'other'];
-
-    return (
-      <>
-        <div>
-          <h4 className="spacer-bottom">{translate('onboarding.language')}</h4>
-          <RadioToggle
-            name="language"
-            onCheck={this.handleLanguageChange}
-            options={languages.map(language => ({
-              label: translate('onboarding.language', language),
-              value: language
-            }))}
-            value={language}
-          />
-        </div>
-        {language === 'java' && this.renderJavaBuild()}
-        {language === 'other' && <RenderOS os={this.state.os} setOS={this.handleOSChange} />}
-      </>
-    );
-  }
-}
index 1714244e00e7ef229eaa5046970067e04d64ef39..6a18aee0343551d2ac46b3e0a7c93bbe9b92048e 100644 (file)
@@ -19,7 +19,6 @@
  */
 import * as React from 'react';
 import { translate } from 'sonar-ui-common/helpers/l10n';
-import { isVSTS } from '../../../helpers/almIntegrations';
 import InstanceMessage from '../../common/InstanceMessage';
 import ProjectAnalysisStep from './ProjectAnalysisStep';
 import TokenStep from './TokenStep';
@@ -54,7 +53,6 @@ export default class ManualTutorial extends React.PureComponent<Props, State> {
     const { component, currentUser } = this.props;
     const { step, token } = this.state;
 
-    const almKey = (component.alm && component.alm.key) || currentUser.externalProvider;
     return (
       <>
         <div className="page-header big-spacer-bottom">
@@ -64,27 +62,22 @@ export default class ManualTutorial extends React.PureComponent<Props, State> {
           </p>
         </div>
 
-        {!isVSTS(almKey) && (
-          <>
-            <TokenStep
-              currentUser={currentUser}
-              finished={Boolean(this.state.token)}
-              initialTokenName={`Analyze "${component.name}"`}
-              onContinue={this.handleTokenDone}
-              onOpen={this.handleTokenOpen}
-              open={step === Steps.TOKEN}
-              stepNumber={1}
-            />
+        <TokenStep
+          currentUser={currentUser}
+          finished={Boolean(this.state.token)}
+          initialTokenName={`Analyze "${component.name}"`}
+          onContinue={this.handleTokenDone}
+          onOpen={this.handleTokenOpen}
+          open={step === Steps.TOKEN}
+          stepNumber={1}
+        />
 
-            <ProjectAnalysisStep
-              component={component}
-              displayRowLayout={true}
-              open={step === Steps.ANALYSIS}
-              stepNumber={2}
-              token={token}
-            />
-          </>
-        )}
+        <ProjectAnalysisStep
+          component={component}
+          open={step === Steps.ANALYSIS}
+          stepNumber={2}
+          token={token}
+        />
       </>
     );
   }
index c3acaff6ae0ef9f8347a6b57cc4444db6633ee38..d9c3a170ff68019e2615de5588ad4321ad85edfc 100644 (file)
 import * as React from 'react';
 import { translate } from 'sonar-ui-common/helpers/l10n';
 import Step from '../components/Step';
-import { LanguageConfig } from '../types';
+import { ManualTutorialConfig } from '../types';
+import BuildToolForm from './BuildToolForm';
 import AnalysisCommand from './commands/AnalysisCommand';
-import LanguageForm from './LanguageForm';
 
 interface Props {
   component: T.Component;
-  displayRowLayout?: boolean;
   onFinish?: (projectKey?: string) => void;
-  onReset?: VoidFunction;
   open: boolean;
-  organization?: string;
   stepNumber: number;
   token?: string;
 }
 
 interface State {
-  config?: LanguageConfig;
-}
-
-export function getProjectKey(config?: LanguageConfig, component?: T.Component) {
-  return (component && component.key) || (config && config.projectKey);
+  config?: ManualTutorialConfig;
 }
 
 export default class ProjectAnalysisStep extends React.PureComponent<Props, State> {
   state: State = {};
 
-  handleLanguageSelect = (config: LanguageConfig) => {
+  handleBuildToolSelect = (config: ManualTutorialConfig) => {
+    const { component } = this.props;
     this.setState({ config });
     if (this.props.onFinish) {
-      const projectKey = config.language !== 'java' ? getProjectKey(config) : undefined;
-      this.props.onFinish(projectKey);
-    }
-  };
-
-  handleLanguageReset = () => {
-    this.setState({ config: undefined });
-    if (this.props.onReset) {
-      this.props.onReset();
+      this.props.onFinish(component.key);
     }
   };
 
   renderForm = () => {
-    const languageComponent = (
-      <LanguageForm
-        component={this.props.component}
-        onDone={this.handleLanguageSelect}
-        onReset={this.handleLanguageReset}
-        organization={this.props.organization}
-      />
-    );
-    const analysisComponent = this.state.config && (
-      <AnalysisCommand
-        component={this.props.component}
-        languageConfig={this.state.config}
-        organization={this.props.organization}
-        small={true}
-        token={this.props.token}
-      />
-    );
-
-    if (this.props.displayRowLayout) {
-      return (
-        <div className="boxed-group-inner">
-          <div className="display-flex-column">
-            {languageComponent}
-            {analysisComponent && <div className="huge-spacer-top">{analysisComponent}</div>}
-          </div>
-        </div>
-      );
-    }
-
     return (
       <div className="boxed-group-inner">
-        <div className="flex-columns">
-          <div className="flex-column flex-column-half bordered-right">{languageComponent}</div>
-          <div className="flex-column flex-column-half">{analysisComponent}</div>
+        <div className="display-flex-column">
+          <BuildToolForm component={this.props.component} onDone={this.handleBuildToolSelect} />
+
+          {this.state.config && (
+            <div className="huge-spacer-top">
+              <AnalysisCommand
+                component={this.props.component}
+                languageConfig={this.state.config}
+                token={this.props.token}
+              />
+            </div>
+          )}
         </div>
       </div>
     );
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/manual/__tests__/BuildToolForm-test.tsx
new file mode 100644 (file)
index 0000000..00afbc1
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+import { shallow } from 'enzyme';
+import * as React from 'react';
+import { mockComponent } from '../../../../helpers/testMocks';
+import { BuildTools, OSs } from '../../types';
+import BuildToolForm from '../BuildToolForm';
+
+it('renders correctly', () => {
+  expect(shallowRender()).toMatchSnapshot('default');
+  expect(shallowRender().setState({ config: { buildTool: BuildTools.Maven } })).toMatchSnapshot(
+    'with "maven" selected'
+  );
+  expect(shallowRender().setState({ config: { buildTool: BuildTools.Other } })).toMatchSnapshot(
+    'with "other" selected'
+  );
+});
+
+it('correctly calls the onDone prop', () => {
+  const onDone = jest.fn();
+  const wrapper = shallowRender({ onDone });
+
+  wrapper.instance().handleBuildToolChange(BuildTools.Gradle);
+  expect(onDone).toBeCalledWith(expect.objectContaining({ buildTool: BuildTools.Gradle }));
+
+  wrapper.instance().handleOSChange(OSs.Windows);
+  expect(onDone).toBeCalledWith(
+    expect.objectContaining({ os: OSs.Windows, buildTool: BuildTools.Other })
+  );
+});
+
+function shallowRender(props: Partial<BuildToolForm['props']> = {}) {
+  return shallow<BuildToolForm>(
+    <BuildToolForm component={mockComponent()} onDone={jest.fn()} {...props} />
+  );
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/LanguageForm-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/LanguageForm-test.tsx
deleted file mode 100644 (file)
index 24dd2af..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockComponent } from '../../../../helpers/testMocks';
-import LanguageForm from '../LanguageForm';
-
-it('selects java', () => {
-  const onDone = jest.fn();
-  const wrapper = shallow(
-    <LanguageForm component={mockComponent()} onDone={onDone} onReset={jest.fn()} />
-  );
-
-  (wrapper.find('RadioToggle').prop('onCheck') as Function)('java');
-  wrapper.update();
-  expect(wrapper).toMatchSnapshot();
-});
-
-it('selects c#', () => {
-  const onDone = jest.fn();
-  const wrapper = shallow(
-    <LanguageForm component={mockComponent()} onDone={onDone} onReset={jest.fn()} />
-  );
-
-  (wrapper.find('RadioToggle').prop('onCheck') as Function)('dotnet');
-  wrapper.update();
-  expect(wrapper).toMatchSnapshot();
-});
-
-it('selects other', () => {
-  const onDone = jest.fn();
-  const wrapper = shallow(
-    <LanguageForm component={mockComponent()} onDone={onDone} onReset={jest.fn()} />
-  );
-
-  (wrapper.find('RadioToggle').prop('onCheck') as Function)('other');
-  wrapper.update();
-  expect(wrapper).toMatchSnapshot();
-});
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/manual/__tests__/__snapshots__/BuildToolForm-test.tsx.snap
new file mode 100644 (file)
index 0000000..756cb8a
--- /dev/null
@@ -0,0 +1,128 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders correctly: default 1`] = `
+<Fragment>
+  <div>
+    <h4
+      className="spacer-bottom"
+    >
+      onboarding.build
+    </h4>
+    <RadioToggle
+      disabled={false}
+      name="language"
+      onCheck={[Function]}
+      options={
+        Array [
+          Object {
+            "label": "onboarding.build.maven",
+            "value": "maven",
+          },
+          Object {
+            "label": "onboarding.build.gradle",
+            "value": "gradle",
+          },
+          Object {
+            "label": "onboarding.build.dotnet",
+            "value": "dotnet",
+          },
+          Object {
+            "label": "onboarding.build.other",
+            "value": "other",
+          },
+        ]
+      }
+      value={null}
+    />
+  </div>
+</Fragment>
+`;
+
+exports[`renders correctly: with "maven" selected 1`] = `
+<Fragment>
+  <div>
+    <h4
+      className="spacer-bottom"
+    >
+      onboarding.build
+    </h4>
+    <RadioToggle
+      disabled={false}
+      name="language"
+      onCheck={[Function]}
+      options={
+        Array [
+          Object {
+            "label": "onboarding.build.maven",
+            "value": "maven",
+          },
+          Object {
+            "label": "onboarding.build.gradle",
+            "value": "gradle",
+          },
+          Object {
+            "label": "onboarding.build.dotnet",
+            "value": "dotnet",
+          },
+          Object {
+            "label": "onboarding.build.other",
+            "value": "other",
+          },
+        ]
+      }
+      value="maven"
+    />
+  </div>
+</Fragment>
+`;
+
+exports[`renders correctly: with "other" selected 1`] = `
+<Fragment>
+  <div>
+    <h4
+      className="spacer-bottom"
+    >
+      onboarding.build
+    </h4>
+    <RadioToggle
+      disabled={false}
+      name="language"
+      onCheck={[Function]}
+      options={
+        Array [
+          Object {
+            "label": "onboarding.build.maven",
+            "value": "maven",
+          },
+          Object {
+            "label": "onboarding.build.gradle",
+            "value": "gradle",
+          },
+          Object {
+            "label": "onboarding.build.dotnet",
+            "value": "dotnet",
+          },
+          Object {
+            "label": "onboarding.build.other",
+            "value": "other",
+          },
+        ]
+      }
+      value="other"
+    />
+  </div>
+  <RenderOptions
+    name="os"
+    onCheck={[Function]}
+    optionLabelKey="onboarding.build.other.os"
+    options={
+      Array [
+        "linux",
+        "win",
+        "mac",
+      ]
+    }
+    titleLabelKey="onboarding.build.other.os"
+  />
+</Fragment>
+`;
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/LanguageForm-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/__snapshots__/LanguageForm-test.tsx.snap
deleted file mode 100644 (file)
index 04745f2..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`selects c# 1`] = `
-<Fragment>
-  <div>
-    <h4
-      className="spacer-bottom"
-    >
-      onboarding.language
-    </h4>
-    <RadioToggle
-      disabled={false}
-      name="language"
-      onCheck={[Function]}
-      options={
-        Array [
-          Object {
-            "label": "onboarding.language.java",
-            "value": "java",
-          },
-          Object {
-            "label": "onboarding.language.dotnet",
-            "value": "dotnet",
-          },
-          Object {
-            "label": "onboarding.language.other",
-            "value": "other",
-          },
-        ]
-      }
-      value="dotnet"
-    />
-  </div>
-</Fragment>
-`;
-
-exports[`selects java 1`] = `
-<Fragment>
-  <div>
-    <h4
-      className="spacer-bottom"
-    >
-      onboarding.language
-    </h4>
-    <RadioToggle
-      disabled={false}
-      name="language"
-      onCheck={[Function]}
-      options={
-        Array [
-          Object {
-            "label": "onboarding.language.java",
-            "value": "java",
-          },
-          Object {
-            "label": "onboarding.language.dotnet",
-            "value": "dotnet",
-          },
-          Object {
-            "label": "onboarding.language.other",
-            "value": "other",
-          },
-        ]
-      }
-      value="java"
-    />
-  </div>
-  <RenderOptions
-    name="java-build"
-    onCheck={[Function]}
-    optionLabelKey="onboarding.language.java.build_technology"
-    options={
-      Array [
-        "maven",
-        "gradle",
-      ]
-    }
-    titleLabelKey="onboarding.language.java.build_technology"
-  />
-</Fragment>
-`;
-
-exports[`selects other 1`] = `
-<Fragment>
-  <div>
-    <h4
-      className="spacer-bottom"
-    >
-      onboarding.language
-    </h4>
-    <RadioToggle
-      disabled={false}
-      name="language"
-      onCheck={[Function]}
-      options={
-        Array [
-          Object {
-            "label": "onboarding.language.java",
-            "value": "java",
-          },
-          Object {
-            "label": "onboarding.language.dotnet",
-            "value": "dotnet",
-          },
-          Object {
-            "label": "onboarding.language.other",
-            "value": "other",
-          },
-        ]
-      }
-      value="other"
-    />
-  </div>
-  <RenderOS
-    setOS={[Function]}
-  />
-</Fragment>
-`;
index 77e51dfb0646c952b4e58befd83109135dfdae22..09df2c2fe0bd181a5badca0f77d35e3277d83f4d 100644 (file)
@@ -59,7 +59,6 @@ exports[`renders correctly: default 1`] = `
         "tags": Array [],
       }
     }
-    displayRowLayout={true}
     open={false}
     stepNumber={2}
   />
index dd66db282585f76610ff7218b98dbcb071577a62..084813bedebda8a5cad99a059e1ea15b8d10a5cc 100644 (file)
  */
 import * as React from 'react';
 import { getHostUrl } from 'sonar-ui-common/helpers/urls';
-import { LanguageConfig } from '../../types';
-import { getProjectKey } from '../ProjectAnalysisStep';
+import { BuildTools, ManualTutorialConfig } from '../../types';
 import DotNet from './DotNet';
 import JavaGradle from './JavaGradle';
 import JavaMaven from './JavaMaven';
 import Other from './Other';
 
-interface Props {
-  component?: T.Component;
-  organization?: string;
-  languageConfig: LanguageConfig;
-  small?: boolean;
+export interface AnalysisCommandProps {
+  component: T.Component;
+  languageConfig: ManualTutorialConfig;
   token?: string;
 }
 
-export default class AnalysisCommand extends React.PureComponent<Props> {
-  renderCommandForMaven = () => {
-    const { component, token } = this.props;
-    if (!token) {
-      return null;
-    }
-    return (
-      <JavaMaven
-        host={getHostUrl()}
-        organization={this.props.organization}
-        projectKey={component && component.key}
-        token={token}
-      />
-    );
-  };
+export default function AnalysisCommand(props: AnalysisCommandProps) {
+  const { component, languageConfig, token } = props;
 
-  renderCommandForGradle = () => {
-    const { component, token } = this.props;
-    if (!token) {
-      return null;
-    }
-    return (
-      <JavaGradle
-        host={getHostUrl()}
-        organization={this.props.organization}
-        projectKey={component && component.key}
-        token={token}
-      />
-    );
-  };
+  if (!token) {
+    return null;
+  }
 
-  renderCommandForDotNet = () => {
-    const { component, languageConfig, small, token } = this.props;
-    const projectKey = getProjectKey(languageConfig, component);
-    if (!projectKey || !token) {
-      return null;
-    }
-    return (
-      <DotNet
-        host={getHostUrl()}
-        organization={this.props.organization}
-        projectKey={projectKey}
-        small={small}
-        token={token}
-      />
-    );
-  };
+  const host = getHostUrl();
+  const projectKey = component.key;
 
-  renderCommandForOther = () => {
-    const { component, languageConfig, token } = this.props;
-    const projectKey = getProjectKey(languageConfig, component);
-    if (!languageConfig || !projectKey || !languageConfig.os || !token) {
-      return null;
-    }
-    return (
-      <Other
-        host={getHostUrl()}
-        organization={this.props.organization}
-        os={languageConfig.os}
-        projectKey={projectKey}
-        token={token}
-      />
-    );
-  };
+  switch (languageConfig.buildTool) {
+    case BuildTools.Maven:
+      return <JavaMaven host={host} projectKey={projectKey} token={token} />;
+
+    case BuildTools.Gradle:
+      return <JavaGradle host={host} projectKey={projectKey} token={token} />;
 
-  render() {
-    const { languageConfig } = this.props;
+    case BuildTools.DotNet:
+      return <DotNet host={host} projectKey={projectKey} token={token} />;
 
-    if (languageConfig.language === 'java') {
-      return languageConfig.javaBuild === 'maven'
-        ? this.renderCommandForMaven()
-        : this.renderCommandForGradle();
-    } else if (languageConfig.language === 'dotnet') {
-      return this.renderCommandForDotNet();
-    } else {
-      return this.renderCommandForOther();
-    }
+    case BuildTools.Other:
+      return languageConfig.os !== undefined ? (
+        <Other host={host} os={languageConfig.os} projectKey={projectKey} token={token} />
+      ) : null;
+
+    default:
+      return null;
   }
 }
index cb69448c2000c25a6d36ab367b3a74668bd9a281..2b83c0dac53da60a7a0cd3adf1ba932298cc7a04 100644 (file)
@@ -23,32 +23,47 @@ import { Link } from 'react-router';
 import { translate } from 'sonar-ui-common/helpers/l10n';
 import CodeSnippet from '../../../common/CodeSnippet';
 import InstanceMessage from '../../../common/InstanceMessage';
-import MSBuildScanner from './MSBuildScanner';
 
-export interface Props {
+export interface DotNetProps {
   host: string;
-  organization?: string;
   projectKey: string;
-  small?: boolean;
   token: string;
 }
 
-export default function DotNet(props: Props) {
+export default function DotNet(props: DotNetProps) {
+  const { host, projectKey, token } = props;
+
   const command1 = [
     'SonarScanner.MSBuild.exe begin',
-    `/k:"${props.projectKey}"`,
-    props.organization && `/d:sonar.organization="${props.organization}"`,
-    `/d:sonar.host.url="${props.host}"`,
-    `/d:sonar.login="${props.token}"`
+    `/k:"${projectKey}"`,
+    `/d:sonar.host.url="${host}"`,
+    `/d:sonar.login="${token}"`
   ];
 
   const command2 = 'MsBuild.exe /t:Rebuild';
 
-  const command3 = ['SonarScanner.MSBuild.exe end', `/d:sonar.login="${props.token}"`];
+  const command3 = ['SonarScanner.MSBuild.exe end', `/d:sonar.login="${token}"`];
 
   return (
     <div>
-      <MSBuildScanner />
+      <div>
+        <h4 className="spacer-bottom">{translate('onboarding.analysis.msbuild.header')}</h4>
+        <p className="spacer-bottom markdown">
+          <FormattedMessage
+            defaultMessage={translate('onboarding.analysis.msbuild.text')}
+            id="onboarding.analysis.msbuild.text"
+            values={{ code: <code>%PATH%</code> }}
+          />
+        </p>
+        <p>
+          <Link
+            className="button"
+            to="/documentation/analysis/scan/sonarscanner-for-msbuild/"
+            target="_blank">
+            {translate('download_verb')}
+          </Link>
+        </p>
+      </div>
 
       <h4 className="huge-spacer-top spacer-bottom">
         {translate('onboarding.analysis.msbuild.execute')}
@@ -58,7 +73,7 @@ export default function DotNet(props: Props) {
       </InstanceMessage>
       <CodeSnippet isOneLine={true} snippet={command1} />
       <CodeSnippet isOneLine={true} snippet={command2} />
-      <CodeSnippet isOneLine={props.small} snippet={command3} />
+      <CodeSnippet isOneLine={true} snippet={command3} />
       <p className="big-spacer-top markdown">
         <FormattedMessage
           defaultMessage={translate('onboarding.analysis.docs')}
index 8358364358dd0199d08e246d040b82ea9425b4c2..cf164fae0bd8b8f34ca5ae8367ba15dbd0ecefcb 100644 (file)
@@ -24,22 +24,21 @@ import { translate } from 'sonar-ui-common/helpers/l10n';
 import CodeSnippet from '../../../common/CodeSnippet';
 import InstanceMessage from '../../../common/InstanceMessage';
 
-export interface Props {
+export interface JavaGradleProps {
   host: string;
-  organization?: string;
-  projectKey?: string;
+  projectKey: string;
   token: string;
 }
 
-export default function JavaGradle(props: Props) {
-  const config = 'plugins {\n  id "org.sonarqube" version "2.7"\n}';
+export default function JavaGradle(props: JavaGradleProps) {
+  const { host, projectKey, token } = props;
+  const config = 'plugins {\n  id "org.sonarqube" version "3.0"\n}';
 
   const command = [
     './gradlew sonarqube',
-    props.projectKey && `-Dsonar.projectKey=${props.projectKey}`,
-    props.organization && `-Dsonar.organization=${props.organization}`,
-    `-Dsonar.host.url=${props.host}`,
-    `-Dsonar.login=${props.token}`
+    `-Dsonar.projectKey=${projectKey}`,
+    `-Dsonar.host.url=${host}`,
+    `-Dsonar.login=${token}`
   ];
 
   return (
@@ -60,6 +59,21 @@ export default function JavaGradle(props: Props) {
         )}
       </InstanceMessage>
       <CodeSnippet snippet={config} />
+      <p className="big-spacer-bottom markdown">
+        <em className="small text-muted">
+          <FormattedMessage
+            defaultMessage={translate('onboarding.analysis.java.gradle.latest_version')}
+            id="onboarding.analysis.java.gradle.latest_version"
+            values={{
+              link: (
+                <Link to="/documentation/analysis/scan/sonarscanner-for-gradle/" target="_blank">
+                  {translate('here')}
+                </Link>
+              )
+            }}
+          />
+        </em>
+      </p>
       <p className="spacer-top spacer-bottom markdown">
         {translate('onboarding.analysis.java.gradle.text.2')}
       </p>
@@ -78,9 +92,7 @@ export default function JavaGradle(props: Props) {
         />
       </p>
       <p className="big-spacer-top markdown">
-        {props.projectKey
-          ? translate('onboarding.analysis.auto_refresh_after_analysis')
-          : translate('onboarding.analysis.browse_url_after_analysis')}
+        {translate('onboarding.analysis.auto_refresh_after_analysis')}
       </p>
     </div>
   );
index 060b0d3863e3d2d3070dd5053c223fb1d5d609fc..e10ddab9d085c29e399f6393fc5713dfd863c609 100644 (file)
@@ -24,20 +24,19 @@ import { translate } from 'sonar-ui-common/helpers/l10n';
 import CodeSnippet from '../../../common/CodeSnippet';
 import InstanceMessage from '../../../common/InstanceMessage';
 
-export interface Props {
+export interface JavaMavenProps {
   host: string;
-  organization?: string;
-  projectKey?: string;
+  projectKey: string;
   token: string;
 }
 
-export default function JavaMaven(props: Props) {
+export default function JavaMaven(props: JavaMavenProps) {
+  const { host, projectKey, token } = props;
   const command = [
     'mvn sonar:sonar',
-    props.projectKey && `-Dsonar.projectKey=${props.projectKey}`,
-    props.organization && `-Dsonar.organization=${props.organization}`,
-    `-Dsonar.host.url=${props.host}`,
-    `-Dsonar.login=${props.token}`
+    `-Dsonar.projectKey=${projectKey}`,
+    `-Dsonar.host.url=${host}`,
+    `-Dsonar.login=${token}`
   ];
 
   return (
@@ -61,9 +60,7 @@ export default function JavaMaven(props: Props) {
         />
       </p>
       <p className="big-spacer-top markdown">
-        {props.projectKey
-          ? translate('onboarding.analysis.auto_refresh_after_analysis')
-          : translate('onboarding.analysis.browse_url_after_analysis')}
+        {translate('onboarding.analysis.auto_refresh_after_analysis')}
       </p>
     </div>
   );
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/MSBuildScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/MSBuildScanner.tsx
deleted file mode 100644 (file)
index f4f4195..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import * as React from 'react';
-import { FormattedMessage } from 'react-intl';
-import { Link } from 'react-router';
-import { translate } from 'sonar-ui-common/helpers/l10n';
-
-interface Props {
-  className?: string;
-}
-
-export default function MSBuildScanner(props: Props) {
-  return (
-    <div className={props.className}>
-      <h4 className="spacer-bottom">{translate('onboarding.analysis.msbuild.header')}</h4>
-      <p className="spacer-bottom markdown">
-        <FormattedMessage
-          defaultMessage={translate('onboarding.analysis.msbuild.text')}
-          id="onboarding.analysis.msbuild.text"
-          values={{ code: <code>%PATH%</code> }}
-        />
-      </p>
-      <p>
-        <Link
-          className="button"
-          to="/documentation/analysis/scan/sonarscanner-for-msbuild/"
-          target="_blank">
-          {translate('download_verb')}
-        </Link>
-      </p>
-    </div>
-  );
-}
index 89ac7b6dbae0902dcf4afeb9a268294da4dc3228..9ac51191ed370f279e24468a8085c4fad36f1e5b 100644 (file)
@@ -23,31 +23,48 @@ import { Link } from 'react-router';
 import { translate } from 'sonar-ui-common/helpers/l10n';
 import CodeSnippet from '../../../common/CodeSnippet';
 import InstanceMessage from '../../../common/InstanceMessage';
+import { OSs } from '../../types';
 import { quote } from '../../utils';
-import SQScanner from './SQScanner';
 
-export interface Props {
+export interface OtherProps {
   host: string;
-  organization?: string;
-  os: string;
+  os: OSs;
   projectKey: string;
   token: string;
 }
 
-export default function Other(props: Props) {
-  const q = quote(props.os);
+export default function Other(props: OtherProps) {
+  const { host, os, projectKey, token } = props;
+
+  const q = quote(os);
   const command = [
-    props.os === 'win' ? 'sonar-scanner.bat' : 'sonar-scanner',
-    '-D' + q(`sonar.projectKey=${props.projectKey}`),
-    props.organization && '-D' + q(`sonar.organization=${props.organization}`),
+    os === OSs.Windows ? 'sonar-scanner.bat' : 'sonar-scanner',
+    '-D' + q(`sonar.projectKey=${projectKey}`),
     '-D' + q('sonar.sources=.'),
-    '-D' + q(`sonar.host.url=${props.host}`),
-    '-D' + q(`sonar.login=${props.token}`)
+    '-D' + q(`sonar.host.url=${host}`),
+    '-D' + q(`sonar.login=${token}`)
   ];
 
   return (
     <div>
-      <SQScanner os={props.os} />
+      <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>
+            }}
+          />
+        </p>
+        <p>
+          <Link className="button" to="/documentation/analysis/scan/sonarscanner/" target="_blank">
+            {translate('download_verb')}
+          </Link>
+        </p>
+      </div>
 
       <h4 className="huge-spacer-top spacer-bottom">
         {translate('onboarding.analysis.sq_scanner.execute')}
@@ -55,7 +72,7 @@ export default function Other(props: Props) {
       <InstanceMessage message={translate('onboarding.analysis.sq_scanner.execute.text')}>
         {transformedMessage => <p className="spacer-bottom markdown">{transformedMessage}</p>}
       </InstanceMessage>
-      <CodeSnippet isOneLine={props.os === 'win'} snippet={command} />
+      <CodeSnippet isOneLine={os === OSs.Windows} snippet={command} />
       <p className="big-spacer-top markdown">
         <FormattedMessage
           defaultMessage={translate('onboarding.analysis.sq_scanner.docs')}
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/SQScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/SQScanner.tsx
deleted file mode 100644 (file)
index f6c3362..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import * as React from 'react';
-import { FormattedMessage } from 'react-intl';
-import { Link } from 'react-router';
-import { translate } from 'sonar-ui-common/helpers/l10n';
-
-interface Props {
-  className?: string;
-  os: string;
-}
-
-export default function SQScanner(props: Props) {
-  return (
-    <div className={props.className}>
-      <h4 className="spacer-bottom">
-        {translate('onboarding.analysis.sq_scanner.header', props.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>{props.os === 'win' ? '%PATH%' : 'PATH'}</code>
-          }}
-        />
-      </p>
-      <p>
-        <Link className="button" to="/documentation/analysis/scan/sonarscanner/" target="_blank">
-          {translate('download_verb')}
-        </Link>
-      </p>
-    </div>
-  );
-}
index 6f8c57e45134dc0861eefbe5c52358e3dea65c02..0322604ba66f543f8958e30be9e8df8871c14157 100644 (file)
  */
 import { shallow } from 'enzyme';
 import * as React from 'react';
-import AnalysisCommand from '../AnalysisCommand';
+import { mockComponent } from '../../../../../helpers/testMocks';
+import { BuildTools, OSs } from '../../../types';
+import AnalysisCommand, { AnalysisCommandProps } from '../AnalysisCommand';
 
 jest.mock('sonar-ui-common/helpers/urls', () => ({
   getHostUrl: () => 'HOST'
 }));
 
-it('display java command', () => {
+it('renders correctly', () => {
+  expect(shallowRender({ languageConfig: { buildTool: BuildTools.Gradle } })).toMatchSnapshot(
+    'gradle'
+  );
+  expect(shallowRender({ languageConfig: { buildTool: BuildTools.Maven } })).toMatchSnapshot(
+    'maven'
+  );
+  expect(shallowRender({ languageConfig: { buildTool: BuildTools.DotNet } })).toMatchSnapshot(
+    '.NET'
+  );
   expect(
-    getWrapper({ languageConfig: { language: 'java', javaBuild: 'gradle' } })
-  ).toMatchSnapshot();
-  expect(
-    getWrapper({ languageConfig: { language: 'java', javaBuild: 'maven' } })
-  ).toMatchSnapshot();
-});
-
-it('display c# command', () => {
-  expect(
-    getWrapper({ languageConfig: { language: 'dotnet', projectKey: 'project-foo' } })
-  ).toMatchSnapshot();
-});
-
-it('display others command', () => {
-  expect(
-    getWrapper({
-      languageConfig: { language: 'other', os: 'window', projectKey: 'project-foo' }
-    })
-  ).toMatchSnapshot();
+    shallowRender({ languageConfig: { buildTool: BuildTools.Other, os: OSs.Windows } })
+  ).toMatchSnapshot('other');
 });
 
-function getWrapper(props = {}) {
-  return shallow(<AnalysisCommand languageConfig={{}} token="myToken" {...props} />);
+function shallowRender(props: Partial<AnalysisCommandProps> = {}) {
+  return shallow<AnalysisCommandProps>(
+    <AnalysisCommand component={mockComponent()} languageConfig={{}} token="myToken" {...props} />
+  );
 }
index 8f00456d2d4abdf9d581aebba714a5bdfa767c66..62a213244f987bb1f8c0aa13f5761d39439487c8 100644 (file)
  */
 import { shallow } from 'enzyme';
 import * as React from 'react';
-import DotNet, { Props } from '../DotNet';
+import DotNet from '../DotNet';
 
 it('DotNet renders correctly', () => {
-  expect(shallowRender).toMatchSnapshot();
-
-  expect(
-    shallowRender({
-      organization: 'organization',
-      small: true
-    })
-  ).toMatchSnapshot();
+  expect(shallow(<DotNet host="host" projectKey="projectKey" token="token" />)).toMatchSnapshot();
 });
-
-function shallowRender(props: Partial<Props> = {}) {
-  return shallow(<DotNet host="host" projectKey="projectKey" token="token" {...props} />);
-}
index 0fc13a7dba4488d205af4789ecdf03af96eaecad..c03f7f0137ffdf95a5aee4de349c5407614b0d5c 100644 (file)
@@ -22,14 +22,7 @@ import * as React from 'react';
 import JavaGradle from '../JavaGradle';
 
 it('renders correctly', () => {
-  expect(shallow(<JavaGradle host="host" token="token" />)).toMatchSnapshot();
   expect(
-    shallow(<JavaGradle host="host" organization="organization" token="token" />)
-  ).toMatchSnapshot();
-});
-
-it('renders with projectKey', () => {
-  expect(
-    shallow(<JavaGradle host="host" organization="organization" projectKey="foo" token="token" />)
+    shallow(<JavaGradle host="host" projectKey="projectKey" token="token" />)
   ).toMatchSnapshot();
 });
index 7304894fd13261df3ab8851de755a389cabe9cfc..3227854fe9f4dbeeed4cecdcd257a8d31863da96 100644 (file)
@@ -22,14 +22,7 @@ import * as React from 'react';
 import JavaMaven from '../JavaMaven';
 
 it('renders correctly', () => {
-  expect(shallow(<JavaMaven host="host" token="token" />)).toMatchSnapshot();
   expect(
-    shallow(<JavaMaven host="host" organization="organization" token="token" />)
-  ).toMatchSnapshot();
-});
-
-it('renders with projectKey', () => {
-  expect(
-    shallow(<JavaMaven host="host" organization="organization" projectKey="foo" token="token" />)
+    shallow(<JavaMaven host="host" projectKey="projectKey" token="token" />)
   ).toMatchSnapshot();
 });
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/MSBuildScanner-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/MSBuildScanner-test.tsx
deleted file mode 100644 (file)
index 8da96cd..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import { shallow } from 'enzyme';
-import * as React from 'react';
-import MSBuildScanner from '../MSBuildScanner';
-
-it('renders correctly', () => {
-  expect(shallow(<MSBuildScanner />)).toMatchSnapshot();
-});
index f4ab19c816fded10a5eb9ecbc1891f9ddb9d6b1c..696bf503cab4a9ae9992bbe3e8917cc8f1775dac 100644 (file)
  */
 import { shallow } from 'enzyme';
 import * as React from 'react';
-import Other from '../Other';
+import { OSs } from '../../../types';
+import Other, { OtherProps } from '../Other';
 
 it('renders correctly', () => {
-  expect(
-    shallow(<Other host="host" os="win" projectKey="projectKey" token="token" />)
-  ).toMatchSnapshot();
-
-  expect(
-    shallow(<Other host="host" os="linux" projectKey="projectKey" token="token" />)
-  ).toMatchSnapshot();
-
-  expect(
-    shallow(<Other host="host" os="linux" projectKey="projectKey" token="token" />)
-  ).toMatchSnapshot();
+  expect(shallowRender()).toMatchSnapshot('linux');
+  expect(shallowRender({ os: OSs.Windows })).toMatchSnapshot('windows');
+  expect(shallowRender({ os: OSs.MacOS })).toMatchSnapshot('macos');
 });
+
+function shallowRender(props: Partial<OtherProps> = {}) {
+  return shallow<OtherProps>(
+    <Other host="host" os={OSs.Linux} projectKey="projectKey" token="token" {...props} />
+  );
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/SQScanner-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/SQScanner-test.tsx
deleted file mode 100644 (file)
index 26a51ae..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import { shallow } from 'enzyme';
-import * as React from 'react';
-import SQScanner from '../SQScanner';
-
-it('renders correctly', () => {
-  expect(shallow(<SQScanner os="win" />)).toMatchSnapshot();
-  expect(shallow(<SQScanner os="linux" />)).toMatchSnapshot();
-  expect(shallow(<SQScanner os="mac" />)).toMatchSnapshot();
-});
index 6afb09941d00e0a9f0eb5b339912081a02a1352d..bb48fe6b8850794e7c0da615c3a279ffae943cc2 100644 (file)
@@ -1,32 +1,34 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`display c# command 1`] = `
+exports[`renders correctly: .NET 1`] = `
 <DotNet
   host="HOST"
-  projectKey="project-foo"
+  projectKey="my-project"
   token="myToken"
 />
 `;
 
-exports[`display java command 1`] = `
+exports[`renders correctly: gradle 1`] = `
 <JavaGradle
   host="HOST"
+  projectKey="my-project"
   token="myToken"
 />
 `;
 
-exports[`display java command 2`] = `
+exports[`renders correctly: maven 1`] = `
 <JavaMaven
   host="HOST"
+  projectKey="my-project"
   token="myToken"
 />
 `;
 
-exports[`display others command 1`] = `
+exports[`renders correctly: other 1`] = `
 <Other
   host="HOST"
-  os="window"
-  projectKey="project-foo"
+  os="win"
+  projectKey="my-project"
   token="myToken"
 />
 `;
index 855871ad5839338e545c4de015b3852feb106471..50fe953751cf1fe797f54c7e4b6a62ce3c0dd9de 100644 (file)
@@ -1,10 +1,40 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`DotNet renders correctly 1`] = `[Function]`;
-
-exports[`DotNet renders correctly 2`] = `
+exports[`DotNet renders correctly 1`] = `
 <div>
-  <MSBuildScanner />
+  <div>
+    <h4
+      className="spacer-bottom"
+    >
+      onboarding.analysis.msbuild.header
+    </h4>
+    <p
+      className="spacer-bottom markdown"
+    >
+      <FormattedMessage
+        defaultMessage="onboarding.analysis.msbuild.text"
+        id="onboarding.analysis.msbuild.text"
+        values={
+          Object {
+            "code": <code>
+              %PATH%
+            </code>,
+          }
+        }
+      />
+    </p>
+    <p>
+      <Link
+        className="button"
+        onlyActiveOnIndex={false}
+        style={Object {}}
+        target="_blank"
+        to="/documentation/analysis/scan/sonarscanner-for-msbuild/"
+      >
+        download_verb
+      </Link>
+    </p>
+  </div>
   <h4
     className="huge-spacer-top spacer-bottom"
   >
@@ -21,7 +51,6 @@ exports[`DotNet renders correctly 2`] = `
       Array [
         "SonarScanner.MSBuild.exe begin",
         "/k:\\"projectKey\\"",
-        "/d:sonar.organization=\\"organization\\"",
         "/d:sonar.host.url=\\"host\\"",
         "/d:sonar.login=\\"token\\"",
       ]
index 9aaa8263e363fda7d5d1667988c6ab494acee2e6..a4a67e7178120b0c4da5bf0b4c45fe4f4a7baa12 100644 (file)
@@ -14,131 +14,33 @@ exports[`renders correctly 1`] = `
   </InstanceMessage>
   <CodeSnippet
     snippet="plugins {
-  id \\"org.sonarqube\\" version \\"2.7\\"
+  id \\"org.sonarqube\\" version \\"3.0\\"
 }"
   />
   <p
-    className="spacer-top spacer-bottom markdown"
-  >
-    onboarding.analysis.java.gradle.text.2
-  </p>
-  <CodeSnippet
-    snippet={
-      Array [
-        "./gradlew sonarqube",
-        undefined,
-        undefined,
-        "-Dsonar.host.url=host",
-        "-Dsonar.login=token",
-      ]
-    }
-  />
-  <p
-    className="big-spacer-top markdown"
-  >
-    <FormattedMessage
-      defaultMessage="onboarding.analysis.docs"
-      id="onboarding.analysis.docs"
-      values={
-        Object {
-          "link": <Link
-            onlyActiveOnIndex={false}
-            style={Object {}}
-            target="_blank"
-            to="/documentation/analysis/scan/sonarscanner-for-gradle/"
-          >
-            onboarding.analysis.java.gradle.docs_link
-          </Link>,
-        }
-      }
-    />
-  </p>
-  <p
-    className="big-spacer-top markdown"
-  >
-    onboarding.analysis.browse_url_after_analysis
-  </p>
-</div>
-`;
-
-exports[`renders correctly 2`] = `
-<div>
-  <h4
-    className="spacer-bottom"
-  >
-    onboarding.analysis.java.gradle.header
-  </h4>
-  <InstanceMessage
-    message="onboarding.analysis.java.gradle.text.1"
-  >
-    <Component />
-  </InstanceMessage>
-  <CodeSnippet
-    snippet="plugins {
-  id \\"org.sonarqube\\" version \\"2.7\\"
-}"
-  />
-  <p
-    className="spacer-top spacer-bottom markdown"
+    className="big-spacer-bottom markdown"
   >
-    onboarding.analysis.java.gradle.text.2
-  </p>
-  <CodeSnippet
-    snippet={
-      Array [
-        "./gradlew sonarqube",
-        undefined,
-        "-Dsonar.organization=organization",
-        "-Dsonar.host.url=host",
-        "-Dsonar.login=token",
-      ]
-    }
-  />
-  <p
-    className="big-spacer-top markdown"
-  >
-    <FormattedMessage
-      defaultMessage="onboarding.analysis.docs"
-      id="onboarding.analysis.docs"
-      values={
-        Object {
-          "link": <Link
-            onlyActiveOnIndex={false}
-            style={Object {}}
-            target="_blank"
-            to="/documentation/analysis/scan/sonarscanner-for-gradle/"
-          >
-            onboarding.analysis.java.gradle.docs_link
-          </Link>,
+    <em
+      className="small text-muted"
+    >
+      <FormattedMessage
+        defaultMessage="onboarding.analysis.java.gradle.latest_version"
+        id="onboarding.analysis.java.gradle.latest_version"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              target="_blank"
+              to="/documentation/analysis/scan/sonarscanner-for-gradle/"
+            >
+              here
+            </Link>,
+          }
         }
-      }
-    />
-  </p>
-  <p
-    className="big-spacer-top markdown"
-  >
-    onboarding.analysis.browse_url_after_analysis
+      />
+    </em>
   </p>
-</div>
-`;
-
-exports[`renders with projectKey 1`] = `
-<div>
-  <h4
-    className="spacer-bottom"
-  >
-    onboarding.analysis.java.gradle.header
-  </h4>
-  <InstanceMessage
-    message="onboarding.analysis.java.gradle.text.1"
-  >
-    <Component />
-  </InstanceMessage>
-  <CodeSnippet
-    snippet="plugins {
-  id \\"org.sonarqube\\" version \\"2.7\\"
-}"
-  />
   <p
     className="spacer-top spacer-bottom markdown"
   >
@@ -148,8 +50,7 @@ exports[`renders with projectKey 1`] = `
     snippet={
       Array [
         "./gradlew sonarqube",
-        "-Dsonar.projectKey=foo",
-        "-Dsonar.organization=organization",
+        "-Dsonar.projectKey=projectKey",
         "-Dsonar.host.url=host",
         "-Dsonar.login=token",
       ]
index c4e572ed480215a94962929b1df880b1fcbd1ff1..6f8bf87db64098a62d62db7568613f1991b1a7be 100644 (file)
@@ -18,114 +18,7 @@ exports[`renders correctly 1`] = `
     snippet={
       Array [
         "mvn sonar:sonar",
-        undefined,
-        undefined,
-        "-Dsonar.host.url=host",
-        "-Dsonar.login=token",
-      ]
-    }
-  />
-  <p
-    className="big-spacer-top markdown"
-  >
-    <FormattedMessage
-      defaultMessage="onboarding.analysis.docs"
-      id="onboarding.analysis.docs"
-      values={
-        Object {
-          "link": <Link
-            onlyActiveOnIndex={false}
-            style={Object {}}
-            target="_blank"
-            to="/documentation/analysis/scan/sonarscanner-for-gradle/"
-          >
-            onboarding.analysis.java.maven.docs_link
-          </Link>,
-        }
-      }
-    />
-  </p>
-  <p
-    className="big-spacer-top markdown"
-  >
-    onboarding.analysis.browse_url_after_analysis
-  </p>
-</div>
-`;
-
-exports[`renders correctly 2`] = `
-<div>
-  <h4
-    className="spacer-bottom"
-  >
-    onboarding.analysis.java.maven.header
-  </h4>
-  <p
-    className="spacer-bottom markdown"
-  >
-    <InstanceMessage
-      message="onboarding.analysis.java.maven.text"
-    />
-  </p>
-  <CodeSnippet
-    snippet={
-      Array [
-        "mvn sonar:sonar",
-        undefined,
-        "-Dsonar.organization=organization",
-        "-Dsonar.host.url=host",
-        "-Dsonar.login=token",
-      ]
-    }
-  />
-  <p
-    className="big-spacer-top markdown"
-  >
-    <FormattedMessage
-      defaultMessage="onboarding.analysis.docs"
-      id="onboarding.analysis.docs"
-      values={
-        Object {
-          "link": <Link
-            onlyActiveOnIndex={false}
-            style={Object {}}
-            target="_blank"
-            to="/documentation/analysis/scan/sonarscanner-for-gradle/"
-          >
-            onboarding.analysis.java.maven.docs_link
-          </Link>,
-        }
-      }
-    />
-  </p>
-  <p
-    className="big-spacer-top markdown"
-  >
-    onboarding.analysis.browse_url_after_analysis
-  </p>
-</div>
-`;
-
-exports[`renders with projectKey 1`] = `
-<div>
-  <h4
-    className="spacer-bottom"
-  >
-    onboarding.analysis.java.maven.header
-  </h4>
-  <p
-    className="spacer-bottom markdown"
-  >
-    <InstanceMessage
-      message="onboarding.analysis.java.maven.text"
-    />
-  </p>
-  <CodeSnippet
-    snippet={
-      Array [
-        "mvn sonar:sonar",
-        "-Dsonar.projectKey=foo",
-        "-Dsonar.organization=organization",
+        "-Dsonar.projectKey=projectKey",
         "-Dsonar.host.url=host",
         "-Dsonar.login=token",
       ]
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/MSBuildScanner-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/MSBuildScanner-test.tsx.snap
deleted file mode 100644 (file)
index 16c37fa..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders correctly 1`] = `
-<div>
-  <h4
-    className="spacer-bottom"
-  >
-    onboarding.analysis.msbuild.header
-  </h4>
-  <p
-    className="spacer-bottom markdown"
-  >
-    <FormattedMessage
-      defaultMessage="onboarding.analysis.msbuild.text"
-      id="onboarding.analysis.msbuild.text"
-      values={
-        Object {
-          "code": <code>
-            %PATH%
-          </code>,
-        }
-      }
-    />
-  </p>
-  <p>
-    <Link
-      className="button"
-      onlyActiveOnIndex={false}
-      style={Object {}}
-      target="_blank"
-      to="/documentation/analysis/scan/sonarscanner-for-msbuild/"
-    >
-      download_verb
-    </Link>
-  </p>
-</div>
-`;
index 6a822115cbf015aa49df569a3c6f4d5a63835789..5b11bd567dbc1e2fc2011f2c4b77571d7fc6dd41 100644 (file)
@@ -1,10 +1,43 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`renders correctly 1`] = `
+exports[`renders correctly: linux 1`] = `
 <div>
-  <SQScanner
-    os="win"
-  />
+  <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>,
+          }
+        }
+      />
+    </p>
+    <p>
+      <Link
+        className="button"
+        onlyActiveOnIndex={false}
+        style={Object {}}
+        target="_blank"
+        to="/documentation/analysis/scan/sonarscanner/"
+      >
+        download_verb
+      </Link>
+    </p>
+  </div>
   <h4
     className="huge-spacer-top spacer-bottom"
   >
@@ -16,15 +49,14 @@ exports[`renders correctly 1`] = `
     <Component />
   </InstanceMessage>
   <CodeSnippet
-    isOneLine={true}
+    isOneLine={false}
     snippet={
       Array [
-        "sonar-scanner.bat",
-        "-D\\"sonar.projectKey=projectKey\\"",
-        undefined,
-        "-D\\"sonar.sources=.\\"",
-        "-D\\"sonar.host.url=host\\"",
-        "-D\\"sonar.login=token\\"",
+        "sonar-scanner",
+        "-Dsonar.projectKey=projectKey",
+        "-Dsonar.sources=.",
+        "-Dsonar.host.url=host",
+        "-Dsonar.login=token",
       ]
     }
   />
@@ -51,11 +83,44 @@ exports[`renders correctly 1`] = `
 </div>
 `;
 
-exports[`renders correctly 2`] = `
+exports[`renders correctly: macos 1`] = `
 <div>
-  <SQScanner
-    os="linux"
-  />
+  <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>,
+          }
+        }
+      />
+    </p>
+    <p>
+      <Link
+        className="button"
+        onlyActiveOnIndex={false}
+        style={Object {}}
+        target="_blank"
+        to="/documentation/analysis/scan/sonarscanner/"
+      >
+        download_verb
+      </Link>
+    </p>
+  </div>
   <h4
     className="huge-spacer-top spacer-bottom"
   >
@@ -72,7 +137,6 @@ exports[`renders correctly 2`] = `
       Array [
         "sonar-scanner",
         "-Dsonar.projectKey=projectKey",
-        undefined,
         "-Dsonar.sources=.",
         "-Dsonar.host.url=host",
         "-Dsonar.login=token",
@@ -102,11 +166,44 @@ exports[`renders correctly 2`] = `
 </div>
 `;
 
-exports[`renders correctly 3`] = `
+exports[`renders correctly: windows 1`] = `
 <div>
-  <SQScanner
-    os="linux"
-  />
+  <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>,
+          }
+        }
+      />
+    </p>
+    <p>
+      <Link
+        className="button"
+        onlyActiveOnIndex={false}
+        style={Object {}}
+        target="_blank"
+        to="/documentation/analysis/scan/sonarscanner/"
+      >
+        download_verb
+      </Link>
+    </p>
+  </div>
   <h4
     className="huge-spacer-top spacer-bottom"
   >
@@ -118,15 +215,14 @@ exports[`renders correctly 3`] = `
     <Component />
   </InstanceMessage>
   <CodeSnippet
-    isOneLine={false}
+    isOneLine={true}
     snippet={
       Array [
-        "sonar-scanner",
-        "-Dsonar.projectKey=projectKey",
-        undefined,
-        "-Dsonar.sources=.",
-        "-Dsonar.host.url=host",
-        "-Dsonar.login=token",
+        "sonar-scanner.bat",
+        "-D\\"sonar.projectKey=projectKey\\"",
+        "-D\\"sonar.sources=.\\"",
+        "-D\\"sonar.host.url=host\\"",
+        "-D\\"sonar.login=token\\"",
       ]
     }
   />
diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/SQScanner-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/SQScanner-test.tsx.snap
deleted file mode 100644 (file)
index dd388d9..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders 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>,
-        }
-      }
-    />
-  </p>
-  <p>
-    <Link
-      className="button"
-      onlyActiveOnIndex={false}
-      style={Object {}}
-      target="_blank"
-      to="/documentation/analysis/scan/sonarscanner/"
-    >
-      download_verb
-    </Link>
-  </p>
-</div>
-`;
-
-exports[`renders correctly 2`] = `
-<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>,
-        }
-      }
-    />
-  </p>
-  <p>
-    <Link
-      className="button"
-      onlyActiveOnIndex={false}
-      style={Object {}}
-      target="_blank"
-      to="/documentation/analysis/scan/sonarscanner/"
-    >
-      download_verb
-    </Link>
-  </p>
-</div>
-`;
-
-exports[`renders correctly 3`] = `
-<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>,
-        }
-      }
-    />
-  </p>
-  <p>
-    <Link
-      className="button"
-      onlyActiveOnIndex={false}
-      style={Object {}}
-      target="_blank"
-      to="/documentation/analysis/scan/sonarscanner/"
-    >
-      download_verb
-    </Link>
-  </p>
-</div>
-`;
index 659d13aac12d86f05431854c4b4dc6f00a30a6cf..80e22751eda4475e2b524d8c9a016061776ed959 100644 (file)
@@ -23,10 +23,19 @@ export enum TutorialModes {
   GitLabCI = 'gitlab-ci'
 }
 
-export interface LanguageConfig {
-  language?: string;
-  javaBuild?: string;
-  cFamilyCompiler?: string;
-  os?: string;
-  projectKey?: string;
+export enum BuildTools {
+  Maven = 'maven',
+  Gradle = 'gradle',
+  DotNet = 'dotnet',
+  Other = 'other'
 }
+
+export enum OSs {
+  Linux = 'linux',
+  Windows = 'win',
+  MacOS = 'mac'
+}
+
+export type ManualTutorialConfig =
+  | { buildTool?: BuildTools.Maven | BuildTools.Gradle | BuildTools.DotNet }
+  | { buildTool: BuildTools.Other; os?: OSs };
index 7845d0ad6664dbadb744b3e879cdf868342c51e5..6b76ec37ee2f71f8f2870f29039c111c7c15b6e6 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import { GithubBindingDefinition, ProjectAlmBindingResponse } from '../../types/alm-settings';
-import { LanguageConfig } from './types';
-
-export function isLanguageConfigured(config?: LanguageConfig) {
-  if (!config) {
-    return false;
-  }
-  const { language, javaBuild, cFamilyCompiler, os, projectKey } = config;
-  const isJavaConfigured = language === 'java' && javaBuild != null;
-  const isDotNetConfigured = language === 'dotnet' && projectKey != null;
-  const isCFamilyConfigured =
-    language === 'c-family' && (cFamilyCompiler === 'msvc' || os != null) && projectKey != null;
-  const isOtherConfigured = language === 'other' && projectKey != null;
-
-  return isJavaConfigured || isDotNetConfigured || isCFamilyConfigured || isOtherConfigured;
-}
 
 export function quote(os: string): (s: string) => string {
   return os === 'win' ? (s: string) => `"${s}"` : (s: string) => s;
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/almIntegrations-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/almIntegrations-test.ts
deleted file mode 100644 (file)
index 4b2b94a..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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 {
-  getAlmMembersUrl,
-  getUserAlmKey,
-  isBitbucket,
-  isGithub,
-  isVSTS,
-  sanitizeAlmId
-} from '../almIntegrations';
-import { mockCurrentUser, mockLoggedInUser } from '../testMocks';
-
-it('#getAlmMembersUrl', () => {
-  expect(getAlmMembersUrl('github', 'https://github.com/Foo')).toBe(
-    'https://github.com/orgs/Foo/people'
-  );
-  expect(getAlmMembersUrl('bitbucket', 'https://bitbucket.com/Foo/')).toBe(
-    'https://bitbucket.com/Foo/profile/members'
-  );
-});
-
-it('#isBitbucket', () => {
-  expect(isBitbucket('bitbucket')).toBe(true);
-  expect(isBitbucket('bitbucketcloud')).toBe(true);
-  expect(isBitbucket('github')).toBe(false);
-});
-
-it('#isGithub', () => {
-  expect(isGithub('github')).toBe(true);
-  expect(isGithub('bitbucket')).toBe(false);
-});
-
-it('#isVSTS', () => {
-  expect(isVSTS('microsoft')).toBe(true);
-  expect(isVSTS('github')).toBe(false);
-});
-
-it('#sanitizeAlmId', () => {
-  expect(sanitizeAlmId('bitbucketcloud')).toBe('bitbucket');
-  expect(sanitizeAlmId('bitbucket')).toBe('bitbucket');
-  expect(sanitizeAlmId('github')).toBe('github');
-});
-
-describe('getUserAlmKey', () => {
-  it('should return sanitized almKey', () => {
-    expect(getUserAlmKey(mockLoggedInUser({ externalProvider: 'bitbucketcloud' }))).toBe(
-      'bitbucket'
-    );
-  });
-
-  it('should return undefined', () => {
-    expect(getUserAlmKey(mockCurrentUser())).toBeUndefined();
-    expect(getUserAlmKey(mockCurrentUser({ isLoggedIn: undefined }))).toBeUndefined();
-  });
-});
diff --git a/server/sonar-web/src/main/js/helpers/almIntegrations.ts b/server/sonar-web/src/main/js/helpers/almIntegrations.ts
deleted file mode 100644 (file)
index 9b96c94..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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 { isLoggedIn } from './users';
-
-export function getAlmMembersUrl(key: string, url: string): string {
-  if (!url.endsWith('/')) {
-    url += '/';
-  }
-  if (isGithub(key)) {
-    return url.replace('github.com/', 'github.com/orgs/') + 'people';
-  }
-  return url + 'profile/members';
-}
-
-export function getUserAlmKey(user: T.CurrentUser) {
-  return isLoggedIn(user) && user.externalProvider
-    ? sanitizeAlmId(user.externalProvider)
-    : undefined;
-}
-
-export function hasAdvancedALMIntegration(user: T.CurrentUser) {
-  return (
-    isLoggedIn(user) && (isBitbucket(user.externalProvider) || isGithub(user.externalProvider))
-  );
-}
-
-export function isBitbucket(almKey?: string): boolean {
-  return almKey ? almKey.startsWith('bitbucket') : false;
-}
-
-export function isGithub(almKey?: string): boolean {
-  return almKey === 'github';
-}
-
-export function isVSTS(almKey?: string): boolean {
-  return almKey === 'microsoft';
-}
-
-export function sanitizeAlmId(almKey: string) {
-  if (isBitbucket(almKey)) {
-    return 'bitbucket';
-  }
-  return almKey;
-}
index e74ce293438a356da545b88e860de879e18093d1..de692f182bb8f0457ba3523a49f6d04e38731117 100644 (file)
@@ -87,6 +87,7 @@ from=From
 global=Global
 github=GitHub
 help=Help
+here=here
 hide=Hide
 inactive=Inactive
 info=Info
@@ -3327,31 +3328,18 @@ onboarding.token.invalid_format=The token you have entered has invalid format.
 
 onboarding.analysis.header=Run analysis on your project
 onboarding.analysis.auto_refresh_after_analysis=Once the analysis is completed, this page will automatically refresh and you will be able to browse the analysis results.
-onboarding.analysis.browse_url_after_analysis=Once the analysis is completed, you will be able to browse your project at the URL displayed at the end of the logs.
 
 onboarding.build=What is your build technology?
 onboarding.build.maven=Maven
 onboarding.build.gradle=Gradle
 onboarding.build.make=Make
-onboarding.build.msbuild=MSBuild
+onboarding.build.dotnet=.NET
 onboarding.build.other=Other (for JS, TS, Go, Python, PHP, ...)
 
-onboarding.language=What is your project's main language?
-onboarding.language.header=Which primary language are you using?
-onboarding.language.java=Java
-onboarding.language.java.build_technology=You are developing primarily in Java: what is your build technology?
-onboarding.language.java.build_technology.maven=Maven
-onboarding.language.java.build_technology.gradle=Gradle
-onboarding.language.dotnet=C# or VB.NET
-onboarding.language.c-family=C, C++, Objective-C
-onboarding.language.c-family.compiler=Which compiler are you using?
-onboarding.language.c-family.compiler.msvc=Microsoft Visual C++
-onboarding.language.c-family.compiler.clang-gcc=Clang or GCC
-onboarding.language.other=Other (JS, TS, Go, Python, PHP, ...)
-onboarding.language.os=What is your OS?
-onboarding.language.os.linux=Linux
-onboarding.language.os.win=Windows
-onboarding.language.os.mac=macOS
+onboarding.build.other.os=What is your OS?
+onboarding.build.other.os.linux=Linux
+onboarding.build.other.os.win=Windows
+onboarding.build.other.os.mac=macOS
 
 onboarding.analysis.docs=Please visit the {link} for more details.
 
@@ -3368,6 +3356,7 @@ onboarding.analysis.java.gradle.header=Execute the Scanner for Gradle from your
 onboarding.analysis.java.gradle.header.ci=Execute the Scanner for Gradle from your CI
 onboarding.analysis.java.gradle.text.1=Running an analysis with Gradle is straighforward. You just need to declare the {plugin_code} plugin in your {filename} file:
 onboarding.analysis.java.gradle.text.2=and run the following command:
+onboarding.analysis.java.gradle.latest_version=You can find the latest version of the Gradle plugin {link}.
 onboarding.analysis.java.gradle.docs_link=official documentation of the Scanner for Gradle
 onboarding.analysis.java.gradle.header.sonarcloud=Execute the Scanner for Gradle from Travis
 onboarding.analysis.java.gradle.text.1.sonarcloud=Declare the {plugin} plugin in your {file} file:
@@ -3530,18 +3519,18 @@ onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence=The name
 onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.path=Maven > Maven installations
 onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.name=Name
 onboarding.tutorial.with.jenkins.jenkinsfile.gradle.step2.sentence=Add the following to your {file} file:
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.replace.sentence=Make sure to replace {default_msbuild} and {default_scanner} with the names you gave to your MSBuild and SonarScanner for MSBuild tools {in_jenkins}.
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.replace.sentence.default_msbuild=Default MSBuild
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.replace.sentence.default_scanner=SonarScanner for MSBuild
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.replace.sentence.in_jenkins=in Jenkins
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help1.sentence=To get the name of these tools in Jenkins, navigate to {path}.
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help1.sentence.path=Manage Jenkins > Global Tool Configuration
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help2.sentence=For your MSBuild tool, the name is located under the {path} section, in the {name} field.
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help2.sentence.path=MSBuild > MSBuild installations
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help2.sentence.name=Name
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help3.sentence=For your SonarScanner for MSBuild tool, the name is located under the {path} section, in the {name} field.
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help3.sentence.path=SonarScanner for MSBuild > SonarScanner for MSBuild installations
-onboarding.tutorial.with.jenkins.jenkinsfile.msbuild.step2.help3.sentence.name=Name
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence=Make sure to replace {default_msbuild} and {default_scanner} with the names you gave to your MSBuild and SonarScanner for MSBuild tools {in_jenkins}.
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.default_msbuild=Default MSBuild
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.default_scanner=SonarScanner for MSBuild
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.in_jenkins=in Jenkins
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1.sentence=To get the name of these tools in Jenkins, navigate to {path}.
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1.sentence.path=Manage Jenkins > Global Tool Configuration
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence=For your MSBuild tool, the name is located under the {path} section, in the {name} field.
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence.path=MSBuild > MSBuild installations
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence.name=Name
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence=For your SonarScanner for MSBuild tool, the name is located under the {path} section, in the {name} field.
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence.path=SonarScanner for MSBuild > SonarScanner for MSBuild installations
+onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence.name=Name
 onboarding.tutorial.with.jenkins.jenkinsfile.other.step2.sentence=Create a {file} file in your repository and paste the following code:
 onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence=Make sure to replace {default} with the name you gave to your SonarQube Scanner tool {in_jenkins}.
 onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence.default=SonarScanner