File 0001-Fixed-the-following-code-smells.patch of Package pgadmin4.34492
From 30d2d1b23e2ee831e6421811b54aa9f94a863cae Mon Sep 17 00:00:00 2001
From: Akshay Joshi <akshay.joshi@enterprisedb.com>
Date: Tue, 9 Apr 2024 19:18:56 +0530
Subject: [PATCH] Fixed the following code smells:
1) useState call is not destructured into value + setter pair.
2) A fragment with only one child is redundant.
3) Unnecessary '.apply()' and '.call()'.
4) Expected the Promise rejection reason to be an Error.
---
.../authenticate/static/js/kerberos.js | 2 +-
.../servers/databases/casts/static/js/cast.js | 9 +-
.../static/js/compound_trigger.js | 4 +-
.../tables/partitions/static/js/partition.js | 4 +-
.../schemas/tables/rules/static/js/rule.js | 2 +-
.../tables/triggers/static/js/trigger.js | 4 +-
.../schemas/types/static/js/type.ui.js | 27 +-
.../servers/databases/static/js/database.js | 2 +-
.../server_groups/servers/static/js/server.js | 2 +-
.../browser/static/js/MainMenuFactory.js | 4 +-
web/pgadmin/browser/static/js/browser.js | 2 +-
web/pgadmin/browser/static/js/node.js | 18 +-
web/pgadmin/browser/static/js/node_ajax.js | 8 +-
web/pgadmin/dashboard/static/js/Dashboard.jsx | 6 +-
.../dashboard/static/js/SystemStats/CPU.jsx | 10 -
.../static/js/SystemStats/Memory.jsx | 10 -
.../static/js/SystemStats/Storage.jsx | 10 -
.../static/js/SystemStats/Summary.jsx | 8 -
.../misc/bgprocess/static/js/Processes.jsx | 86 +++---
.../misc/cloud/static/js/CloudWizard.jsx | 282 +++++++++---------
web/pgadmin/misc/cloud/static/js/azure.js | 2 +-
web/pgadmin/misc/cloud/static/js/biganimal.js | 2 +-
web/pgadmin/misc/cloud/static/js/google.js | 6 +-
.../dependencies/static/js/Dependencies.jsx | 2 +-
.../misc/dependents/static/js/Dependents.jsx | 2 +-
.../properties/CollectionNodeProperties.jsx | 6 +-
.../misc/properties/ObjectNodeProperties.jsx | 2 +-
web/pgadmin/static/js/AppMenuBar.jsx | 66 ++--
web/pgadmin/static/js/Explain/svg_download.js | 2 +-
.../static/js/SchemaView/DataGridView.jsx | 42 ++-
web/pgadmin/static/js/SchemaView/FormView.jsx | 84 +++---
.../js/SecurityPages/MfaRegisterPage.jsx | 72 +++--
.../js/SecurityPages/MfaValidatePage.jsx | 44 +--
.../js/components/ObjectBreadcrumbs.jsx | 36 ++-
web/pgadmin/static/js/components/PgTable.jsx | 14 +-
web/pgadmin/static/js/custom_hooks.js | 14 +-
.../js/helpers/DataGridViewWithHeaderForm.jsx | 4 +-
.../js/helpers/Layout/LayoutIframeTab.jsx | 13 +-
web/pgadmin/static/js/helpers/Menu.js | 4 +-
.../static/js/helpers/ModalProvider.jsx | 17 +-
.../static/js/helpers/wizard/Wizard.jsx | 4 +-
web/pgadmin/static/js/tree/tree.js | 12 +-
.../static/js/erd_tool/components/ERDTool.jsx | 6 +-
.../static/js/erd_tool/nodes/TableNode.jsx | 5 +-
.../grant_wizard/static/js/GrantWizard.jsx | 8 +-
.../static/js/ImportExportServers.jsx | 4 +-
.../components/QueryToolDataGrid/Editors.jsx | 6 +-
.../js/components/dialogs/FilterDialog.jsx | 4 +-
.../js/components/dialogs/MacrosDialog.jsx | 4 +-
.../components/sections/GraphVisualiser.jsx | 12 +-
.../js/components/sections/QueryHistory.jsx | 2 -
51 files changed, 488 insertions(+), 513 deletions(-)
diff --git a/web/pgadmin/authenticate/static/js/kerberos.js b/web/pgadmin/authenticate/static/js/kerberos.js
index 42a7d19e17c..da6f840c5c7 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 8ccf22e4da5..c808f5be33e 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 157546f33c0..968b553c313 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 f6e3c191e5b..90e7f1440da 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 b3d9ec40303..3b84476c162 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 55563d3aad1..34df1df1ebf 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 6d4a6daacb1..6fd1a883bd7 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 b1b0f4e8b37..fbc1387ccd6 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 0d479e4036c..bc697cc01b4 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 ce704b1cd8f..f6f94ee6a67 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 0b4209e272c..fe7ebf35668 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 b4b9bda4396..fd25a2ca027 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 58ca3d1119d..fbc2fd27359 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 f038151c05f..6b59d6bbadd 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 3c0a6828574..b7888d7aab8 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 25a2e46c6ea..0f78c7be234 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 4030fe0fa1a..37b16452729 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 83ac9d4892f..625ae4ce89d 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 1d093c3f83e..97e15adc7a4 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 (
- <>
- <PgTable
- data-test="processes"
- className={classes.autoResizer}
- columns={columns}
- data={tableData}
- sortOptions={[{id: 'stime', desc: true}]}
- getSelectedRows={(rows)=>{setSelectedRows(rows);}}
- isSelectRow={true}
- tableProps={{
- autoResetSelectedRows: false,
- getRowId: (row)=>{
- return row.id;
- }
- }}
- CustomHeader={()=>{
- return (
- <Box>
- <PgButtonGroup>
- <PgIconButton
- icon={<DeleteIcon style={{height: '1.4rem'}}/>}
- 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}
- ></PgIconButton>
- <PgIconButton
- icon={<HelpIcon style={{height: '1.4rem'}}/>}
- aria-label="Help"
- title={gettext('Help')}
- onClick={() => {
- window.open(url_for('help.static', {'filename': 'processes.html'}));
- }}
- ></PgIconButton>
- </PgButtonGroup>
- </Box>
- );
- }}
- ></PgTable>
- </>
+ <PgTable
+ data-test="processes"
+ className={classes.autoResizer}
+ columns={columns}
+ data={tableData}
+ sortOptions={[{id: 'stime', desc: true}]}
+ getSelectedRows={(rows)=>{setSelectedRows(rows);}}
+ isSelectRow={true}
+ tableProps={{
+ autoResetSelectedRows: false,
+ getRowId: (row)=>{
+ return row.id;
+ }
+ }}
+ CustomHeader={()=>{
+ return (
+ <Box>
+ <PgButtonGroup>
+ <PgIconButton
+ icon={<DeleteIcon style={{height: '1.4rem'}}/>}
+ 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}
+ ></PgIconButton>
+ <PgIconButton
+ icon={<HelpIcon style={{height: '1.4rem'}}/>}
+ aria-label="Help"
+ title={gettext('Help')}
+ onClick={() => {
+ window.open(url_for('help.static', {'filename': 'processes.html'}));
+ }}
+ ></PgIconButton>
+ </PgButtonGroup>
+ </Box>
+ );
+ }}
+ ></PgTable>
);
}
diff --git a/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx b/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx
index cc98cb0243c..5f7969207a1 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 (
<CloudWizardEventsContext.Provider value={eventBus.current}>
- <>
- <Wizard
- title={gettext('Deploy Cloud Instance')}
- stepList={steps}
- disableNextStep={disableNextCheck}
- onStepChange={wizardStepChange}
- onSave={onSave}
- onHelp={onDialogHelp}
- beforeNext={onBeforeNext}
- beforeBack={onBeforeBack}>
- <WizardStep stepId={0}>
- <Box className={classes.messageBox}>
- <Box className={classes.messagePadding}>{gettext('Select a cloud provider for PostgreSQL database.')}</Box>
- </Box>
- <Box className={classes.messageBox}>
- <ToggleButtons cloudProvider={cloudProvider} setCloudProvider={setCloudProvider}
- options={cloud_providers}
- ></ToggleButtons>
- </Box>
- <FormFooterMessage type={errMsg[0]} message={errMsg[1]} onClose={onErrClose} />
- </WizardStep>
- <WizardStep stepId={1} >
- <Box className={classes.buttonMarginEDB}>
- {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && <Box className={classes.messageBox}>
- <Box>{gettext('The verification code to authenticate the pgAdmin to EDB BigAnimal is: ')} <strong>{verificationCode}</strong>
- <br/>{gettext('By clicking the below button, you will be redirected to the EDB BigAnimal authentication page in a new tab.')}
- </Box>
- </Box>}
- {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && <PrimaryButton onClick={authenticateBigAnimal} disabled={verificationIntiated ? true: false}>
- {gettext('Click here to authenticate yourself to EDB BigAnimal')}
- </PrimaryButton>}
- {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && <Box className={classes.messageBox}>
- <Box ></Box>
- </Box>}
- </Box>
- {cloudProvider == CLOUD_PROVIDERS.AWS && <AwsCredentials cloudProvider={cloudProvider} nodeInfo={nodeInfo} nodeData={nodeData} setCloudDBCred={setCloudDBCred}/>}
- { cloudProvider == CLOUD_PROVIDERS.AZURE &&
+ <Wizard
+ title={gettext('Deploy Cloud Instance')}
+ stepList={steps}
+ disableNextStep={disableNextCheck}
+ onStepChange={wizardStepChange}
+ onSave={onSave}
+ onHelp={onDialogHelp}
+ beforeNext={onBeforeNext}
+ beforeBack={onBeforeBack}>
+ <WizardStep stepId={0}>
+ <Box className={classes.messageBox}>
+ <Box className={classes.messagePadding}>{gettext('Select a cloud provider for PostgreSQL database.')}</Box>
+ </Box>
+ <Box className={classes.messageBox}>
+ <ToggleButtons cloudProvider={cloudProvider} setCloudProvider={setCloudProvider}
+ options={cloud_providers}
+ ></ToggleButtons>
+ </Box>
+ <FormFooterMessage type={errMsg[0]} message={errMsg[1]} onClose={onErrClose} />
+ </WizardStep>
+ <WizardStep stepId={1} >
+ <Box className={classes.buttonMarginEDB}>
+ {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && <Box className={classes.messageBox}>
+ <Box>{gettext('The verification code to authenticate the pgAdmin to EDB BigAnimal is: ')} <strong>{verificationCode}</strong>
+ <br/>{gettext('By clicking the below button, you will be redirected to the EDB BigAnimal authentication page in a new tab.')}
+ </Box>
+ </Box>}
+ {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && <PrimaryButton onClick={authenticateBigAnimal} disabled={verificationIntiated}>
+ {gettext('Click here to authenticate yourself to EDB BigAnimal')}
+ </PrimaryButton>}
+ {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && <Box className={classes.messageBox}>
+ <Box ></Box>
+ </Box>}
+ </Box>
+ {cloudProvider == CLOUD_PROVIDERS.AWS && <AwsCredentials cloudProvider={cloudProvider} nodeInfo={nodeInfo} nodeData={nodeData} setCloudDBCred={setCloudDBCred}/>}
+ { cloudProvider == CLOUD_PROVIDERS.AZURE &&
<Box flexGrow={1}>
<AzureCredentials cloudProvider={cloudProvider} setAzureCredData={setAzureCredData}/>
</Box>}
- <Box flexGrow={1}>
- {cloudProvider == CLOUD_PROVIDERS.GOOGLE && <GoogleCredentials cloudProvider={cloudProvider} setGoogleCredData={setGoogleCredData}/>}
- </Box>
- <FormFooterMessage type={errMsg[0]} message={errMsg[1]} onClose={onErrClose} />
- </WizardStep>
- <WizardStep stepId={2} >
- {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 2 && <BigAnimalClusterType
- cloudProvider={cloudProvider}
- nodeInfo={nodeInfo}
- nodeData={nodeData}
- setBigAnimalClusterTypeData={setBigAnimalClusterTypeData}
- hostIP={hostIP}
- /> }
- <FormFooterMessage type={errMsg[0]} message={errMsg[1]} onClose={onErrClose} />
- </WizardStep>
- <WizardStep stepId={3} >
- {cloudProvider == CLOUD_PROVIDERS.AWS && callRDSAPI == 3 && <AwsInstanceDetails
- cloudProvider={cloudProvider}
- nodeInfo={nodeInfo}
- nodeData={nodeData}
- setCloudInstanceDetails={setCloudInstanceDetails}
- hostIP={hostIP} /> }
- {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 3 && <BigAnimalInstance
- cloudProvider={cloudProvider}
- nodeInfo={nodeInfo}
- nodeData={nodeData}
- setBigAnimalInstanceData={setBigAnimalInstanceData}
- hostIP={hostIP}
- bigAnimalClusterTypeData={bigAnimalClusterTypeData}
- /> }
- {cloudProvider == CLOUD_PROVIDERS.AZURE && callRDSAPI == 3 && <AzureInstanceDetails
- cloudProvider={cloudProvider}
- nodeInfo={nodeInfo}
- nodeData={nodeData}
- setAzureInstanceData={setAzureInstanceData}
- hostIP={hostIP}
- azureInstanceData = {azureInstanceData}
- /> }
- {cloudProvider == CLOUD_PROVIDERS.GOOGLE && callRDSAPI == 3 && <GoogleInstanceDetails
- cloudProvider={cloudProvider}
- nodeInfo={nodeInfo}
- nodeData={nodeData}
- setGoogleInstanceData={setGoogleInstanceData}
- hostIP={hostIP}
- googleInstanceData = {googleInstanceData}
- /> }
- <FormFooterMessage type={errMsg[0]} message={errMsg[1]} onClose={onErrClose} />
- </WizardStep>
- <WizardStep stepId={4} >
- {cloudProvider == CLOUD_PROVIDERS.AWS && <AwsDatabaseDetails
+ <Box flexGrow={1}>
+ {cloudProvider == CLOUD_PROVIDERS.GOOGLE && <GoogleCredentials cloudProvider={cloudProvider} setGoogleCredData={setGoogleCredData}/>}
+ </Box>
+ <FormFooterMessage type={errMsg[0]} message={errMsg[1]} onClose={onErrClose} />
+ </WizardStep>
+ <WizardStep stepId={2} >
+ {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 2 && <BigAnimalClusterType
+ cloudProvider={cloudProvider}
+ nodeInfo={nodeInfo}
+ nodeData={nodeData}
+ setBigAnimalClusterTypeData={setBigAnimalClusterTypeData}
+ hostIP={hostIP}
+ /> }
+ <FormFooterMessage type={errMsg[0]} message={errMsg[1]} onClose={onErrClose} />
+ </WizardStep>
+ <WizardStep stepId={3} >
+ {cloudProvider == CLOUD_PROVIDERS.AWS && callRDSAPI == 3 && <AwsInstanceDetails
+ cloudProvider={cloudProvider}
+ nodeInfo={nodeInfo}
+ nodeData={nodeData}
+ setCloudInstanceDetails={setCloudInstanceDetails}
+ hostIP={hostIP} /> }
+ {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 3 && <BigAnimalInstance
+ cloudProvider={cloudProvider}
+ nodeInfo={nodeInfo}
+ nodeData={nodeData}
+ setBigAnimalInstanceData={setBigAnimalInstanceData}
+ hostIP={hostIP}
+ bigAnimalClusterTypeData={bigAnimalClusterTypeData}
+ /> }
+ {cloudProvider == CLOUD_PROVIDERS.AZURE && callRDSAPI == 3 && <AzureInstanceDetails
+ cloudProvider={cloudProvider}
+ nodeInfo={nodeInfo}
+ nodeData={nodeData}
+ setAzureInstanceData={setAzureInstanceData}
+ hostIP={hostIP}
+ azureInstanceData = {azureInstanceData}
+ /> }
+ {cloudProvider == CLOUD_PROVIDERS.GOOGLE && callRDSAPI == 3 && <GoogleInstanceDetails
+ cloudProvider={cloudProvider}
+ nodeInfo={nodeInfo}
+ nodeData={nodeData}
+ setGoogleInstanceData={setGoogleInstanceData}
+ hostIP={hostIP}
+ googleInstanceData = {googleInstanceData}
+ /> }
+ <FormFooterMessage type={errMsg[0]} message={errMsg[1]} onClose={onErrClose} />
+ </WizardStep>
+ <WizardStep stepId={4} >
+ {cloudProvider == CLOUD_PROVIDERS.AWS && <AwsDatabaseDetails
+ cloudProvider={cloudProvider}
+ nodeInfo={nodeInfo}
+ nodeData={nodeData}
+ setCloudDBDetails={setCloudDBDetails}
+ />
+ }
+ {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 4 && <BigAnimalDatabase
+ cloudProvider={cloudProvider}
+ nodeInfo={nodeInfo}
+ nodeData={nodeData}
+ setBigAnimalDatabaseData={setBigAnimalDatabaseData}
+ bigAnimalClusterTypeData={bigAnimalClusterTypeData}
+ />
+ }
+ {cloudProvider == CLOUD_PROVIDERS.AZURE && <AzureDatabaseDetails
+ cloudProvider={cloudProvider}
+ nodeInfo={nodeInfo}
+ nodeData={nodeData}
+ setAzureDatabaseData={setAzureDatabaseData}
+ />
+ }
+ {cloudProvider == CLOUD_PROVIDERS.GOOGLE && <GoogleDatabaseDetails
+ cloudProvider={cloudProvider}
+ nodeInfo={nodeInfo}
+ nodeData={nodeData}
+ setGoogleDatabaseData={setGoogleDatabaseData}
+ />
+ }
+ </WizardStep>
+ <WizardStep stepId={5} >
+ <Box className={classes.boxText}>{gettext('Please review the details before creating the cloud instance.')}</Box>
+ <Paper variant="outlined" elevation={0} className={classes.summaryContainer}>
+ {cloudProvider == CLOUD_PROVIDERS.AWS && callRDSAPI == 5 && <FinalSummary
cloudProvider={cloudProvider}
- nodeInfo={nodeInfo}
- nodeData={nodeData}
- setCloudDBDetails={setCloudDBDetails}
+ instanceData={cloudInstanceDetails}
+ databaseData={cloudDBDetails}
/>
}
- {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 4 && <BigAnimalDatabase
+ {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 5 && <FinalSummary
cloudProvider={cloudProvider}
- nodeInfo={nodeInfo}
- nodeData={nodeData}
- setBigAnimalDatabaseData={setBigAnimalDatabaseData}
- bigAnimalClusterTypeData={bigAnimalClusterTypeData}
+ instanceData={bigAnimalInstanceData}
+ databaseData={bigAnimalDatabaseData}
+ clusterTypeData={bigAnimalClusterTypeData}
/>
}
- {cloudProvider == CLOUD_PROVIDERS.AZURE && <AzureDatabaseDetails
+ {cloudProvider == CLOUD_PROVIDERS.AZURE && callRDSAPI == 5 && <FinalSummary
cloudProvider={cloudProvider}
- nodeInfo={nodeInfo}
- nodeData={nodeData}
- setAzureDatabaseData={setAzureDatabaseData}
+ instanceData={azureInstanceData}
+ databaseData={azureDatabaseData}
/>
}
- {cloudProvider == CLOUD_PROVIDERS.GOOGLE && <GoogleDatabaseDetails
+ {cloudProvider == CLOUD_PROVIDERS.GOOGLE && callRDSAPI == 5 && <FinalSummary
cloudProvider={cloudProvider}
- nodeInfo={nodeInfo}
- nodeData={nodeData}
- setGoogleDatabaseData={setGoogleDatabaseData}
+ instanceData={googleInstanceData}
+ databaseData={googleDatabaseData}
/>
}
- </WizardStep>
- <WizardStep stepId={5} >
- <Box className={classes.boxText}>{gettext('Please review the details before creating the cloud instance.')}</Box>
- <Paper variant="outlined" elevation={0} className={classes.summaryContainer}>
- {cloudProvider == CLOUD_PROVIDERS.AWS && callRDSAPI == 5 && <FinalSummary
- cloudProvider={cloudProvider}
- instanceData={cloudInstanceDetails}
- databaseData={cloudDBDetails}
- />
- }
- {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && callRDSAPI == 5 && <FinalSummary
- cloudProvider={cloudProvider}
- instanceData={bigAnimalInstanceData}
- databaseData={bigAnimalDatabaseData}
- clusterTypeData={bigAnimalClusterTypeData}
- />
- }
- {cloudProvider == CLOUD_PROVIDERS.AZURE && callRDSAPI == 5 && <FinalSummary
- cloudProvider={cloudProvider}
- instanceData={azureInstanceData}
- databaseData={azureDatabaseData}
- />
- }
- {cloudProvider == CLOUD_PROVIDERS.GOOGLE && callRDSAPI == 5 && <FinalSummary
- cloudProvider={cloudProvider}
- instanceData={googleInstanceData}
- databaseData={googleDatabaseData}
- />
- }
- </Paper>
- </WizardStep>
- </Wizard>
- </>
+ </Paper>
+ </WizardStep>
+ </Wizard>
</CloudWizardEventsContext.Provider>
);
}
diff --git a/web/pgadmin/misc/cloud/static/js/azure.js b/web/pgadmin/misc/cloud/static/js/azure.js
index 0e87bce1022..b7990032046 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 9331f930aab..96c36fe4193 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 f7425333f2d..84e1990e740 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 971b4b685c1..97c5886138f 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 3afa2ef9233..8f3e7511c1c 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 7cda4911d9a..6238692c5fc 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 0a76b229b8c..979a1894579 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 286dd8a7ce8..c010134ce1c 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, makeStyles } from '@material-ui/core';
import React, { useState, useEffect } from 'react';
import { PrimaryButton } from './components/Buttons';
@@ -90,33 +98,32 @@ export default function AppMenuBar() {
const userMenuInfo = pgAdmin.Browser.utils.userMenuInfo;
return(
- <>
- <Box className={classes.root} data-test="app-menu-bar">
- <div className={classes.logo} />
- <div className={classes.menus}>
- {pgAdmin.Browser.MainMenus?.map((menu)=>{
- return (
- <PgMenu
- menuButton={<PrimaryButton key={menu.label} data-label={menu.label}>{menu.label}<KeyboardArrowDownIcon fontSize="small" /></PrimaryButton>}
- label={menu.label}
- key={menu.name}
- >
- {menu.getMenuItems().map((menuItem, i)=>{
- const submenus = menuItem.getMenuItems();
- if(submenus) {
- return <PgSubMenu key={menuItem.label} label={menuItem.label}>
- {submenus.map((submenuItem, si)=>{
- return getPgMenuItem(submenuItem, si);
- })}
- </PgSubMenu>;
- }
- return getPgMenuItem(menuItem, i);
- })}
- </PgMenu>
- );
- })}
- </div>
- {userMenuInfo &&
+ <Box className={classes.root} data-test="app-menu-bar">
+ <div className={classes.logo} />
+ <div className={classes.menus}>
+ {pgAdmin.Browser.MainMenus?.map((menu)=>{
+ return (
+ <PgMenu
+ menuButton={<PrimaryButton key={menu.label} data-label={menu.label}>{menu.label}<KeyboardArrowDownIcon fontSize="small" /></PrimaryButton>}
+ label={menu.label}
+ key={menu.name}
+ >
+ {menu.getMenuItems().map((menuItem, i)=>{
+ const submenus = menuItem.getMenuItems();
+ if(submenus) {
+ return <PgSubMenu key={menuItem.label} label={menuItem.label}>
+ {submenus.map((submenuItem, si)=>{
+ return getPgMenuItem(submenuItem, si);
+ })}
+ </PgSubMenu>;
+ }
+ return getPgMenuItem(menuItem, i);
+ })}
+ </PgMenu>
+ );
+ })}
+ </div>
+ {userMenuInfo &&
<div className={classes.userMenu}>
<PgMenu
menuButton={
@@ -124,7 +131,7 @@ export default function AppMenuBar() {
<div className={classes.gravatar}>
{userMenuInfo.gravatar &&
<img src={userMenuInfo.gravatar} width = "18" height = "18"
- alt ={`Gravatar image for ${ userMenuInfo.username }`} />}
+ alt ={`Gravatar for ${ userMenuInfo.username }`} />}
{!userMenuInfo.gravatar && <AccountCircleRoundedIcon />}
</div>
{ userMenuInfo.username } ({userMenuInfo.auth_source})
@@ -139,7 +146,6 @@ export default function AppMenuBar() {
})}
</PgMenu>
</div>}
- </Box>
- </>
+ </Box>
);
}
diff --git a/web/pgadmin/static/js/Explain/svg_download.js b/web/pgadmin/static/js/Explain/svg_download.js
index 4f0225fe197..fdc2a314d5d 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 04f2ab9f069..1d5f9dbe865 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(()=>
- <>
- <div {...row.getRowProps()} ref={rowRef} data-handler-id={handlerId}
- className={isHovered ? classes.tableRowHovered : null}
- data-test='data-table-row'
- >
- {row.cells.map((cell, ci) => {
- let classNames = [classes.tableCell];
-
- 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 &&
+ <div {...row.getRowProps()} ref={rowRef} data-handler-id={handlerId}
+ className={isHovered ? classes.tableRowHovered : null}
+ data-test='data-table-row'
+ >
+ {row.cells.map((cell, ci) => {
+ let classNames = [classes.tableCell];
+
+ 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 &&
<div ref={cell.column.id == 'btn-reorder' ? dragHandleRef : null} key={ci} {...cell.getCellProps()} className={clsx(classNames)}>
{cell.render('Cell', {
reRenderRow: ()=>{setKey((currKey)=>!currKey);}
})}
</div>
- );
- })}
- <div className='hover-overlay'></div>
- </div>
- </>, depsMap);
+ );
+ })}
+ <div className='hover-overlay'></div>
+ </div>, 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 eeaf49bd448..bcd607fe09e 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 (
- <>
- <Box height="100%" display="flex" flexDirection="column" className={className} ref={formRef} data-test="form-view">
- <Box>
- <Tabs
- value={tabValue}
- onChange={(event, selTabValue) => {
- setTabValue(selTabValue);
- }}
- variant="scrollable"
- scrollButtons="auto"
- action={(ref)=>ref?.updateIndicator()}
- >
- {Object.keys(finalTabs).map((tabName)=>{
- return <Tab key={tabName} label={tabName} data-test={tabName}/>;
- })}
- </Tabs>
- </Box>
- {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 (
- <TabPanel key={tabName} value={tabValue} index={i} classNameRoot={clsx(tabsClassname[tabName], isNested ? classes.nestedTabPanel : null)}
- className={clsx(contentClassName)} data-testid={tabName}>
- {finalTabs[tabName]}
- </TabPanel>
- );
- })}
+ <Box height="100%" display="flex" flexDirection="column" className={className} ref={formRef} data-test="form-view">
+ <Box>
+ <Tabs
+ value={tabValue}
+ onChange={(event, selTabValue) => {
+ setTabValue(selTabValue);
+ }}
+ variant="scrollable"
+ scrollButtons="auto"
+ action={(ref)=>ref?.updateIndicator()}
+ >
+ {Object.keys(finalTabs).map((tabName)=>{
+ return <Tab key={tabName} label={tabName} data-test={tabName}/>;
+ })}
+ </Tabs>
</Box>
- </>);
+ {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 (
+ <TabPanel key={tabName} value={tabValue} index={i} classNameRoot={clsx(tabsClassname[tabName], isNested ? classes.nestedTabPanel : null)}
+ className={clsx(contentClassName)} data-testid={tabName}>
+ {finalTabs[tabName]}
+ </TabPanel>
+ );
+ })}
+ </Box>);
} else {
let contentClassName = [classes.nonTabPanelContent, stateUtils.formErr.message ? classes.errorMargin : null];
return (
- <>
- <Box height="100%" display="flex" flexDirection="column" className={clsx(className)} ref={formRef} data-test="form-view">
- <TabPanel value={tabValue} index={0} classNameRoot={classes.nonTabPanel}
- className={clsx(contentClassName)}>
- {Object.keys(finalTabs).map((tabName)=>{
- return (
- <React.Fragment key={tabName}>{finalTabs[tabName]}</React.Fragment>
- );
- })}
- </TabPanel>
- </Box>
- </>);
+ <Box height="100%" display="flex" flexDirection="column" className={clsx(className)} ref={formRef} data-test="form-view">
+ <TabPanel value={tabValue} index={0} classNameRoot={classes.nonTabPanel}
+ className={clsx(contentClassName)}>
+ {Object.keys(finalTabs).map((tabName)=>{
+ return (
+ <React.Fragment key={tabName}>{finalTabs[tabName]}</React.Fragment>
+ );
+ })}
+ </TabPanel>
+ </Box>);
}
}
diff --git a/web/pgadmin/static/js/SecurityPages/MfaRegisterPage.jsx b/web/pgadmin/static/js/SecurityPages/MfaRegisterPage.jsx
index 15e3e0d565d..d96d63ecd9a 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 '@material-ui/core';
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 (
- <>
- <BasePage title={gettext('Authentication Registration')} pageImage={<LoginImage style={{height: '100%', width: '100%'}} />} {...props}>
- <form style={{display:'flex', gap:'15px', flexDirection:'column', minHeight: 0}} action={actionUrl} method="POST">
- {mfaView ? <>
- {mfaView.auth_method == 'email' && <EmailRegisterView mfaView={mfaView} />}
- {mfaView.auth_method == 'authenticator' && <AuthenticatorRegisterView mfaView={mfaView} />}
- <Box display="flex" gridGap="15px">
- <SecurityButton name="continue" value="Continue">{gettext('Continue')}</SecurityButton>
- <DefaultButton type="submit" name="cancel" value="Cancel" style={{width: '100%'}}>{gettext('Cancel')}</DefaultButton>
- </Box>
- </>:<>
- {mfaList?.map((m)=>{
- return (
- <Box display="flex" width="100%" key={m.label}>
- <div style={{
- width: '10%', mask: `url(${m.icon})`, maskRepeat: 'no-repeat',
- WebkitMask: `url(${m.icon})`, WebkitMaskRepeat: 'no-repeat',
- backgroundColor: '#fff'
- }}>
- </div>
- <div style={{width: '70%'}}>{m.label}</div>
- <div style={{width: '20%'}}>
- <SecurityButton name={m.id} value={m.registered ? 'DELETE' : 'SETUP'}>{m.registered ? gettext('Delete') : gettext('Setup')}</SecurityButton>
- </div>
- </Box>
- );
- })}
- {nextUrl != 'internal' && <SecurityButton value="Continue">{gettext('Continue')}</SecurityButton>}
- </>}
- <div><input type="hidden" name="next" value={nextUrl}/></div>
- </form>
- </BasePage>
- </>
+ <BasePage title={gettext('Authentication Registration')} pageImage={<LoginImage style={{height: '100%', width: '100%'}} />} {...props}>
+ <form style={{display:'flex', gap:'15px', flexDirection:'column', minHeight: 0}} action={actionUrl} method="POST">
+ {mfaView ? <>
+ {mfaView.auth_method == 'email' && <EmailRegisterView mfaView={mfaView} />}
+ {mfaView.auth_method == 'authenticator' && <AuthenticatorRegisterView mfaView={mfaView} />}
+ <Box display="flex" gap="15px">
+ <SecurityButton name="continue" value="Continue">{gettext('Continue')}</SecurityButton>
+ <DefaultButton type="submit" name="cancel" value="Cancel" style={{width: '100%'}}>{gettext('Cancel')}</DefaultButton>
+ </Box>
+ </>:<>
+ {mfaList?.map((m)=>{
+ return (
+ <Box display="flex" width="100%" key={m.label}>
+ <div style={{
+ width: '10%', mask: `url(${m.icon})`, maskRepeat: 'no-repeat',
+ WebkitMask: `url(${m.icon})`, WebkitMaskRepeat: 'no-repeat',
+ backgroundColor: '#fff'
+ }}>
+ </div>
+ <div style={{width: '70%'}}>{m.label}</div>
+ <div style={{width: '20%'}}>
+ <SecurityButton name={m.id} value={m.registered ? 'DELETE' : 'SETUP'}>{m.registered ? gettext('Delete') : gettext('Setup')}</SecurityButton>
+ </div>
+ </Box>
+ );
+ })}
+ {nextUrl != 'internal' && <SecurityButton value="Continue">{gettext('Continue')}</SecurityButton>}
+ </>}
+ <div><input type="hidden" name="next" value={nextUrl}/></div>
+ </form>
+ </BasePage>
);
}
diff --git a/web/pgadmin/static/js/SecurityPages/MfaValidatePage.jsx b/web/pgadmin/static/js/SecurityPages/MfaValidatePage.jsx
index c7cd1daea1f..6c0baa3e035 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 (
- <>
- <BasePage title={gettext('Authentication')} pageImage={<LoginImage style={{height: '100%', width: '100%'}} />} {...props}>
- <form style={{display:'flex', gap:'15px', flexDirection:'column', minHeight: 0}} action={actionUrl} method="POST">
- <InputSelect value={method} options={Object.keys(views).map((k)=>({
- label: views[k].label,
- value: views[k].id,
- imageUrl: views[k].icon
- }))} onChange={setMethod} controlProps={{
- allowClear: false,
- }} />
- <div><input type='hidden' name='mfa_method' defaultValue={method} /></div>
- {method == 'email' && <EmailValidateView mfaView={views[method].view} sendEmailUrl={sendEmailUrl} csrfHeader={csrfHeader} csrfToken={csrfToken} />}
- {method == 'authenticator' && <AuthenticatorValidateView mfaView={views[method].view} />}
- <div style={{textAlign: 'right'}}>
- <a style={{color:'inherit'}} href={logoutUrl}>{gettext('Logout')}</a>
- </div>
- </form>
- </BasePage>
- </>
+ <BasePage title={gettext('Authentication')} pageImage={<LoginImage style={{height: '100%', width: '100%'}} />} {...props}>
+ <form style={{display:'flex', gap:'15px', flexDirection:'column', minHeight: 0}} action={actionUrl} method="POST">
+ <InputSelect value={method} options={Object.keys(views).map((k)=>({
+ label: views[k].label,
+ value: views[k].id,
+ imageUrl: views[k].icon
+ }))} onChange={setMethod} controlProps={{
+ allowClear: false,
+ }} />
+ <div><input type='hidden' name='mfa_method' defaultValue={method} /></div>
+ {method == 'email' && <EmailValidateView mfaView={views[method].view} sendEmailUrl={sendEmailUrl} csrfHeader={csrfHeader} csrfToken={csrfToken} />}
+ {method == 'authenticator' && <AuthenticatorValidateView mfaView={views[method].view} />}
+ <div style={{textAlign: 'right'}}>
+ <a style={{color:'inherit'}} href={logoutUrl}>{gettext('Logout')}</a>
+ </div>
+ </form>
+ </BasePage>
);
}
diff --git a/web/pgadmin/static/js/components/ObjectBreadcrumbs.jsx b/web/pgadmin/static/js/components/ObjectBreadcrumbs.jsx
index d572456a64e..7b773c2a0dd 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, makeStyles } from '@material-ui/core';
import React, { useState, useEffect } from 'react';
import AccountTreeIcon from '@material-ui/icons/AccountTree';
@@ -68,24 +76,22 @@ export default function ObjectBreadcrumbs() {
}
return(
- <>
- <Box className={classes.root} data-testid="object-breadcrumbs">
- <div className={classes.row}>
- <AccountTreeIcon style={{height: '1rem', marginRight: '0.125rem'}} data-label="AccountTreeIcon"/>
- <div className={classes.overflow}>
- {
- objectData.path?.reduce((res, item)=>(
- res.concat(<span key={item}>{item}</span>, <ArrowForwardIosRoundedIcon key={item+'-arrow'} style={{height: '0.8rem', width: '1.25rem'}} />)
- ), []).slice(0, -1)
- }
- </div>
+ <Box className={classes.root} data-testid="object-breadcrumbs">
+ <div className={classes.row}>
+ <AccountTreeIcon style={{height: '1rem', marginRight: '0.125rem'}} data-label="AccountTreeIcon"/>
+ <div className={classes.overflow}>
+ {
+ objectData.path?.reduce((res, item)=>(
+ res.concat(<span key={item}>{item}</span>, <ArrowForwardIosRoundedIcon key={item+'-arrow'} style={{height: '0.8rem', width: '1.25rem'}} />)
+ ), []).slice(0, -1)
+ }
</div>
- {preferences.breadcrumbs_show_comment && objectData.description &&
+ </div>
+ {preferences.breadcrumbs_show_comment && objectData.description &&
<div className={classes.row}>
<CommentIcon style={{height: '1rem', marginRight: '0.125rem'}} data-label="CommentIcon"/>
<div className={classes.overflow}>{objectData.description}</div>
</div>}
- </Box>
- </>
+ </Box>
);
-}
\ 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 64a7b10f2f3..9d03e784316 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 (
- <>
- <Checkbox
- color="primary"
- ref={resolvedRef} {...rest}
- inputProps={{'aria-label': label}}
- />
- </>
+ <Checkbox
+ color="primary"
+ ref={resolvedRef} {...rest}
+ inputProps={{'aria-label': label}}
+ />
);
},
);
@@ -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 c87a339ae64..2d376dc8bae 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 168a8d32b3b..b83f9624ffd 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}
/>
<Box display="flex">
- <DefaultButton className={classes.addBtn} onClick={onAddClick} disabled={isAddDisabled}>Add</DefaultButton>
+ <DefaultButton className={classes.addBtn} onClick={onAddClick} disabled={addDisabled}>Add</DefaultButton>
</Box>
</Box>}
</Box>
diff --git a/web/pgadmin/static/js/helpers/Layout/LayoutIframeTab.jsx b/web/pgadmin/static/js/helpers/Layout/LayoutIframeTab.jsx
index 09a60f83bc5..f637e077c0a 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 '@material-ui/core';
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 (
<div ref={selfRef} data-target={target} style={{width: '100%', height: '100%'}}>
<Portal ref={(r)=>{
if(r) setIframeTarget(r.querySelector('#'+target));
@@ -59,8 +67,7 @@ export default function LayoutIframeTab({target, src, children}) {
</Frame>
}
</Portal>
- </div>
- </>;
+ </div>);
}
LayoutIframeTab.propTypes = {
diff --git a/web/pgadmin/static/js/helpers/Menu.js b/web/pgadmin/static/js/helpers/Menu.js
index 675a60c6147..5e32956fe74 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 a9f5e898f44..cb40a27d8a4 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 (
<Dialog
open={true}
onClose={closeModal}
PaperComponent={PaperComponent}
- PaperProps={{ 'isfullscreen': isfullScreen.toString(), 'isresizeable': isResizeable.toString(), width: dialogWidth, height: dialogHeight, minHeight: minHeight, minWidth: minWidth }}
- fullScreen={isfullScreen}
+ PaperProps={{ 'isfullscreen': isFullScreen.toString(), 'isresizeable': isResizeable.toString(), width: dialogWidth, height: dialogHeight, minHeight: minHeight, minWidth: minWidth }}
+ fullScreen={isFullScreen}
fullWidth={isFullWidth}
disablePortal
>
- { showTitle && <>
+ { showTitle &&
<DialogTitle className='modal-drag-area'>
<Box className={classes.titleBar}>
<Box className={classes.title} marginRight="0.25rem" >{title}</Box>
{
- showFullScreen && !isfullScreen &&
- <Box className={classes.iconButtonStyle}><PgIconButton title={gettext('Maximize')} icon={<ExpandDialogIcon className={classes.icon} />} size="xs" noBorder onClick={() => { setIsFullScreen(!isfullScreen); }} /></Box>
+ showFullScreen && !isFullScreen &&
+ <Box className={classes.iconButtonStyle}><PgIconButton title={gettext('Maximize')} icon={<ExpandDialogIcon className={classes.icon} />} size="xs" noBorder onClick={() => { setIsFullScreen(!isFullScreen); }} /></Box>
}
{
- showFullScreen && isfullScreen &&
- <Box className={classes.iconButtonStyle}><PgIconButton title={gettext('Minimize')} icon={<MinimizeDialogIcon className={classes.icon} />} size="xs" noBorder onClick={() => { setIsFullScreen(!isfullScreen); }} /></Box>
+ showFullScreen && isFullScreen &&
+ <Box className={classes.iconButtonStyle}><PgIconButton title={gettext('Minimize')} icon={<MinimizeDialogIcon className={classes.icon} />} size="xs" noBorder onClick={() => { setIsFullScreen(!isFullScreen); }} /></Box>
}
<Box marginLeft="auto"><PgIconButton title={gettext('Close')} icon={<CloseIcon />} size="xs" noBorder onClick={closeModal} /></Box>
</Box>
</DialogTitle>
- </>
}
<DialogContent height="100%">
{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 5de2a0dd883..02b435a69b5 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 eb78419cee4..f6d9cc7deaf 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 803de8fb88b..f7d6ce6a1c2 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 be199608188..0174fe70119 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 {
}}
/>}
</div>
- {tableMetaData.is_promise && <>
+ {tableMetaData.is_promise &&
<div className={classes.tableSection}>
{!tableMetaData.data_failed && <div className={classes.tableNameText}>{gettext('Fetching...')}</div>}
{tableMetaData.data_failed && <div className={clsx(classes.tableNameText, classes.error)}>{gettext('Failed to get data. Please delete this table.')}</div>}
- </div>
- </>}
+ </div>}
{!tableMetaData.is_promise && <>
<div className={classes.tableSection}>
<RowIcon icon={SchemaIcon}/>
diff --git a/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx b/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx
index b19051d9679..8804e4798c0 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}>
</PgTable>
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 3a130729ee2..9901caaf4a1 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 3a36775a8af..9e486300d2f 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')}
</DefaultButton>
{column.can_edit &&
- <>
<PrimaryButton startIcon={<CheckRoundedIcon />} onClick={onOK} size="small" className={classes.buttonMargin}>
{gettext('OK')}
</PrimaryButton>
- </>}
+ }
</Box>
</Box>
</Portal>
@@ -390,11 +389,10 @@ export function JsonTextEditor({row, column, onRowChange, onClose}) {
{gettext('Cancel')}
</DefaultButton>
{column.can_edit &&
- <>
<PrimaryButton startIcon={<CheckRoundedIcon />} onClick={onOK} size="small" className={classes.buttonMargin}>
{gettext('OK')}
</PrimaryButton>
- </>}
+ }
</Box>
</Box>
</Portal>
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 6530186615a..47151f92f6e 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 (
<SchemaView
formType={'dialog'}
getInitData={getInitData}
@@ -147,7 +147,7 @@ export default function FilterDialog({onClose, onSave}) {
formClassName={classes.root}
checkDirtyOnEnableSave={true}
/>
- </>);
+ );
}
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 1c6f82716bc..c3bcb966599 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 (
<SchemaView
formType={'dialog'}
getInitData={()=>{
@@ -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 24f605c8b39..7529e5a81d4 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} />
<DefaultButton style={{marginLeft: 'auto'}} onClick={onGenerate} startIcon={<ShowChartRoundedIcon />}
- disabled={ _.isEmpty(xaxis) || yaxis.length <= 0 }>
+ disabled={ _.isEmpty(xAxis) || yAxis.length <= 0 }>
{gettext('Generate')}
</DefaultButton>
<PgIconButton title={expandedState ? gettext('Collapse') : gettext('Expand')}
@@ -422,12 +422,12 @@ export function GraphVisualiser({initColumns}) {
<Box className={classes.displayFlex}>
<span className={classes.spanLabel}>{graphType != 'P' ? gettext('X Axis') : gettext('Label')}</span>
<InputSelect className={classes.axisSelectCtrl} options={xAxisOptions}
- onChange={(v)=>setXAxis(v)} value={xaxis} optionsReloadBasis={optionsReload}/>
+ onChange={(v)=>setXAxis(v)} value={xAxis} optionsReloadBasis={optionsReload}/>
</Box>
<Box className={classes.displayFlex}>
<span className={classes.spanLabel}>{graphType != 'P' ? gettext('Y Axis') : gettext('Value')}</span>
<InputSelect className={classes.axisSelectCtrl} controlProps={{'multiple': graphType != 'P', allowSelectAll: graphType != 'P'}}
- options={yAxisOptions} onChange={(v)=>setYAxis(v)} value={yaxis} optionsReloadBasis={optionsReload}/>
+ options={yAxisOptions} onChange={(v)=>setYAxis(v)} value={yAxis} optionsReloadBasis={optionsReload}/>
</Box>
</>
}
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 d5c7281adae..2df6635a05a 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();