From 1ceb2bbf0a279e63de3fccb3f37e31994958e6c7 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 12 Oct 2017 09:52:20 +0200 Subject: [PATCH] SONAR-9830 Onboarding of C# projects is not working properly --- .../tutorials/onboarding/commands/ClangGCC.js | 4 +- .../tutorials/onboarding/commands/Command.js | 17 +++++++-- .../tutorials/onboarding/commands/DotNet.js | 14 +++---- .../tutorials/onboarding/commands/Msvc.js | 18 ++++----- .../tutorials/onboarding/commands/Other.js | 2 +- .../__snapshots__/ClangGCC-test.js.snap | 6 +++ .../__snapshots__/DotNet-test.js.snap | 20 ++++++---- .../__tests__/__snapshots__/Msvc-test.js.snap | 38 +++++++++---------- .../__snapshots__/Other-test.js.snap | 3 ++ .../js/apps/tutorials/onboarding/styles.css | 10 +++++ 10 files changed, 81 insertions(+), 51 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/ClangGCC.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/ClangGCC.js index 2833ad4832c..025160b9c0b 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/ClangGCC.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/ClangGCC.js @@ -67,8 +67,8 @@ export default function ClangGCC(props /*: Props */) { __html: translate('onboarding.analysis.sq_scanner.execute.text') }} /> - - + +

+ command: string | Array, + 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 = (