aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-07-12 09:57:58 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-07-12 09:57:58 +0200
commitc5461cfceb990f43c4a6cc3322c50616858b3578 (patch)
tree1018d77df4327b75255818b461b02215b8a765a9
parent2a52bc7f6ec59e4fbdfea27d5ecd03d10cf76d75 (diff)
downloadsonarqube-c5461cfceb990f43c4a6cc3322c50616858b3578.tar.gz
sonarqube-c5461cfceb990f43c4a6cc3322c50616858b3578.zip
SONAR-4183 Prevent adding blank column in Measures Service
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb26
1 files changed, 16 insertions, 10 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb
index 7d5c6e76bde..1f03eef00ba 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb
@@ -84,21 +84,25 @@
$j(document).ready(function () {
$j("#select-metric").on("change", function (e) {
var selectedKey = $j("#select-metric option:selected").val();
- if (selectedKey.indexOf('metric:') == 0) {
- if (selectedKey.indexOf('metric:new_') == 0) {
- $j('#select-period option :eq(0)').attr('disabled', 'disabled');
- $j('#select-period ').val('1');
+ if (selectedKey != null && selectedKey != '') {
+ if (selectedKey.indexOf('metric:') == 0) {
+ if (selectedKey.indexOf('metric:new_') == 0) {
+ $j('#select-period option :eq(0)').attr('disabled', 'disabled');
+ $j('#select-period ').val('1');
+ } else {
+ $j('#select-period option :eq(0)').removeAttr('disabled');
+ $j('#select-period').val('');
+ }
+ $j('#select-period').show();
} else {
- $j('#select-period option :eq(0)').removeAttr('disabled');
- $j('#select-period').val('');
+ $j('#select-period').hide();
}
- $j('#select-period').show();
+ $j("#add-metric").removeAttr('disabled');
} else {
- $j('#select-period').hide();
+ $j("#add-metric").attr("disabled", "disabled");
}
- $j("#add-metric").removeAttr('disabled');
-
});
+
$j("#add-metric").on("click", function (e) {
var cols = filterCriteria<%= widget_id -%>['cols']||[];
var columnKey = $j("#select-metric option:selected").val();
@@ -110,6 +114,8 @@
filterCriteria['edit']='true';
window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
});
+ $j("#add-metric").attr("disabled", "disabled");
+
$j("#exit-edit").on("click", function (e) {
delete filterCriteria['edit'];
window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);