From 049542b7edabb7a11d0a95cfc39f51d84d1912d5 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 5 Jul 2025 15:43:26 +0300 Subject: [PATCH 1/7] Add DropInPaths property --- init/init-lib.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/init-lib.pl b/init/init-lib.pl index a65a66018..1b32a2456 100644 --- a/init/init-lib.pl +++ b/init/init-lib.pl @@ -2181,7 +2181,7 @@ while(@units) { while(@args < 100 && @units) { push(@args, shift(@units)); } - my $out = &backquote_command("systemctl show --property=Id,Description,UnitFileState,ActiveState,SubState,ExecStart,ExecStop,ExecReload,ExecMainPID,FragmentPath ".join(" ", @args)." 2>/dev/null"); + my $out = &backquote_command("systemctl show --property=Id,Description,UnitFileState,ActiveState,SubState,ExecStart,ExecStop,ExecReload,ExecMainPID,FragmentPath,DropInPaths ".join(" ", @args)." 2>/dev/null"); my @lines = split(/\r?\n/, $out); my $curr; my @units; From 2e245a103574bebc6e4270437ab6dcc05d747b4e Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 5 Jul 2025 16:03:47 +0300 Subject: [PATCH 2/7] 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 From 4d417ea4bfc246926638f351f69f07f9adac29d4 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 5 Jul 2025 16:38:55 +0300 Subject: [PATCH 3/7] Fix to put lengthy descriptions to a nice details element --- gray-theme/unauthenticated/gray-theme.css | 4 ++++ init/index.cgi | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gray-theme/unauthenticated/gray-theme.css b/gray-theme/unauthenticated/gray-theme.css index d83600003..b2206b002 100644 --- a/gray-theme/unauthenticated/gray-theme.css +++ b/gray-theme/unauthenticated/gray-theme.css @@ -422,6 +422,10 @@ details.ui_hidden_table_start > summary::-webkit-details-marker { color: #a1acc0; } +details.on-hover:not(:hover) summary::after { + visibility: hidden !important; +} + details.inline { cursor: pointer; padding: 0; diff --git a/init/index.cgi b/init/index.cgi index ff05b5194..51deb863f 100755 --- a/init/index.cgi +++ b/init/index.cgi @@ -336,7 +336,6 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) { &ui_link("edit_systemd.cgi?new=1", $text{'index_sadd'}) ); print &ui_links_row(\@links); print &ui_columns_start([ "", $text{'systemd_name'}, - $text{'systemd_desc'}, $text{'systemd_type'}, $text{'systemd_status'}, $text{'systemd_boot'}, @@ -357,12 +356,17 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) { else { $type = ''; } + my $title = ($u->{'boot'} == -1 ? + &html_escape($sname) : + &ui_link($l, &html_escape($sname))); + my $desc = &html_escape($u->{'desc'}); 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'}), + !$desc ? $title : &ui_details({ + class => 'inline on-hover', + html => 1, + title => $title, + content => $desc}), $type, $u->{'fullstatus'} || "$text{'index_unknown'}", $u->{'boot'} == 1 ? From a65f9f5d6c5e0e65f56cc506caae7f6b1a4ae26c Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 5 Jul 2025 18:57:23 +0300 Subject: [PATCH 4/7] Fix to respect config option and show no description --- init/index.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/index.cgi b/init/index.cgi index 51deb863f..95f468445 100755 --- a/init/index.cgi +++ b/init/index.cgi @@ -359,7 +359,7 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) { my $title = ($u->{'boot'} == -1 ? &html_escape($sname) : &ui_link($l, &html_escape($sname))); - my $desc = &html_escape($u->{'desc'}); + my $desc = $config{'desc'} ? &html_escape($u->{'desc'}) : ''; print &ui_columns_row([ &ui_checkbox("d", $u->{'name'}, undef), !$desc ? $title : &ui_details({ From 9dc877910f06b00820f2fbbe6e52642706012fc3 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sun, 6 Jul 2025 02:27:13 +0300 Subject: [PATCH 5/7] Fix to always show summary arrow when opened --- gray-theme/unauthenticated/gray-theme.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gray-theme/unauthenticated/gray-theme.css b/gray-theme/unauthenticated/gray-theme.css index b2206b002..484d6b42a 100644 --- a/gray-theme/unauthenticated/gray-theme.css +++ b/gray-theme/unauthenticated/gray-theme.css @@ -422,7 +422,7 @@ details.ui_hidden_table_start > summary::-webkit-details-marker { color: #a1acc0; } -details.on-hover:not(:hover) summary::after { +details:not([open]).on-hover:not(:hover) summary::after { visibility: hidden !important; } From ed42dd582232f3fdf6636dd6b447a92ad6954515 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Fri, 11 Jul 2025 15:25:02 +0300 Subject: [PATCH 6/7] Fix to always show description --- init/index.cgi | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/init/index.cgi b/init/index.cgi index 95f468445..c87868ae9 100755 --- a/init/index.cgi +++ b/init/index.cgi @@ -336,6 +336,7 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) { &ui_link("edit_systemd.cgi?new=1", $text{'index_sadd'}) ); print &ui_links_row(\@links); print &ui_columns_start([ "", $text{'systemd_name'}, + $config{'desc'} ? $text{'systemd_desc'} : (), $text{'systemd_type'}, $text{'systemd_status'}, $text{'systemd_boot'}, @@ -359,14 +360,11 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) { my $title = ($u->{'boot'} == -1 ? &html_escape($sname) : &ui_link($l, &html_escape($sname))); - my $desc = $config{'desc'} ? &html_escape($u->{'desc'}) : ''; + my $desc = $config{'desc'} ? &html_escape($u->{'desc'}) : undef; print &ui_columns_row([ &ui_checkbox("d", $u->{'name'}, undef), - !$desc ? $title : &ui_details({ - class => 'inline on-hover', - html => 1, - title => $title, - content => $desc}), + $title, + $desc // (), $type, $u->{'fullstatus'} || "$text{'index_unknown'}", $u->{'boot'} == 1 ? From 76efb4ee104a176ce6b7c19d1e3206b1e2e3417d Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 12 Jul 2025 19:40:04 +0300 Subject: [PATCH 7/7] Fix not to show runlevels config option for systemd --- init/init-lib.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init/init-lib.pl b/init/init-lib.pl index 1b32a2456..ae3ed90ce 100644 --- a/init/init-lib.pl +++ b/init/init-lib.pl @@ -2901,4 +2901,12 @@ my ($name) = @_; return $name =~ /\./ ? $name : "com.webmin.".$name; } +# config_pre_load(mod-info, [mod-order]) +# Check if some config options are conditional +sub config_pre_load +{ +my ($modconf_info, $modconf_order) = @_; +$modconf_info->{'desc'} =~ s/2-[^,]+,// if ($init_mode eq "systemd"); +} + 1;