fix(map): read all relevant selection sources
This commit is contained in:
@@ -1042,6 +1042,22 @@ export function MapWorkspace({
|
||||
limitationMessage: product.limitation_message,
|
||||
})
|
||||
}
|
||||
for (const source of officialMapProducts.bathymetry.filter(
|
||||
(item) =>
|
||||
item.key === 'vha_inland_profiles'
|
||||
&& item.acquisition_supported
|
||||
&& item.configured,
|
||||
)) {
|
||||
result.push({
|
||||
kind: 'bathymetry_profiles',
|
||||
productKey: source.key,
|
||||
displayName: source.display_name,
|
||||
theme: 'bathymetry',
|
||||
availabilityLabel: 'historische profielpunten · laad bij selectie',
|
||||
attribution: source.attribution,
|
||||
limitationMessage: source.limitation_message,
|
||||
})
|
||||
}
|
||||
}
|
||||
for (const product of officialMapProducts.officialVector.filter((item) =>
|
||||
productCoversZones(item.coverage_zones, effectiveZones),
|
||||
@@ -1101,6 +1117,27 @@ export function MapWorkspace({
|
||||
}
|
||||
return result
|
||||
}, [onDemandProductsForZones, selectedCoverageZones])
|
||||
const selectionRelevantThemes = useMemo(() => {
|
||||
if (!mapSelectionBbox || !coverage) {
|
||||
return DATA_THEMES
|
||||
}
|
||||
const boundedThemes = new Set(
|
||||
onDemandProductsForZones(coverage.intersected_zones).map((product) => product.theme),
|
||||
)
|
||||
return DATA_THEMES.filter((theme) => {
|
||||
if (boundedThemes.has(theme.id)) {
|
||||
return true
|
||||
}
|
||||
if (!themeDatasetMap[theme.id]) {
|
||||
return false
|
||||
}
|
||||
const coverageTheme = COVERAGE_THEME_BY_MAP_THEME[theme.id]
|
||||
return coverage.items.some(
|
||||
(item) => item.theme === coverageTheme && item.status === 'operational',
|
||||
)
|
||||
})
|
||||
}, [coverage, mapSelectionBbox, onDemandProductsForZones, themeDatasetMap])
|
||||
const unavailableSelectionThemeCount = Math.max(DATA_THEMES.length - selectionRelevantThemes.length, 0)
|
||||
const activeOnDemandMapProduct = themeDatasetMap[activeTheme.id]
|
||||
? null
|
||||
: onDemandProductMap.get(activeTheme.id) ?? null
|
||||
@@ -1290,6 +1327,10 @@ export function MapWorkspace({
|
||||
}),
|
||||
[themeInsights],
|
||||
)
|
||||
const readSelectionThemeCount = useMemo(
|
||||
() => new Set(themeResults.map((result) => result.theme.id)).size,
|
||||
[themeResults],
|
||||
)
|
||||
const activeThemeInsight = themeResults.find((item) => item.theme.id === activeThemeId)
|
||||
const activeResultDataset = activeThemeInsight?.dataset ?? activeThemeDataset
|
||||
const activeSelectionResult = activeThemeInsight?.result
|
||||
@@ -1703,7 +1744,7 @@ export function MapWorkspace({
|
||||
resolvedZones = resolvedCoverage.intersected_zones
|
||||
}
|
||||
const resolvedProducts = analysisMode === 'current'
|
||||
? onDemandProductsForZones(resolvedZones).filter((product) => product.theme === activeThemeId)
|
||||
? onDemandProductsForZones(resolvedZones)
|
||||
: []
|
||||
const availableThemes: Array<MapThemeQuery<DataThemeId>> = []
|
||||
for (const theme of DATA_THEMES) {
|
||||
@@ -2389,7 +2430,7 @@ export function MapWorkspace({
|
||||
) : mapSelectionLoading || themeResultsLoading || temporalComparisonLoading ? (
|
||||
<div className="geo-results-loading" role="status">
|
||||
<span />
|
||||
<strong>Gegevens worden uit PostGIS gelezen…</strong>
|
||||
<strong>Officiële bronnen worden begrensd geladen en geanalyseerd…</strong>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
@@ -2498,26 +2539,35 @@ export function MapWorkspace({
|
||||
|
||||
<div className="geo-theme-results">
|
||||
<div className="geo-results-title-row">
|
||||
<h4>Alle beschikbare thema’s</h4>
|
||||
<span>{themeResults.length} bevraagd</span>
|
||||
<h4>Alle relevante thema’s</h4>
|
||||
<span>{readSelectionThemeCount} van {selectionRelevantThemes.length} uitgelezen</span>
|
||||
</div>
|
||||
{DATA_THEMES.map((theme) => {
|
||||
{selectionRelevantThemes.flatMap((theme) => {
|
||||
const dataset = themeDatasetMap[theme.id]
|
||||
const item = themeResults.find((result) => result.theme.id === theme.id)
|
||||
return (
|
||||
<div className="geo-theme-result-row" key={theme.id}>
|
||||
<span className={`geo-theme-symbol geo-theme-symbol-${theme.id}`} aria-hidden="true" />
|
||||
<span>
|
||||
<strong>{theme.label}</strong>
|
||||
<small>{dataset ? getDatasetSourceDisplayName(dataset) : 'Geen bron gekoppeld'}</small>
|
||||
</span>
|
||||
<span className="geo-theme-result-value">
|
||||
<b>{item ? resultMetricLabel(item.result) : dataset ? 'Niet bevraagd' : 'Bron ontbreekt'}</b>
|
||||
{item?.result.summary ? <small>{item.result.summary.metric_label}</small> : null}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
const items = themeResults.filter((result) => result.theme.id === theme.id)
|
||||
const rows = items.length > 0 ? items : [null]
|
||||
return rows.map((item, index) => {
|
||||
const resultDataset = item?.dataset ?? dataset
|
||||
return (
|
||||
<div className="geo-theme-result-row" key={`${theme.id}:${resultDataset?.id ?? index}`}>
|
||||
<span className={`geo-theme-symbol geo-theme-symbol-${theme.id}`} aria-hidden="true" />
|
||||
<span>
|
||||
<strong>{theme.label}</strong>
|
||||
<small>{resultDataset ? getDatasetSourceDisplayName(resultDataset) : 'Officiële bron kon niet worden geladen'}</small>
|
||||
</span>
|
||||
<span className="geo-theme-result-value">
|
||||
<b>{item ? resultMetricLabel(item.result) : 'Inladen mislukt'}</b>
|
||||
{item?.result.summary ? <small>{item.result.summary.metric_label}</small> : null}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
})}
|
||||
{unavailableSelectionThemeCount > 0 ? (
|
||||
<p className="geo-data-notice">
|
||||
{unavailableSelectionThemeCount} thema’s zijn voor deze zone niet van toepassing of hebben nog geen gevalideerde operationele koppeling.
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user