diff options
| author | Simon Rettberg | 2022-07-06 15:56:29 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2022-07-06 15:56:29 +0200 |
| commit | ae128c579ba1b06ee740ea5f07919cf4f33f340f (patch) | |
| tree | ebdad61ec014babaffedf9bcc541b7fc179c33c6 /modules-available/statistics/templates/machine-hdds.html | |
| parent | [dnbd3/vmstore] Add selection for DNBD3 server, or NFS mode, show any errors (diff) | |
| download | slx-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/machine-hdds.html')
| -rw-r--r-- | modules-available/statistics/templates/machine-hdds.html | 31 |
1 files changed, 9 insertions, 22 deletions
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 |
