Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
44 changes: 43 additions & 1 deletion css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 5 additions & 1 deletion locales/po/cacti.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 <developers@cacti.net>>\n"
"Language-Team: Cacti Developers <developers@cacti.net>\n"
Expand Down Expand Up @@ -1970,6 +1970,10 @@ msgstr ""
msgid "Actions"
msgstr ""

#: servcheck_test.php
msgid "Status"
msgstr ""

#: servcheck_test.php
msgid "Last Check (attempt)"
msgstr ""
Expand Down
12 changes: 11 additions & 1 deletion servcheck_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,11 @@ function data_list(): void {
'sort' => 'ASC',
'align' => 'left'
],
'status' => [
'display' => __('Status', 'servcheck'),
Comment thread
TheWitness marked this conversation as resolved.
'sort' => '',
'align' => 'left'
],
'last_check' => [
'display' => __('Last Check (attempt)', 'servcheck'),
'sort' => 'ASC',
Expand Down Expand Up @@ -1299,7 +1304,7 @@ function data_list(): void {
$style = 'servcheck_error';
}

print "<tr class='tableRow selectable $style id='line{$row['id']}'>";
print "<tr class='tableRow selectable $style' id='line{$row['id']}'>";

print "<td width='1%' style='padding:0px;white-space:nowrap'>
<a class='pic' href='" . html_escape($config['url_path'] . 'plugins/servcheck/servcheck_test.php?action=edit&id=' . $row['id']) . "' title='" . __esc('Edit Service Check', 'servcheck') . "'>
Expand Down Expand Up @@ -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('<span class="servcheck_pill ' . $style . '">' . html_escape($state_label) . '</span>', $row['id']);

if ($row['last_check'] == '0000-00-00 00:00:00') {
form_selectable_cell(__('N/A (N/A)', 'servcheck'), $row['id'], '', 'right');
} else {
Expand Down
Loading