Add governed GRB refresh workflow
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-16 17:59:00 +02:00
parent bbf56d762c
commit eed6ee796e
21 changed files with 1313 additions and 1 deletions
+31 -1
View File
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useRef, useState } from 'react'
import { datasetsApi } from '../services/api'
import type { SourceCatalogProbeReport, SourceFreshnessReport } from '../types'
import type { GrbRefreshPlan, SourceCatalogProbeReport, SourceFreshnessReport } from '../types'
export function useSourceFreshness(selectedProjectId: string | null) {
const [report, setReport] = useState<SourceFreshnessReport | null>(null)
@@ -12,6 +12,9 @@ export function useSourceFreshness(selectedProjectId: string | null) {
const [catalogReport, setCatalogReport] = useState<SourceCatalogProbeReport | null>(null)
const [catalogLoading, setCatalogLoading] = useState(false)
const [catalogError, setCatalogError] = useState<string | null>(null)
const [grbRefreshPlan, setGrbRefreshPlan] = useState<GrbRefreshPlan | null>(null)
const [grbRefreshPlanLoading, setGrbRefreshPlanLoading] = useState(false)
const [grbRefreshPlanError, setGrbRefreshPlanError] = useState<string | null>(null)
const refresh = useCallback(async () => {
const requestId = ++requestSequence.current
@@ -45,10 +48,15 @@ export function useSourceFreshness(selectedProjectId: string | null) {
setCatalogReport(null)
setCatalogError(null)
setCatalogLoading(false)
setGrbRefreshPlan(null)
setGrbRefreshPlanError(null)
setGrbRefreshPlanLoading(false)
return
}
setCatalogLoading(true)
setCatalogError(null)
setGrbRefreshPlanLoading(true)
setGrbRefreshPlanError(null)
try {
const nextReport = await datasetsApi.sourceCatalogProbes(selectedProjectId, force)
if (catalogRequestSequence.current === requestId) {
@@ -58,9 +66,25 @@ export function useSourceFreshness(selectedProjectId: string | null) {
if (catalogRequestSequence.current === requestId) {
setCatalogError(caught instanceof Error ? caught.message : 'De officiële broncatalogi konden niet worden gecontroleerd.')
}
if (catalogRequestSequence.current === requestId) {
setCatalogLoading(false)
setGrbRefreshPlanLoading(false)
}
return
}
try {
const nextPlan = await datasetsApi.grbRefreshPlan(selectedProjectId)
if (catalogRequestSequence.current === requestId) {
setGrbRefreshPlan(nextPlan)
}
} catch (caught) {
if (catalogRequestSequence.current === requestId) {
setGrbRefreshPlanError(caught instanceof Error ? caught.message : 'Het veilige GRB-vernieuwingsplan kon niet worden opgebouwd.')
}
} finally {
if (catalogRequestSequence.current === requestId) {
setCatalogLoading(false)
setGrbRefreshPlanLoading(false)
}
}
}, [selectedProjectId])
@@ -77,6 +101,9 @@ export function useSourceFreshness(selectedProjectId: string | null) {
setCatalogReport(null)
setCatalogError(null)
setCatalogLoading(false)
setGrbRefreshPlan(null)
setGrbRefreshPlanError(null)
setGrbRefreshPlanLoading(false)
}, [selectedProjectId])
return {
@@ -88,5 +115,8 @@ export function useSourceFreshness(selectedProjectId: string | null) {
catalogLoading,
catalogError,
probeCatalogs,
grbRefreshPlan,
grbRefreshPlanLoading,
grbRefreshPlanError,
}
}