* Tue Apr 22 2025 Brian Read <brianr@koozali.org> 11.0.0-2.sme
- Add some styling to the hardware information and quick navigation
This commit is contained in:
41
root/usr/share/smanager/lib/SrvMngr/Controller/Hwinfo.pm
Normal file
41
root/usr/share/smanager/lib/SrvMngr/Controller/Hwinfo.pm
Normal file
@@ -0,0 +1,41 @@
|
||||
package SrvMngr::Controller::Hwinfo;
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# heading : Investigation
|
||||
# description : Hardware Info
|
||||
# navigation : 4000 800
|
||||
#----------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
# name : hwinfo, method : get, url : /hwinfo, ctlact : Hwinfo#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);
|
||||
|
||||
#use SrvMngr::Model::Main;
|
||||
sub main {
|
||||
my $c = shift;
|
||||
$c->app->log->info($c->log_req);
|
||||
my $title = $c->l('hwinfo_panel');
|
||||
my $hwinfo_height = $c->param('height') || '600';
|
||||
my $hwinfo_full_html = qx(perl -T /etc/e-smith/web/functions/hwinfo);
|
||||
my ($hwinfo_html) = $hwinfo_full_html =~ m{<body[^>]*>(.*?)</body>}si;
|
||||
$hwinfo_html = '<head><link rel="stylesheet" href="css/hwinfo.css"></head>'.$hwinfo_html;
|
||||
$hwinfo_html =~ s/<div class="indented">|<\/div>//g;
|
||||
# Remove lines starting with the specified phrases
|
||||
$hwinfo_html =~ s/^( SME Server|<BR>Copyright \(c\)).*\n//gmi;
|
||||
|
||||
open(my $fh, '>', '/root/hwinfo.txt') or die $!;
|
||||
print $fh $hwinfo_html;
|
||||
close($fh);
|
||||
|
||||
$c->stash(title => $title, hwinfo => $hwinfo_html, height => $hwinfo_height);
|
||||
#die("$hwinfo_html");
|
||||
$c->render(template => 'hwinfo');
|
||||
} ## end sub main
|
||||
1;
|
@@ -0,0 +1,2 @@
|
||||
'hwi_FUll_description' => 'Full description',
|
||||
'hwi_hwinfo' => 'Hardware Information'
|
Reference in New Issue
Block a user