mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 19:34:01 +00:00
fix(traffic): date the STALE row by the oldest cached tile; add zh-Hant string
This commit is contained in:
1 parent
9659f38fe6
commit
69c5b32598
5 files changed
+34
-4
No files matched your search
@@ -1,2 +1,3 @@
|
|||||||
- The Traffic layer reads STALE instead of LIVE when the TomTom proxy serves
|
- The Traffic layer reads STALE instead of LIVE when the TomTom proxy serves
|
||||||
cached flow tiles (budget spent or TomTom failing) (quanticsoul4772, #1405).
|
cached flow tiles (budget spent or TomTom failing), and the row dates them by
|
||||||
|
the oldest cached tile (quanticsoul4772, #1405).
|
||||||
@@ -5760,7 +5760,8 @@ easier to meet (detection is now on more often), but does not create it.
|
|||||||
shared loading batch as LOAD FAILED. Harnesses must gate on `!stats.error`,
|
shared loading batch as LOAD FAILED. Harnesses must gate on `!stats.error`,
|
||||||
never on `mode === 'live'` alone. When the drawn flow came from the proxy's
|
never on `mode === 'live'` alone. When the drawn flow came from the proxy's
|
||||||
cached STALE-BUDGET / STALE-ERROR tiles, `getStats()` reports `stale: true`
|
cached STALE-BUDGET / STALE-ERROR tiles, `getStats()` reports `stale: true`
|
||||||
and `oldestTileAt`, the row reads STALE, and the sync chip reads
|
and `oldestTileAt`, the row reads STALE with the oldest tile's age, and the
|
||||||
|
sync chip reads
|
||||||
`STALE · Roads: <source> · Flow: cached TomTom tiles` instead of LIVE.
|
`STALE · Roads: <source> · Flow: cached TomTom tiles` instead of LIVE.
|
||||||
- Traffic runs in `sim` mode (white dots, hardcoded speeds) unless `TOMTOM_API_KEY`
|
- Traffic runs in `sim` mode (white dots, hardcoded speeds) unless `TOMTOM_API_KEY`
|
||||||
is configured (env or Keychain `tomtom-api`/`api-key`), which enables `live` mode:
|
is configured (env or Keychain `tomtom-api`/`api-key`), which enables `live` mode:
|
||||||
|
|||||||
@@ -1054,6 +1054,7 @@
|
|||||||
"LIVE · Roads: {source} · No flow roads in view": "實時 · 道路:{source} · 視野內沒有帶路況數據的道路",
|
"LIVE · Roads: {source} · No flow roads in view": "實時 · 道路:{source} · 視野內沒有帶路況數據的道路",
|
||||||
"LIVE · Roads: {source} · Flow {percent}%": "實時 · 道路:{source} · 路況 {percent}%",
|
"LIVE · Roads: {source} · Flow {percent}%": "實時 · 道路:{source} · 路況 {percent}%",
|
||||||
"SIMULATED · Roads: {source} · Flow {percent}%": "模擬 · 道路:{source} · 路況 {percent}%",
|
"SIMULATED · Roads: {source} · Flow {percent}%": "模擬 · 道路:{source} · 路況 {percent}%",
|
||||||
|
"STALE · Roads: {source} · Flow: cached TomTom tiles": "過期 · 道路:{source} · 路況:TomTom 緩存瓦片",
|
||||||
"Syncing flow · Roads: OpenStreetMap · Flow: TomTom · Unmatched: simulated": "正在同步路況 · 道路:OpenStreetMap · 路況:TomTom · 未匹配:模擬",
|
"Syncing flow · Roads: OpenStreetMap · Flow: TomTom · Unmatched: simulated": "正在同步路況 · 道路:OpenStreetMap · 路況:TomTom · 未匹配:模擬",
|
||||||
"LIVE · Roads: OpenStreetMap · Flow: TomTom · {percent}% cov · Unmatched: simulated": "實時 · 道路:OpenStreetMap · 路況:TomTom · 覆蓋 {percent}% · 未匹配:模擬",
|
"LIVE · Roads: OpenStreetMap · Flow: TomTom · {percent}% cov · Unmatched: simulated": "實時 · 道路:OpenStreetMap · 路況:TomTom · 覆蓋 {percent}% · 未匹配:模擬",
|
||||||
"LIVE · Roads: OpenStreetMap · Flow: TomTom · {percent}% cov": "實時 · 道路:OpenStreetMap · 路況:TomTom · 覆蓋 {percent}%",
|
"LIVE · Roads: OpenStreetMap · Flow: TomTom · {percent}% cov": "實時 · 道路:OpenStreetMap · 路況:TomTom · 覆蓋 {percent}%",
|
||||||
|
|||||||
@@ -714,18 +714,24 @@ export class LayerPanel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (feedState === 'stale') {
|
if (feedState === 'stale') {
|
||||||
|
// A layer drawing cached upstream data (Traffic's proxy tiles) dates the
|
||||||
|
// row by the oldest of it, not by the load that re-served it.
|
||||||
|
const dataAgo =
|
||||||
|
Number(stats.oldestTileAt) > 0
|
||||||
|
? this._timeAgo(stats.oldestTileAt)
|
||||||
|
: ago;
|
||||||
if (typeof stats.retryInSec === 'number' && stats.retryInSec > 0) {
|
if (typeof stats.retryInSec === 'number' && stats.retryInSec > 0) {
|
||||||
return t('{state} · {source} · {ago} · retrying in {seconds}s', {
|
return t('{state} · {source} · {ago} · retrying in {seconds}s', {
|
||||||
state: stateLabel,
|
state: stateLabel,
|
||||||
source,
|
source,
|
||||||
ago,
|
ago: dataAgo,
|
||||||
seconds: stats.retryInSec,
|
seconds: stats.retryInSec,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return t('{state} · {source} · {ago}', {
|
return t('{state} · {source} · {ago}', {
|
||||||
state: stateLabel,
|
state: stateLabel,
|
||||||
source,
|
source,
|
||||||
ago,
|
ago: dataAgo,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (typeof stats.loadingLabel === 'string' && stats.loadingLabel.trim()) {
|
if (typeof stats.loadingLabel === 'string' && stats.loadingLabel.trim()) {
|
||||||
|
|||||||
@@ -93,6 +93,27 @@ test('partial feed controls distinguish incomplete records from stale data and o
|
|||||||
assert.equal(button.textContent, 'OFF');
|
assert.equal(button.textContent, 'OFF');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('a stale row dates cached data by its oldest tile, not the last load', async () => {
|
||||||
|
const { LayerPanel } = await import('./layerPanel.js');
|
||||||
|
const panel = LayerPanel.prototype;
|
||||||
|
const layer = {
|
||||||
|
id: 'traffic',
|
||||||
|
name: 'Street Traffic',
|
||||||
|
source: 'TomTom',
|
||||||
|
enabled: true,
|
||||||
|
stats: {
|
||||||
|
mode: 'live',
|
||||||
|
stale: true,
|
||||||
|
count: 4,
|
||||||
|
lastUpdate: Date.now(),
|
||||||
|
oldestTileAt: Date.now() - 3 * 3600_000,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
assert.match(panel._buildMetaText(layer), /^STALE · TomTom · 3h ago$/);
|
||||||
|
delete layer.stats.oldestTileAt;
|
||||||
|
assert.match(panel._buildMetaText(layer), /^STALE · TomTom · just now$/);
|
||||||
|
});
|
||||||
|
|
||||||
test('readout rows contain only toggles and metadata; ordinary rows retain controls', async () => {
|
test('readout rows contain only toggles and metadata; ordinary rows retain controls', async () => {
|
||||||
const { LayerPanel } = await import('./layerPanel.js');
|
const { LayerPanel } = await import('./layerPanel.js');
|
||||||
const { railFixture } = await import('./railTestFixture.mjs');
|
const { railFixture } = await import('./railTestFixture.mjs');
|
||||||
|
|||||||
Reference in new issue
Block a user