diff --git a/web/pgadmin/dashboard/static/js/Dashboard.jsx b/web/pgadmin/dashboard/static/js/Dashboard.jsx index 4b7d779cc..a7f33e712 100644 --- a/web/pgadmin/dashboard/static/js/Dashboard.jsx +++ b/web/pgadmin/dashboard/static/js/Dashboard.jsx @@ -27,6 +27,7 @@ import ActiveQuery from './ActiveQuery.ui'; import _ from 'lodash'; import CachedIcon from '@mui/icons-material/Cached'; import EmptyPanelMessage from '../../../static/js/components/EmptyPanelMessage'; +import TabPanel from '../../../static/js/components/TabPanel'; function parseData(data) { var res = []; @@ -123,16 +124,15 @@ export default function Dashboard({ ...props }) { const classes = useStyles(); - let tab = ['Sessions', 'Locks', 'Prepared Transactions']; + let tabs = ['Sessions', 'Locks', 'Prepared Transactions']; const [dashData, setdashData] = useState([]); const [msg, setMsg] = useState(''); - const[infoMsg, setInfo] = useState(''); const [val, setVal] = useState(0); const [refresh, setRefresh] = useState(false); const [schemaDict, setSchemaDict] = React.useState({}); if (!did) { - tab.push('Configuration'); + tabs.push('Configuration'); } val == 3 && did && setVal(0); const tabChanged = (e, tabVal) => { @@ -233,11 +233,9 @@ export default function Dashboard({ .delete(url) .then(function (res) { if (res.data == gettext('Success')) { - setInfo(txtSuccess); Notify.success(txtSuccess); setRefresh(!refresh); } else { - setInfo(txtError); Notify.error(txtError); } }) @@ -302,11 +300,12 @@ export default function Dashboard({ .delete(url) .then(function (res) { if (res.data == gettext('Success')) { - setInfo(txtSuccess); Notify.success(txtSuccess); + setRefresh(!refresh); } else { - setInfo(txtError); Notify.error(txtError); + setRefresh(!refresh); + } }) .catch(function (error) { @@ -722,6 +721,10 @@ export default function Dashboard({ return false; } }; + useEffect(() => { + // Reset Tab values to 0, so that it will select "Sessions" on node changed. + nodeData?._type === 'database' && setVal(0); + },[nodeData]); useEffect(() => { let url, @@ -770,7 +773,7 @@ export default function Dashboard({ if (message != '') { setMsg(message); } - }, [nodeData, val, did, preferences, infoMsg, refresh, props.dbConnected]); + }, [nodeData, val, did, preferences, refresh, props.dbConnected]); const RefreshButton = () =>{ return( @@ -810,33 +813,47 @@ export default function Dashboard({ > {gettext('Server activity')}{' '} - - - {tab.map((tabValue, i) => { - return ; - })} - - - - - + + + + {tabs.map((tabValue, i) => { + return ; + })} + + + + + + + + + + + + + + + diff --git a/web/pgadmin/static/js/components/PgTable.jsx b/web/pgadmin/static/js/components/PgTable.jsx index 35ed86488..b3e99f740 100644 --- a/web/pgadmin/static/js/components/PgTable.jsx +++ b/web/pgadmin/static/js/components/PgTable.jsx @@ -274,6 +274,7 @@ export default function PgTable({ columns, data, isSelectRow, caveTable=true, .. data, defaultColumn, isSelectRow, + autoResetSortBy: false, }, useGlobalFilter, useSortBy,