Fixed an issue where Geometry Viewer renders geometry incorrectly after trying to view 3D or non-4326 SRID geometry. #6017

This commit is contained in:
Aditya Toshniwal 2023-11-17 16:29:01 +05:30
parent 5bdccb6e63
commit 0bc044fa67
4 changed files with 12 additions and 13 deletions

View File

@ -36,6 +36,7 @@ Bug fixes
| `Issue #2986 <https://github.com/pgadmin-org/pgadmin4/issues/2986>`_ - Fix an issue where the scroll position of panels was not remembered on Firefox. | `Issue #2986 <https://github.com/pgadmin-org/pgadmin4/issues/2986>`_ - Fix an issue where the scroll position of panels was not remembered on Firefox.
| `Issue #5770 <https://github.com/pgadmin-org/pgadmin4/issues/5770>`_ - Add DROP SQL for foreign keys in SQL generated by ERD when using WITH DROP option. | `Issue #5770 <https://github.com/pgadmin-org/pgadmin4/issues/5770>`_ - Add DROP SQL for foreign keys in SQL generated by ERD when using WITH DROP option.
| `Issue #5807 <https://github.com/pgadmin-org/pgadmin4/issues/5807>`_ - Fixed an issue where psql was not taking the role used to connect in server properties. | `Issue #5807 <https://github.com/pgadmin-org/pgadmin4/issues/5807>`_ - Fixed an issue where psql was not taking the role used to connect in server properties.
| `Issue #6017 <https://github.com/pgadmin-org/pgadmin4/issues/6017>`_ - Fixed an issue where Geometry Viewer renders geometry incorrectly after trying to view 3D or non-4326 SRID geometry.
| `Issue #6459 <https://github.com/pgadmin-org/pgadmin4/issues/6459>`_ - Fix the sorting of size on the statistics panel. | `Issue #6459 <https://github.com/pgadmin-org/pgadmin4/issues/6459>`_ - Fix the sorting of size on the statistics panel.
| `Issue #6487 <https://github.com/pgadmin-org/pgadmin4/issues/6487>`_ - Fixed restoration of query tool database connection after dropping and re-creating the database with the same name. | `Issue #6487 <https://github.com/pgadmin-org/pgadmin4/issues/6487>`_ - Fixed restoration of query tool database connection after dropping and re-creating the database with the same name.
| `Issue #6602 <https://github.com/pgadmin-org/pgadmin4/issues/6602>`_ - Fix an issue where the default server-group is being deleted if the load-server json file contains no servers. | `Issue #6602 <https://github.com/pgadmin-org/pgadmin4/issues/6602>`_ - Fix an issue where the default server-group is being deleted if the load-server json file contains no servers.

View File

@ -87,15 +87,9 @@ export default function CollectionNodeProperties({
const [data, setData] = React.useState([]); const [data, setData] = React.useState([]);
const [infoMsg, setInfoMsg] = React.useState('Please select an object in the tree view.'); const [infoMsg, setInfoMsg] = React.useState('Please select an object in the tree view.');
const [selectedObject, setSelectedObject] = React.useState([]); const [selectedObject, setSelectedObject] = React.useState([]);
const [reload, setReload] = React.useState(false);
const [loaderText, setLoaderText] = React.useState(''); const [loaderText, setLoaderText] = React.useState('');
const schemaRef = React.useRef(); const schemaRef = React.useRef();
//Reload the collection node on refresh or change in children count
React.useEffect(() => {
setReload(!reload);
}, [nodeItem?._children]);
const [pgTableColumns, setPgTableColumns] = React.useState([ const [pgTableColumns, setPgTableColumns] = React.useState([
{ {
Header: 'properties', Header: 'properties',
@ -174,19 +168,20 @@ export default function CollectionNodeProperties({
contentType: 'application/json; charset=utf-8', contentType: 'application/json; charset=utf-8',
}) })
.then(function (res) { .then(function (res) {
setLoaderText('');
if (res.success == 0) { if (res.success == 0) {
pgAdmin.Browser.notifier.alert(res.errormsg, res.info); pgAdmin.Browser.notifier.alert(res.errormsg, res.info);
} }
pgAdmin.Browser.tree.refresh(selItem); pgAdmin.Browser.tree.refresh(selItem);
setReload(!reload); setIsStale(true);
}) })
.catch(function (error) { .catch(function (error) {
setLoaderText('');
pgAdmin.Browser.notifier.alert( pgAdmin.Browser.notifier.alert(
gettext('Error deleting %s', selectedItemData._label.toLowerCase()), gettext('Error deleting %s', selectedItemData._label.toLowerCase()),
_.isUndefined(error.response) ? error.message : error.response.data.errormsg _.isUndefined(error.response) ? error.message : error.response.data.errormsg
); );
})
.then(()=>{
setLoaderText('');
}); });
}; };
@ -280,7 +275,7 @@ export default function CollectionNodeProperties({
}); });
setIsStale(false); setIsStale(false);
} }
}, [nodeData, node, nodeItem, reload]); }, [nodeData, node, nodeItem, isStale]);
const CustomHeader = () => { const CustomHeader = () => {
const canDrop = evalFunc(node, node.canDrop, nodeData, nodeItem, treeNodeInfo); const canDrop = evalFunc(node, node.canDrop, nodeData, nodeItem, treeNodeInfo);

View File

@ -56,6 +56,9 @@ export default function rcdockOverride(theme) {
}, },
'& .dock-tab-btn': { '& .dock-tab-btn': {
pointerEvents: 'none', pointerEvents: 'none',
},
'& .dock-nav-more': {
display: 'none',
} }
}, },
'&.dock-style-dialogs': { '&.dock-style-dialogs': {

View File

@ -376,7 +376,6 @@ export function GeometryViewer({rows, columns, column}) {
const contentRef = React.useRef(); const contentRef = React.useRef();
const data = parseData(rows, columns, column); const data = parseData(rows, columns, column);
const queryToolCtx = React.useContext(QueryToolContext); const queryToolCtx = React.useContext(QueryToolContext);
const crs = data.selectedSRID === 4326 ? CRS.EPSG3857 : CRS.Simple;
useEffect(()=>{ useEffect(()=>{
let timeoutId; let timeoutId;
@ -391,10 +390,11 @@ export function GeometryViewer({rows, columns, column}) {
contentResizeObserver.observe(contentRef.current); contentResizeObserver.observe(contentRef.current);
}, []); }, []);
// Dyanmic CRS is not supported. Use srid as key and recreate the map on change
return ( return (
<Box ref={contentRef} width="100%" height="100%"> <Box ref={contentRef} width="100%" height="100%" key={data.selectedSRID}>
<MapContainer <MapContainer
crs={crs} crs={data.selectedSRID === 4326 ? CRS.EPSG3857 : CRS.Simple}
zoom={2} center={[20, 100]} zoom={2} center={[20, 100]}
preferCanvas={true} preferCanvas={true}
className={classes.mapContainer} className={classes.mapContainer}