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 @@ -5,6 +5,7 @@
* ci: Drop Ruby from the CodeQL language matrix; the plugin ships no Ruby source, so the Ruby database build failed with "no source code seen"
* dev: Move the shared function and database libraries to includes/ and point the entry-point includes, coverage source, and tests at the new path
* feature: Restyle the System Logs and Alert Logs severity legends as rounded, evenly spaced, solid-colour chips that line up with the Thold status legends, with theme-appropriate backgrounds loaded from a per-theme css/<theme>.css file (falling back to a theme-neutral css/legend.css)
* dev: Keep the severity-legend chips equal width (sized to the longest label) 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)
* dev: Enforce patch coverage of changed lines in CI and remove the inert COMPOSER_ROOT_VERSION env from the Pest step
* feature: Add a Syslog-owned durable replication outbox for configured Remote Data Collectors; processed events are delivered idempotently to the Main Collector for centralized viewing, retained through outages, and retried during recovery, while intentionally discarded records remain unreplicated
Expand Down
1 change: 1 addition & 0 deletions css/classic.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

.syslogLegend .syslogLegendItem {
flex: 1 1 0;
min-width: var(--syslog-chip-min, max-content);
Comment thread
TheWitness marked this conversation as resolved.
text-align: center;
white-space: nowrap;
padding: 4px 6px;
Expand Down
1 change: 1 addition & 0 deletions css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

.syslogLegend .syslogLegendItem {
flex: 1 1 0;
min-width: var(--syslog-chip-min, max-content);
Comment thread
TheWitness marked this conversation as resolved.
text-align: center;
white-space: nowrap;
padding: 4px 6px;
Expand Down
1 change: 1 addition & 0 deletions css/deepness.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

.syslogLegend .syslogLegendItem {
flex: 1 1 0;
min-width: var(--syslog-chip-min, max-content);
Comment thread
TheWitness marked this conversation as resolved.
text-align: center;
white-space: nowrap;
padding: 4px 6px;
Expand Down
1 change: 1 addition & 0 deletions css/legend.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

.syslogLegend .syslogLegendItem {
flex: 1 1 0;
min-width: var(--syslog-chip-min, max-content);
Comment thread
TheWitness marked this conversation as resolved.
text-align: center;
white-space: nowrap;
padding: 4px 6px;
Expand Down
1 change: 1 addition & 0 deletions css/midwinter.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

.syslogLegend .syslogLegendItem {
flex: 1 1 0;
min-width: var(--syslog-chip-min, max-content);
Comment thread
TheWitness marked this conversation as resolved.
text-align: center;
white-space: nowrap;
padding: 4px 6px;
Expand Down
1 change: 1 addition & 0 deletions css/modern.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

.syslogLegend .syslogLegendItem {
flex: 1 1 0;
min-width: var(--syslog-chip-min, max-content);
Comment thread
TheWitness marked this conversation as resolved.
text-align: center;
white-space: nowrap;
padding: 4px 6px;
Expand Down
1 change: 1 addition & 0 deletions css/paper-plane.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

.syslogLegend .syslogLegendItem {
flex: 1 1 0;
min-width: var(--syslog-chip-min, max-content);
Comment thread
TheWitness marked this conversation as resolved.
text-align: center;
white-space: nowrap;
padding: 4px 6px;
Expand Down
1 change: 1 addition & 0 deletions css/paw.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

.syslogLegend .syslogLegendItem {
flex: 1 1 0;
min-width: var(--syslog-chip-min, max-content);
Comment thread
TheWitness marked this conversation as resolved.
text-align: center;
white-space: nowrap;
padding: 4px 6px;
Expand Down
1 change: 1 addition & 0 deletions css/sunrise.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

.syslogLegend .syslogLegendItem {
flex: 1 1 0;
min-width: var(--syslog-chip-min, max-content);
Comment thread
TheWitness marked this conversation as resolved.
text-align: center;
white-space: nowrap;
padding: 4px 6px;
Expand Down
54 changes: 41 additions & 13 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,16 +747,30 @@ function syslog_include_js(): void {
function syslog_syslog_legend(): void {
html_start_box('', '100%', '', '3', 'center', '');

$items = [
'logEmergency' => __('Emergency', 'syslog'),
'logCritical' => __('Critical', 'syslog'),
'logAlert' => __('Alert', 'syslog'),
'logError' => __('Error', 'syslog'),
'logWarning' => __('Warning', 'syslog'),
'logNotice' => __('Notice', 'syslog'),
'logInfo' => __('Info', 'syslog'),
'logDebug' => __('Debug', 'syslog'),
];

$chip_min = 0;

foreach ($items as $label) {
$chip_min = max($chip_min, mb_strlen($label));
Comment thread
TheWitness marked this conversation as resolved.
}

print '<tr class="tableRow"><td>';
print '<div class="syslogLegend">';
print '<div class="syslogLegendItem logEmergency">' . __('Emergency', 'syslog') . '</div>';
print '<div class="syslogLegendItem logCritical">' . __('Critical', 'syslog') . '</div>';
print '<div class="syslogLegendItem logAlert">' . __('Alert', 'syslog') . '</div>';
print '<div class="syslogLegendItem logError">' . __('Error', 'syslog') . '</div>';
print '<div class="syslogLegendItem logWarning">' . __('Warning', 'syslog') . '</div>';
print '<div class="syslogLegendItem logNotice">' . __('Notice', 'syslog') . '</div>';
print '<div class="syslogLegendItem logInfo">' . __('Info', 'syslog') . '</div>';
print '<div class="syslogLegendItem logDebug">' . __('Debug', 'syslog') . '</div>';
print '<div class="syslogLegend" style="--syslog-chip-min: calc(' . $chip_min . 'ch + 1.5rem)">';

foreach ($items as $class => $label) {
print '<div class="syslogLegendItem ' . $class . '">' . $label . '</div>';
}

print '</div>';
print '</td></tr>';

Expand All @@ -774,11 +788,25 @@ function syslog_syslog_legend(): void {
function syslog_log_legend(): void {
html_start_box('', '100%', '', '3', 'center', '');

$items = [
'logAlert' => __('Alert', 'syslog'),
'logWarning' => __('Warning', 'syslog'),
'logInfo' => __('Informational', 'syslog'),
];

$chip_min = 0;

foreach ($items as $label) {
$chip_min = max($chip_min, mb_strlen($label));
}

print '<tr class="tableRow"><td>';
print '<div class="syslogLegend">';
print '<div class="syslogLegendItem logAlert">' . __('Alert', 'syslog') . '</div>';
print '<div class="syslogLegendItem logWarning">' . __('Warning', 'syslog') . '</div>';
print '<div class="syslogLegendItem logInfo">' . __('Informational', 'syslog') . '</div>';
print '<div class="syslogLegend" style="--syslog-chip-min: calc(' . $chip_min . 'ch + 1.5rem)">';

foreach ($items as $class => $label) {
print '<div class="syslogLegendItem ' . $class . '">' . $label . '</div>';
}

print '</div>';
print '</td></tr>';

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/SyslogLegendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
$output = ob_get_clean();

expect($output)->toContain('<tr class="tableRow"><td>');
expect($output)->toContain('<div class="syslogLegend">');
expect($output)->toContain('<div class="syslogLegend" style="--syslog-chip-min:');
Comment thread
TheWitness marked this conversation as resolved.
expect(substr_count($output, 'syslogLegendItem'))->toBe(8);

foreach (['logEmergency' => 'Emergency', 'logCritical' => 'Critical', 'logAlert' => 'Alert',
Expand All @@ -58,7 +58,7 @@
syslog_log_legend();
$output = ob_get_clean();

expect($output)->toContain('<div class="syslogLegend">');
expect($output)->toContain('<div class="syslogLegend" style="--syslog-chip-min:');
expect(substr_count($output, 'syslogLegendItem'))->toBe(3);

foreach (['logAlert' => 'Alert', 'logWarning' => 'Warning', 'logInfo' => 'Informational'] as $class => $label) {
Expand Down
Loading