Add Flemish bathymetry partition workflow
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import type { DatasetCreateResponse } from '../../types'
|
||||
import { useState } from 'react'
|
||||
import { datasetsApi } from '../../services/api'
|
||||
import type { BathymetrySourceProbeRead, DatasetCreateResponse } from '../../types'
|
||||
import { getDatasetSourceDisplayName } from '../../lib/datasetDisplay'
|
||||
import {
|
||||
OFFICIAL_SOURCE_PORTFOLIO,
|
||||
@@ -10,6 +12,7 @@ import {
|
||||
|
||||
interface SourceCatalogPanelProps {
|
||||
datasets: DatasetCreateResponse[]
|
||||
projectId?: string
|
||||
}
|
||||
|
||||
const THEME_LABELS: Record<string, string> = {
|
||||
@@ -63,7 +66,19 @@ function timelineSummary(
|
||||
].filter(Boolean).join(' · ')
|
||||
}
|
||||
|
||||
export function SourceCatalogPanel({ datasets }: SourceCatalogPanelProps): JSX.Element {
|
||||
function mdkStatusLabel(status: BathymetrySourceProbeRead['status']): string {
|
||||
if (status === 'reachable') return 'Service bereikbaar'
|
||||
if (status === 'tls_error') return 'Geblokkeerd: certificaat'
|
||||
if (status === 'endpoint_unavailable') return 'Service niet bereikbaar'
|
||||
if (status === 'invalid_capabilities') return 'Ongeldige service-informatie'
|
||||
if (status === 'disabled') return 'Controle uitgeschakeld'
|
||||
return 'Configuratie controleren'
|
||||
}
|
||||
|
||||
export function SourceCatalogPanel({ datasets, projectId }: SourceCatalogPanelProps): JSX.Element {
|
||||
const [mdkProbe, setMdkProbe] = useState<BathymetrySourceProbeRead | null>(null)
|
||||
const [mdkProbeLoading, setMdkProbeLoading] = useState(false)
|
||||
const [mdkProbeError, setMdkProbeError] = useState<string | null>(null)
|
||||
const ready = datasets.filter((dataset) => dataset.status === 'ready')
|
||||
const waterinfoDatasets = ready.filter((dataset) => dataset.source_name === 'waterinfo')
|
||||
const historicalOrthophotos = ready.filter(
|
||||
@@ -135,6 +150,19 @@ export function SourceCatalogPanel({ datasets }: SourceCatalogPanelProps): JSX.E
|
||||
}
|
||||
})
|
||||
|
||||
const checkMdkReadiness = async (): Promise<void> => {
|
||||
if (!projectId || mdkProbeLoading) return
|
||||
setMdkProbeLoading(true)
|
||||
setMdkProbeError(null)
|
||||
try {
|
||||
setMdkProbe(await datasetsApi.probeMdkBathymetry(projectId))
|
||||
} catch (error) {
|
||||
setMdkProbeError(error instanceof Error ? error.message : 'De Noordzee-bron kon niet worden gecontroleerd.')
|
||||
} finally {
|
||||
setMdkProbeLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="workspace-panel source-catalog-panel" aria-label="Beschikbare databronnen">
|
||||
<div className="panel-title-row">
|
||||
@@ -264,6 +292,29 @@ export function SourceCatalogPanel({ datasets }: SourceCatalogPanelProps): JSX.E
|
||||
</details>
|
||||
) : null}
|
||||
|
||||
<details className="source-loaded-disclosure">
|
||||
<summary>Maritieme bronstatus</summary>
|
||||
<div className="source-catalog-loaded">
|
||||
<article>
|
||||
<strong>MDK-dieptemodel Belgische Noordzee</strong>
|
||||
<span>{mdkProbe ? mdkStatusLabel(mdkProbe.status) : 'Nog niet live gecontroleerd'}</span>
|
||||
<p>
|
||||
{mdkProbe?.message ??
|
||||
'Controleert uitsluitend de officiële service-informatie met geldige TLS. Er wordt geen raster gedownload.'}
|
||||
</p>
|
||||
{mdkProbeError ? <small className="error-text">{mdkProbeError}</small> : null}
|
||||
<button
|
||||
className="secondary-button"
|
||||
type="button"
|
||||
disabled={!projectId || mdkProbeLoading}
|
||||
onClick={() => void checkMdkReadiness()}
|
||||
>
|
||||
{mdkProbeLoading ? 'Controleren...' : 'Controleer Noordzee-bron'}
|
||||
</button>
|
||||
</article>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details className="source-opportunity-list">
|
||||
<summary>Officiële bronnen die hierna kunnen worden ingeladen</summary>
|
||||
<div className="source-opportunity-domains">
|
||||
|
||||
Reference in New Issue
Block a user