aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-05-13 13:32:12 +0200
committerStas Vilchik <vilchiks@gmail.com>2016-05-13 13:32:18 +0200
commit5d3d62b840255f41ecb079271f6c3df3187da468 (patch)
treeb01ba9662b9b6319e57d19edf95e2a3c6bf8f146 /server/sonar-web
parent98c745aaed5d98118f47a57ef43317fb4962c8a8 (diff)
downloadsonarqube-5d3d62b840255f41ecb079271f6c3df3187da468.tar.gz
sonarqube-5d3d62b840255f41ecb079271f6c3df3187da468.zip
SONAR-7327 Display a warning when no components selected on the Measures page
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/measures/app.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/measures/app.js b/server/sonar-web/src/main/js/apps/measures/app.js
index a0979df4f13..f3ce71cbaaf 100644
--- a/server/sonar-web/src/main/js/apps/measures/app.js
+++ b/server/sonar-web/src/main/js/apps/measures/app.js
@@ -82,6 +82,15 @@ const newAlertFilter = function () {
});
};
+const showAlert = text => {
+ const alert = document.createElement('div');
+ alert.classList.add('alert', 'alert-warning');
+ alert.textContent = text;
+
+ const container = document.querySelector('.navigator-details');
+ container.insertBefore(alert, container.firstChild);
+};
+
const init = function () {
NavigatorApp.addRegions({ filtersRegion: '.navigator-filters' });
@@ -169,6 +178,21 @@ const init = function () {
NavigatorApp.filterBarView.restoreFromQuery(window.queryParams);
}
key.setScope('list');
+
+ if (window.queryParams) {
+ const qualifiersFilter = window.queryParams.find(p => p.key === 'qualifiers[]');
+ const noQualifiers = !qualifiersFilter || !qualifiersFilter.value || !qualifiersFilter.value.length;
+
+ const baseFilter = window.queryParams.find(p => p.key === 'base');
+ const noBase = !baseFilter || !baseFilter.value || !baseFilter.value.length;
+
+ const favoritesFilter = window.queryParams.find(p => p.key === 'onFavourites');
+ const noFavorites = !favoritesFilter || !favoritesFilter.value;
+
+ if (noQualifiers && noBase && noFavorites) {
+ showAlert(translate('measures.select_components'));
+ }
+ }
};
NavigatorApp.on('start', function () {