First run for DiskUsage

This commit is contained in:
Brian Read 2024-09-12 19:48:08 +01:00
parent 2200c50029
commit 436bc6d2f2
3 changed files with 141 additions and 1 deletions

View File

@ -0,0 +1,89 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 ( at 2024-09-12 19:46
%#
<div id="DiskUsage-PARAMS" class="partial DiskUsage-PARAMS">
<script>
window.onload = function() {
SelectInput();
};
</script>
<h2>
%= l('du Hello PARAMS');
</h2>
% my $btn = l('APPLY');
%= form_for "DiskUsaged" => (method => 'POST') => begin
% param 'trt' => ${prefix}_data->{trt} unless param 'trt';
%= hidden_field 'trt' => ${prefix}_data->{trt}
%# Inputs etc in here.
<h2><%=l('Manage DiskUsage settings:')%></h2>
<p>
%= l('&amp;nbsp')
</p>
<p>
%= l('Wed Sep 11 19:01:00 BST 2024')
</p>
<pre>
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/main-root 29G 4.8G 24G 17% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 12K 2.0G 1% /dev/shm
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 2.0G 648K 2.0G 1% /run
/dev/sda1 497M 111M 386M 23% /boot'
</pre>
<br /><table class="sme-border TableSort sme-table">
<thead>
<tr table-head-row>
<th class='sme-border table-head-col table-head-col-I-bays '><%=l('I-bays')%></th>
<th class='sme-border table-head-col table-head-col-Usage '><%=l('Usage')%></th>
<th class='sme-border table-head-col table-head-col-Path '><%=l('Path')%></th>
</tr>
</thead>
<tbody>
% my $control_data = $self->stash('Table1');
% foreach my $row (@$control_data) {
<tr class='table-row'>
<td class='sme-border table-col table-col-Table1-I-bays'><%=$c->render_to_string(inline=>$row->{Table1-I-bays})%></td>
<td class='sme-border table-col table-col-Table1-Usage'><%=$c->render_to_string(inline=>$row->{Table1-Usage})%></td>
<td class='sme-border table-col table-col-Table1-Path'><%=$c->render_to_string(inline=>$row->{Table1-Path})%></td>
</tr>
%}
</tbody>
</table>
<p>
%= l('&amp;nbsp')
</p>
<br /><table class="sme-border TableSort sme-table">
<thead>
<tr table-head-row>
<th class='sme-border table-head-col table-head-col-Users '><%=l('Users')%></th>
<th class='sme-border table-head-col table-head-col-Usage '><%=l('Usage')%></th>
<th class='sme-border table-head-col table-head-col-Path '><%=l('Path')%></th>
</tr>
</thead>
<tbody>
% my $control_data = $self->stash('Table2');
% foreach my $row (@$control_data) {
<tr class='table-row'>
<td class='sme-border table-col table-col-Table2-Users'><%=$c->render_to_string(inline=>$row->{Table2-Users})%></td>
<td class='sme-border table-col table-col-Table2-Usage'><%=$c->render_to_string(inline=>$row->{Table2-Usage})%></td>
<td class='sme-border table-col table-col-Table2-Path'><%=$c->render_to_string(inline=>$row->{Table2-Path})%></td>
</tr>
%}
</tbody>
</table>
%# Probably finally by a submit.
%end
</div>

50
Targets/diskusage.html.ep Normal file
View File

@ -0,0 +1,50 @@
% layout 'default', title => "Sme server 2 - Disk Usage", share_dir => './';
%#
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 ( at 2024-09-12 19:46
%#
% content_for 'module' => begin
<div id="module" class="module DiskUsage-panel">
% if ($config->{debug} == 1) {
<p>
%= dumper $c->current_route
</p>
% }
<h1><%=$title%></h1>
% if ( stash('modul') ) {
%= $c->render_to_string(inline => stash('modul') );
% }
%if (${prefix}_data->{first}) {
<br><p>
%=$c->render_to_string(inline =>$c->l(${prefix}_data->{first}))
</p>
%} elsif (${prefix}_data->{success}) {
<div class='sme-border'>
<h2> Operation Status Report</h2><p>
%= $c->l(${prefix}_data->{success});
</p>
</div>
%} elsif (${prefix}_data->{error}) {
<div class='sme-error'>
<h2> Operation Status Report - error</h2><p>
%= $c->l(${prefix}_data->{error});
</p>
</div>
%}
%#Routing to partials according to trt parameter.
%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
% if (${prefix}_data->{trt} eq "PARAMS") {
%= include 'partials/_du_PARAMS'
%}
</div>
%end

View File

@ -6,7 +6,7 @@
'MenuNavigation': '2000 400',
'firstPanel': 'PARAMS',
'signalEvent': 'smeserver-diskusage-update',
'html': {
'html': [ {
'Name': 'params',
'route': 'PARAMS',
'Header': 'Disk usage',
@ -44,4 +44,5 @@
]
}
}
]
}