diff options
author | Simon Rettberg | 2016-07-13 17:55:21 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-07-13 17:55:21 +0200 |
commit | 28365aa243bb84d896c2058b33893e8e501f22d3 (patch) | |
tree | 7ece9bd5d506b156e6655bf04c846a81143383c3 /modules-available/statistics/templates | |
parent | [statistics] Change delimiter to something more unusual, add captions for fil... (diff) | |
download | slx-admin-28365aa243bb84d896c2058b33893e8e501f22d3.tar.gz slx-admin-28365aa243bb84d896c2058b33893e8e501f22d3.tar.xz slx-admin-28365aa243bb84d896c2058b33893e8e501f22d3.zip |
[statistics] Add location to filter dropdown list
Diffstat (limited to 'modules-available/statistics/templates')
-rw-r--r-- | modules-available/statistics/templates/clientlist.html | 19 | ||||
-rw-r--r-- | modules-available/statistics/templates/machine-main.html | 7 |
2 files changed, 19 insertions, 7 deletions
diff --git a/modules-available/statistics/templates/clientlist.html b/modules-available/statistics/templates/clientlist.html index 57ec7f64..664d5413 100644 --- a/modules-available/statistics/templates/clientlist.html +++ b/modules-available/statistics/templates/clientlist.html @@ -151,9 +151,12 @@ var slxFilterNames = { kvmstate: '{{lang_kvmSupport}}', badsectors: '{{lang_reallocatedSectors}}', clientip: '{{lang_ip}}', - state: '{{lang_usageState}}' + state: '{{lang_usageState}}', + location: '{{lang_location}}' }; +slxLocations = {{{locations}}}; + var slxFilterDel = '{{delimiter}}'; @@ -188,7 +191,7 @@ document.addEventListener("DOMContentLoaded", function () { })[0].selectize; /* add query */ var str = "{{{query}}}"; - var eExp = /^(\w+)\s*([=><!]+)\s*(.*)$/; + var eExp = /^(\w+)\s*([=><!~]+)\s*(.*)$/; str.split(slxFilterDel).forEach(function(v) { var match = eExp.exec(v); if (match && match.length === 4) { @@ -217,7 +220,11 @@ document.addEventListener("DOMContentLoaded", function () { $('#argumentInput').hide(); $('#argumentSelect').show(); columns[col]['values'].forEach(function (v) { - $('#argumentSelect').append($('<option>', { value: v, text: v })); + var t = v; + if (col === 'location' && slxLocations['L' + v]) { + t = slxLocations['L' + v].pad + ' ' + slxLocations['L' + v].name; + } + $('#argumentSelect').append($('<option>', { value: v, text: t })); }); } else { $('#argumentInput').datepicker('remove'); @@ -288,8 +295,12 @@ function addFilterFromForm() { function addFilter(col, op, argument) { var filterValue = col + ' ' + op + ' ' + argument; var filterText = filterValue; + var displayArgument = argument; + if (col === 'location' && slxLocations['L' + argument]) { + displayArgument = slxLocations['L' + argument].name; + } if (slxFilterNames[col]) { - filterText = slxFilterNames[col] + ' ' + op + ' ' + argument; + filterText = slxFilterNames[col] + ' ' + op + ' ' + displayArgument; } filterSelectize.addOption({value: filterValue, text: filterText}); filterSelectize.addItem(filterValue); diff --git a/modules-available/statistics/templates/machine-main.html b/modules-available/statistics/templates/machine-main.html index daff724e..f76b5770 100644 --- a/modules-available/statistics/templates/machine-main.html +++ b/modules-available/statistics/templates/machine-main.html @@ -2,11 +2,12 @@ {{hostname}} {{#hostname}}–{{/hostname}} {{clientip}} {{#notes}}<a href="#usernotes"><span class="glyphicon glyphicon-exclamation-sign"></span></a>{{/notes}} </h1> -<div> +<ol class="breadcrumb"> {{#locations}} - » <a href="?do=statistics&filter=location&argument={{locationid}}">{{locationname}}</a> + <li><a href="?do=statistics&show=list&filters=location={{locationid}}">{{locationname}}</a></li> {{/locations}} -</div> + <li class="active">{{hostname}} {{^hostname}} {{clientip}} {{/hostname}}</li> +</ol> <div class="row"> <div class="col-md-6"> |