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 <noreply@anthropic.com>
This commit is contained in:
adamandClaude Opus 5.5 committed 2026-10-13 20:09:52 +01:00
1 parent aca0abc780
commit 5cd22f52d4
3 files changed
+13 -2

No files matched your search

+5
View File
@@ -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 jarld` works too. The alias is linked when the unit is enabled; the
package relinks a unit enabled by an older version on upgrade. 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 ## [0.6.0] - 2026-10-13
### Added ### Added
+4 -1
View File
@@ -235,7 +235,10 @@ before it).
## Comparing views ## Comparing views
A zone's **Compare views** tab, or `jarl zone diff`, compares it with the 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 $ jarl zone diff adbraun.lol --view internal
+4 -1
View File
@@ -88,7 +88,10 @@ export async function render(el, params, query) {
// the same. ?name= (and &type=) narrows it to one name. // the same. ?name= (and &type=) narrows it to one name.
async function compareTab(el, zone, query) { async function compareTab(el, zone, query) {
const others = zone.other_views || []; 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 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" } }); const typeIn = input({ value: query.get("type") || "", placeholder: "any type", class: "mono", style: { width: "90px" } });
let showSame = false; let showSame = false;