Persist map selections as derived datasets
This commit is contained in:
@@ -194,6 +194,9 @@ interface MapWorkspaceProps {
|
||||
selectionExporting: boolean
|
||||
selectionExportError: string | null
|
||||
latestSelectionExportPath: string | null
|
||||
selectionDatasetSaving: boolean
|
||||
selectionDatasetError: string | null
|
||||
latestSelectionDatasetName: string | null
|
||||
availableMapDatasets: DatasetCreateResponse[]
|
||||
onSelectMapArea: (areaId: string) => void
|
||||
onOpenDatasetInMap: (dataset: DatasetCreateResponse) => void
|
||||
@@ -206,6 +209,7 @@ interface MapWorkspaceProps {
|
||||
onRunMapSelectionExtract: (bbox: VectorSelectionBBox) => void
|
||||
onClearMapSelectionExtract: () => void
|
||||
onExportMapSelection: (bbox: VectorSelectionBBox) => void
|
||||
onDeriveMapSelectionDataset: (bbox: VectorSelectionBBox) => void
|
||||
}
|
||||
|
||||
export function MapWorkspace({
|
||||
@@ -231,6 +235,9 @@ export function MapWorkspace({
|
||||
selectionExporting,
|
||||
selectionExportError,
|
||||
latestSelectionExportPath,
|
||||
selectionDatasetSaving,
|
||||
selectionDatasetError,
|
||||
latestSelectionDatasetName,
|
||||
availableMapDatasets,
|
||||
onSelectMapArea,
|
||||
onOpenDatasetInMap,
|
||||
@@ -243,6 +250,7 @@ export function MapWorkspace({
|
||||
onRunMapSelectionExtract,
|
||||
onClearMapSelectionExtract,
|
||||
onExportMapSelection,
|
||||
onDeriveMapSelectionDataset,
|
||||
}: MapWorkspaceProps): JSX.Element {
|
||||
const [bboxSelectionMode, setBboxSelectionMode] = useState(false)
|
||||
const [firstSelectionCorner, setFirstSelectionCorner] = useState<[number, number] | null>(null)
|
||||
@@ -338,6 +346,14 @@ export function MapWorkspace({
|
||||
onExportMapSelection(bbox)
|
||||
}
|
||||
|
||||
const saveAreaSelectionDataset = () => {
|
||||
const bbox = parseBboxInput(bboxInput)
|
||||
if (!bbox) {
|
||||
return
|
||||
}
|
||||
onDeriveMapSelectionDataset(bbox)
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="map-workspace-shell" data-testid="map-workspace">
|
||||
<div className="panel-title-row">
|
||||
@@ -611,11 +627,23 @@ export function MapWorkspace({
|
||||
>
|
||||
{selectionExporting ? 'Saving export...' : 'Save area export'}
|
||||
</button>
|
||||
<button
|
||||
className="secondary-action"
|
||||
disabled={!currentSelectionBbox || selectionDatasetSaving}
|
||||
type="button"
|
||||
onClick={saveAreaSelectionDataset}
|
||||
>
|
||||
{selectionDatasetSaving ? 'Saving dataset...' : 'Save as dataset'}
|
||||
</button>
|
||||
</div>
|
||||
{selectionExportError ? <p className="error">{selectionExportError}</p> : null}
|
||||
{latestSelectionExportPath ? (
|
||||
<p className="muted">Saved selection artifact: {latestSelectionExportPath}</p>
|
||||
) : null}
|
||||
{selectionDatasetError ? <p className="error">{selectionDatasetError}</p> : null}
|
||||
{latestSelectionDatasetName ? (
|
||||
<p className="muted">Saved derived dataset: {latestSelectionDatasetName}</p>
|
||||
) : null}
|
||||
{areaSelectionPreviewFeatures.length > 0 ? (
|
||||
<div className="table-scroll feature-property-table" aria-label="Area selection feature table">
|
||||
<table>
|
||||
|
||||
Reference in New Issue
Block a user