From 9bd0586f8fb0ff7bdc78f6070bd205078361ae34 Mon Sep 17 00:00:00 2001 From: devinleighsmith Date: Tue, 11 Feb 2025 11:18:31 -0800 Subject: [PATCH 1/2] psp-9813 ensure error messages from backend display properly. --- source/frontend/src/features/documents/ComposedDocument.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/frontend/src/features/documents/ComposedDocument.ts b/source/frontend/src/features/documents/ComposedDocument.ts index 6b32222818..aa49a532ce 100644 --- a/source/frontend/src/features/documents/ComposedDocument.ts +++ b/source/frontend/src/features/documents/ComposedDocument.ts @@ -124,7 +124,7 @@ export class BatchUploadResponseModel { if (exists(apiResponse)) { if (isApiError(apiResponse)) { this.isSuccess = false; - this.errorMessage = (apiResponse as IApiError).details; + this.errorMessage = (apiResponse as IApiError).error; } else { this.isSuccess = true; } From d06ae9685bf853dc7ec3e7c26f19e89e684fb931 Mon Sep 17 00:00:00 2001 From: devinleighsmith Date: Tue, 11 Feb 2025 12:29:44 -0800 Subject: [PATCH 2/2] psp-9940 Separate file based bounds from search and loading based bounds. --- .../mapFSM/machineDefinition/mapMachine.ts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/source/frontend/src/components/common/mapFSM/machineDefinition/mapMachine.ts b/source/frontend/src/components/common/mapFSM/machineDefinition/mapMachine.ts index c68b76754f..811306ff78 100644 --- a/source/frontend/src/components/common/mapFSM/machineDefinition/mapMachine.ts +++ b/source/frontend/src/components/common/mapFSM/machineDefinition/mapMachine.ts @@ -42,7 +42,7 @@ const featureViewStates = { SET_FILE_PROPERTY_LOCATIONS: { actions: [ assign({ filePropertyLocations: (_, event: any) => event.locations }), - raise('REQUEST_FIT_BOUNDS'), + raise('REQUEST_FIT_FILE_BOUNDS'), ], }, }, @@ -62,7 +62,7 @@ const featureViewStates = { SET_FILE_PROPERTY_LOCATIONS: { actions: [ assign({ filePropertyLocations: (_, event: any) => event.locations }), - raise('REQUEST_FIT_BOUNDS'), + raise('REQUEST_FIT_FILE_BOUNDS'), ], }, }, @@ -168,9 +168,7 @@ const mapRequestStates = { context?.mapFeatureData?.pimsLocationFeatures?.features ?? []; // business logic, if there are file properties, use those, otherwise, zoom to a single feature if there is only one, or all features if there are more than one. - if (context.filePropertyLocations.length > 0) { - return latLngBounds(context.filePropertyLocations); - } else if (pimsLocationFeatures.length + fullyAttributedFeatures.length === 1) { + if (pimsLocationFeatures.length + fullyAttributedFeatures.length === 1) { // if there is exactly one pims or pmbc feature, use that feature const features = [...pimsLocationFeatures, ...fullyAttributedFeatures]; return geoJSON(features[0]).getBounds(); @@ -207,6 +205,17 @@ const mapRequestStates = { target: 'pendingFitBounds', }, }, + REQUEST_FIT_FILE_BOUNDS: { + actions: assign({ + requestedFitBounds: (context: MachineContext) => { + // business logic, if there are file properties, use those, otherwise, zoom to a single feature if there is only one, or all features if there are more than one. + if (context.filePropertyLocations.length > 0) { + return latLngBounds(context.filePropertyLocations); + } + }, + }), + target: 'pendingFitBounds', + }, }, pendingFlyTo: { on: { @@ -377,7 +386,7 @@ const sideBarStates = { assign({ filePropertyLocations: (_: MachineContext, event: any) => event.locations || [], }), - raise('REQUEST_FIT_BOUNDS'), + raise('REQUEST_FIT_FILE_BOUNDS'), ], },