Harden export preview handling
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-06-17 07:04:07 +02:00
parent 21b84dae6c
commit ff21911ac5
10 changed files with 111 additions and 15 deletions
+2 -6
View File
@@ -9,6 +9,7 @@ import { DatasetDetailPanel } from './components/datasets/DatasetDetailPanel'
import { DatasetPanel } from './components/datasets/DatasetPanel'
import { DetectionLab } from './components/detection/DetectionLab'
import { ExportCenter } from './components/exports/ExportCenter'
import { ExportPreview } from './components/exports/ExportPreview'
import { MapWorkspace } from './components/map/MapWorkspace'
import { AreaPanel } from './components/project/AreaPanel'
import { ProjectPanel } from './components/project/ProjectPanel'
@@ -740,12 +741,7 @@ function App(): JSX.Element {
onPreviewContent={previewExportContent}
onDownload={downloadExportArtifact}
/>
{exportPreview ? (
<section>
<h2>Export Preview</h2>
<pre className="job-result">{JSON.stringify(exportPreview, null, 2)}</pre>
</section>
) : null}
<ExportPreview content={exportPreview} />
<DatasetPanel
selectedProjectId={selectedProjectId}
@@ -24,6 +24,16 @@ function isVectorDatasetType(datasetType: string): boolean {
return datasetType === 'vector' || datasetType === 'geojson'
}
function canPreviewJson(item: ExportRead): boolean {
if (item.export_type === 'project_report_html') {
return false
}
if (item.metadata_json?.format === 'html') {
return false
}
return true
}
export function ExportCenter({
selectedProjectId,
selectedDataset,
@@ -80,9 +90,13 @@ export function ExportCenter({
<div>status: {item.status}</div>
<div>path: {item.storage_path}</div>
<div>export id: {item.id}</div>
<button type="button" onClick={() => onPreviewContent(item.id)}>
Preview JSON content
</button>
{canPreviewJson(item) ? (
<button type="button" onClick={() => onPreviewContent(item.id)}>
Preview JSON content
</button>
) : (
<div>Preview: download-only HTML artifact</div>
)}
<button type="button" onClick={() => onDownload(item.id)}>
Download artifact
</button>
@@ -0,0 +1,16 @@
interface ExportPreviewProps {
content: Record<string, unknown> | null
}
export function ExportPreview({ content }: ExportPreviewProps): JSX.Element | null {
if (!content) {
return null
}
return (
<section>
<h2>Export Preview</h2>
<pre className="job-result">{JSON.stringify(content, null, 2)}</pre>
</section>
)
}