initial commit of file from CVS for smeserver-durep on Sat Sep 7 20:21:52 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:21:52 +10:00
parent b7162f2054
commit ce6f5341b1
30 changed files with 1974 additions and 2 deletions

View File

@@ -0,0 +1,67 @@
package SrvMngr::Controller::Durep;
#----------------------------------------------------------------------
# heading : System
# description : Disk usage report
# navigation : 4000 390
# menu : A
#
# name : durep, method : get, url : /durep, ctlact : durep#main
#
# routes : end
#----------------------------------------------------------------------
use strict;
use warnings;
use Mojo::Base 'Mojolicious::Controller';
use Locale::gettext;
use SrvMngr::I18N;
use SrvMngr qw(theme_list init_session);
sub main {
my $c = shift;
$c->app->log->info($c->log_req);
my $modul = get_du( $c );
$c->stash( modul => $modul );
$c->render(template => 'durep');
}
sub get_du {
my ($c) = @_;
my $tx = $c->tx;
my $req = $tx->req;
# 3 env variables for durep.cgi
$ENV{'SCRIPT_NAME'} = 'durep';
$ENV{'REQUEST_METHOD'} = $req->method;
$ENV{'QUERY_STRING'} = $req->url->query->to_string;
my $res = `/etc/e-smith/web/panels/manager/html/durep/durep.cgi`;
$res =~ s|server-manager/durep|smanager/images|g;
my $step = 0; my $out;
my @lines = split /\n/, $res;
# remove except 'body'
foreach my $line (@lines) {
if ( $line =~ m|<body>| ) {
$step = 1;
} elsif ( $line =~ m|</body>| ) {
$step = 2;
} elsif ( $step == 1 ) {
$out .= $line;
}
}
return $out;
}
1;

View File

@@ -0,0 +1 @@
'dur_FORM_TITLE' => 'Disk usage report',

View File

@@ -0,0 +1,127 @@
/*
a:hover {
background-color: #DDDDDD;
}
body {
text-align: center;
background-color: #ffffff;
}
*/
div.tbar {
text-align: left;
width: 100%;
background-color: #EEEEEE;
border-top: solid 1px #DDDDDD;
border-bottom: solid 1px #DDDDDD;
}
div.bbar {
text-align: left;
width: 100%;
background-color: #EEEEEE;
border-top: solid 1px #DDDDDD;
border-bottom: solid 1px #DDDDDD;
}
div.bbar * {
font-size: 90%;
}
div.options {
text-align: left;
margin: 2em;
background-color: #EEEEEE;
border: solid 1px #DDDDDD;
}
.light {
background-color: #ffffff;
}
.mid {
background-color: #f6f6f6;
}
.dark {
background-color: #f0f0f0;
}
.tbar table {
width: 100%;
padding-left: 2pt;
font-weight: bold;
}
.bbar table {
width: 100%;
padding-left: 2pt;
}
table.list {
margin: 2em 0px;
border: solid 1px #CCCCCC;
margin-left: auto;
margin-right: auto;
}
table.list td {
text-align: left;
padding: 2px 5px;
}
table.list th {
text-align: left;
padding: 2px 5px;
text-align: left;
background-color: #DDDDDD;
}
table.report {
margin: 2em 0px;
border: solid 1px #CCCCCC;
text-align: left;
margin-left: auto;
margin-right: auto;
}
table.report td {
padding: 2px 5px;
}
table.report th {
padding: 2px 5px;
text-align: left;
background-color: #DDDDDD;
}
.graph {
padding: 0px;
background-color: #eeeeee;
width: 200px;
height: 15px;
}
th.right {
text-align: right;
}
td.right {
text-align: right;
}
span.dir {
font-weight: bold;
}
span.empty {
color: #006600;
font-weight: bold;
}
span.coalesced {
color: #880000;
font-weight: bold;
}

View File

@@ -0,0 +1,24 @@
% layout 'default', title => 'Sme server 2 - Durep';
% content_for 'head_contrib' => begin
%= stylesheet '/css/durep.css'
%end
% content_for 'module' => begin
% if ($config->{debug} == 1) {
<p>
%= dumper $c->current_route
</p>
% }
<div id="central" class="module durep-panel">
% if ( stash 'error' ) {
<br><div class=sme-error>
%= $c->render_to_string(inline => stash 'error')
</div>
%}
%= $c->render_to_string(inline => $modul)
</div>
% end