From: Grégoire Aubert Date: Tue, 22 May 2018 12:55:16 +0000 (+0200) Subject: SONAR-10710 Improve error message of licenses issues for normal users X-Git-Tag: 6.7.4~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c948b71216a95514409415abfb847d1444297184;p=sonarqube.git SONAR-10710 Improve error message of licenses issues for normal users --- diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx index 5b906826ecc..99c01c71910 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx @@ -87,11 +87,13 @@ export default class ComponentNavBgTaskNotif extends React.PureComponent ) { return ( - {currentTask.errorMessage} - {this.context.canAdmin && ( - + {currentTask.errorMessage} + {this.context.canAdmin ? ( + {translate('license.component_navigation.button', currentTask.errorType)}. + ) : ( + translate('please_contact_administrator') )} ); diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx index 72e517426cc..b155d6dde17 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx @@ -54,15 +54,21 @@ it('renders background task license info correctly', () => { expect( getWrapper({ currentTask: { status: 'FAILED', errorType: 'LICENSING', errorMessage: 'Foo' } }) ).toMatchSnapshot(); + expect( + getWrapper( + { currentTask: { status: 'FAILED', errorType: 'LICENSING', errorMessage: 'Foo' } }, + { canAdmin: false } + ) + ).toMatchSnapshot(); }); -function getWrapper(props = {}) { +function getWrapper(props = {}, context = {}) { return shallow( , - { context: { canAdmin: true } } + { context: { canAdmin: true, ...context } } ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap index 679067cb000..a8426344156 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap @@ -27,11 +27,12 @@ exports[`renders background task license info correctly 1`] = ` - + Foo `; +exports[`renders background task license info correctly 2`] = ` + + + Foo + + please_contact_administrator + +`; + exports[`renders background task pending info correctly 1`] = `