diff --git a/web/pgadmin/authenticate/static/js/kerberos.js b/web/pgadmin/authenticate/static/js/kerberos.js index 42a7d19e1..da6f840c5 100644 --- a/web/pgadmin/authenticate/static/js/kerberos.js +++ b/web/pgadmin/authenticate/static/js/kerberos.js @@ -43,7 +43,7 @@ function fetch_ticket_lifetime () { if (ticket_lifetime > 0) { return Promise.resolve(ticket_lifetime); } else { - return Promise.reject(); + return Promise.reject(new Error(null)); } }); diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js b/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js index 8ccf22e4d..c808f5be3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js +++ b/web/pgadmin/browser/server_groups/servers/databases/casts/static/js/cast.js @@ -76,11 +76,10 @@ define('pgadmin.node.cast', [ return new Promise((resolve, reject)=>{ const api = getApiInstance(); - let _url = pgBrowser.Nodes['cast'].generate_url.apply( - pgBrowser.Nodes['cast'], [ - null, 'get_functions', itemNodeData, false, - treeNodeInfo, - ]); + let _url = pgBrowser.Nodes['cast'].generate_url( + null, 'get_functions', itemNodeData, false, + treeNodeInfo, + ); let data = {'srctyp' : srcTyp, 'trgtyp' : trgtyp}; if(srcTyp != undefined && srcTyp != '' && diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js index 157546f33..968b553c3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/compound_triggers/static/js/compound_trigger.js @@ -191,7 +191,7 @@ define('pgadmin.node.compound_trigger', [ } return itemData.icon === 'icon-compound_trigger-bad' && - this.canCreate.apply(this, [itemData, item, data]); + this.canCreate(itemData, item, data); }, // Check to whether trigger is enable ? canCreate_with_compound_trigger_disable: function(itemData, item, data) { @@ -201,7 +201,7 @@ define('pgadmin.node.compound_trigger', [ } return itemData.icon === 'icon-compound_trigger' && - this.canCreate.apply(this, [itemData, item, data]); + this.canCreate(itemData, item, data); }, }); } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js index f6e3c191e..90e7f1440 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js @@ -322,14 +322,14 @@ function( canCreate: SchemaChildTreeNode.isTreeItemOfChildOfSchema, // Check to whether table has disable trigger(s) canCreate_with_trigger_enable: function(itemData, item, data) { - if(this.canCreate.apply(this, [itemData, item, data])) { + if(this.canCreate(itemData, item, data)) { // We are here means we can create menu, now let's check condition return (itemData.tigger_count > 0); } }, // Check to whether table has enable trigger(s) canCreate_with_trigger_disable: function(itemData, item, data) { - if(this.canCreate.apply(this, [itemData, item, data])) { + if(this.canCreate(itemData, item, data)) { // We are here means we can create menu, now let's check condition return (itemData.tigger_count > 0 && itemData.has_enable_triggers > 0); } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/static/js/rule.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/static/js/rule.js index b3d9ec403..3b84476c1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/static/js/rule.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/static/js/rule.js @@ -234,7 +234,7 @@ define('pgadmin.node.rule', [ } return itemData.icon === 'icon-rule-bad' && - this.canCreate.apply(this,[itemData, item, data]); + this.canCreate(itemData, item, data); }, // Check to whether rule is enable ? canCreate_with_rule_disable: function(itemData, item, data) { diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js index 55563d3aa..34df1df1e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.js @@ -183,7 +183,7 @@ define('pgadmin.node.trigger', [ } return itemData.icon === 'icon-trigger-bad' && - this.canCreate.apply(this, [itemData, item, data]); + this.canCreate(itemData, item, data); }, // Check to whether trigger is enable ? canCreate_with_trigger_disable: function(itemData, item, data) { @@ -193,7 +193,7 @@ define('pgadmin.node.trigger', [ } return itemData.icon === 'icon-trigger' && - this.canCreate.apply(this, [itemData, item, data]); + this.canCreate(itemData, item, data); }, }); } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.ui.js index 6d4a6daac..6fd1a883b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.ui.js @@ -85,11 +85,10 @@ function getRangeSchema(nodeObj, treeNodeInfo, itemNodeData) { return new Promise((resolve, reject)=>{ const api = getApiInstance(); - let _url = nodeObj.generate_url.apply( - nodeObj, [ - null, 'get_subopclass', itemNodeData, false, - treeNodeInfo, - ]); + let _url = nodeObj.generate_url( + null, 'get_subopclass', itemNodeData, false, + treeNodeInfo, + ); let data; if(!_.isUndefined(typname) && typname != ''){ @@ -113,11 +112,10 @@ function getRangeSchema(nodeObj, treeNodeInfo, itemNodeData) { return new Promise((resolve, reject)=>{ const api = getApiInstance(); - let _url = nodeObj.generate_url.apply( - nodeObj, [ - null, 'get_canonical', itemNodeData, false, - treeNodeInfo, - ]); + let _url = nodeObj.generate_url( + null, 'get_canonical', itemNodeData, false, + treeNodeInfo, + ); let data = []; if(!_.isUndefined(name) && name != '' && name != null){ @@ -140,11 +138,10 @@ function getRangeSchema(nodeObj, treeNodeInfo, itemNodeData) { return new Promise((resolve, reject)=>{ const api = getApiInstance(); - let _url = nodeObj.generate_url.apply( - nodeObj, [ - null, 'get_stypediff', itemNodeData, false, - treeNodeInfo, - ]); + let _url = nodeObj.generate_url( + null, 'get_stypediff', itemNodeData, false, + treeNodeInfo, + ); let data; if(!_.isUndefined(typname) && typname != '' && diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js index b1b0f4e8b..fbc1387cc 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js +++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js @@ -462,7 +462,7 @@ define('pgadmin.node.database', [ ); /* Call enable/disable menu function after database is connected. To make sure all the menus for database is in the right state */ - pgBrowser.enable_disable_menus.apply(pgBrowser, [_item]); + pgBrowser.enable_disable_menus(_item); pgBrowser.Nodes['database'].callbacks.selected(_item, _data); if (!_connected) { diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js index 0d479e403..bc697cc01 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/server.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js @@ -713,7 +713,7 @@ define('pgadmin.node.server', [ /* Call enable/disable menu function after database is connected. To make sure all the menus for database is in the right state */ - pgBrowser.enable_disable_menus.apply(pgBrowser, [_item]); + pgBrowser.enable_disable_menus(_item); // We're not reconnecting if (!_wasConnected) { diff --git a/web/pgadmin/browser/static/js/MainMenuFactory.js b/web/pgadmin/browser/static/js/MainMenuFactory.js index ce704b1cd..f6f94ee6a 100644 --- a/web/pgadmin/browser/static/js/MainMenuFactory.js +++ b/web/pgadmin/browser/static/js/MainMenuFactory.js @@ -87,7 +87,7 @@ export default class MainMenuFactory { if (options.module && 'callbacks' in options.module && options.module.callbacks[options.callback]) { options.module.callbacks[options.callback].apply(options.module, [options.data, pgAdmin.Browser.tree?.selected()]); } else if (options?.module?.[options.callback]) { - options.module[options.callback].apply(options.module, [options.data, pgAdmin.Browser.tree?.selected()]); + options.module[options.callback](options.data, pgAdmin.Browser.tree?.selected()); } else if (options?.callback) { options.callback(options); } else if (options.url != '#') { @@ -117,7 +117,7 @@ export default class MainMenuFactory { let selectedNode=pgAdmin.Browser.tree.selected(); let flag=!_.isUndefined(selectedNodeFromNodes.showMenu); if(flag){ - var showMenu = selectedNodeFromNodes.showMenu(d, selectedNode); + let showMenu = selectedNodeFromNodes.showMenu(d, selectedNode); return {flag:showMenu?false:flag,showMenu}; } else{ return {flag,showMenu:undefined}; diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index 0b4209e27..fe7ebf356 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -1697,7 +1697,7 @@ define('pgadmin.browser', [ load: true, }; ctx.success = function() { - this.b._refreshNode.call(this.b, this, this.d); + this.b._refreshNode(this, this.d); }.bind(ctx); findNode(__ctx.i, d, ctx); } diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js index b4b9bda43..fd25a2ca0 100644 --- a/web/pgadmin/browser/static/js/node.js +++ b/web/pgadmin/browser/static/js/node.js @@ -139,7 +139,7 @@ define('pgadmin.browser.node', [ }, enable: _.isFunction(self.canEdit) ? function() { - return !!(self.canEdit.apply(self, arguments)); + return !!(self.canEdit(arguments)); } : (!!self.canEdit), }]); } @@ -159,7 +159,7 @@ define('pgadmin.browser.node', [ }, enable: _.isFunction(self.canDrop) ? function() { - return !!(self.canDrop.apply(self, arguments)); + return !!(self.canDrop(arguments)); } : (!!self.canDrop), }]); @@ -177,7 +177,7 @@ define('pgadmin.browser.node', [ }, enable: _.isFunction(self.canDropCascade) ? function() { - return self.canDropCascade.apply(self, arguments); + return self.canDropCascade(arguments); } : (!!self.canDropCascade), }]); } @@ -386,7 +386,7 @@ define('pgadmin.browser.node', [ const onSave = (newNodeData)=>{ // Clear the cache for this node now. setTimeout(()=>{ - this.clear_cache.apply(this, item); + this.clear_cache(item); }, 0); try { pgBrowser.Events.trigger( @@ -416,7 +416,7 @@ define('pgadmin.browser.node', [ const onSave = (newNodeData)=>{ // Clear the cache for this node now. setTimeout(()=>{ - this.clear_cache.apply(this, item); + this.clear_cache(item); }, 0); try { pgBrowser.Events.trigger( @@ -446,7 +446,7 @@ define('pgadmin.browser.node', [ // Clear the cache for this node now. setTimeout(()=>{ - this.clear_cache.apply(this, item); + this.clear_cache(item); }, 0); pgBrowser.Events.trigger( @@ -530,7 +530,7 @@ define('pgadmin.browser.node', [ title = gettext('Delete CASCADE %s?', obj.label); if (!(_.isFunction(obj.canDropCascade) ? - obj.canDropCascade.apply(obj, [d, i]) : obj.canDropCascade)) { + obj.canDropCascade(d, i) : obj.canDropCascade)) { pgAdmin.Browser.notifier.error( gettext('The %s "%s" cannot be dropped.', obj.label, d.label), 10000 @@ -547,7 +547,7 @@ define('pgadmin.browser.node', [ } if (!(_.isFunction(obj.canDrop) ? - obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) { + obj.canDrop(d, i) : obj.canDrop)) { pgAdmin.Browser.notifier.error( gettext('The %s "%s" cannot be dropped/removed.', obj.label, d.label), 10000 @@ -745,7 +745,7 @@ define('pgadmin.browser.node', [ removed: function(item) { let self = this; setTimeout(function() { - self.clear_cache.apply(self, item); + self.clear_cache(item); }, 0); }, refresh: function(cmd, _item) { diff --git a/web/pgadmin/browser/static/js/node_ajax.js b/web/pgadmin/browser/static/js/node_ajax.js index 58ca3d111..fbc2fd273 100644 --- a/web/pgadmin/browser/static/js/node_ajax.js +++ b/web/pgadmin/browser/static/js/node_ajax.js @@ -144,10 +144,10 @@ export function getNodeListById(nodeObj, treeNodeInfo, itemNodeData, params={}, _.each(rows, function(r) { if (filter(r)) { let l = (_.isFunction(nodeObj['node_label']) ? - (nodeObj['node_label']).apply(nodeObj, [r]) : + nodeObj['node_label'](r) : r.label), image = (_.isFunction(nodeObj['node_image']) ? - (nodeObj['node_image']).apply(nodeObj, [r]) : + nodeObj['node_image'](r) : (nodeObj['node_image'] || ('icon-' + nodeObj.type))); res.push({ @@ -175,10 +175,10 @@ export function getNodeListByName(node, treeNodeInfo, itemNodeData, params={}, f _.each(rows, function(r) { if (filter(r)) { let l = (_.isFunction(nodeObj['node_label']) ? - (nodeObj['node_label']).apply(nodeObj, [r]) : + nodeObj['node_label'](r) : r.label), image = (_.isFunction(nodeObj['node_image']) ? - (nodeObj['node_image']).apply(nodeObj, [r]) : + nodeObj['node_image'](r) : (nodeObj['node_image'] || ('icon-' + nodeObj.type))); res.push({ diff --git a/web/pgadmin/dashboard/static/js/Dashboard.jsx b/web/pgadmin/dashboard/static/js/Dashboard.jsx index f038151c0..6b59d6bba 100644 --- a/web/pgadmin/dashboard/static/js/Dashboard.jsx +++ b/web/pgadmin/dashboard/static/js/Dashboard.jsx @@ -143,7 +143,7 @@ function Dashboard({ mainTabs.push(gettext('Replication')); } let systemStatsTabs = [gettext('Summary'), gettext('CPU'), gettext('Memory'), gettext('Storage')]; - const [dashData, setdashData] = useState([]); + const [dashData, setDashData] = useState([]); const [msg, setMsg] = useState(''); const [ssMsg, setSsMsg] = useState(''); const [tabVal, setTabVal] = useState(0); @@ -751,7 +751,7 @@ function Dashboard({ type: 'GET', }) .then((res) => { - setdashData(parseData(res.data)); + setDashData(parseData(res.data)); }) .catch((error) => { pgAdmin.Browser.notifier.alert( @@ -769,7 +769,7 @@ function Dashboard({ }) .then((res) => { const data = res.data; - if(data['ss_present'] == false){ + if(!data['ss_present']){ setSsMsg(gettext('The system_stats extension is not installed. You can install the extension in a database using the "CREATE EXTENSION system_stats;" SQL command. Reload pgAdmin once it is installed.')); setLdid(0); } else { diff --git a/web/pgadmin/dashboard/static/js/SystemStats/CPU.jsx b/web/pgadmin/dashboard/static/js/SystemStats/CPU.jsx index 3c0a68285..b7888d7aa 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/CPU.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/CPU.jsx @@ -70,8 +70,6 @@ export default function CPU({preferences, sid, did, pageVisible, enablePoll=true const [loadAvgInfo, loadAvgInfoReduce] = useReducer(statsReducer, chartsDefault['la_stats']); const [processCpuUsageStats, setProcessCpuUsageStats] = useState([]); - const [, setCounterData] = useState({}); - const [pollDelay, setPollDelay] = useState(5000); const [errorMsg, setErrorMsg] = useState(null); @@ -196,20 +194,12 @@ export default function CPU({preferences, sid, did, pageVisible, enablePoll=true setProcessCpuUsageStats(pcu_info_list); } - - setCounterData((prevCounterData)=>{ - return { - ...prevCounterData, - ...data, - }; - }); }) .catch((error)=>{ if(!errorMsg) { cpuUsageInfoReduce({reset:chartsDefault['cpu_stats']}); loadAvgInfoReduce({reset:chartsDefault['la_stats']}); setProcessCpuUsageStats([]); - setCounterData({}); if(error.response) { if (error.response.status === 428) { setErrorMsg(gettext('Please connect to the selected server to view the graph.')); diff --git a/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx b/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx index 25a2e46c6..0f78c7be2 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx @@ -69,8 +69,6 @@ export default function Memory({preferences, sid, did, pageVisible, enablePoll=t const [swapMemoryUsageInfo, swapMemoryUsageInfoReduce] = useReducer(statsReducer, chartsDefault['sm_stats']); const [processMemoryUsageStats, setProcessMemoryUsageStats] = useState([]); - const [, setCounterData] = useState({}); - const [pollDelay, setPollDelay] = useState(5000); const [errorMsg, setErrorMsg] = useState(null); const [chartDrawnOnce, setChartDrawnOnce] = useState(false); @@ -199,20 +197,12 @@ export default function Memory({preferences, sid, did, pageVisible, enablePoll=t setProcessMemoryUsageStats(pmu_info_list); } - - setCounterData((prevCounterData)=>{ - return { - ...prevCounterData, - ...data, - }; - }); }) .catch((error)=>{ if(!errorMsg) { memoryUsageInfoReduce({reset:chartsDefault['m_stats']}); swapMemoryUsageInfoReduce({reset:chartsDefault['sm_stats']}); setProcessMemoryUsageStats([]); - setCounterData({}); if(error.response) { if (error.response.status === 428) { setErrorMsg(gettext('Please connect to the selected server to view the graph.')); diff --git a/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx b/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx index 4030fe0fa..37b164527 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx @@ -172,8 +172,6 @@ export default function Storage({preferences, sid, did, pageVisible, enablePoll= const [diskStats, setDiskStats] = useState([]); const [ioInfo, ioInfoReduce] = useReducer(ioStatsReducer, chartsDefault['io_stats']); - const [, setCounterData] = useState({}); - const [pollDelay, setPollDelay] = useState(5000); const [errorMsg, setErrorMsg] = useState(null); const [chartDrawnOnce, setChartDrawnOnce] = useState(false); @@ -351,18 +349,10 @@ export default function Storage({preferences, sid, did, pageVisible, enablePoll= } ioInfoReduce({incoming: new_io_stats}); } - - setCounterData((prevCounterData)=>{ - return { - ...prevCounterData, - ...data, - }; - }); }) .catch((error)=>{ if(!errorMsg) { ioInfoReduce({reset:chartsDefault['io_stats']}); - setCounterData({}); if(error.response) { if (error.response.status === 428) { setErrorMsg(gettext('Please connect to the selected server to view the graph.')); diff --git a/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx b/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx index 83ac9d489..625ae4ce8 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx @@ -87,7 +87,6 @@ export default function Summary({preferences, sid, did, pageVisible, enablePoll= const [osStats, setOsStats] = useState([]); const [cpuStats, setCpuStats] = useState([]); - const [, setCounterData] = useState({}); const [pollDelay, setPollDelay] = useState(5000); const [errorMsg, setErrorMsg] = useState(null); const [chartDrawnOnce, setChartDrawnOnce] = useState(false); @@ -204,17 +203,10 @@ export default function Summary({preferences, sid, did, pageVisible, enablePoll= setErrorMsg(null); processHandleCountReduce({incoming: data['hpc_stats']}); - setCounterData((prevCounterData)=>{ - return { - ...prevCounterData, - ...data, - }; - }); }) .catch((error)=>{ if(!errorMsg) { processHandleCountReduce({reset:chartsDefault['hpc_stats']}); - setCounterData({}); if(error.response) { if (error.response.status === 428) { setErrorMsg(gettext('Please connect to the selected server to view the graph.')); diff --git a/web/pgadmin/misc/bgprocess/static/js/Processes.jsx b/web/pgadmin/misc/bgprocess/static/js/Processes.jsx index 1d093c3f8..97e15adc7 100644 --- a/web/pgadmin/misc/bgprocess/static/js/Processes.jsx +++ b/web/pgadmin/misc/bgprocess/static/js/Processes.jsx @@ -275,49 +275,47 @@ export default function Processes() { }, []); return ( - <> - {setSelectedRows(rows);}} - isSelectRow={true} - tableProps={{ - autoResetSelectedRows: false, - getRowId: (row)=>{ - return row.id; - } - }} - CustomHeader={()=>{ - return ( - - - } - aria-label="Acknowledge and Remove" - title={gettext('Acknowledge and Remove')} - onClick={() => { - pgAdmin.Browser.notifier.confirm(gettext('Remove Processes'), gettext('Are you sure you want to remove the selected processes?'), ()=>{ - pgAdmin.Browser.BgProcessManager.acknowledge(selectedRows.map((p)=>p.original.id)); - }); - }} - disabled={selectedRows.length <= 0} - > - } - aria-label="Help" - title={gettext('Help')} - onClick={() => { - window.open(url_for('help.static', {'filename': 'processes.html'})); - }} - > - - - ); - }} - > - + {setSelectedRows(rows);}} + isSelectRow={true} + tableProps={{ + autoResetSelectedRows: false, + getRowId: (row)=>{ + return row.id; + } + }} + CustomHeader={()=>{ + return ( + + + } + aria-label="Acknowledge and Remove" + title={gettext('Acknowledge and Remove')} + onClick={() => { + pgAdmin.Browser.notifier.confirm(gettext('Remove Processes'), gettext('Are you sure you want to remove the selected processes?'), ()=>{ + pgAdmin.Browser.BgProcessManager.acknowledge(selectedRows.map((p)=>p.original.id)); + }); + }} + disabled={selectedRows.length <= 0} + > + } + aria-label="Help" + title={gettext('Help')} + onClick={() => { + window.open(url_for('help.static', {'filename': 'processes.html'})); + }} + > + + + ); + }} + > ); } diff --git a/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx b/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx index cc98cb024..5f7969207 100644 --- a/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx +++ b/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx @@ -71,7 +71,7 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} let steps = [gettext('Cloud Provider'), gettext('Credentials'), gettext('Cluster Type'), gettext('Instance Specification'), gettext('Database Details'), gettext('Review')]; const [currentStep, setCurrentStep] = React.useState(''); - const [selectionVal, setCloudSelection] = React.useState(''); + const [cloudSelection, setCloudSelection] = React.useState(''); const [errMsg, setErrMsg] = React.useState(''); const [cloudInstanceDetails, setCloudInstanceDetails] = React.useState({}); const [cloudDBCred, setCloudDBCred] = React.useState({}); @@ -295,14 +295,14 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} setErrMsg([MESSAGE_TYPE.INFO, gettext('Validating credentials...')]); let _url = url_for('rds.verify_credentials'); const post_data = { - cloud: selectionVal, + cloud: cloudSelection, secret: cloudDBCred, }; axiosApi.post(_url, post_data) .then((res) => { if(!res.data.success) { setErrMsg([MESSAGE_TYPE.ERROR, res.data.info]); - reject(); + reject(new Error(res.data.info)); } else { setErrMsg(['', '']); if (activeStep == 1) { @@ -314,7 +314,7 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} }) .catch(() => { setErrMsg([MESSAGE_TYPE.ERROR, gettext('Error while checking cloud credentials')]); - reject(); + reject(new Error(gettext('Error while checking cloud credentials'))); }); } else if(activeStep == 0 && cloudProvider == CLOUD_PROVIDERS.BIGANIMAL) { if (!isEmptyString(verificationURI)) { resolve(); return; } @@ -328,7 +328,7 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} }) .catch((error) => { setErrMsg([MESSAGE_TYPE.ERROR, gettext(error)]); - reject(); + reject(new Error(gettext(error))); }); } else if (cloudProvider == CLOUD_PROVIDERS.AZURE) { if (activeStep == 1) { @@ -347,7 +347,7 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} resolve(); }).catch((error)=>{ setErrMsg([MESSAGE_TYPE.ERROR, gettext(error)]); - reject(); + reject(new Error(gettext(error))); }); } else { resolve(); @@ -423,157 +423,155 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} return ( - <> - - - - {gettext('Select a cloud provider for PostgreSQL database.')} - - - - - - - - - {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && - {gettext('The verification code to authenticate the pgAdmin to EDB BigAnimal is: ')} {verificationCode} -
{gettext('By clicking the below button, you will be redirected to the EDB BigAnimal authentication page in a new tab.')} -
-
} - {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && - {gettext('Click here to authenticate yourself to EDB BigAnimal')} - } - {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && - - } -
- {cloudProvider == CLOUD_PROVIDERS.AWS && } - { cloudProvider == CLOUD_PROVIDERS.AZURE && + + + + {gettext('Select a cloud provider for PostgreSQL database.')} + + + + + + + + + {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && + {gettext('The verification code to authenticate the pgAdmin to EDB BigAnimal is: ')} {verificationCode} +
{gettext('By clicking the below button, you will be redirected to the EDB BigAnimal authentication page in a new tab.')} +
+
} + {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && + {gettext('Click here to authenticate yourself to EDB BigAnimal')} + } + {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && + + } +
+ {cloudProvider == CLOUD_PROVIDERS.AWS && } + { cloudProvider == CLOUD_PROVIDERS.AZURE && } - - {cloudProvider == CLOUD_PROVIDERS.GOOGLE && } - - -
- - {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 2 && + {cloudProvider == CLOUD_PROVIDERS.GOOGLE && } + + + + + {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 2 && } + + + + {cloudProvider == CLOUD_PROVIDERS.AWS && callRDSAPI == 3 && } + {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 3 && } + {cloudProvider == CLOUD_PROVIDERS.AZURE && callRDSAPI == 3 && } + {cloudProvider == CLOUD_PROVIDERS.GOOGLE && callRDSAPI == 3 && } + + + + {cloudProvider == CLOUD_PROVIDERS.AWS && + } + {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 4 && + } + {cloudProvider == CLOUD_PROVIDERS.AZURE && + } + {cloudProvider == CLOUD_PROVIDERS.GOOGLE && + } + + + {gettext('Please review the details before creating the cloud instance.')} + + {cloudProvider == CLOUD_PROVIDERS.AWS && callRDSAPI == 5 && } - - - - {cloudProvider == CLOUD_PROVIDERS.AWS && callRDSAPI == 3 && } - {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 3 && } - {cloudProvider == CLOUD_PROVIDERS.AZURE && callRDSAPI == 3 && } - {cloudProvider == CLOUD_PROVIDERS.GOOGLE && callRDSAPI == 3 && } - - - - {cloudProvider == CLOUD_PROVIDERS.AWS && } - {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 4 && } - {cloudProvider == CLOUD_PROVIDERS.AZURE && } - {cloudProvider == CLOUD_PROVIDERS.GOOGLE && } - - - {gettext('Please review the details before creating the cloud instance.')} - - {cloudProvider == CLOUD_PROVIDERS.AWS && callRDSAPI == 5 && - } - {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 5 && - } - {cloudProvider == CLOUD_PROVIDERS.AZURE && callRDSAPI == 5 && - } - {cloudProvider == CLOUD_PROVIDERS.GOOGLE && callRDSAPI == 5 && - } - - -
- + +
+
); } diff --git a/web/pgadmin/misc/cloud/static/js/azure.js b/web/pgadmin/misc/cloud/static/js/azure.js index 0e87bce10..b79900320 100644 --- a/web/pgadmin/misc/cloud/static/js/azure.js +++ b/web/pgadmin/misc/cloud/static/js/azure.js @@ -61,7 +61,7 @@ export function AzureCredentials(props) { }) .catch((error) => { _eventBus.fireEvent('SET_ERROR_MESSAGE_FOR_CLOUD_WIZARD',[MESSAGE_TYPE.ERROR, gettext(`Error while verifying Microsoft Azure: ${error}`)]); - reject(false); + reject(new Error(gettext(error))); }); }); }, diff --git a/web/pgadmin/misc/cloud/static/js/biganimal.js b/web/pgadmin/misc/cloud/static/js/biganimal.js index 9331f930a..96c36fe41 100644 --- a/web/pgadmin/misc/cloud/static/js/biganimal.js +++ b/web/pgadmin/misc/cloud/static/js/biganimal.js @@ -205,7 +205,7 @@ export function validateBigAnimal() { } }) .catch((error) => { - reject(`Error while fetching EDB BigAnimal verification URI: ${error.response.data.errormsg}`); + reject(new Error(`Error while fetching EDB BigAnimal verification URI: ${error.response.data.errormsg}`)); }); }); } diff --git a/web/pgadmin/misc/cloud/static/js/google.js b/web/pgadmin/misc/cloud/static/js/google.js index f7425333f..84e1990e7 100644 --- a/web/pgadmin/misc/cloud/static/js/google.js +++ b/web/pgadmin/misc/cloud/static/js/google.js @@ -62,7 +62,7 @@ export function GoogleCredentials(props) { }) .catch((error) => { _eventBus.fireEvent('SET_ERROR_MESSAGE_FOR_CLOUD_WIZARD',[MESSAGE_TYPE.ERROR, gettext(`Error while authentication: ${error}`)]); - reject(false); + reject(new Error(gettext(`Error while authentication: ${error}`))); }); }); }, @@ -201,7 +201,7 @@ GoogleInstanceDetails.propTypes = { // Google Database Details export function GoogleDatabaseDetails(props) { - const [gooeleDBInstance, setGoogleDBInstance] = React.useState(); + const [googleDBInstance, setGoogleDBInstance] = React.useState(); const classes = useStyles(); React.useMemo(() => { @@ -220,7 +220,7 @@ export function GoogleDatabaseDetails(props) { formType={'dialog'} getInitData={() => { /*This is intentional (SonarQube)*/ }} viewHelperProps={{ mode: 'create' }} - schema={gooeleDBInstance} + schema={googleDBInstance} showFooter={false} isTabView={false} onDataChange={(isChanged, changedData) => { diff --git a/web/pgadmin/misc/dependencies/static/js/Dependencies.jsx b/web/pgadmin/misc/dependencies/static/js/Dependencies.jsx index 971b4b685..97c588613 100644 --- a/web/pgadmin/misc/dependencies/static/js/Dependencies.jsx +++ b/web/pgadmin/misc/dependencies/static/js/Dependencies.jsx @@ -59,7 +59,7 @@ function parseData(data, node) { if (element.icon == null || element.icon == '') { if (node) { element.icon = _.isFunction(node['node_image']) - ? node['node_image'].apply(node, [null, null]) + ? node['node_image'](null, null) : node['node_image'] || 'icon-' + element.type; } else { element.icon = 'icon-' + element.type; diff --git a/web/pgadmin/misc/dependents/static/js/Dependents.jsx b/web/pgadmin/misc/dependents/static/js/Dependents.jsx index 3afa2ef92..8f3e7511c 100644 --- a/web/pgadmin/misc/dependents/static/js/Dependents.jsx +++ b/web/pgadmin/misc/dependents/static/js/Dependents.jsx @@ -59,7 +59,7 @@ function parseData(data, node) { if (element.icon == null || element.icon == '') { if (node) { element.icon = _.isFunction(node['node_image']) - ? node['node_image'].apply(node, [null, null]) + ? node['node_image'](null, null) : node['node_image'] || 'icon-' + element.type; } else { element.icon = 'icon-' + element.type; diff --git a/web/pgadmin/misc/properties/CollectionNodeProperties.jsx b/web/pgadmin/misc/properties/CollectionNodeProperties.jsx index 7cda4911d..6238692c5 100644 --- a/web/pgadmin/misc/properties/CollectionNodeProperties.jsx +++ b/web/pgadmin/misc/properties/CollectionNodeProperties.jsx @@ -112,9 +112,7 @@ export default function CollectionNodeProperties({ selItem = pgAdmin.Browser.tree.selected(), selectedItemData = selItem ? pgAdmin.Browser.tree.itemData(selItem) : null, selNode = selectedItemData && pgAdmin.Browser.Nodes[selectedItemData._type], - url = undefined, - msg = undefined, - title = undefined; + url, msg, title; if (selNode?.type == 'coll-constraints') { // In order to identify the constraint type, the type should be passed to the server @@ -206,7 +204,7 @@ export default function CollectionNodeProperties({ setLoaderText(gettext('Loading...')); if (!_.isUndefined(nodeObj.getSchema)) { - schemaRef.current = nodeObj.getSchema?.call(nodeObj, treeNodeInfo, nodeData); + schemaRef.current = nodeObj.getSchema?.(treeNodeInfo, nodeData); schemaRef.current?.fields.forEach((field) => { if (node.columns.indexOf(field.id) > -1) { if (field.label.indexOf('?') > -1) { diff --git a/web/pgadmin/misc/properties/ObjectNodeProperties.jsx b/web/pgadmin/misc/properties/ObjectNodeProperties.jsx index 0a76b229b..979a18945 100644 --- a/web/pgadmin/misc/properties/ObjectNodeProperties.jsx +++ b/web/pgadmin/misc/properties/ObjectNodeProperties.jsx @@ -42,7 +42,7 @@ export default function ObjectNodeProperties({panelId, node, treeNodeInfo, nodeD let warnOnCloseFlag = true; const confirmOnCloseReset = usePreferences().getPreferencesForModule('browser').confirm_on_properties_close; let updatedData = ['table', 'partition'].includes(nodeType) && !_.isEmpty(nodeData.rows_cnt) ? {rows_cnt: nodeData.rows_cnt} : undefined; - let schema = node.getSchema.call(node, treeNodeInfo, nodeData); + let schema = node.getSchema(treeNodeInfo, nodeData); // We only have two actionTypes, 'create' and 'edit' to initiate the dialog, // so if isActionTypeCopy is true, we should revert back to "create" since diff --git a/web/pgadmin/static/js/AppMenuBar.jsx b/web/pgadmin/static/js/AppMenuBar.jsx index 286dd8a7c..c010134ce 100644 --- a/web/pgadmin/static/js/AppMenuBar.jsx +++ b/web/pgadmin/static/js/AppMenuBar.jsx @@ -1,3 +1,11 @@ +///////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2024, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +////////////////////////////////////////////////////////////// import { Box } from '@mui/material'; import { makeStyles } from '@mui/styles'; import React, { useState, useEffect } from 'react'; @@ -90,33 +98,32 @@ export default function AppMenuBar() { const userMenuInfo = pgAdmin.Browser.utils.userMenuInfo; return( - <> - -
-
- {pgAdmin.Browser.MainMenus?.map((menu)=>{ - return ( - {menu.label}} - label={menu.label} - key={menu.name} - > - {menu.getMenuItems().map((menuItem, i)=>{ - const submenus = menuItem.getMenuItems(); - if(submenus) { - return - {submenus.map((submenuItem, si)=>{ - return getPgMenuItem(submenuItem, si); - })} - ; - } - return getPgMenuItem(menuItem, i); - })} - - ); - })} -
- {userMenuInfo && + +
+
+ {pgAdmin.Browser.MainMenus?.map((menu)=>{ + return ( + {menu.label}} + label={menu.label} + key={menu.name} + > + {menu.getMenuItems().map((menuItem, i)=>{ + const submenus = menuItem.getMenuItems(); + if(submenus) { + return + {submenus.map((submenuItem, si)=>{ + return getPgMenuItem(submenuItem, si); + })} + ; + } + return getPgMenuItem(menuItem, i); + })} + + ); + })} +
+ {userMenuInfo &&
{userMenuInfo.gravatar && {`Gravatar} + alt ={`Gravatar for ${ userMenuInfo.username }`} />} {!userMenuInfo.gravatar && }
{ userMenuInfo.username } ({userMenuInfo.auth_source}) @@ -139,7 +146,6 @@ export default function AppMenuBar() { })}
} -
- + ); } diff --git a/web/pgadmin/static/js/Explain/svg_download.js b/web/pgadmin/static/js/Explain/svg_download.js index 4f0225fe1..fdc2a314d 100644 --- a/web/pgadmin/static/js/Explain/svg_download.js +++ b/web/pgadmin/static/js/Explain/svg_download.js @@ -15,7 +15,7 @@ function convertImageURLtoDataURI(api, image) { image.setAttribute('href', 'data:image/svg+xml;base64,'+window.btoa(data)); resolve(); }).catch(()=>{ - reject(); + reject(new Error(null)); }); }); } diff --git a/web/pgadmin/static/js/SchemaView/DataGridView.jsx b/web/pgadmin/static/js/SchemaView/DataGridView.jsx index 04f2ab9f0..1d5f9dbe8 100644 --- a/web/pgadmin/static/js/SchemaView/DataGridView.jsx +++ b/web/pgadmin/static/js/SchemaView/DataGridView.jsx @@ -290,33 +290,31 @@ function DataTableRow({index, row, totalRows, isResizing, isHovered, schema, sch drop(rowRef); return useMemo(()=> - <> -
- {row.cells.map((cell, ci) => { - let classNames = [classes.tableCell]; +
+ {row.cells.map((cell, ci) => { + let classNames = [classes.tableCell]; - let {modeSupported} = cell.column.field? getFieldMetaData(cell.column.field, schemaRef.current, {}, viewHelperProps) : {modeSupported: true}; + let {modeSupported} = cell.column.field? getFieldMetaData(cell.column.field, schemaRef.current, {}, viewHelperProps) : {modeSupported: true}; - if(typeof(cell.column.id) == 'string' && cell.column.id.startsWith('btn-')) { - classNames.push(classes.btnCell); - } - if(cell.column.id == 'btn-edit' && row.isExpanded) { - classNames.push(classes.expandedIconCell); - } - return (modeSupported && + if(typeof(cell.column.id) == 'string' && cell.column.id.startsWith('btn-')) { + classNames.push(classes.btnCell); + } + if(cell.column.id == 'btn-edit' && row.isExpanded) { + classNames.push(classes.expandedIconCell); + } + return (modeSupported &&
{cell.render('Cell', { reRenderRow: ()=>{setKey((currKey)=>!currKey);} })}
- ); - })} -
-
- , depsMap); + ); + })} +
+
, depsMap); } export function DataGridHeader({label, canAdd, onAddClick, canSearch, onSearchTextChange}) { diff --git a/web/pgadmin/static/js/SchemaView/FormView.jsx b/web/pgadmin/static/js/SchemaView/FormView.jsx index eeaf49bd4..bcd607fe0 100644 --- a/web/pgadmin/static/js/SchemaView/FormView.jsx +++ b/web/pgadmin/static/js/SchemaView/FormView.jsx @@ -428,54 +428,50 @@ export default function FormView({ if(isTabView) { return ( - <> - - - { - setTabValue(selTabValue); - }} - variant="scrollable" - scrollButtons="auto" - action={(ref)=>ref?.updateIndicator()} - > - {Object.keys(finalTabs).map((tabName)=>{ - return ; - })} - - - {Object.keys(finalTabs).map((tabName, i)=>{ - let contentClassName = [stateUtils.formErr.message ? classes.errorMargin : null]; - if(fullTabs.indexOf(tabName) == -1) { - contentClassName.push(classes.nestedControl); - } else { - contentClassName.push(classes.fullControl); - } - return ( - - {finalTabs[tabName]} - - ); - })} + + + { + setTabValue(selTabValue); + }} + variant="scrollable" + scrollButtons="auto" + action={(ref)=>ref?.updateIndicator()} + > + {Object.keys(finalTabs).map((tabName)=>{ + return ; + })} + - ); + {Object.keys(finalTabs).map((tabName, i)=>{ + let contentClassName = [stateUtils.formErr.message ? classes.errorMargin : null]; + if(fullTabs.indexOf(tabName) == -1) { + contentClassName.push(classes.nestedControl); + } else { + contentClassName.push(classes.fullControl); + } + return ( + + {finalTabs[tabName]} + + ); + })} + ); } else { let contentClassName = [classes.nonTabPanelContent, stateUtils.formErr.message ? classes.errorMargin : null]; return ( - <> - - - {Object.keys(finalTabs).map((tabName)=>{ - return ( - {finalTabs[tabName]} - ); - })} - - - ); + + + {Object.keys(finalTabs).map((tabName)=>{ + return ( + {finalTabs[tabName]} + ); + })} + + ); } } diff --git a/web/pgadmin/static/js/SecurityPages/MfaRegisterPage.jsx b/web/pgadmin/static/js/SecurityPages/MfaRegisterPage.jsx index 15e3e0d56..d96d63ecd 100644 --- a/web/pgadmin/static/js/SecurityPages/MfaRegisterPage.jsx +++ b/web/pgadmin/static/js/SecurityPages/MfaRegisterPage.jsx @@ -1,3 +1,11 @@ +///////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2024, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +////////////////////////////////////////////////////////////// import { Box } from '@mui/material'; import React, { useState } from 'react'; import LoginImage from '../../img/login.svg?svgr'; @@ -68,39 +76,37 @@ AuthenticatorRegisterView.propTypes = { export default function MfaRegisterPage({actionUrl, mfaList, nextUrl, mfaView, ...props}) { return ( - <> - } {...props}> -
- {mfaView ? <> - {mfaView.auth_method == 'email' && } - {mfaView.auth_method == 'authenticator' && } - - {gettext('Continue')} - {gettext('Cancel')} - - :<> - {mfaList?.map((m)=>{ - return ( - -
-
-
{m.label}
-
- {m.registered ? gettext('Delete') : gettext('Setup')} -
-
- ); - })} - {nextUrl != 'internal' && {gettext('Continue')}} - } -
- -
- + } {...props}> +
+ {mfaView ? <> + {mfaView.auth_method == 'email' && } + {mfaView.auth_method == 'authenticator' && } + + {gettext('Continue')} + {gettext('Cancel')} + + :<> + {mfaList?.map((m)=>{ + return ( + +
+
+
{m.label}
+
+ {m.registered ? gettext('Delete') : gettext('Setup')} +
+
+ ); + })} + {nextUrl != 'internal' && {gettext('Continue')}} + } +
+ +
); } diff --git a/web/pgadmin/static/js/SecurityPages/MfaValidatePage.jsx b/web/pgadmin/static/js/SecurityPages/MfaValidatePage.jsx index c7cd1daea..6c0baa3e0 100644 --- a/web/pgadmin/static/js/SecurityPages/MfaValidatePage.jsx +++ b/web/pgadmin/static/js/SecurityPages/MfaValidatePage.jsx @@ -1,3 +1,11 @@ +///////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2024, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +////////////////////////////////////////////////////////////// import React, { useState } from 'react'; import LoginImage from '../../img/login.svg?svgr'; import { InputSelect, InputText, MESSAGE_TYPE, NotifierMessage } from '../components/FormComponents'; @@ -93,25 +101,23 @@ AuthenticatorValidateView.propTypes = { export default function MfaValidatePage({actionUrl, views, logoutUrl, sendEmailUrl, csrfHeader, csrfToken, ...props}) { const [method, setMethod] = useState(Object.values(views).find((v)=>v.selected)?.id); return ( - <> - } {...props}> -
- ({ - label: views[k].label, - value: views[k].id, - imageUrl: views[k].icon - }))} onChange={setMethod} controlProps={{ - allowClear: false, - }} /> -
- {method == 'email' && } - {method == 'authenticator' && } - - -
- + } {...props}> +
+ ({ + label: views[k].label, + value: views[k].id, + imageUrl: views[k].icon + }))} onChange={setMethod} controlProps={{ + allowClear: false, + }} /> +
+ {method == 'email' && } + {method == 'authenticator' && } + + +
); } diff --git a/web/pgadmin/static/js/components/ObjectBreadcrumbs.jsx b/web/pgadmin/static/js/components/ObjectBreadcrumbs.jsx index d572456a6..7b773c2a0 100644 --- a/web/pgadmin/static/js/components/ObjectBreadcrumbs.jsx +++ b/web/pgadmin/static/js/components/ObjectBreadcrumbs.jsx @@ -1,3 +1,11 @@ +///////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2024, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +////////////////////////////////////////////////////////////// import { Box } from '@mui/material'; import { makeStyles } from '@mui/styles'; import React, { useState, useEffect } from 'react'; @@ -68,24 +76,22 @@ export default function ObjectBreadcrumbs() { } return( - <> - -
- -
- { - objectData.path?.reduce((res, item)=>( - res.concat({item}, ) - ), []).slice(0, -1) - } -
+ +
+ +
+ { + objectData.path?.reduce((res, item)=>( + res.concat({item}, ) + ), []).slice(0, -1) + }
- {preferences.breadcrumbs_show_comment && objectData.description && +
+ {preferences.breadcrumbs_show_comment && objectData.description &&
{objectData.description}
} -
- + ); -} \ No newline at end of file +} diff --git a/web/pgadmin/static/js/components/PgTable.jsx b/web/pgadmin/static/js/components/PgTable.jsx index 64a7b10f2..9d03e7843 100644 --- a/web/pgadmin/static/js/components/PgTable.jsx +++ b/web/pgadmin/static/js/components/PgTable.jsx @@ -207,13 +207,11 @@ const IndeterminateCheckbox = React.forwardRef( resolvedRef.current.indeterminate = indeterminate; }, [resolvedRef, indeterminate]); return ( - <> - - + ); }, ); @@ -639,4 +637,4 @@ export function getSwitchCell() { }; return Cell; -} \ No newline at end of file +} diff --git a/web/pgadmin/static/js/custom_hooks.js b/web/pgadmin/static/js/custom_hooks.js index c87a339ae..2d376dc8b 100644 --- a/web/pgadmin/static/js/custom_hooks.js +++ b/web/pgadmin/static/js/custom_hooks.js @@ -1,3 +1,11 @@ +///////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2024, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +////////////////////////////////////////////////////////////// import {useRef, useEffect, useState, useCallback, useLayoutEffect} from 'react'; import moment from 'moment'; import { isMac } from './keyboard_shortcuts'; @@ -53,10 +61,10 @@ export function useDelayDebounce(callback, args, delay) { } export function useOnScreen(ref) { - const [isIntersecting, setIntersecting] = useState(false); + const [intersecting, setIntersecting] = useState(false); const observer = new IntersectionObserver( ([entry]) => { - setIntersecting(entry.isIntersecting); + setIntersecting(entry.intersecting); } ); useEffect(() => { @@ -67,7 +75,7 @@ export function useOnScreen(ref) { return () => { observer.disconnect(); }; }, []); - return isIntersecting; + return intersecting; } export function useIsMounted() { diff --git a/web/pgadmin/static/js/helpers/DataGridViewWithHeaderForm.jsx b/web/pgadmin/static/js/helpers/DataGridViewWithHeaderForm.jsx index 168a8d32b..b83f9624f 100644 --- a/web/pgadmin/static/js/helpers/DataGridViewWithHeaderForm.jsx +++ b/web/pgadmin/static/js/helpers/DataGridViewWithHeaderForm.jsx @@ -36,7 +36,7 @@ export default function DataGridViewWithHeaderForm(props) { const classes = useStyles(); const headerFormData = useRef({}); const schemaRef = useRef(otherProps.schema); - const [isAddDisabled, setAddDisabled] = useState(true); + const [addDisabled, setAddDisabled] = useState(true); const [headerFormResetKey, setHeaderFormResetKey] = useState(0); const onAddClick = useCallback(()=>{ if(!otherProps.canAddRow) { @@ -80,7 +80,7 @@ export default function DataGridViewWithHeaderForm(props) { resetKey={headerFormResetKey} /> - Add + Add } diff --git a/web/pgadmin/static/js/helpers/Layout/LayoutIframeTab.jsx b/web/pgadmin/static/js/helpers/Layout/LayoutIframeTab.jsx index 09a60f83b..f637e077c 100644 --- a/web/pgadmin/static/js/helpers/Layout/LayoutIframeTab.jsx +++ b/web/pgadmin/static/js/helpers/Layout/LayoutIframeTab.jsx @@ -1,3 +1,11 @@ +///////////////////////////////////////////////////////////// +// +// pgAdmin 4 - PostgreSQL Tools +// +// Copyright (C) 2013 - 2024, The pgAdmin Development Team +// This software is released under the PostgreSQL Licence +// +////////////////////////////////////////////////////////////// import { Portal } from '@mui/material'; import React, { useEffect, useRef, useState } from 'react'; import Frame from 'react-frame-component'; @@ -47,7 +55,7 @@ export default function LayoutIframeTab({target, src, children}) { }; }, [iframeTarget]); - return <> + return (
{ if(r) setIframeTarget(r.querySelector('#'+target)); @@ -59,8 +67,7 @@ export default function LayoutIframeTab({target, src, children}) { } -
- ; +
); } LayoutIframeTab.propTypes = { diff --git a/web/pgadmin/static/js/helpers/Menu.js b/web/pgadmin/static/js/helpers/Menu.js index 675a60c61..5e32956fe 100644 --- a/web/pgadmin/static/js/helpers/Menu.js +++ b/web/pgadmin/static/js/helpers/Menu.js @@ -15,7 +15,7 @@ export default class Menu { this.name = name; this.id = id; this.index = index || 1; - this.menuItems = [], + this.menuItems = []; this.addSepratior = addSepratior || false; } @@ -202,7 +202,7 @@ export class MenuItem { return true; } if (this.module && _.isFunction(this.module[this.enable])) { - return !(this.module[this.enable]).apply(this.module, [node, item, this.data]); + return !(this.module[this.enable])(node, item, this.data); } return false; diff --git a/web/pgadmin/static/js/helpers/ModalProvider.jsx b/web/pgadmin/static/js/helpers/ModalProvider.jsx index a9f5e898f..cb40a27d8 100644 --- a/web/pgadmin/static/js/helpers/ModalProvider.jsx +++ b/web/pgadmin/static/js/helpers/ModalProvider.jsx @@ -276,35 +276,34 @@ function ModalContainer({ id, title, content, dialogHeight, dialogWidth, onClose onClose?.(); } }; - const [isfullScreen, setIsFullScreen] = useState(fullScreen); + const [isFullScreen, setIsFullScreen] = useState(fullScreen); return ( - { showTitle && <> + { showTitle && {title} { - showFullScreen && !isfullScreen && - } size="xs" noBorder onClick={() => { setIsFullScreen(!isfullScreen); }} /> + showFullScreen && !isFullScreen && + } size="xs" noBorder onClick={() => { setIsFullScreen(!isFullScreen); }} /> } { - showFullScreen && isfullScreen && - } size="xs" noBorder onClick={() => { setIsFullScreen(!isfullScreen); }} /> + showFullScreen && isFullScreen && + } size="xs" noBorder onClick={() => { setIsFullScreen(!isFullScreen); }} /> } } size="xs" noBorder onClick={closeModal} /> - } {useMemo(()=>{ return content(closeModal); }, [])} diff --git a/web/pgadmin/static/js/helpers/wizard/Wizard.jsx b/web/pgadmin/static/js/helpers/wizard/Wizard.jsx index 5de2a0dd8..02b435a69 100644 --- a/web/pgadmin/static/js/helpers/wizard/Wizard.jsx +++ b/web/pgadmin/static/js/helpers/wizard/Wizard.jsx @@ -136,7 +136,7 @@ function Wizard({ stepList, onStepChange, onSave, className, ...props }) { const classes = useStyles(); const [activeStep, setActiveStep] = React.useState(0); const steps = stepList && stepList.length > 0 ? stepList : []; - const [disableNext, setdisableNext] = React.useState(false); + const [disableNext, setDisableNext] = React.useState(false); const handleNext = () => { @@ -177,7 +177,7 @@ function Wizard({ stepList, onStepChange, onSave, className, ...props }) { React.useEffect(() => { if (props.disableNextStep) { - setdisableNext(props.disableNextStep(activeStep)); + setDisableNext(props.disableNextStep(activeStep)); } }); diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js index eb78419ce..f6d9cc7de 100644 --- a/web/pgadmin/static/js/tree/tree.js +++ b/web/pgadmin/static/js/tree/tree.js @@ -347,7 +347,7 @@ export class Tree { let tree = this; if (path == null || !Array.isArray(path)) { - return Promise.reject(); + return Promise.reject(new Error(null)); } const basepath = '/browser/' + path.slice(0, path.length-1).join('/') + '/'; path = '/browser/' + path.join('/'); @@ -366,7 +366,7 @@ export class Tree { * the path for currentNode itself is not matching */ if (currentNode.path !== undefined && !onCorrectPath(currentNode.path)) { - reject(null); + reject(new Error(null)); } else if (currentNode.path === path) { resolve(currentNode); } else { @@ -380,10 +380,10 @@ export class Tree { return; } } - reject(null); + reject(new Error(null)); }) .catch(() => { - reject(null); + reject(new Error(null)); }); } }); @@ -403,7 +403,7 @@ export class Tree { currItem = currItem.parent; } retStack = retStack.reverse(); - if(separator == false) return retStack; + if(!separator) return retStack; return retStack.join(separator); } @@ -621,6 +621,6 @@ export function findInTree(rootNode, path) { })(rootNode); } -let isValidTreeNodeData = (data) => (!_.isEmpty(data)); +const isValidTreeNodeData = (data) => (!_.isEmpty(data)); export { isValidTreeNodeData }; diff --git a/web/pgadmin/tools/erd/static/js/erd_tool/components/ERDTool.jsx b/web/pgadmin/tools/erd/static/js/erd_tool/components/ERDTool.jsx index 803de8fb8..f7d6ce6a1 100644 --- a/web/pgadmin/tools/erd/static/js/erd_tool/components/ERDTool.jsx +++ b/web/pgadmin/tools/erd/static/js/erd_tool/components/ERDTool.jsx @@ -128,12 +128,10 @@ class ERDTool extends React.Component { this.diagram = new ERDCore(); /* Flag for checking if user has opted for save before close */ this.closeOnSave = React.createRef(); - this.fileInputRef = React.createRef(); this.containerRef = React.createRef(); this.diagramContainerRef = React.createRef(); this.canvasEle = props.isTest ? document.createElement('div') : null; this.noteRefEle = null; - this.noteNode = null; this.keyboardActionObj = null; this.erdDialogs = new ERDDialogs(this.context); this.apiObj = getApiInstance(); @@ -486,7 +484,7 @@ class ERDTool extends React.Component { }) .catch((err)=>{ console.error(err); - reject(); + reject(new Error(err)); }); }); const {x, y} = this.diagram.getEngine().getRelativeMousePoint(e); @@ -641,7 +639,7 @@ class ERDTool extends React.Component { this.setTitle(fileName); this.setLoading(null); if(this.closeOnSave) { - this.closePanel.call(this); + this.closePanel(); } }).catch((err)=>{ this.setLoading(null); diff --git a/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx b/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx index be1996081..0174fe701 100644 --- a/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx +++ b/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx @@ -343,12 +343,11 @@ class TableNodeWidgetRaw extends React.Component { }} />}
- {tableMetaData.is_promise && <> + {tableMetaData.is_promise &&
{!tableMetaData.data_failed &&
{gettext('Fetching...')}
} {tableMetaData.data_failed &&
{gettext('Failed to get data. Please delete this table.')}
} -
- } + } {!tableMetaData.is_promise && <>
diff --git a/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx b/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx index b19051d96..8804e4798 100644 --- a/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx +++ b/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx @@ -115,9 +115,9 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData, onClose }) { let steps = [gettext('Object Selection'), gettext('Privilege Selection'), gettext('Review')]; const [selectedObject, setSelectedObject] = React.useState([]); const [selectedAcl, setSelectedAcl] = React.useState({}); - const [msqlData, setSQL] = React.useState(''); + const [msqlData, setMSQLData] = React.useState(''); const [loaderText, setLoaderText] = React.useState(''); - const [tablebData, setTableData] = React.useState([]); + const [tableData, setTableData] = React.useState([]); const [privOptions, setPrivOptions] = React.useState({}); const [privileges, setPrivileges] = React.useState([]); const [privSchemaInstance, setPrivSchemaInstance] = React.useState(); @@ -201,7 +201,7 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData, onClose }) { }; api.post(msql_url, post_data) .then(res => { - setSQL(res.data.data); + setMSQLData(res.data.data); setLoaderText(''); }) .catch(() => { @@ -319,7 +319,7 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData, onClose }) { className={classes.table} height={window.innerHeight - 450} columns={columns} - data={tablebData} + data={tableData} isSelectRow={true} getSelectedRows={getTableSelectedRows}> diff --git a/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx b/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx index 3a130729e..9901caaf4 100644 --- a/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx +++ b/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx @@ -175,7 +175,7 @@ export default function ImportExportServers({onClose}) { .catch(() => { setLoaderText(''); setErrMsg(gettext('Error while fetching Server Groups and Servers.')); - reject(); + reject(new Error(gettext('Error while fetching Server Groups and Servers.'))); }); } else if (selectionFormData.imp_exp == 'i') { let load_servers_url = url_for('import_export_servers.load_servers'); @@ -192,7 +192,7 @@ export default function ImportExportServers({onClose}) { .catch((err) => { setLoaderText(''); setErrMsg(err.response.data.errormsg); - reject(); + reject(new Error(err.response.data.errormsg)); }); } } else { diff --git a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx index 3a36775a8..9e486300d 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/Editors.jsx @@ -212,11 +212,10 @@ export function TextEditor({row, column, onRowChange, onClose}) { {gettext('Cancel')} {column.can_edit && - <> } onClick={onOK} size="small" className={classes.buttonMargin}> {gettext('OK')} - } + } @@ -390,11 +389,10 @@ export function JsonTextEditor({row, column, onRowChange, onClose}) { {gettext('Cancel')} {column.can_edit && - <> } onClick={onOK} size="small" className={classes.buttonMargin}> {gettext('OK')} - } + } diff --git a/web/pgadmin/tools/sqleditor/static/js/components/dialogs/FilterDialog.jsx b/web/pgadmin/tools/sqleditor/static/js/components/dialogs/FilterDialog.jsx index 653018661..47151f92f 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/dialogs/FilterDialog.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/dialogs/FilterDialog.jsx @@ -130,7 +130,7 @@ export default function FilterDialog({onClose, onSave}) { }); }; - return (<> + return ( - ); + ); } FilterDialog.propTypes = { diff --git a/web/pgadmin/tools/sqleditor/static/js/components/dialogs/MacrosDialog.jsx b/web/pgadmin/tools/sqleditor/static/js/components/dialogs/MacrosDialog.jsx index 1c6f82716..c3bcb9665 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/dialogs/MacrosDialog.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/dialogs/MacrosDialog.jsx @@ -159,7 +159,7 @@ export default function MacrosDialog({onClose, onSave}) { if(keyOptions.length <= 0) { return <>; } - return (<> + return ( { @@ -180,7 +180,7 @@ export default function MacrosDialog({onClose, onSave}) { isTabView={false} formClassName={classes.root} /> - ); + ); } MacrosDialog.propTypes = { diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/GraphVisualiser.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/GraphVisualiser.jsx index 24f605c8b..7529e5a81 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/GraphVisualiser.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/GraphVisualiser.jsx @@ -255,8 +255,8 @@ export function GraphVisualiser({initColumns}) { const eventBus = useContext(QueryToolEventsContext); const queryToolCtx = useContext(QueryToolContext); const [graphType, setGraphType] = useState('L'); - const [xaxis, setXAxis] = useState(null); - const [yaxis, setYAxis] = useState([]); + const [xAxis, setXAxis] = useState(null); + const [yAxis, setYAxis] = useState([]); const [[graphData, graphDataKey], setGraphData] = useState([{'datasets': []}, 0]); const [loaderText, setLoaderText] = useState(''); const [columns, setColumns] = useState(initColumns); @@ -359,7 +359,7 @@ export function GraphVisualiser({initColumns}) { setLoaderText(gettext('Rendering data points...')); // Set the Graph Data setGraphData( - (prev)=> [getGraphDataSet(graphType, res.data.data.result, columns, xaxis, _.isArray(yaxis) ? yaxis : [yaxis] , queryToolCtx), prev[1] + 1] + (prev)=> [getGraphDataSet(graphType, res.data.data.result, columns, xAxis, _.isArray(yAxis) ? yAxis : [yAxis] , queryToolCtx), prev[1] + 1] ); setLoaderText(''); @@ -411,7 +411,7 @@ export function GraphVisualiser({initColumns}) { } }} value={graphType} /> } - disabled={ _.isEmpty(xaxis) || yaxis.length <= 0 }> + disabled={ _.isEmpty(xAxis) || yAxis.length <= 0 }> {gettext('Generate')} {graphType != 'P' ? gettext('X Axis') : gettext('Label')} setXAxis(v)} value={xaxis} optionsReloadBasis={optionsReload}/> + onChange={(v)=>setXAxis(v)} value={xAxis} optionsReloadBasis={optionsReload}/> {graphType != 'P' ? gettext('Y Axis') : gettext('Value')} setYAxis(v)} value={yaxis} optionsReloadBasis={optionsReload}/> + options={yAxisOptions} onChange={(v)=>setYAxis(v)} value={yAxis} optionsReloadBasis={optionsReload}/> } diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx index d5c7281ad..2df6635a0 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx @@ -378,7 +378,6 @@ export function QueryHistory() { const [selectedItemKey, setSelectedItemKey] = React.useState(1); const [showInternal, setShowInternal] = React.useState(true); const [loaderText, setLoaderText] = React.useState(''); - const [,refresh] = React.useState({}); const selectedEntry = qhu.current.getEntry(selectedItemKey); const layoutDocker = useContext(LayoutDockerContext); const listRef = React.useRef(); @@ -425,7 +424,6 @@ export function QueryHistory() { }; } qhu.current.addEntry(h); - refresh({}); }; listRef.current?.focus();