From 2e245a103574bebc6e4270437ab6dcc05d747b4e Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 5 Jul 2025 16:03:47 +0300 Subject: [PATCH] Add a separate "Unit type" column --- init/index.cgi | 21 +++++++++++++++------ init/lang/en | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/init/index.cgi b/init/index.cgi index 7ff437c46..ff05b5194 100755 --- a/init/index.cgi +++ b/init/index.cgi @@ -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'} || "$text{'index_unknown'}", $u->{'boot'} == 1 ? &ui_text_color("$text{'yes'}", 'success') : diff --git a/init/lang/en b/init/lang/en index f9c9e9947..7844f1c36 100644 --- a/init/lang/en +++ b/init/lang/en @@ -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