JS/ui: create new simple filter URLs

This commit is contained in:
Thomas Gelf 2014-06-20 13:40:41 +02:00
parent f2c67ea047
commit f98d8f7fc5
1 changed files with 5 additions and 7 deletions

View File

@ -403,19 +403,17 @@
// create new url // create new url
if (selectionData.length < 2) { if (selectionData.length < 2) {
// single-selection this.icinga.logger.error('Something went wrong, we should never multiselect just one row');
$.each(selectionData[0], function(key, value){
queries.push(key + '=' + encodeURIComponent(value));
});
} else { } else {
// multi-selection
$.each(selectionData, function(i, el){ $.each(selectionData, function(i, el){
var parts = []
$.each(el, function(key, value) { $.each(el, function(key, value) {
queries.push(key + '[' + i + ']=' + encodeURIComponent(value)); parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
}); });
queries.push('(' + parts.join('&') + ')');
}); });
} }
return queries.join('&'); return '(' + queries.join('|') + ')';
}, },
/** /**