diff --git a/CHANGELOG.md b/CHANGELOG.md index 04b329c..2f0bfb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ --- develop --- +* feature: Add a Status column to the Tests list (right after Name) that shows each service check's current state as a colour-coded pill, reusing the status legend's solid colours so the badge stays legible on top of the row tint on every theme * security: Replace the confirmation pages' inline `onClick='cactiReturnTo()'` Cancel buttons with the CSP-safe `cactiReturnTo` class and move the filter rows selects' inline `onChange` handlers into the ready block (bound via change, not click) so the pages no longer trip Cacti's Content-Security-Policy script-src-attr directive * dev: Keep the status-legend chips equal width (sized to the longest label, laid out as a CSS grid so chips stay equal across wrapped rows) as the legend wraps responsively * dev: Measure CI coverage with xdebug instead of pcov so the plugin's own sources are instrumented (pcov auto-scopes to the Composer root and skipped cacti/plugins/, leaving the patch-coverage gate with nothing to measure) diff --git a/css/common.css b/css/common.css index 258fdf4..dc31601 100644 --- a/css/common.css +++ b/css/common.css @@ -112,9 +112,51 @@ } .servcheck_legend .servcheck_ok { - background-color: #2f8f3a; + background-color: #2e7d32; } .servcheck_legend .servcheck_disabled { background-color: #5f5f57; } + +/* + * Status pill shown in the Tests list's Status column. It reuses the same + * solid, opaque state colours as the legend chips so the status reads as a + * compact badge that stays legible on top of the subtle row tint behind it on + * every theme. The compound selectors keep a higher specificity than the + * per-theme single-class row tints so the badge colour always wins. + */ +.servcheck_pill { + display: inline-block; + min-width: 7ch; + text-align: center; + white-space: nowrap; + padding: 2px 10px; + border-radius: 10px; + font-weight: bold; + color: #ffffff; +} + +.servcheck_pill.servcheck_error { + background-color: #a12820; +} + +.servcheck_pill.servcheck_duration { + background-color: #1f6f86; +} + +.servcheck_pill.servcheck_warning { + background-color: #a85712; +} + +.servcheck_pill.servcheck_failing { + background-color: #7d6f18; +} + +.servcheck_pill.servcheck_ok { + background-color: #2e7d32; +} + +.servcheck_pill.servcheck_disabled { + background-color: #5f5f57; +} diff --git a/locales/po/cacti.pot b/locales/po/cacti.pot index fb09917..634c4d0 100644 --- a/locales/po/cacti.pot +++ b/locales/po/cacti.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Cacti \n" "Report-Msgid-Bugs-To: developers@cacti.net\n" -"POT-Creation-Date: 2026-09-29 18:44-0400\n" +"POT-Creation-Date: 2026-10-08 14:31-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Cacti Developers >\n" "Language-Team: Cacti Developers \n" @@ -1970,6 +1970,10 @@ msgstr "" msgid "Actions" msgstr "" +#: servcheck_test.php +msgid "Status" +msgstr "" + #: servcheck_test.php msgid "Last Check (attempt)" msgstr "" diff --git a/servcheck_test.php b/servcheck_test.php index ccf51a5..73f7b53 100644 --- a/servcheck_test.php +++ b/servcheck_test.php @@ -1222,6 +1222,11 @@ function data_list(): void { 'sort' => 'ASC', 'align' => 'left' ], + 'status' => [ + 'display' => __('Status', 'servcheck'), + 'sort' => '', + 'align' => 'left' + ], 'last_check' => [ 'display' => __('Last Check (attempt)', 'servcheck'), 'sort' => 'ASC', @@ -1299,7 +1304,7 @@ function data_list(): void { $style = 'servcheck_error'; } - print ""; + print ""; print " @@ -1331,6 +1336,11 @@ function data_list(): void { form_selectable_cell($row['name'], $row['id']); + $state_key = substr($style, strlen('servcheck_')); + $state_label = $servcheck_states[$state_key] ?? $state_key; + + form_selectable_cell('' . html_escape($state_label) . '', $row['id']); + if ($row['last_check'] == '0000-00-00 00:00:00') { form_selectable_cell(__('N/A (N/A)', 'servcheck'), $row['id'], '', 'right'); } else {