summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/templates
diff options
context:
space:
mode:
authorSimon Rettberg2022-07-06 15:56:29 +0200
committerSimon Rettberg2022-07-06 15:56:29 +0200
commitae128c579ba1b06ee740ea5f07919cf4f33f340f (patch)
treeebdad61ec014babaffedf9bcc541b7fc179c33c6 /modules-available/statistics/templates
parent[dnbd3/vmstore] Add selection for DNBD3 server, or NFS mode, show any errors (diff)
downloadslx-admin-ae128c579ba1b06ee740ea5f07919cf4f33f340f.tar.gz
slx-admin-ae128c579ba1b06ee740ea5f07919cf4f33f340f.tar.xz
slx-admin-ae128c579ba1b06ee740ea5f07919cf4f33f340f.zip
[statistics] Fix Chart.js for HDD view
Diffstat (limited to 'modules-available/statistics/templates')
-rw-r--r--modules-available/statistics/templates/clientlist.html8
-rw-r--r--modules-available/statistics/templates/filterbox.html68
-rw-r--r--modules-available/statistics/templates/machine-hdds.html31
3 files changed, 13 insertions, 94 deletions
diff --git a/modules-available/statistics/templates/clientlist.html b/modules-available/statistics/templates/clientlist.html
index 3df95d92..df271591 100644
--- a/modules-available/statistics/templates/clientlist.html
+++ b/modules-available/statistics/templates/clientlist.html
@@ -152,7 +152,7 @@
<span class="glyphicon glyphicon-refresh"></span>
{{lang_reset}}
</button>
- <div class="btn-group">
+ <div class="btn-group dropup">
<button class="btn btn-default dropdown-toggle btn-machine-action" type="button" id="dropdownMenu1"
data-toggle="dropdown" aria-haspopup="true">
<span class="glyphicon glyphicon-list"></span>
@@ -184,7 +184,7 @@
</ul>
</div>
{{#rebootcontrol}}
- <div class="btn-group">
+ <div class="btn-group dropup">
<button class="btn btn-default dropdown-toggle btn-machine-action" type="button" id="dropdownMenu2"
data-toggle="dropdown" aria-haspopup="true">
<span class="glyphicon glyphicon-list"></span>
@@ -222,7 +222,7 @@
{{#canBenchmark}}
<button type="submit" name="action" value="benchmark" class="btn btn-primary btn-machine-action">
<span class="glyphicon glyphicon-dashboard"></span>
- {{lang_remoteExec}}
+ {{lang_remoteSpeedcheck}}
</button>
{{/canBenchmark}}
</div>
@@ -230,7 +230,7 @@
</div>
{{/rebootcontrol}}
{{#canDelete}}
- <div class="btn-group">
+ <div class="btn-group dropup">
<button type="submit" name="action" value="delmachines" class="btn btn-danger btn-machine-action"
data-confirm="{{lang_sureDeletePermanent}}">
<span class="glyphicon glyphicon-trash"></span>
diff --git a/modules-available/statistics/templates/filterbox.html b/modules-available/statistics/templates/filterbox.html
index aba4b41c..f62c4d7c 100644
--- a/modules-available/statistics/templates/filterbox.html
+++ b/modules-available/statistics/templates/filterbox.html
@@ -117,80 +117,12 @@ document.addEventListener("DOMContentLoaded", function () {
});
});
- // All the pie chars
- function makePieChart($parent) {
- var data = $parent.data('chart');
- var chartData = {
- datasets: [{
- data: data.map(function(x) { return x.value; }),
- backgroundColor: data.map(function(x) { return x.color; })
- }]
- };
- var $canv = $('<canvas style="width:100%;height:250px">');
- $parent.append($canv);
- (function() {
- var $dest = $parent.data('chart-dest');
- var cur = null;
- new Chart($canv[0].getContext('2d'), {
- type: 'pie', data: chartData, options: {
- animation: false,
- onHover: function (_, list) {
- if (list.length === 0 || list[0].index !== cur) {
- if (cur !== null) {
- $($dest + cur).removeClass('slx-bold');
- cur = null;
- }
- }
- if (list.length !== 0 && list[0].index !== cur) {
- console.log(list[0]);
- cur = list[0].index;
- $($dest + cur).addClass('slx-bold');
- }
- },
- plugins: {
- tooltip: {enabled: false},
- legend: {display: false}
- }
- }
- });
- })();
- }
$('.auto-chart').each(function() {
makePieChart($(this));
});
}, false);
-function popupFilter(field) {
- var $row = addFilter(field, null, null);
- if ($row !== null) {
- $row.find('.arg').focus();
- $row.removeClass('slx-focus')
- setTimeout(function() { $row.addClass('slx-focus'); }, 10);
- }
-}
-
-function addFilter(field, op, argument) {
- if (field === null)
- return null;
- var $row = $('#filter-' + field);
- if ($row.length === 0)
- return null;
- if (argument !== null) {
- $row.find('.op').val(op);
- $row.find('.arg').val(argument);
- }
- // Enable checkbox only if we got a predefined value, or if argument is in a select, as the user might want the preselected item and doesn't notice the checkbox is unchecked
- if (argument !== null || $row.find('select.arg').length !== 0) {
- $row.find('.filter-enable').prop('checked', true);
- }
- $row.show();
- return $row;
-}
-
-function refresh() {
- $('#query-form').submit();
-}
// --></script>
diff --git a/modules-available/statistics/templates/machine-hdds.html b/modules-available/statistics/templates/machine-hdds.html
index 84feccfd..49b49277 100644
--- a/modules-available/statistics/templates/machine-hdds.html
+++ b/modules-available/statistics/templates/machine-hdds.html
@@ -34,7 +34,7 @@
<th>{{lang_partType}}</th>
</tr>
{{#partitions}}
- <tr id="{{id}}">
+ <tr id="part-{{hddidx}}-{{idx}}">
<td>{{index}}</td>
<td class="text-right text-nowrap">{{size_s}}</td>
<td>{{name}}</td>
@@ -46,31 +46,18 @@
<div class="slx-bold">{{lang_unused}}: {{unused_s}}</div>
{{/unused_s}}
</div>
- <div class="col-sm-5">
- <canvas id="{{devid}}-chart" style="width:100%;height:250px"></canvas>
- <script type="text/javascript">
- document.addEventListener("DOMContentLoaded", function() {
- var data = {{{json}}};
- var sel = false;
- new Chart(document.getElementById('{{devid}}-chart').getContext('2d')).Pie(data, {
- animation: false,
- tooltipTemplate: "<%if (label){%><%=label%><%}%>",
- customTooltips: function(tooltip) {
- if (sel !== false) sel.removeClass('info');
- if (!tooltip) {
- sel = false;
- return;
- }
- sel = $('#' + tooltip.text);
- sel.addClass('info');
- }
- });
- }, false);
- </script>
+ <div class="col-sm-5 auto-chart" data-chart="{{json}}" data-chart-dest="#part-{{hddidx}}-">
</div>
</div>
</div>
</div>
</div>
{{/hdds}}
+ <script type="text/javascript">
+ document.addEventListener("DOMContentLoaded", function() {
+ $('.auto-chart').each(function() {
+ makePieChart($(this));
+ });
+ });
+ </script>
</div> \ No newline at end of file