diff --git a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts index f41ede70bf0..dc81147326a 100644 --- a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts +++ b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts @@ -298,7 +298,7 @@ export class MapEventProcessor extends AbstractEventProcessor { } static getBasemapOptions(mapId: string): TypeBasemapOptions { - return this.getMapStateProtected(mapId).basemapOptions; + return this.getMapStateProtected(mapId).currentBasemapOptions || this.getMapStateProtected(mapId).basemapOptions; } static getCurrentBasemapOptions(mapId: string): TypeBasemapOptions { diff --git a/packages/geoview-core/src/core/components/data-table/data-table-modal.tsx b/packages/geoview-core/src/core/components/data-table/data-table-modal.tsx index 2b44bd40acf..76300b28e0e 100644 --- a/packages/geoview-core/src/core/components/data-table/data-table-modal.tsx +++ b/packages/geoview-core/src/core/components/data-table/data-table-modal.tsx @@ -103,23 +103,25 @@ export default function DataTableModal(): JSX.Element { const columnList = [] as MRTColumnDef[]; entries.forEach(([key, value]) => { - columnList.push({ - id: key, - accessorFn: (row) => { - // check if row is valid react element. - if (isValidElement(row[key])) { - return row[key]; - } - if (typeof row[key]?.value === 'string' || typeof row[key]?.value === 'number') { - return row[key]?.value ?? ''; - } - return ''; - }, - header: value?.alias ?? '', - Cell: ({ cell }) => getCellValue(cell.getValue() as string), - Header: ({ column }) => getTableHeader(column.columnDef.header), - maxSize: 120, - }); + // Do not show internal geoviewID field + if (value?.alias !== 'geoviewID') + columnList.push({ + id: key, + accessorFn: (row) => { + // check if row is valid react element. + if (isValidElement(row[key])) { + return row[key]; + } + if (typeof row[key]?.value === 'string' || typeof row[key]?.value === 'number') { + return row[key]?.value ?? ''; + } + return ''; + }, + header: value?.alias ?? '', + Cell: ({ cell }) => getCellValue(cell.getValue() as string), + Header: ({ column }) => getTableHeader(column.columnDef.header), + maxSize: 120, + }); }); return columnList; diff --git a/packages/geoview-core/src/core/components/details/feature-detail-modal.tsx b/packages/geoview-core/src/core/components/details/feature-detail-modal.tsx index f4d995fcbdc..41735820567 100644 --- a/packages/geoview-core/src/core/components/details/feature-detail-modal.tsx +++ b/packages/geoview-core/src/core/components/details/feature-detail-modal.tsx @@ -40,7 +40,7 @@ export default function FeatureDetailModal(): JSX.Element { const nameFieldValueTmp = feature.fieldInfo[feature.nameField !== null ? feature.nameField : 0]; setNameFieldValue(nameFieldValueTmp !== undefined ? (nameFieldValueTmp.value as string) : ''); - return Object.keys(feature?.fieldInfo ?? {}).map((fieldName) => { + const featureInfo = Object.keys(feature?.fieldInfo ?? {}).map((fieldName) => { return { fieldKey: feature.fieldInfo[fieldName]!.fieldKey, value: feature.fieldInfo[fieldName]!.value, @@ -49,6 +49,11 @@ export default function FeatureDetailModal(): JSX.Element { domain: null, }; }); + + // Remove last item who is the geoviewID + featureInfo.pop(); + + return featureInfo; }, [feature]); return ( diff --git a/packages/geoview-core/src/core/components/details/feature-info-new.tsx b/packages/geoview-core/src/core/components/details/feature-info-new.tsx index 09f699220b3..6e8ddcbbe41 100644 --- a/packages/geoview-core/src/core/components/details/feature-info-new.tsx +++ b/packages/geoview-core/src/core/components/details/feature-info-new.tsx @@ -55,11 +55,20 @@ export function FeatureInfo({ features, currentFeatureIndex }: TypeFeatureInfoPr logger.logTraceUseMemo('DETAILS PANEL - Feature Info new - featureInfoList'); const featureInfo = Object.keys(feature?.fieldInfo ?? {}).map((fieldName) => { + // We have few service WMS from BC where fields name are extremely long and separated by . + // for WMS and WFS we should only keep the last item. If we see this with other type of services, + // we may need to remove the check and apply all the time. + // TODO: should we do this at the root when sourceinfo is define? + const alias = + feature.geoviewLayerType !== 'ogcWms' && feature.geoviewLayerType !== 'ogcWfs' + ? feature.fieldInfo[fieldName]?.alias || fieldName + : (feature.fieldInfo[fieldName]?.alias || fieldName).split('.').pop() || ''; + return { fieldKey: feature.fieldInfo[fieldName]!.fieldKey, value: feature.fieldInfo[fieldName]!.value, dataType: feature.fieldInfo[fieldName]!.dataType, - alias: feature.fieldInfo[fieldName]!.alias ? feature.fieldInfo[fieldName]!.alias : fieldName, + alias, domain: null, }; }); diff --git a/packages/geoview-core/src/core/components/layers/left-panel/delete-undo-button.tsx b/packages/geoview-core/src/core/components/layers/left-panel/delete-undo-button.tsx index a8bdd56ef0b..50d22fc9b2d 100644 --- a/packages/geoview-core/src/core/components/layers/left-panel/delete-undo-button.tsx +++ b/packages/geoview-core/src/core/components/layers/left-panel/delete-undo-button.tsx @@ -86,6 +86,16 @@ export function DeleteUndoButton(props: DeleteUndoButtonProps): JSX.Element { } }; + // Make sure there is no pending state on unmount. If not, it can stay in progress forever... + // If user switch panel when action is in progress + useEffect(() => { + return () => { + setInUndoState(false); + setLayerDeleteInProgress(false); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + useEffect(() => { if (progress === 100) { deleteLayer(layer.layerPath); diff --git a/packages/geoview-core/src/core/utils/date-mgt.ts b/packages/geoview-core/src/core/utils/date-mgt.ts index 8c79552e29c..8f6355fcdd7 100644 --- a/packages/geoview-core/src/core/utils/date-mgt.ts +++ b/packages/geoview-core/src/core/utils/date-mgt.ts @@ -718,7 +718,8 @@ export abstract class DateMgt { * @returns {string} The date format. */ static deduceDateFormat(dateString: string): string { - let dateFormat = dateString !== null ? dateString.toUpperCase().replaceAll('/', '-').replaceAll(' ', 'T') : 'YYYY-MM-DD'; + let dateFormat = + dateString !== null && dateString !== undefined ? dateString.toUpperCase().replaceAll('/', '-').replaceAll(' ', 'T') : 'YYYY-MM-DD'; dateFormat = dateFormat .replace(/\d{4}/, 'YYYY') .replace(/^\d{1,2}(?=-\d{1,2}-YYYY)|((?<=^YYYY-\d-)|(?<=^YYYY-\d\d-))\d{1,2}/, 'DD')