aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-02-14 17:08:36 +0100
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-02-15 13:28:33 +0100
commit86bc73dcba53684be54bceca2c3302d417f3ca15 (patch)
tree766c61a0b67ec6628e92de893916b922f2aac337 /server/sonar-web
parentc7721b9130b5b877ac6301859a2b597a91c86d92 (diff)
downloadsonarqube-86bc73dcba53684be54bceca2c3302d417f3ca15.tar.gz
sonarqube-86bc73dcba53684be54bceca2c3302d417f3ca15.zip
SONAR-10435 Improve error message of licenses issues for normal users
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBgTaskNotif-test.tsx.snap18
3 files changed, 29 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 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<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 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(
<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 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`] = `
<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"