Skip to content

Commit 7b516a1

Browse files
fix(ui,css): document warnings reply key; warn-tint the degraded backend span (luci #8992 round 5)
Refs openwrt/luci#8992, #216
1 parent 1870b71 commit 7b516a1

5 files changed

Lines changed: 19 additions & 13 deletions

File tree

docs/developer/upstream-openwrt.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,9 @@ These PRs are the reference workflow for each review stage on
182182
| 1 | First `openwrt-ai` round | [#228](https://github.com/lucas-albers-lz4/fwlive/pull/228) (on [#227](https://github.com/lucas-albers-lz4/fwlive/pull/227)) | Resolver, awk/jsonfilter classifier, `json_escape` in logging.sh, UCI whitespace, cut README/`SOURCE_DATE_EPOCH` |
183183
| 2 | Round 2 | [#247](https://github.com/lucas-albers-lz4/fwlive/pull/247) (#243#246) | Resolve double-unwrap, WAN lock probe, rules-map error in UI, Makefile blank |
184184
| 3 | Round 3 | [#253](https://github.com/lucas-albers-lz4/fwlive/pull/253) | Non-sticky rules error, #239 staged-line helpers; timeout diagnostics (revised in wave 4) |
185-
| 4 | Round 4 | *(this PR)* | `timeout_missing` → non-gating `warnings` + backend span; staged-line selftests |
186-
| 5+ | Round 5 … | *(next fwlive PR)* | Fold blockers in fwlive first; re-cut; push luci snapshot |
185+
| 4 | Round 4 | [#255](https://github.com/lucas-albers-lz4/fwlive/pull/255) | `timeout_missing` → non-gating `warnings` + backend span; staged-line selftests |
186+
| 5 | Round 5 | [#258](https://github.com/lucas-albers-lz4/fwlive/pull/258) | Document `warnings` expect key; warn-tint degraded backend span; drop inaccurate `classList.toggle` note |
187+
| 6+ | Round 6 … | *(next fwlive PR)* | Fold blockers in fwlive first; re-cut; push luci snapshot |
187188

188189
Process docs for the agent gate live in [#212](https://github.com/lucas-albers-lz4/fwlive/pull/212)
189190
([pr-cycle.md](pr-cycle.md) + this file). Umbrella issues [#216](https://github.com/lucas-albers-lz4/fwlive/issues/216) /

openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/css.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/fwlive/fwlive.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,10 @@
717717
margin-left: 8px;
718718
vertical-align: middle;
719719
}
720+
.fwlive-backend.fwlive-backend-warn {
721+
color: var(--warn-color-high);
722+
font-weight: 600;
723+
}
720724
.fwlive-filter-panel { margin-bottom: 12px; }
721725
.fwlive-map[data-view="simple"] .fwlive-grid-core {
722726
display: grid;

openwrt-feed/luci-app-fwlive/htdocs/luci-static/resources/view/status/fwlive.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ const callFwliveLoggingStatus = rpc.declare({
4747
nf_log_ipv4: false,
4848
nf_log_ipv6: false,
4949
ready: false,
50-
blockers: []
50+
blockers: [],
51+
warnings: []
5152
} }
5253
});
5354

@@ -521,6 +522,7 @@ return view.extend({
521522
const label = document.getElementById('fwlive-backend');
522523
if (label) {
523524
let text = this.backendDisplayLabel();
525+
let degraded = false;
524526
if (this.lastRulesError) {
525527
let err = '';
526528
if (this.lastRulesError === 'rules_truncated')
@@ -530,13 +532,16 @@ return view.extend({
530532
else
531533
err = _('Rule labels unavailable');
532534
text = text ? text + ' \u00b7 ' + err : err;
535+
degraded = true;
533536
}
534537
const warnings = (this.loggingStatus && this.loggingStatus.warnings) || [];
535538
if (warnings.indexOf('timeout_missing') >= 0) {
536539
const warn = _('Limited diagnostics — timeout command missing');
537540
text = text ? text + ' \u00b7 ' + warn : warn;
541+
degraded = true;
538542
}
539543
label.textContent = text;
544+
label.classList.toggle('fwlive-backend-warn', degraded);
540545
}
541546

542547
this.updateEmptyStateUi();
@@ -1296,17 +1301,11 @@ return view.extend({
12961301
const scroll = document.getElementById('fwlive-scroll');
12971302
const wrapBtn = document.getElementById('fwlive-msg-wrap');
12981303
const onelineBtn = document.getElementById('fwlive-msg-oneline');
1304+
const oneline = this.messageLayout === 'oneline';
12991305
if (scroll) {
1300-
/* add/remove — classList.toggle(name, force) is unsupported on some 21.02-era browsers */
1301-
if (this.messageLayout === 'oneline') {
1302-
scroll.classList.add('fwlive-msg-oneline');
1303-
scroll.classList.remove('fwlive-msg-wrap');
1304-
} else {
1305-
scroll.classList.add('fwlive-msg-wrap');
1306-
scroll.classList.remove('fwlive-msg-oneline');
1307-
}
1306+
scroll.classList.toggle('fwlive-msg-oneline', oneline);
1307+
scroll.classList.toggle('fwlive-msg-wrap', !oneline);
13081308
}
1309-
const oneline = this.messageLayout === 'oneline';
13101309
if (wrapBtn)
13111310
wrapBtn.setAttribute('aria-pressed', oneline ? 'false' : 'true');
13121311
if (onelineBtn)

tests/fwlive-modules-smoke.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ assert.ok(
3939
);
4040
assert.ok(!/expect:\s*\{\s*log:\s*\[\]\s*\}/.test(viewSrc),
4141
'callFwlivePoll must not use expect:{log:[]} (strips reply.error, #233)');
42+
assert.ok(/expect:\s*\{\s*'':\s*\{\s*wan_zone: null,\s*wan_log: false,\s*wan_log_limit: null,\s*nf_log_ipv4: false,\s*nf_log_ipv6: false,\s*ready: false,\s*blockers: \[\],\s*warnings: \[\]\s*\}\s*\}/.test(viewSrc),
43+
'callFwliveLoggingStatus expect must document the full reply shape incl. warnings (openwrt/luci#8992 round 5)');
4244
assert.ok(/if\s*\(\s*reply\.error\s*\)/.test(viewSrc),
4345
'fetchEntries must set lastPollError when poll reply includes error');
4446
assert.ok(/const raw = reply\.log/.test(viewSrc),

0 commit comments

Comments
 (0)