]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9830 Onboarding of C# projects is not working properly
authorStas Vilchik <stas.vilchik@sonarsource.com>
Thu, 12 Oct 2017 07:52:20 +0000 (09:52 +0200)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Mon, 16 Oct 2017 09:08:02 +0000 (11:08 +0200)
server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/ClangGCC.js
server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Command.js
server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/DotNet.js
server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Msvc.js
server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Other.js
server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/ClangGCC-test.js.snap
server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/DotNet-test.js.snap
server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Msvc-test.js.snap
server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Other-test.js.snap
server/sonar-web/src/main/js/apps/tutorials/onboarding/styles.css

index 2833ad4832cddd4cdd8a74133866f0ee33577977..025160b9c0bc135261fdde6ed2349cecfc7891f3 100644 (file)
@@ -67,8 +67,8 @@ export default function ClangGCC(props /*: Props */) {
           __html: translate('onboarding.analysis.sq_scanner.execute.text')
         }}
       />
-      <Command command={command1} />
-      <Command command={command2} />
+      <Command command={command1} isWindows={props.os === 'win'} />
+      <Command command={command2} isWindows={props.os === 'win'} />
       <p
         className="big-spacer-top markdown"
         dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.sq_scanner.docs') }}
index aa6ad03916e2c21b0e55ed64f5fe7ba095ac42be..d1ea81af9cf87fd616101e64a209219985e4e830 100644 (file)
 // @flow
 import React from 'react';
 import Clipboard from 'clipboard';
+import classNames from 'classnames';
 import Tooltip from '../../../../components/controls/Tooltip';
 import { translate } from '../../../../helpers/l10n';
 
 /*::
 type Props = {
-  command: string | Array<?string>
+  command: string | Array<?string>,
+  isWindows?: boolean
 };
 */
 
@@ -50,6 +52,12 @@ export default class Command extends React.PureComponent {
     this.clipboard.on('success', this.showTooltip);
   }
 
+  componentDidUpdate() {
+    this.clipboard.destroy();
+    this.clipboard = new Clipboard(this.copyButton);
+    this.clipboard.on('success', this.showTooltip);
+  }
+
   componentWillUnmount() {
     this.mounted = false;
     this.clipboard.destroy();
@@ -69,9 +77,9 @@ export default class Command extends React.PureComponent {
   };
 
   render() {
-    const { command } = this.props;
+    const { command, isWindows } = this.props;
     const commandArray = Array.isArray(command) ? command.filter(line => line != null) : [command];
-    const finalCommand = commandArray.join(s);
+    const finalCommand = isWindows ? commandArray.join(' ') : commandArray.join(s);
 
     const button = (
       <button data-clipboard-text={finalCommand} ref={node => (this.copyButton = node)}>
@@ -80,7 +88,8 @@ export default class Command extends React.PureComponent {
     );
 
     return (
-      <div className="onboarding-command">
+      <div
+        className={classNames('onboarding-command', { 'onboarding-command-windows': isWindows })}>
         <pre>{finalCommand}</pre>
         {this.state.tooltipShown ? (
           <Tooltip defaultVisible={true} placement="top" overlay="Copied!" trigger="manual">
index 22d42c83e4726f202460f5bd441fed157bb20621..f253b4bf92ee77e51c90f6ed1c8f78602b1be676 100644 (file)
@@ -36,14 +36,14 @@ export default function DotNet(props /*: Props */) {
   const command1 = [
     'SonarQube.Scanner.MSBuild.exe begin',
     `/k:"${props.projectKey}"`,
-    props.organization && `/d:"sonar.organization=${props.organization}"`,
-    `/d:"sonar.host.url=${props.host}`,
-    `/d:"sonar.login=${props.token}"`
+    props.organization && `/d:sonar.organization="${props.organization}"`,
+    `/d:sonar.host.url="${props.host}"`,
+    `/d:sonar.login="${props.token}"`
   ];
 
   const command2 = 'MsBuild.exe /t:Rebuild';
 
-  const command3 = ['SonarQube.Scanner.MSBuild.exe end', `/d:"sonar.login=${props.token}"`];
+  const command3 = ['SonarQube.Scanner.MSBuild.exe end', `/d:sonar.login="${props.token}"`];
 
   return (
     <div>
@@ -58,9 +58,9 @@ export default function DotNet(props /*: Props */) {
           __html: translate('onboarding.analysis.msbuild.execute.text')
         }}
       />
-      <Command command={command1} />
-      <Command command={command2} />
-      <Command command={command3} />
+      <Command command={command1} isWindows={true} />
+      <Command command={command2} isWindows={true} />
+      <Command command={command3} isWindows={true} />
       <p
         className="big-spacer-top markdown"
         dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.msbuild.docs') }}
index b73c4b2a9472af080e2f911e76d95243b4983f0d..c47e5b2a4c3eebd75f8538898aeaf6b8a215c12c 100644 (file)
@@ -37,15 +37,15 @@ export default function Msvc(props /*: Props */) {
   const command1 = [
     'SonarQube.Scanner.MSBuild.exe begin',
     `/k:"${props.projectKey}"`,
-    props.organization && `/d:"sonar.organization=${props.organization}"`,
-    '/d:"sonar.cfamily.build-wrapper-output=bw-output"',
-    `/d:"sonar.host.url=${props.host}`,
-    `/d:"sonar.login=${props.token}"`
+    props.organization && `/d:sonar.organization="${props.organization}"`,
+    '/d:sonar.cfamily.build-wrapper-output=bw-output',
+    `/d:sonar.host.url="${props.host}"`,
+    `/d:sonar.login="${props.token}"`
   ];
 
-  const command2 = ['build-wrapper-win-x86-64.exe', '--out-dir bw-output MsBuild.exe /t:Rebuild'];
+  const command2 = 'build-wrapper-win-x86-64.exe --out-dir bw-output MsBuild.exe /t:Rebuild';
 
-  const command3 = ['SonarQube.Scanner.MSBuild.exe end', `/d:"sonar.login=${props.token}"`];
+  const command3 = ['SonarQube.Scanner.MSBuild.exe end', `/d:sonar.login="${props.token}"`];
 
   return (
     <div>
@@ -61,9 +61,9 @@ export default function Msvc(props /*: Props */) {
           __html: translate('onboarding.analysis.msbuild.execute.text')
         }}
       />
-      <Command command={command1} />
-      <Command command={command2} />
-      <Command command={command3} />
+      <Command command={command1} isWindows={true} />
+      <Command command={command2} isWindows={true} />
+      <Command command={command3} isWindows={true} />
       <p
         className="big-spacer-top markdown"
         dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.msbuild.docs') }}
index 0bb64ab425c534f1e8eb17e0afcbce6ee00359f1..36867f665f35494ff85bd36c08a1ee0568aa4472 100644 (file)
@@ -56,7 +56,7 @@ export default function Other(props /*: Props */) {
           __html: translate('onboarding.analysis.sq_scanner.execute.text')
         }}
       />
-      <Command command={command} />
+      <Command command={command} isWindows={props.os === 'win'} />
       <p
         className="big-spacer-top markdown"
         dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.sq_scanner.docs') }}
index 1ec053c4083ae5bff3c8c2194ee699562ff3bbf6..c462b767acf3084289042e99c01387a1b05ec0d7 100644 (file)
@@ -24,6 +24,7 @@ exports[`renders correctly 1`] = `
   />
   <Command
     command="build-wrapper-win-x86-64.exe --out-dir bw-output make clean all"
+    isWindows={true}
   />
   <Command
     command={
@@ -37,6 +38,7 @@ exports[`renders correctly 1`] = `
         "-Dsonar.login=token",
       ]
     }
+    isWindows={true}
   />
   <p
     className="big-spacer-top markdown"
@@ -73,6 +75,7 @@ exports[`renders correctly 2`] = `
   />
   <Command
     command="build-wrapper-linux-x86-64 --out-dir bw-output make clean all"
+    isWindows={false}
   />
   <Command
     command={
@@ -86,6 +89,7 @@ exports[`renders correctly 2`] = `
         "-Dsonar.login=token",
       ]
     }
+    isWindows={false}
   />
   <p
     className="big-spacer-top markdown"
@@ -122,6 +126,7 @@ exports[`renders correctly 3`] = `
   />
   <Command
     command="build-wrapper-linux-x86-64 --out-dir bw-output make clean all"
+    isWindows={false}
   />
   <Command
     command={
@@ -135,6 +140,7 @@ exports[`renders correctly 3`] = `
         "-Dsonar.login=token",
       ]
     }
+    isWindows={false}
   />
   <p
     className="big-spacer-top markdown"
index 3672a2f4c8d230d19205f3555032a9c1c9fd854b..b82b31b3cc1774c6487aa6e9e5f7ae8ce946f346 100644 (file)
@@ -22,21 +22,24 @@ exports[`renders correctly 1`] = `
         "SonarQube.Scanner.MSBuild.exe begin",
         "/k:\\"projectKey\\"",
         undefined,
-        "/d:\\"sonar.host.url=host",
-        "/d:\\"sonar.login=token\\"",
+        "/d:sonar.host.url=\\"host\\"",
+        "/d:sonar.login=\\"token\\"",
       ]
     }
+    isWindows={true}
   />
   <Command
     command="MsBuild.exe /t:Rebuild"
+    isWindows={true}
   />
   <Command
     command={
       Array [
         "SonarQube.Scanner.MSBuild.exe end",
-        "/d:\\"sonar.login=token\\"",
+        "/d:sonar.login=\\"token\\"",
       ]
     }
+    isWindows={true}
   />
   <p
     className="big-spacer-top markdown"
@@ -70,22 +73,25 @@ exports[`renders correctly 2`] = `
       Array [
         "SonarQube.Scanner.MSBuild.exe begin",
         "/k:\\"projectKey\\"",
-        "/d:\\"sonar.organization=organization\\"",
-        "/d:\\"sonar.host.url=host",
-        "/d:\\"sonar.login=token\\"",
+        "/d:sonar.organization=\\"organization\\"",
+        "/d:sonar.host.url=\\"host\\"",
+        "/d:sonar.login=\\"token\\"",
       ]
     }
+    isWindows={true}
   />
   <Command
     command="MsBuild.exe /t:Rebuild"
+    isWindows={true}
   />
   <Command
     command={
       Array [
         "SonarQube.Scanner.MSBuild.exe end",
-        "/d:\\"sonar.login=token\\"",
+        "/d:sonar.login=\\"token\\"",
       ]
     }
+    isWindows={true}
   />
   <p
     className="big-spacer-top markdown"
index 564d75fb708c77c7b54549a5fd9577e4f9023357..e27a0b48d83fe93ab9cbe35dc0856840a680045b 100644 (file)
@@ -26,27 +26,25 @@ exports[`renders correctly 1`] = `
         "SonarQube.Scanner.MSBuild.exe begin",
         "/k:\\"projectKey\\"",
         undefined,
-        "/d:\\"sonar.cfamily.build-wrapper-output=bw-output\\"",
-        "/d:\\"sonar.host.url=host",
-        "/d:\\"sonar.login=token\\"",
+        "/d:sonar.cfamily.build-wrapper-output=bw-output",
+        "/d:sonar.host.url=\\"host\\"",
+        "/d:sonar.login=\\"token\\"",
       ]
     }
+    isWindows={true}
   />
   <Command
-    command={
-      Array [
-        "build-wrapper-win-x86-64.exe",
-        "--out-dir bw-output MsBuild.exe /t:Rebuild",
-      ]
-    }
+    command="build-wrapper-win-x86-64.exe --out-dir bw-output MsBuild.exe /t:Rebuild"
+    isWindows={true}
   />
   <Command
     command={
       Array [
         "SonarQube.Scanner.MSBuild.exe end",
-        "/d:\\"sonar.login=token\\"",
+        "/d:sonar.login=\\"token\\"",
       ]
     }
+    isWindows={true}
   />
   <p
     className="big-spacer-top markdown"
@@ -84,28 +82,26 @@ exports[`renders correctly 2`] = `
       Array [
         "SonarQube.Scanner.MSBuild.exe begin",
         "/k:\\"projectKey\\"",
-        "/d:\\"sonar.organization=organization\\"",
-        "/d:\\"sonar.cfamily.build-wrapper-output=bw-output\\"",
-        "/d:\\"sonar.host.url=host",
-        "/d:\\"sonar.login=token\\"",
+        "/d:sonar.organization=\\"organization\\"",
+        "/d:sonar.cfamily.build-wrapper-output=bw-output",
+        "/d:sonar.host.url=\\"host\\"",
+        "/d:sonar.login=\\"token\\"",
       ]
     }
+    isWindows={true}
   />
   <Command
-    command={
-      Array [
-        "build-wrapper-win-x86-64.exe",
-        "--out-dir bw-output MsBuild.exe /t:Rebuild",
-      ]
-    }
+    command="build-wrapper-win-x86-64.exe --out-dir bw-output MsBuild.exe /t:Rebuild"
+    isWindows={true}
   />
   <Command
     command={
       Array [
         "SonarQube.Scanner.MSBuild.exe end",
-        "/d:\\"sonar.login=token\\"",
+        "/d:sonar.login=\\"token\\"",
       ]
     }
+    isWindows={true}
   />
   <p
     className="big-spacer-top markdown"
index 699ff84d414d4d69f5c42556600a0b78d989b3bc..060600bb1bc1d559f1fd93f10be9fb60d4ef059c 100644 (file)
@@ -29,6 +29,7 @@ exports[`renders correctly 1`] = `
         "-Dsonar.login=token",
       ]
     }
+    isWindows={true}
   />
   <p
     className="big-spacer-top markdown"
@@ -70,6 +71,7 @@ exports[`renders correctly 2`] = `
         "-Dsonar.login=token",
       ]
     }
+    isWindows={false}
   />
   <p
     className="big-spacer-top markdown"
@@ -111,6 +113,7 @@ exports[`renders correctly 3`] = `
         "-Dsonar.login=token",
       ]
     }
+    isWindows={false}
   />
   <p
     className="big-spacer-top markdown"
index 26f7f464cd2d0fe592f5085431002d61deb2d2a1..fbfe0b4ba5c046612dbe24a4ac11c1990b4d0ab7 100644 (file)
@@ -62,6 +62,7 @@
   color: #fff;
   font-size: 11px;
   font-weight: normal;
+  user-select: none;
 }
 
 .onboarding-command button:hover,
   color: #404040;
 }
 
+.onboarding-command-windows pre {
+  padding-bottom: 40px;
+}
+
+.onboarding-command-windows button {
+  top: auto;
+  top: 40px;
+}
+
 .onboarding .page-actions {
   text-align: right;
   margin-bottom: 0;