Add a separate "Unit type" column

This commit is contained in:
Ilia Ross
2025-07-05 16:03:47 +03:00
parent 049542b7ed
commit 2e245a1035
2 changed files with 16 additions and 6 deletions

View File

@@ -335,11 +335,13 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) {
&select_invert_link("d"),
&ui_link("edit_systemd.cgi?new=1", $text{'index_sadd'}) );
print &ui_links_row(\@links);
print &ui_columns_start([ "", $text{'index_uname'},
$text{'index_udesc'},
$text{'index_ucstatus'},
$text{'index_uboot'},
$text{'index_ustatus'}, ]);
print &ui_columns_start([ "", $text{'systemd_name'},
$text{'systemd_desc'},
$text{'systemd_type'},
$text{'systemd_status'},
$text{'systemd_boot'},
$text{'index_ustatus'} ]);
my $units_piped = join('|', map { quotemeta } &get_systemd_unit_types());
foreach $u (&list_systemd_services()) {
if ($u->{'legacy'}) {
$l = "edit_action.cgi?0+".&urlize($u->{'name'});
@@ -348,13 +350,20 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) {
$l = "edit_systemd.cgi?name=".&urlize($u->{'name'});
}
my $sname = $u->{'name'};
$sname =~ s/\.service$//;
my ($type) = $sname =~ /\.([^.]+)$/;
if (defined($type) && $type =~ /^(?:$units_piped)$/) {
$sname =~ s/\.$type$//;
}
else {
$type = '';
}
print &ui_columns_row([
&ui_checkbox("d", $u->{'name'}, undef),
$u->{'boot'} == -1 ?
&html_escape($sname) :
&ui_link($l, &html_escape($sname)),
&html_escape($u->{'desc'}),
$type,
$u->{'fullstatus'} || "<i>$text{'index_unknown'}</i>",
$u->{'boot'} == 1 ?
&ui_text_color("$text{'yes'}", 'success') :

View File

@@ -227,6 +227,7 @@ systemd_egone=Unit no longer exists!
systemd_elegacy=Not a systemd unit!
systemd_header=Systemd unit details
systemd_name=Unit name
systemd_type=Unit type
systemd_file=Configuration file
systemd_desc=Unit description
systemd_start=Commands to run on startup