diff --git a/docs/en_US/release_notes_6_12.rst b/docs/en_US/release_notes_6_12.rst index 3d2888d75..e0a543a9a 100644 --- a/docs/en_US/release_notes_6_12.rst +++ b/docs/en_US/release_notes_6_12.rst @@ -20,4 +20,5 @@ Bug fixes ********* | `Issue #7517 `_ - Enable the start debugging button once execution is completed. + | `Issue #7518 `_ - Ensure that dashboard graph API is not called after the panel has been closed. | `Issue #7523 `_ - Fixed typo error for Statistics on the table header. diff --git a/web/pgadmin/browser/static/js/panel.js b/web/pgadmin/browser/static/js/panel.js index 6e1eaadd0..8f1d1b7ab 100644 --- a/web/pgadmin/browser/static/js/panel.js +++ b/web/pgadmin/browser/static/js/panel.js @@ -273,6 +273,15 @@ define( ); } } + if (eventName == 'panelClosed' && selectedPanel._type == 'dashboard') { + getPanelView( + pgBrowser.tree, + $container[0], + pgBrowser, + this._type, + false + ); + } } }); diff --git a/web/pgadmin/browser/static/js/panel_view.jsx b/web/pgadmin/browser/static/js/panel_view.jsx index 1a45fa6ad..8302af60a 100644 --- a/web/pgadmin/browser/static/js/panel_view.jsx +++ b/web/pgadmin/browser/static/js/panel_view.jsx @@ -24,7 +24,8 @@ export function getPanelView( tree, container, pgBrowser, - panelType + panelType, + panelVisible = true ) { let item = !_.isNull(tree)? tree.selected(): null, nodeData, node, treeNodeInfo, preferences, graphPref, dashPref; @@ -52,6 +53,7 @@ export function getPanelView( sid={!_.isUndefined(treeNodeInfo) && !_.isUndefined(treeNodeInfo['server']) ? treeNodeInfo['server']._id : ''} serverConnected={!_.isUndefined(treeNodeInfo) && !_.isUndefined(treeNodeInfo['server']) ? treeNodeInfo.server.connected: false} dbConnected={!_.isUndefined(treeNodeInfo) && !_.isUndefined(treeNodeInfo['database']) ? treeNodeInfo.database.connected: false} + panelVisible={panelVisible} /> , container diff --git a/web/pgadmin/dashboard/static/js/Dashboard.jsx b/web/pgadmin/dashboard/static/js/Dashboard.jsx index 0cc839cf3..31f6cd0e0 100644 --- a/web/pgadmin/dashboard/static/js/Dashboard.jsx +++ b/web/pgadmin/dashboard/static/js/Dashboard.jsx @@ -797,7 +797,7 @@ export default function Dashboard({ preferences={preferences} sid={sid} did={did} - pageVisible={true} + pageVisible={props.panelVisible} > )} {!_.isUndefined(preferences) && preferences.show_activity && ( @@ -887,6 +887,7 @@ Dashboard.propTypes = { row: PropTypes.object, serverConnected: PropTypes.bool, dbConnected: PropTypes.bool, + panelVisible: PropTypes.bool, }; export function ChartContainer(props) { diff --git a/web/pgadmin/dashboard/static/js/Graphs.jsx b/web/pgadmin/dashboard/static/js/Graphs.jsx index ced047c94..f8aa15120 100644 --- a/web/pgadmin/dashboard/static/js/Graphs.jsx +++ b/web/pgadmin/dashboard/static/js/Graphs.jsx @@ -179,6 +179,9 @@ export default function Graphs({preferences, sid, did, pageVisible, enablePoll=t }); let path = getStatsUrl(sid, did, getFor); + if (!pageVisible){ + return; + } axios.get(path) .then((resp)=>{ let data = resp.data;