From: Grégoire Aubert Date: Wed, 14 Feb 2018 16:08:36 +0000 (+0100) Subject: SONAR-10435 Improve error message of licenses issues for normal users X-Git-Tag: 7.5~1650 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=86bc73dcba53684be54bceca2c3302d417f3ca15;p=sonarqube.git SONAR-10435 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 a28f8088ae5..b5bb9a7a3dc 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 08c36de0e12..c404f6ee227 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 @@ -64,15 +64,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 bb69e51c46d..2c7d92f06fb 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`] = `