From 472945cdd2331f0b1bf7eddeee1c744f588b4e2d Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 19 Jun 2017 05:48:01 -0700 Subject: [PATCH] apply more feedback on onboarding tutorial (#2179) --- .../main/js/app/components/help/LinksHelp.js | 45 ++++++++++++------- .../components/help/LinksHelpSonarCloud.js | 34 +++++++++----- .../js/app/components/nav/global/GlobalNav.js | 9 +--- .../main/js/apps/overview/components/App.js | 2 +- .../apps/overview/components/EmptyOverview.js | 27 +++++++++-- .../apps/tutorials/onboarding/AnalysisStep.js | 1 + .../apps/tutorials/onboarding/Onboarding.js | 11 ++--- .../tutorials/onboarding/OnboardingModal.js | 6 +-- .../onboarding/__tests__/Onboarding-test.js | 11 ++--- .../onboarding/commands/JavaGradle.js | 8 +++- .../onboarding/commands/JavaMaven.js | 6 +++ .../tutorials/onboarding/commands/Msvc.js | 2 +- .../__snapshots__/JavaGradle-test.js.snap | 20 ++++++++- .../__snapshots__/JavaMaven-test.js.snap | 16 +++++++ .../__tests__/__snapshots__/Msvc-test.js.snap | 14 +++++- .../core/config/CorePropertyDefinitions.java | 2 +- .../resources/org/sonar/l10n/core.properties | 5 ++- 17 files changed, 153 insertions(+), 66 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/help/LinksHelp.js b/server/sonar-web/src/main/js/app/components/help/LinksHelp.js index e76ef2c6bb6..b84c28222d5 100644 --- a/server/sonar-web/src/main/js/app/components/help/LinksHelp.js +++ b/server/sonar-web/src/main/js/app/components/help/LinksHelp.js @@ -29,22 +29,35 @@ export default function LinksHelp({ onClose }: Props) {

{translate('help.section.links')}

- {translate('footer.community')}{' - '} - - {translate('footer.documentation')} - - {' - '} - - {translate('footer.support')} - - {' - '} - - {translate('footer.plugins')} - - {' - '} - {translate('footer.web_api')} - {' - '} - {translate('footer.about')} +

+ {translate('footer.community')} +

+ +

+ + {translate('footer.documentation')} + +

+ +

+ + {translate('footer.support')} + +

+ +

+ + {translate('footer.plugins')} + +

+ +

+ {translate('footer.web_api')} +

+ +

+ {translate('footer.about')} +

); } diff --git a/server/sonar-web/src/main/js/app/components/help/LinksHelpSonarCloud.js b/server/sonar-web/src/main/js/app/components/help/LinksHelpSonarCloud.js index 6efdac91b50..9fdf2751253 100644 --- a/server/sonar-web/src/main/js/app/components/help/LinksHelpSonarCloud.js +++ b/server/sonar-web/src/main/js/app/components/help/LinksHelpSonarCloud.js @@ -29,17 +29,29 @@ export default function LinksHelpSonarCloud({ onClose }: Props) {

{translate('help.section.links')}

- {translate('footer.news')} - {' - '} - {translate('footer.terms')} - {' - '} - {translate('footer.twitter')} - {' - '} - {translate('footer.get_started')} - {' - '} - {translate('footer.help')} - {' - '} - {translate('footer.about')} +

+ {translate('footer.news')} +

+ +

+ {translate('footer.terms')} +

+ +

+ {translate('footer.twitter')} +

+ +

+ {translate('footer.get_started')} +

+ +

+ {translate('footer.help')} +

+ +

+ {translate('footer.about')} +

); } diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js index cb2d2eca428..5f6de29a8f7 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js @@ -87,9 +87,7 @@ class GlobalNav extends React.PureComponent { openOnboardingTutorial = () => this.setState({ helpOpen: false, onboardingTutorialOpen: true }); - finishOnboardingTutorial = () => this.setState({ onboardingTutorialOpen: false }); - - skipOnboardingTutorial = () => { + closeOnboardingTutorial = () => { this.setState({ onboardingTutorialOpen: false, onboardingTutorialTooltip: true }); this.interval = setInterval(() => { this.setState({ onboardingTutorialTooltip: false }); @@ -131,10 +129,7 @@ class GlobalNav extends React.PureComponent { />} {this.state.onboardingTutorialOpen && - } + } ); } diff --git a/server/sonar-web/src/main/js/apps/overview/components/App.js b/server/sonar-web/src/main/js/apps/overview/components/App.js index 8a4adde9571..5e314f44351 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/App.js +++ b/server/sonar-web/src/main/js/apps/overview/components/App.js @@ -60,7 +60,7 @@ class App extends React.PureComponent { } if (!component.analysisDate) { - return ; + return ; } return ; diff --git a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js index 8bba1c5c7a5..ba9689b3b5e 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js +++ b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js @@ -17,21 +17,40 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// @flow import React from 'react'; +import { Link } from 'react-router'; import { translate } from '../../../helpers/l10n'; -const EmptyOverview = ({ component }) => { +type Props = { + component: { key: string } +}; + +export default function EmptyOverview({ component }: Props) { + const rawMessage = translate('provisioning.no_analysis.delete'); + const head = rawMessage.substr(0, rawMessage.indexOf('{0}')); + const tail = rawMessage.substr(rawMessage.indexOf('{0}') + 3); + return (
{translate('provisioning.no_analysis')}
+ +
+ {head} + + {translate('provisioning.no_analysis.delete_it')} + + {tail} +
+

{translate('key')}

{component.key}
); -}; - -export default EmptyOverview; +} diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js index 78733e66992..497f104b304 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/AnalysisStep.js @@ -69,6 +69,7 @@ export default class AnalysisStep extends React.PureComponent { diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/Onboarding.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/Onboarding.js index 2f79f7add07..45df83f7dcd 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/Onboarding.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/Onboarding.js @@ -33,7 +33,6 @@ import './styles.css'; type Props = {| currentUser: { login: string, isLoggedIn: boolean }, onFinish: () => void, - onSkip: () => void, organizationsEnabled: boolean, sonarCloud: boolean |}; @@ -76,16 +75,12 @@ export default class Onboarding extends React.PureComponent { this.mounted = false; } - finishOnboarding = (skipped: boolean = false) => { + finishOnboarding = () => { this.setState({ skipping: true }); skipOnboarding().then( () => { if (this.mounted) { - if (skipped) { - this.props.onSkip(); - } else { - this.props.onFinish(); - } + this.props.onFinish(); if (this.state.projectKey) { this.context.router.push(getProjectUrl(this.state.projectKey)); @@ -119,7 +114,7 @@ export default class Onboarding extends React.PureComponent { handleSkipClick = (event: Event) => { event.preventDefault(); - this.finishOnboarding(true); + this.finishOnboarding(); }; handleFinish = (projectKey?: string) => this.setState({ finished: true, projectKey }); diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.js index 3ec32829d17..7ae51334755 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.js @@ -23,8 +23,7 @@ import Modal from 'react-modal'; import { translate } from '../../../helpers/l10n'; type Props = {| - onFinish: () => void, - onSkip: () => void + onFinish: () => void |}; type State = { @@ -63,8 +62,7 @@ export default class OnboardingModal extends React.PureComponent { contentLabel={translate('tutorials.onboarding')} className="modal modal-large" overlayClassName="modal-overlay"> - {OnboardingContainer != null && - } + {OnboardingContainer != null && } ); } diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/Onboarding-test.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/Onboarding-test.js index f336d73a79b..ae21ca80fc9 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/Onboarding-test.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/__tests__/Onboarding-test.js @@ -34,7 +34,6 @@ it('guides for on-premise', () => { @@ -52,7 +51,6 @@ it('guides for sonarcloud', () => { @@ -70,19 +68,18 @@ it('guides for sonarcloud', () => { expect(wrapper).toMatchSnapshot(); }); -it('skips', () => { - const onSkip = jest.fn(); +it('finishes', () => { + const onFinish = jest.fn(); const wrapper = mount( ); click(wrapper.find('.js-skip')); return doAsync(() => { - expect(onSkip).toBeCalled(); + expect(onFinish).toBeCalled(); }); }); diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaGradle.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaGradle.js index 3f89a2bb241..f7a710b9472 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaGradle.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaGradle.js @@ -29,7 +29,7 @@ type Props = {| |}; export default function JavaGradle(props: Props) { - const config = 'plugins {\n id "org.sonarqube" version "2.2"\n}'; + const config = 'plugins {\n id "org.sonarqube" version "2.5"\n}'; const command = [ './gradlew sonarqube', @@ -54,6 +54,12 @@ export default function JavaGradle(props: Props) { className="big-spacer-top markdown" dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.java.gradle.docs') }} /> +

); } diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaMaven.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaMaven.js index 6317b1bac2e..1166463012a 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaMaven.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/JavaMaven.js @@ -45,6 +45,12 @@ export default function JavaMaven(props: Props) { className="big-spacer-top markdown" dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.java.maven.docs') }} /> +

); } diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Msvc.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Msvc.js index 00fba90474a..fe18afad6e3 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Msvc.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/Msvc.js @@ -41,7 +41,7 @@ export default function Msvc(props: Props) { `/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}"`]; diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaGradle-test.js.snap b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaGradle-test.js.snap index df6bf9db47f..559864e0d90 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaGradle-test.js.snap +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaGradle-test.js.snap @@ -17,7 +17,7 @@ exports[`renders correctly 1`] = ` />

+

`; @@ -63,7 +71,7 @@ exports[`renders correctly 2`] = ` />

+

`; diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaMaven-test.js.snap b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaMaven-test.js.snap index 3cd4796988b..60d6f6c8dfb 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaMaven-test.js.snap +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/JavaMaven-test.js.snap @@ -30,6 +30,14 @@ exports[`renders correctly 1`] = ` } } /> +

`; @@ -63,5 +71,13 @@ exports[`renders correctly 2`] = ` } } /> +

`; diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Msvc-test.js.snap b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Msvc-test.js.snap index c2f54b40496..564d75fb708 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Msvc-test.js.snap +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/commands/__tests__/__snapshots__/Msvc-test.js.snap @@ -33,7 +33,12 @@ exports[`renders correctly 1`] = ` } />