From 5cd22f52d44e5f58787066abf16e39e7b5c3d6f4 Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 13 Oct 2026 20:09:52 +0100 Subject: [PATCH] Compare views: start with a view the zone is linked to The tab picked the first other view in view order, so a zone linked with one view opened compared with an unrelated one. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 5 +++++ docs/views.md | 5 ++++- internal/web/static/assets/pages/zone.js | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df1d6db..c048faf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ All notable changes to Jarl are documented here. The format follows jarld` works too. The alias is linked when the unit is enabled; the package relinks a unit enabled by an older version on upgrade. +### Changed + +- A linked zone's Compare views tab starts with a view it is linked to, + not the first other view. + ## [0.6.0] - 2026-10-13 ### Added diff --git a/docs/views.md b/docs/views.md index 83a6e68..be305f9 100644 --- a/docs/views.md +++ b/docs/views.md @@ -235,7 +235,10 @@ before it). ## Comparing views A zone's **Compare views** tab, or `jarl zone diff`, compares it with the -same zone in another view (or all of them), from the view you're on: +same zone in another view (or all of them), from the view you're on. +The tab starts with a view the zone is linked to, if any, else the +first other view; `jarl zone diff` compares with every other view unless +`--with` names some: ``` $ jarl zone diff adbraun.lol --view internal diff --git a/internal/web/static/assets/pages/zone.js b/internal/web/static/assets/pages/zone.js index 6631db4..ab2a491 100644 --- a/internal/web/static/assets/pages/zone.js +++ b/internal/web/static/assets/pages/zone.js @@ -88,7 +88,10 @@ export async function render(el, params, query) { // the same. ?name= (and &type=) narrows it to one name. async function compareTab(el, zone, query) { const others = zone.other_views || []; - const withSel = select([...(others.length > 1 ? [["", "all other views"]] : []), ...others.map((v) => [v, v])], query.get("with") || others[0] || ""); + // A linked zone starts with a view it is linked to: that is the + // comparison that matters (its differences are its own records). + const linked = (zone.linked_with || []).filter((v) => others.includes(v)); + const withSel = select([...(others.length > 1 ? [["", "all other views"]] : []), ...others.map((v) => [v, v])], query.get("with") || linked[0] || others[0] || ""); const nameIn = input({ value: query.get("name") || "", placeholder: "all names, or one: www, @", class: "mono", style: { width: "200px" } }); const typeIn = input({ value: query.get("type") || "", placeholder: "any type", class: "mono", style: { width: "90px" } }); let showSame = false;