mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 03:14:00 +00:00
Use shared availability for an empty Street Level provider list
This commit is contained in:
1 parent
0d9bfdf9de
commit
b78ff7a915
4 files changed
+32
-1
No files matched your search
@@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
- Street Level with no providers uses the shared unavailable state and refuses
|
||||||
|
activation before initialization, while keeping its layer identity visible.
|
||||||
|
|
||||||
- Application source configuration accepts replacements and explicit removal.
|
- Application source configuration accepts replacements and explicit removal.
|
||||||
Missing catalog feeds leave their layers unavailable without blocking startup
|
Missing catalog feeds leave their layers unavailable without blocking startup
|
||||||
or making fallback requests; malformed supplied feeds remain configuration errors.
|
or making fallback requests; malformed supplied feeds remain configuration errors.
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ visibility lifecycle before initialization. Invalid supplied methods still fail
|
|||||||
construction. `createStandaloneApplication` and `createStandaloneCatalog` accept
|
construction. `createStandaloneApplication` and `createStandaloneCatalog` accept
|
||||||
`sources` overrides; unspecified entries retain
|
`sources` overrides; unspecified entries retain
|
||||||
standalone defaults, and null entries explicitly remove a source. Street Level
|
standalone defaults, and null entries explicitly remove a source. Street Level
|
||||||
continues to accept an explicit provider list. Directions and Recent Imagery
|
continues to accept an explicit provider list. An empty Street Level provider
|
||||||
|
list uses the same unavailable lifecycle and disabled layer toggle. Directions and Recent Imagery
|
||||||
acquisition are still selected by their application constructors.
|
acquisition are still selected by their application constructors.
|
||||||
|
|
||||||
Application catalog composition accepts an optional `streetLevelProviders` list.
|
Application catalog composition accepts an optional `streetLevelProviders` list.
|
||||||
|
|||||||
@@ -82,3 +82,20 @@ test('standalone defaults allow exact replacements and explicit removal, and rej
|
|||||||
/Unknown source/,
|
/Unknown source/,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('empty Street Level uses the shared unavailable lifecycle without initialization', async (t) => {
|
||||||
|
const actual = catalog({}, t);
|
||||||
|
const manager = new LayerLifecycle({});
|
||||||
|
manager.register(actual.get('street-level'));
|
||||||
|
assert.equal(await manager.setEnabled('street-level', true), false);
|
||||||
|
assert.equal(manager.layers.get('street-level').initialized, false);
|
||||||
|
const row = manager.getAll()[0];
|
||||||
|
assert.equal(row.stats.status, 'unavailable');
|
||||||
|
assert.equal(row.stats.error, 'No street-level imagery providers configured');
|
||||||
|
assert.equal(await manager.setEnabled('street-level', false), true);
|
||||||
|
const configured = catalog(createStandaloneLayerSources(), t);
|
||||||
|
assert.equal(
|
||||||
|
configured.get('street-level').getSourceAvailability().available,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -333,6 +333,16 @@ export function createStreetLevelLayer({
|
|||||||
requiresKeyId: requiresKeyIdFor(definitionsFrozen),
|
requiresKeyId: requiresKeyIdFor(definitionsFrozen),
|
||||||
/** Registered providers, in chip order. */
|
/** Registered providers, in chip order. */
|
||||||
providerIds: definitionsFrozen.map((def) => def.id),
|
providerIds: definitionsFrozen.map((def) => def.id),
|
||||||
|
getSourceAvailability() {
|
||||||
|
const available = definitionsFrozen.length > 0;
|
||||||
|
return {
|
||||||
|
available,
|
||||||
|
source: STREET_LEVEL_LAYER_ID,
|
||||||
|
reason: available
|
||||||
|
? null
|
||||||
|
: 'No street-level imagery providers configured',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
init(viewer) {
|
init(viewer) {
|
||||||
if (state.initialized)
|
if (state.initialized)
|
||||||
|
|||||||
Reference in new issue
Block a user