git clone https://garage44.eu/jeroen/cartopolis.gitcartopolis-agent · 2026-11-30T18:32:28Z
fix(web): data layers page draws its preview, says 'layer' for one The preview map was written as a function component, which Mithril takes for a closure component, so step 2 drew empty and step 3 not at all; it is a plain function now. A suggested name starts with a capital. The form gains 'Follow the source's changes' (on), and a layer's row says whether it follows them.
crates/atlas/web/mock.ts | 8 +++++---
.../atlas/web/src/components/pages/feeds/feeds.tsx | 23 +++++++++++++++-------
crates/atlas/web/src/types.ts | 3 +++
3 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/crates/atlas/web/mock.ts b/crates/atlas/web/mock.ts
index 44bf1b4f..bff7a6a2 100644
--- a/crates/atlas/web/mock.ts
+++ b/crates/atlas/web/mock.ts
@@ -877,17 +877,19 @@ const feeds: FeedListed[] = [
link: '',
name: 'Stuwen',
refresh_hours: 6,
+ follow: true,
source: {dataset: 'https://www.triplexl.nl/datasets/archixl/noorderzijlvest', kind: 'triplexl', query: 'stuwen-kaart'},
title: 'naam',
},
state: {
cells: 61,
- changed_ms: 1_764_350_000_000,
+ changed_ms: 1795885980000,
error: null,
- ok_ms: 1_764_520_000_000,
+ ok_ms: 1796055960000,
placed: 1578,
rows: 1578,
- tried_ms: 1_764_520_000_000,
+ source_revision: 1,
+ tried_ms: 1796055960000,
values: feedValues,
},
},
diff --git a/crates/atlas/web/src/components/pages/feeds/feeds.tsx b/crates/atlas/web/src/components/pages/feeds/feeds.tsx
index 53485421..9e19e4ee 100644
--- a/crates/atlas/web/src/components/pages/feeds/feeds.tsx
+++ b/crates/atlas/web/src/components/pages/feeds/feeds.tsx
@@ -46,6 +46,7 @@ interface Draft {
credit: string
licence: string
refresh_hours: number | null
+ follow: boolean
busy: boolean
}
@@ -62,13 +63,14 @@ function fresh(): Draft {
preview: null,
query: '',
refresh_hours: 6,
+ follow: true,
title: '',
url: '',
}
}
/** The preview's dots on a plain ground, north up (`lib/feeds.project`). */
-function PreviewMap({p}: {p: FeedPreview}) {
+function previewMap(p: FeedPreview) {
const dots = project(p.points, MAP_W, MAP_H)
return (
<svg class="feeds-map" height={MAP_H} role="img" viewBox={`0 0 ${MAP_W} ${MAP_H}`} width={MAP_W}>
@@ -119,7 +121,8 @@ class NewFeed extends MithrilComponent<{onDone: (saved: boolean) => void}> {
d.title = ['naam', 'name', 'titel', 'title', 'label'].find(named) ?? p.columns.find((c) => c !== p.geometry) ?? ''
d.fields = p.columns.filter((c) => c !== p.geometry && c !== d.title && !looksLikeIri(p, c)).slice(0, 4)
if (!d.name && q) {
- d.name = q.description.replace(/ op de kaart.*$/i, '').replace(/^De /, '')
+ const bare = q.description.replace(/ op de kaart.*$/i, '').replace(/^De /, '') || q.name
+ d.name = bare.charAt(0).toUpperCase() + bare.slice(1)
}
}
}
@@ -140,6 +143,7 @@ class NewFeed extends MithrilComponent<{onDone: (saved: boolean) => void}> {
link: '',
name: d.name.trim(),
refresh_hours: d.refresh_hours ?? 6,
+ follow: d.follow,
source: {dataset: d.dataset.dataset, kind: 'triplexl', query: d.query},
title: d.title,
}
@@ -200,7 +204,7 @@ class NewFeed extends MithrilComponent<{onDone: (saved: boolean) => void}> {
{p && (
<Card>
<h3 class="feeds-step">2 · What it draws</h3>
- <PreviewMap p={p} />
+ {previewMap(p)}
<p class="feeds-note">
{p.rows.toLocaleString()} records, {p.placed.toLocaleString()} with a place
{p.geometry ? `, from the column “${p.geometry}”` : ' — no column holds points'}
@@ -258,7 +262,12 @@ class NewFeed extends MithrilComponent<{onDone: (saved: boolean) => void}> {
/>
))}
</div>
- <FieldNumber label="Ask the source again every" model={bind(d, 'refresh_hours')} unit="hours" />
+ <FieldCheckbox
+ help="Atlas looks at the dataset's revision every minute and asks again after a commit."
+ label="Follow the source's changes"
+ model={bind(d, 'follow')}
+ />
+ <FieldNumber label="And in any case every" model={bind(d, 'refresh_hours')} unit="hours" />
<FieldText help="As the source asks to be credited" label="Credit" model={bind(d, 'credit')} />
<FieldText label="Licence" model={bind(d, 'licence')} />
<div class="feeds-actions">
@@ -326,7 +335,7 @@ export class Feeds extends MithrilComponent {
return (
<div class="feeds">
<div class="feeds-head">
- <span class="feeds-count">{s.feeds === null ? '' : `${s.feeds.length} layers`}</span>
+ <span class="feeds-count">{s.feeds === null ? '' : `${s.feeds.length} ${s.feeds.length === 1 ? 'layer' : 'layers'}`}</span>
<span class="feeds-spacer" />
{!s.adding && (
<Button
@@ -403,8 +412,8 @@ export class Feeds extends MithrilComponent {
)}
</div>
<div class="feeds-meta">
- {def.source.dataset.replace(/^https:\/\//, '')} · {def.source.query} · every{' '}
- {def.refresh_hours} h · asked {when(state.tried_ms)} · changed {when(state.changed_ms)}
+ {def.source.dataset.replace(/^https:\/\//, '')} · {def.source.query} ·{' '}
+ {def.follow ? 'follows its changes, and ' : ''}every {def.refresh_hours} h · asked {when(state.tried_ms)} · changed {when(state.changed_ms)}
</div>
{state.error && <div class="feeds-error">{state.error}</div>}
</li>
diff --git a/crates/atlas/web/src/types.ts b/crates/atlas/web/src/types.ts
index c2d34b0b..a5ab9733 100644
--- a/crates/atlas/web/src/types.ts
+++ b/crates/atlas/web/src/types.ts
@@ -708,6 +708,8 @@ export interface FeedDef {
credit: string
licence: string
refresh_hours: number
+ /** Also ask again as soon as the dataset has a new commit. */
+ follow: boolean
}
/** What the last refresh of a layer found (`feeds::State`). */
@@ -720,6 +722,7 @@ export interface FeedState {
placed: number
cells: number
values: string[]
+ source_revision: number | null
}
export interface FeedListed {