Add reusable GIS run mode and AI runtime opt-in
This commit is contained in:
@@ -201,6 +201,7 @@ interface MapWorkspaceProps {
|
||||
latestSelectionExportPath: string | null
|
||||
selectionDatasetSaving: boolean
|
||||
selectionDatasetError: string | null
|
||||
latestSelectionDataset: DatasetCreateResponse | null
|
||||
latestSelectionDatasetName: string | null
|
||||
mapQaReferenceDatasets: DatasetCreateResponse[]
|
||||
selectedMapQaReferenceDatasetId: string
|
||||
@@ -258,6 +259,7 @@ export function MapWorkspace({
|
||||
latestSelectionExportPath,
|
||||
selectionDatasetSaving,
|
||||
selectionDatasetError,
|
||||
latestSelectionDataset,
|
||||
latestSelectionDatasetName,
|
||||
mapQaReferenceDatasets,
|
||||
selectedMapQaReferenceDatasetId,
|
||||
@@ -290,6 +292,7 @@ export function MapWorkspace({
|
||||
const [fullWorkflowRunning, setFullWorkflowRunning] = useState(false)
|
||||
const [fullWorkflowStatus, setFullWorkflowStatus] = useState('Ready to run persisted GIS workflow.')
|
||||
const [fullWorkflowError, setFullWorkflowError] = useState<string | null>(null)
|
||||
const [fullWorkflowMode, setFullWorkflowMode] = useState<'new' | 'reuse'>('new')
|
||||
const selectedMapArea = areas.find((area) => area.id === selectedMapAreaId)
|
||||
const featureProperties = selectedMapFeature?.properties ?? null
|
||||
const featureSummaryEntries = featureProperties
|
||||
@@ -409,6 +412,30 @@ export function MapWorkspace({
|
||||
|
||||
const runFullGisWorkflow = async () => {
|
||||
const bbox = currentSelectionBbox ?? selectedAreaBbox ?? activeLayerBbox
|
||||
if (fullWorkflowMode === 'reuse') {
|
||||
if (!latestSelectionDataset) {
|
||||
setFullWorkflowError('Save a map selection dataset before reusing the latest result.')
|
||||
return
|
||||
}
|
||||
if (!selectedMapQaReferenceDatasetId) {
|
||||
setFullWorkflowError('Select a reference dataset before reusing the latest result for QA/QC.')
|
||||
return
|
||||
}
|
||||
setFullWorkflowRunning(true)
|
||||
setFullWorkflowError(null)
|
||||
try {
|
||||
setFullWorkflowStatus('Reusing latest saved dataset for QA/QC...')
|
||||
const qaResult = await onRunMapSelectionQa(latestSelectionDataset)
|
||||
setFullWorkflowStatus(qaResult ? 'Reused latest saved dataset and completed QA/QC.' : 'Latest saved dataset reused, but QA/QC did not complete.')
|
||||
} catch (error) {
|
||||
setFullWorkflowError(error instanceof Error ? error.message : 'Full GIS workflow failed.')
|
||||
setFullWorkflowStatus('Workflow stopped.')
|
||||
} finally {
|
||||
setFullWorkflowRunning(false)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (!selectedMapDataset || !bbox) {
|
||||
setFullWorkflowError('Select a database layer and AOI/layer extent before running the full workflow.')
|
||||
return
|
||||
@@ -753,9 +780,26 @@ export function MapWorkspace({
|
||||
</div>
|
||||
</div>
|
||||
<div className="guided-gis-actions">
|
||||
<label className="guided-gis-run-mode">
|
||||
Run mode
|
||||
<select
|
||||
value={fullWorkflowMode}
|
||||
onChange={(event) => setFullWorkflowMode(event.target.value === 'reuse' ? 'reuse' : 'new')}
|
||||
disabled={fullWorkflowRunning}
|
||||
>
|
||||
<option value="new">Create new dataset/export</option>
|
||||
<option value="reuse" disabled={!latestSelectionDataset}>
|
||||
Reuse latest saved dataset for QA
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<button
|
||||
className="primary-action guided-gis-full-run"
|
||||
disabled={!selectedMapDataset || !mapFeatureCollection || (!currentSelectionBbox && !selectedAreaBbox && !activeLayerBbox) || fullWorkflowRunning}
|
||||
disabled={
|
||||
fullWorkflowRunning ||
|
||||
(fullWorkflowMode === 'new' && (!selectedMapDataset || !mapFeatureCollection || (!currentSelectionBbox && !selectedAreaBbox && !activeLayerBbox))) ||
|
||||
(fullWorkflowMode === 'reuse' && (!latestSelectionDataset || !selectedMapQaReferenceDatasetId))
|
||||
}
|
||||
type="button"
|
||||
onClick={runFullGisWorkflow}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user