diff options
author | Simon Rettberg | 2016-07-29 12:18:36 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-07-29 12:18:36 +0200 |
commit | 6abbd2bf9a0dafa93e92928a269820eaa127b12b (patch) | |
tree | d44eb55035a84f73e1795d93e2f26be6ddada0df /modules-available/statistics/templates | |
parent | [baseconfig] Rework makeInput to prevent generating invalid tag attribs (diff) | |
download | slx-admin-6abbd2bf9a0dafa93e92928a269820eaa127b12b.tar.gz slx-admin-6abbd2bf9a0dafa93e92928a269820eaa127b12b.tar.xz slx-admin-6abbd2bf9a0dafa93e92928a269820eaa127b12b.zip |
[statistics] Make filtering more dynamic, remove hard cutoff from summary
Diffstat (limited to 'modules-available/statistics/templates')
5 files changed, 35 insertions, 11 deletions
diff --git a/modules-available/statistics/templates/cpumodels.html b/modules-available/statistics/templates/cpumodels.html index f4af9cd2..0ab5286f 100644 --- a/modules-available/statistics/templates/cpumodels.html +++ b/modules-available/statistics/templates/cpumodels.html @@ -15,10 +15,12 @@ </tr> {{#rows}} <tr id="{{id}}"> - <td class="text-left slx-nowrap" style="overflow:hidden;text-overflow: ellipsis;"> - <a href="?do=Statistics&show=stat&filters={{query}}~,~systemmodel={{urlsystemmodel}}">{{systemmodel}}</a> + <td class="text-left text-nowrap filter-col" data-filter-col="systemmodel" style="overflow:hidden;text-overflow: ellipsis;"> + <a class="filter-val" data-filter-val="{{systemmodel}}" href="?do=Statistics&show=stat&filters={{query}}~,~systemmodel={{urlsystemmodel}}">{{systemmodel}}</a> + </td> + <td class="text-right filter-col" data-filter-col="realcores"> + <a class="filter-val" data-filter-val="{{cores}}" href="?do=Statistics&show=stat&filters={{query}}~,~realcores={{cores}}">{{cores}}</a> </td> - <td class="text-right"><a href="?do=Statistics&show=stat&filters={{query}}~,~realcores={{cores}}">{{cores}}</a></td> <td class="text-right">{{count}}</td> </tr> {{/rows}} diff --git a/modules-available/statistics/templates/filterbox.html b/modules-available/statistics/templates/filterbox.html index 2e7928e9..a8a36adb 100644 --- a/modules-available/statistics/templates/filterbox.html +++ b/modules-available/statistics/templates/filterbox.html @@ -99,7 +99,8 @@ document.addEventListener("DOMContentLoaded", function () { /* initialize selectize */ filterSelectize = $('#filterInput').selectize({ delimiter: slxFilterDel, - plugins: ['restore_on_backspace', 'remove_button'], + persist: false, + plugins: ['remove_button'], create: function(input) { return {value: input, text: input} }, @@ -156,6 +157,22 @@ document.addEventListener("DOMContentLoaded", function () { initButtons(); + $('.filter-col').each(function(idx, elem) { + var e = $(elem); + var col = e.data('filter-col'); + if (!col) return; + e.find('.filter-val').each(function(idx, elem) { + var e = $(elem); + var val = e.data('filter-val'); + if (!val) return; + e.click(function(ev) { + ev.preventDefault(); + addFilter(col, '=', val); + refresh(); + }); + }); + }); + }, false); diff --git a/modules-available/statistics/templates/id44.html b/modules-available/statistics/templates/id44.html index f0b5b9f7..84b515d1 100644 --- a/modules-available/statistics/templates/id44.html +++ b/modules-available/statistics/templates/id44.html @@ -6,14 +6,16 @@ <div class="panel-body"> <div class="row"> <div class="col-sm-6"> - <table class="table table-condensed table-striped"> + <table class="filter-col table table-condensed table-striped" data-filter-col="hddgb"> <tr> <th>{{lang_partitionSize}}</th> <th class="text-right">{{lang_machineCount}}</th> </tr> {{#rows}} <tr id="tmpid{{gb}}" class="{{class}}"> - <td class="text-left slx-nowrap"><a href="?do=Statistics&show=stat&filters={{query}}~,~hddgb={{gb}}">{{gb}} GiB</td> + <td class="text-left text-nowrap"> + <a class="filter-val" data-filter-val="{{gb}}" href="?do=Statistics&show=stat&filters={{query}}~,~hddgb={{gb}}">{{gb}} GiB</a> + </td> <td class="text-right">{{count}}</td> </tr> {{/rows}} @@ -35,7 +37,6 @@ return; } sel = $('#tmpid' + String(tooltip.text)); - console.log('#tmpid' + String(tooltip.text)); sel.addClass('slx-bold'); } }); diff --git a/modules-available/statistics/templates/kvmstate.html b/modules-available/statistics/templates/kvmstate.html index 4c286d36..c44fb9ab 100644 --- a/modules-available/statistics/templates/kvmstate.html +++ b/modules-available/statistics/templates/kvmstate.html @@ -6,14 +6,16 @@ <div class="panel-body"> <div class="row"> <div class="col-sm-6"> - <table class="table table-condensed table-striped"> + <table class="filter-col table table-condensed table-striped" data-filter-col="kvmstate"> <tr> <th>{{lang_kvmState}}</th> <th class="text-right">{{lang_machineCount}}</th> </tr> {{#rows}} <tr id="kvm{{kvmstate}}"> - <td class="text-left slx-nowrap"><a href="?do=Statistics&show=stat&filters={{query}}~,~kvmstate={{kvmstate}}">{{kvmstate}}</a></td> + <td class="text-left slx-nowrap"> + <a class="filter-val" data-filter-val="{{kvmstate}}" href="?do=Statistics&show=stat&filters={{query}}~,~kvmstate={{kvmstate}}">{{kvmstate}}</a> + </td> <td class="text-right">{{count}}</td> </tr> {{/rows}} diff --git a/modules-available/statistics/templates/memory.html b/modules-available/statistics/templates/memory.html index 8a882fa6..2d50c47f 100644 --- a/modules-available/statistics/templates/memory.html +++ b/modules-available/statistics/templates/memory.html @@ -6,14 +6,16 @@ <div class="panel-body"> <div class="row"> <div class="col-sm-6"> - <table class="table table-condensed table-striped"> + <table class="filter-col table table-condensed table-striped" data-filter-col="gbram"> <tr> <th>{{lang_ramSize}}</th> <th class="text-right">{{lang_machineCount}}</th> </tr> {{#rows}} <tr id="ramid{{gb}}" class="{{class}}"> - <td class="text-left slx-nowrap"><a href="?do=Statistics&show=stat&filters={{query}}~,~gbram={{gb}}">{{gb}} GiB</a></td> + <td class="text-left slx-nowrap"> + <a class="filter-val" data-filter-val="{{gb}}" href="?do=Statistics&show=stat&filters={{query}}~,~gbram={{gb}}">{{gb}} GiB</a> + </td> <td class="text-right">{{count}}</td> </tr> {{/rows}} |