Polish dataset catalog actions
This commit is contained in:
@@ -77,6 +77,19 @@ function datasetRoleLabel(role: string): string {
|
||||
return 'Source'
|
||||
}
|
||||
|
||||
function datasetActionHint(dataset: DatasetCreateResponse, role: string): string {
|
||||
if (role === 'reference') {
|
||||
return 'QA reference layer. Select it when comparing candidates against trusted geometry.'
|
||||
}
|
||||
if (role === 'candidate') {
|
||||
return 'QA candidate layer. Open on the map or send to Export / QA.'
|
||||
}
|
||||
if (dataset.dataset_type === 'raster') {
|
||||
return 'Raster source. Use the raster tools in the inspector after selecting it.'
|
||||
}
|
||||
return 'Source dataset. Inspect details before using it in downstream workflows.'
|
||||
}
|
||||
|
||||
export function DatasetPanel({
|
||||
selectedProjectId,
|
||||
selectedDatasetId,
|
||||
@@ -225,33 +238,44 @@ export function DatasetPanel({
|
||||
<span>features: {dataset.feature_count ?? dataset.vector_summary?.feature_count ?? 'n/a'}</span>
|
||||
<span>bbox: {formatBounds(dataset.bounds_json ?? dataset.vector_summary?.bounds_json)}</span>
|
||||
</div>
|
||||
<div className="button-row">
|
||||
<p className="dataset-action-hint">{datasetActionHint(dataset, datasetRole)}</p>
|
||||
<div className="dataset-action-grid">
|
||||
<button
|
||||
className="primary-action"
|
||||
className="primary-action dataset-action-button"
|
||||
type="button"
|
||||
onClick={() => onLoadDatasetDetails(selectedProjectId ?? '', dataset)}
|
||||
data-testid={`dataset-select-${dataset.id}`}
|
||||
>
|
||||
Select / details
|
||||
</button>
|
||||
<button className="secondary-action" type="button" onClick={() => onOpenDatasetInMap(dataset)}>
|
||||
Open in map
|
||||
<span>Inspect</span>
|
||||
<small>Select / details</small>
|
||||
</button>
|
||||
<button
|
||||
className="secondary-action"
|
||||
className="secondary-action dataset-action-button"
|
||||
type="button"
|
||||
onClick={() => onOpenDatasetInMap(dataset)}
|
||||
aria-label="Open in map"
|
||||
>
|
||||
<span>Map</span>
|
||||
<small>Open layer</small>
|
||||
</button>
|
||||
<button
|
||||
className="secondary-action dataset-action-button"
|
||||
type="button"
|
||||
onClick={() => onOpenDatasetExport(dataset)}
|
||||
disabled={!(dataset.dataset_type === 'vector' || dataset.dataset_type === 'geojson')}
|
||||
>
|
||||
Export / QA
|
||||
<span>Export / QA</span>
|
||||
<small>{dataset.dataset_type === 'vector' || dataset.dataset_type === 'geojson' ? 'Compare or export' : 'Vector/GeoJSON only'}</small>
|
||||
</button>
|
||||
<button
|
||||
className="secondary-action"
|
||||
className="secondary-action dataset-action-button"
|
||||
type="button"
|
||||
onClick={() => onRefreshMetadata(dataset.id)}
|
||||
disabled={dataset.dataset_type === 'raster'}
|
||||
aria-label="Refresh metadata"
|
||||
>
|
||||
Refresh metadata
|
||||
<span>Metadata</span>
|
||||
<small>{dataset.dataset_type === 'raster' ? 'Raster metadata is automatic' : 'Refresh vector stats'}</small>
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user