From b8efee46f3400727e8ebb11017a38773eebcedde Mon Sep 17 00:00:00 2001 From: Henning Bredel Date: Wed, 14 Aug 2024 10:50:22 +0200 Subject: [PATCH] Fix loading embedded tabular collection --- .../client/js/plugins/TabularCollectionViewer.jsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/geonode_mapstore_client/client/js/plugins/TabularCollectionViewer.jsx b/geonode_mapstore_client/client/js/plugins/TabularCollectionViewer.jsx index 86dd285094..1ee7768652 100644 --- a/geonode_mapstore_client/client/js/plugins/TabularCollectionViewer.jsx +++ b/geonode_mapstore_client/client/js/plugins/TabularCollectionViewer.jsx @@ -7,13 +7,8 @@ import { Tabs, Tab } from 'react-bootstrap'; import { createPlugin } from '@mapstore/framework/utils/PluginsUtils'; import resourceReducer from '@js/reducers/gnresource'; -import { layersSelector } from '@mapstore/framework/selectors/layers'; import { TableComponent } from './TabularPreview'; -function propertyToKey(property, index) { - return `${property}`; -}; - function TabbedTablesComponent({ owsUrl, tableLayers }) { const [tabs, setTabs] = useState([]) const [key, setKey] = useState(0); @@ -55,11 +50,11 @@ TabbedTablesComponent.propTypes = { const TabularCollectionViewerPlugin = connect( createSelector([ - layersSelector, + state => state?.gnresource?.data || null, (state) => state?.gnsettings?.geoserverUrl, - ], (layers, geoserverUrl, map) => { + ], (resource, geoserverUrl) => { const owsUrl = `${geoserverUrl}ows` - const tableLayers = layers.filter(l => l.group !== "background") + const tableLayers = resource.maplayers || [] return { owsUrl, tableLayers }; }) )(TabbedTablesComponent);