feat(settings): Settings brought into line with the rest of Steward (milestone 493)
The last page of #5214's walk. Settings still described Steward as it was before monitors were unified and SNMP was rebuilt, drew its tabs below the breadcrumb, and showed the report schedule in UTC. - Tabs (#5377): settings/_tabs.html is a settings_tabs() macro called in each page's section_tabs block, above the trail, as Ansible's are. The breadcrumb guard also fails any page that {% include %}s a tab strip. - Report time (#5378): reports.schedule_tz keeps the zone of whoever saved the schedule; check_and_send compares in it (report_due), and the form shows the day and hour on the reader's clock (schedule_in) under their zone's name. "Last sent" uses |when. - Wording (#5379): the report contents list what the report holds (monitors, not ping-enabled hosts); "Ping latency" is "Response time" and says what it grades; plugin detail says enabling loads now and disabling needs a restart; the monitor interval says it applies on the next check (the scheduler reads it every pass); the dead list-config branch is gone. - Traefik (#5380): the 5xx and 4xx cutoffs are settings (traefik.threshold.error_5xx_pct 0.1, error_4xx_pct 1.0) in a "Traefik routers" group on Thresholds while the plugin runs, read by router_state through error_cutoffs(). The Traefik page has a Thresholds button for admins, to /settings/thresholds/#traefik. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -291,3 +291,25 @@ async def test_the_config_tile_says_when_it_last_reloaded(app):
|
||||
error_4xx=1.0, error_5xx=0.1)
|
||||
assert "Config reloaded" in page and "3m ago" in page and "343 reloads" in page
|
||||
assert "Reload failed" not in page
|
||||
|
||||
|
||||
# ── Error cutoffs are settings, reachable from the page (#5380) ─────────────
|
||||
|
||||
def test_router_state_reads_the_error_cutoffs_from_settings():
|
||||
strict = to_thresholds_cfg({"traefik.threshold.error_5xx_pct": 0.0, "traefik.threshold.error_4xx_pct": 0.2})
|
||||
lenient = to_thresholds_cfg({"traefik.threshold.error_5xx_pct": 5.0, "traefik.threshold.error_4xx_pct": 10.0})
|
||||
assert router_state(_latest(e5=0.05), strict)[0] == "crit"
|
||||
assert router_state(_latest(e5=0.05), TH)[0] == "ok" # under the 0.1% default
|
||||
assert router_state(_latest(e5=2.5), lenient)[0] == "ok"
|
||||
assert router_state(_latest(e4=0.5), strict)[0] == "warn"
|
||||
assert router_state(_latest(e4=5.0), lenient)[0] == "ok"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("role, linked", [("admin", True), ("viewer", False)])
|
||||
async def test_the_page_links_an_admin_to_the_router_thresholds(app, role, linked):
|
||||
from quart import session
|
||||
async with app.test_request_context("/plugins/traefik/"):
|
||||
session["user_role"] = role
|
||||
page = await render_plugin_template(app, "traefik", "traefik/index.html", poll_interval=30,
|
||||
access_log_enabled=False, current_range="1h")
|
||||
assert ('href="/settings/thresholds/#traefik"' in page) is linked
|
||||
|
||||
Reference in New Issue
Block a user