diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2018-05-22 14:55:16 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2018-05-23 08:47:36 +0200 |
commit | c948b71216a95514409415abfb847d1444297184 (patch) | |
tree | b24ce982e061192dfd301308c1c5170032c5d5b8 | |
parent | d52c0e31c2232e3ad14c8fc0a9240cb7dfddfda0 (diff) | |
download | sonarqube-c948b71216a95514409415abfb847d1444297184.tar.gz sonarqube-c948b71216a95514409415abfb847d1444297184.zip |
SONAR-10710 Improve error message of licenses issues for normal users
4 files changed, 30 insertions, 7 deletions
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<Props> ) { return ( <NavBarNotif className="alert alert-danger"> - <span>{currentTask.errorMessage}</span> - {this.context.canAdmin && ( - <Link className="little-spacer-left" to="/admin/extension/license/app"> + <span className="little-spacer-right">{currentTask.errorMessage}</span> + {this.context.canAdmin ? ( + <Link to="/admin/extension/license/app"> {translate('license.component_navigation.button', currentTask.errorType)}. </Link> + ) : ( + translate('please_contact_administrator') )} </NavBarNotif> ); 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( <ComponentNavBgTaskNotif component={component} currentTask={{ status: 'FAILED' } as Task} {...props} />, - { 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`] = ` <NavBarNotif className="alert alert-danger" > - <span> + <span + className="little-spacer-right" + > Foo </span> <Link - className="little-spacer-left" onlyActiveOnIndex={false} style={Object {}} to="/admin/extension/license/app" @@ -42,6 +43,19 @@ exports[`renders background task license info correctly 1`] = ` </NavBarNotif> `; +exports[`renders background task license info correctly 2`] = ` +<NavBarNotif + className="alert alert-danger" +> + <span + className="little-spacer-right" + > + Foo + </span> + please_contact_administrator +</NavBarNotif> +`; + exports[`renders background task pending info correctly 1`] = ` <NavBarNotif className="alert alert-info" diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 2ee56009dfa..dccba131f7b 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -216,6 +216,7 @@ no_results_search.favorites=We couldn't find any results matching selected crite no_results_search.2=Try to change filters to get some results. no_results_search.favorites.2=Would you like to search among {url} projects? page_extension_failed=Page extension failed. +please_contact_administrator=Please contact the instance administrator. set_as_default=Set as Default unset_as_default=Unset as Default show_more=Show More |