mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
Merge commit '1a9cfb180914fc9c2b06088a836b45dbf27254d5' into review/bilawal-status-371
This commit is contained in:
commit
8eb6d09105
8 files changed
+200
-21
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { governorRequestRender } from '../renderGovernor.js';
|
||||
import { GUIDANCE_STATUSES } from '../loadingFeedback.js';
|
||||
import { markDetectionSourcesChanged } from './detection.js';
|
||||
function cloneLayerParams(value) {
|
||||
if (Array.isArray(value)) return value.map(cloneLayerParams);
|
||||
@@ -2233,6 +2234,12 @@ export class DataLayerManager {
|
||||
}
|
||||
return `${stateLabel} · ${source} · ${presentedError}`;
|
||||
}
|
||||
// A guidance status carries its prompt in `statusMessage`, not `error`, so
|
||||
// the row still tells the operator what to do without reporting a fault.
|
||||
if (GUIDANCE_STATUSES.includes(String(stats.status || '').toLowerCase())
|
||||
&& typeof stats.statusMessage === 'string' && stats.statusMessage.trim()) {
|
||||
return `${source} · ${stats.statusMessage.trim()}`;
|
||||
}
|
||||
const ago = stats.lastUpdate ? this._timeAgo(stats.lastUpdate) : 'never';
|
||||
if (stats.loading) {
|
||||
const loadingLabel = typeof stats.loadingLabel === 'string' && stats.loadingLabel.trim()
|
||||
|
||||
@@ -3256,3 +3256,14 @@ test('a layer that surrenders its row controls hides the block entirely', async
|
||||
else globalThis.document = originalDocument;
|
||||
}
|
||||
});
|
||||
|
||||
test('layer metadata shows a guidance prompt without reporting it as a fault', () => {
|
||||
const mgr = new DataLayerManager({});
|
||||
const text = mgr._buildMetaText({
|
||||
enabled: true,
|
||||
source: 'OpenStreetMap',
|
||||
stats: { status: 'zoom-in', error: null, count: 0, statusMessage: 'Zoom in to search mapped installations' },
|
||||
});
|
||||
assert.match(text, /Zoom in to search mapped installations$/);
|
||||
assert.doesNotMatch(text, /UNAVAILABLE|DEGRADED/);
|
||||
});
|
||||
@@ -425,12 +425,18 @@ function scheduleLoad() {
|
||||
async function loadInstallations() {
|
||||
if (!state.enabled || !state.viewer) return;
|
||||
const box = viewportBox(state.viewer);
|
||||
// Guidance, not a fault: the layer chose not to query because the view is
|
||||
// unbounded (a global view, or Cockpit looking at the horizon). Keep it out
|
||||
// of `error` — the manager derives refresh failures and the global status
|
||||
// chip derives LOAD FAILED from that field, and a "zoom in" prompt turned
|
||||
// every Cockpit refresh into a reported failure. The row and toast read the
|
||||
// prompt from `statusMessage` (installationFeedback) instead.
|
||||
if (!box) {
|
||||
state.abort?.abort();
|
||||
state.abort = null;
|
||||
state.loading = false;
|
||||
clearUnavailableRetry();
|
||||
setInstallationStatus('zoom-in', 'Zoom in to load mapped installation context');
|
||||
setInstallationStatus('zoom-in');
|
||||
return;
|
||||
}
|
||||
state.abort?.abort();
|
||||
|
||||
@@ -758,6 +758,8 @@ test('zoom-out aborts an active installation request and returns non-loading gui
|
||||
assert.equal(observedSignal.aborted, true);
|
||||
assert.equal(militaryInstallationsLayer.getStats().loading, false);
|
||||
assert.equal(militaryInstallationsLayer.getStats().status, 'zoom-in');
|
||||
assert.equal(militaryInstallationsLayer.getStats().error, null, 'guidance is not a fault');
|
||||
assert.match(militaryInstallationsLayer.getStats().statusMessage, /zoom in/i);
|
||||
} finally {
|
||||
militaryInstallationsLayer.destroy(viewer);
|
||||
globalThis.fetch = originalFetch;
|
||||
|
||||
Reference in new issue
Block a user