mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
Fixed following code smells reported by SonarQube:
1) Remove this redundant jump. 2) Remove this commented out code. 3) Variables should not be shadowed.
This commit is contained in:
parent
12d6271b13
commit
343c3ee49c
@ -73,7 +73,6 @@ export default class ForeignTableSchema extends BaseUISchema {
|
||||
return t.value;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -133,9 +132,9 @@ export default class ForeignTableSchema extends BaseUISchema {
|
||||
|
||||
if(tabColsResponse) {
|
||||
tabColsResponse.then((res)=>{
|
||||
resolve((state)=>{
|
||||
resolve((tmpstate)=>{
|
||||
let finalCols = res.map((col)=>obj.columnsObj.getNewData(col));
|
||||
finalCols = [...state.columns, ...finalCols];
|
||||
finalCols = [...tmpstate.columns, ...finalCols];
|
||||
return {
|
||||
adding_inherit_cols: false,
|
||||
columns: finalCols,
|
||||
@ -156,9 +155,9 @@ export default class ForeignTableSchema extends BaseUISchema {
|
||||
removeOid = this.getTableOid(tabName);
|
||||
}
|
||||
if(removeOid) {
|
||||
resolve((state)=>{
|
||||
let finalCols = state.columns;
|
||||
_.remove(state.columns, (col)=>col.inheritedid==removeOid);
|
||||
resolve((tmpstate)=>{
|
||||
let finalCols = tmpstate.columns;
|
||||
_.remove(tmpstate.columns, (col)=>col.inheritedid==removeOid);
|
||||
return {
|
||||
adding_inherit_cols: false,
|
||||
columns: finalCols
|
||||
|
@ -32,7 +32,6 @@ export class OwnedBySchema extends BaseUISchema {
|
||||
return t._id;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
get baseFields() {
|
||||
|
@ -208,7 +208,7 @@ function inSchema(node_info) {
|
||||
}
|
||||
|
||||
export default class IndexSchema extends BaseUISchema {
|
||||
constructor(getColumnSchema, fieldOptions = {}, nodeData = [], initValues={}) {
|
||||
constructor(columnSchema, fieldOptions = {}, nodeData = [], initValues={}) {
|
||||
super({
|
||||
name: undefined,
|
||||
oid: undefined,
|
||||
@ -230,7 +230,7 @@ export default class IndexSchema extends BaseUISchema {
|
||||
this.node_info = {
|
||||
...nodeData.node_info
|
||||
};
|
||||
this.getColumnSchema = getColumnSchema;
|
||||
this.getColumnSchema = columnSchema;
|
||||
}
|
||||
|
||||
get idAttribute() {
|
||||
|
@ -387,7 +387,6 @@ export default class TableSchema extends BaseUISchema {
|
||||
return t.tid;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for column grid when to Add
|
||||
@ -535,14 +534,14 @@ export default class TableSchema extends BaseUISchema {
|
||||
|
||||
if(tabColsResponse) {
|
||||
tabColsResponse.then((res)=>{
|
||||
resolve((state)=>{
|
||||
resolve((tmpstate)=>{
|
||||
let finalCols = res.map((col)=>obj.columnsSchema.getNewData(col));
|
||||
let currentSelectedCols = [];
|
||||
if (!_.isEmpty(state.columns)){
|
||||
currentSelectedCols = state.columns;
|
||||
if (!_.isEmpty(tmpstate.columns)){
|
||||
currentSelectedCols = tmpstate.columns;
|
||||
}
|
||||
let colNameList = [];
|
||||
state.columns.forEach((col=>{
|
||||
tmpstate.columns.forEach((col=>{
|
||||
colNameList.push(col.name);
|
||||
}));
|
||||
for (let col of Object.values(finalCols)) {
|
||||
@ -576,9 +575,9 @@ export default class TableSchema extends BaseUISchema {
|
||||
removeOid = this.getTableOid(tabName);
|
||||
}
|
||||
if(removeOid) {
|
||||
resolve((state)=>{
|
||||
let finalCols = state.columns;
|
||||
_.remove(state.columns, (col)=>col.inheritedid==removeOid);
|
||||
resolve((tmpstate)=>{
|
||||
let finalCols = tmpstate.columns;
|
||||
_.remove(tmpstate.columns, (col)=>col.inheritedid==removeOid);
|
||||
obj.changeColumnOptions(finalCols);
|
||||
return {
|
||||
adding_inherit_cols: false,
|
||||
|
@ -7,7 +7,6 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
// import TypeSchema from './type.ui';
|
||||
import { getNodeListByName } from '../../../../../../../static/js/node_ajax';
|
||||
import { getNodePrivilegeRoleSchema } from '../../../../../static/js/privilege.ui';
|
||||
import TypeSchema, { getCompositeSchema, getRangeSchema, getExternalSchema, getDataTypeSchema } from './type.ui';
|
||||
|
@ -1269,7 +1269,7 @@ class DataTypeSchema extends BaseUISchema {
|
||||
}
|
||||
|
||||
export default class TypeSchema extends BaseUISchema {
|
||||
constructor(getPrivilegeRoleSchema, getCompositeSchema, getRangeSchema, getExternalSchema, getDataTypeSchema, fieldOptions = {}, initValues={}) {
|
||||
constructor(getPrivilegeRoleSchema, compositeSchema, rangeSchema, externalSchema, dataTypeSchema, fieldOptions = {}, initValues={}) {
|
||||
super({
|
||||
name: null,
|
||||
oid: undefined,
|
||||
@ -1287,10 +1287,10 @@ export default class TypeSchema extends BaseUISchema {
|
||||
...fieldOptions
|
||||
};
|
||||
this.getPrivilegeRoleSchema = getPrivilegeRoleSchema;
|
||||
this.compositeSchema = getCompositeSchema(); // create only once the composite schema to avoid initializing the current (i.e. top)
|
||||
this.getRangeSchema = getRangeSchema;
|
||||
this.getExternalSchema = getExternalSchema;
|
||||
this.getDataTypeSchema = getDataTypeSchema;
|
||||
this.compositeSchema = compositeSchema(); // create only once the composite schema to avoid initializing the current (i.e. top)
|
||||
this.getRangeSchema = rangeSchema;
|
||||
this.getExternalSchema = externalSchema;
|
||||
this.getDataTypeSchema = dataTypeSchema;
|
||||
this.nodeInfo = this.fieldOptions.node_info;
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,6 @@ define('pgadmin.node.mview', [
|
||||
gettext('Utility not found'),
|
||||
gettext('Failed to fetch Utility information')
|
||||
);
|
||||
return;
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -424,10 +424,10 @@ define('pgadmin.node.database', [
|
||||
function() {
|
||||
connect_to_database(_model, _data, _tree, _item, _wasConnected);
|
||||
},
|
||||
function(error) {
|
||||
function(fun_error) {
|
||||
tree.setInode(_item);
|
||||
tree.addIcon(_item, {icon: 'icon-database-not-connected'});
|
||||
Notify.pgNotifier(error, xhr, gettext('Connect to database.'));
|
||||
Notify.pgNotifier(fun_error, xhr, gettext('Connect to database.'));
|
||||
}
|
||||
);
|
||||
} else {
|
||||
|
@ -266,14 +266,14 @@ define('pgadmin.node.role', [
|
||||
deps: ['role_op'],
|
||||
filter: function(d) {
|
||||
// Exclude the currently selected
|
||||
let tree = pgBrowser.tree,
|
||||
_i = tree.selected(),
|
||||
_d = _i && _i.length == 1 ? tree.itemData(_i) : undefined;
|
||||
let ltree = pgBrowser.tree,
|
||||
_idx = ltree.selected(),
|
||||
_data = _idx && _idx.length == 1 ? ltree.itemData(_idx) : undefined;
|
||||
|
||||
if(!_d)
|
||||
if(!_data)
|
||||
return true;
|
||||
|
||||
return d && (d.label != _d.label);
|
||||
return d && (d.label != _data.label);
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -434,18 +434,18 @@ define('pgadmin.node.role', [
|
||||
//Disable Okay button
|
||||
self.__internal.buttons[2].element.disabled = true;
|
||||
// Find current/selected node
|
||||
var tree = pgBrowser.tree,
|
||||
_i = tree.selected(),
|
||||
_d = _i ? tree.itemData(_i) : undefined,
|
||||
node = _d && pgBrowser.Nodes[_d._type];
|
||||
var ltree = pgBrowser.tree,
|
||||
_idx = ltree.selected(),
|
||||
_data = _idx ? ltree.itemData(_idx) : undefined,
|
||||
node = _data && pgBrowser.Nodes[_data._type];
|
||||
|
||||
finalUrl = obj.generate_url(_i, 'reassign' , _d, true);
|
||||
old_role_name = _d.label;
|
||||
finalUrl = obj.generate_url(_idx, 'reassign' , _data, true);
|
||||
old_role_name = _data.label;
|
||||
|
||||
if (!_d)
|
||||
if (!_data)
|
||||
return;
|
||||
// Create treeInfo
|
||||
var treeInfo = pgBrowser.tree.getTreeNodeHierarchy(_i);
|
||||
var treeInfo = pgBrowser.tree.getTreeNodeHierarchy(_idx);
|
||||
// Instance of backbone model
|
||||
var newModel = new RoleReassignObjectModel({}, {node_info: treeInfo}),
|
||||
fields = Backform.generateViewSchema(
|
||||
@ -552,8 +552,8 @@ define('pgadmin.node.role', [
|
||||
gettext('Role reassign/drop failed.'),
|
||||
err.errormsg
|
||||
);
|
||||
} catch (e) {
|
||||
console.warn(e.stack || e);
|
||||
} catch (ex) {
|
||||
console.warn(ex.stack || ex);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -831,7 +831,6 @@ define('pgadmin.node.server', [
|
||||
tree.addIcon(item, {icon: 'icon-shared-server-not-connected'});
|
||||
}
|
||||
}
|
||||
return;
|
||||
}).always(function(){
|
||||
data.is_connecting = false;
|
||||
});
|
||||
|
@ -2031,7 +2031,7 @@ define('pgadmin.browser', [
|
||||
null, 'nodes', childDummyInfo, true, childTreeInfo
|
||||
);
|
||||
|
||||
var _node = _node || arguments[1];
|
||||
_node = _node || arguments[1];
|
||||
|
||||
$.ajax({
|
||||
url: childNodeUrl,
|
||||
|
@ -22,8 +22,8 @@ function url_dialog(_title, _url, _help_filename, _width, _height) {
|
||||
|
||||
alertify.dialog(dlgName, function factory() {
|
||||
return {
|
||||
main: function(_title) {
|
||||
this.set({'title': _title});
|
||||
main: function(_tmptitle) {
|
||||
this.set({'title': _tmptitle});
|
||||
},
|
||||
build: function() {
|
||||
alertify.pgDialogBuild.apply(this);
|
||||
@ -95,7 +95,6 @@ function url_dialog(_title, _url, _help_filename, _width, _height) {
|
||||
e.button.element.name, e.button.element.getAttribute('url'),
|
||||
null, null
|
||||
);
|
||||
return;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -244,7 +244,6 @@ _.extend(pgBrowser.keyboardNavigation, {
|
||||
const tree = this.getTreeDetails();
|
||||
|
||||
$('#tree').trigger('focus');
|
||||
// tree.t.focus(tree.i);
|
||||
tree.t.select(tree.i);
|
||||
},
|
||||
bindSubMenuQueryTool: function() {
|
||||
|
@ -96,21 +96,21 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
|
||||
const onHelp = (isSqlHelp=false, isNew=false)=>{
|
||||
if(isSqlHelp) {
|
||||
let server = treeNodeInfo.server;
|
||||
let url = pgAdmin.Browser.utils.pg_help_path;
|
||||
let helpUrl = pgAdmin.Browser.utils.pg_help_path;
|
||||
let fullUrl = '';
|
||||
|
||||
if (server.server_type == 'ppas' && nodeObj.epasHelp) {
|
||||
fullUrl = getEPASHelpUrl(server.version);
|
||||
} else {
|
||||
if (nodeObj.sqlCreateHelp == '' && nodeObj.sqlAlterHelp != '') {
|
||||
fullUrl = getHelpUrl(url, nodeObj.sqlAlterHelp, server.version);
|
||||
fullUrl = getHelpUrl(helpUrl, nodeObj.sqlAlterHelp, server.version);
|
||||
} else if (nodeObj.sqlCreateHelp != '' && nodeObj.sqlAlterHelp == '') {
|
||||
fullUrl = getHelpUrl(url, nodeObj.sqlCreateHelp, server.version);
|
||||
fullUrl = getHelpUrl(helpUrl, nodeObj.sqlCreateHelp, server.version);
|
||||
} else {
|
||||
if (isNew) {
|
||||
fullUrl = getHelpUrl(url, nodeObj.sqlCreateHelp, server.version);
|
||||
fullUrl = getHelpUrl(helpUrl, nodeObj.sqlCreateHelp, server.version);
|
||||
} else {
|
||||
fullUrl = getHelpUrl(url, nodeObj.sqlAlterHelp, server.version);
|
||||
fullUrl = getHelpUrl(helpUrl, nodeObj.sqlAlterHelp, server.version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ import * as SqlEditorUtils from 'sources/sqleditor_utils';
|
||||
import pgWindow from 'sources/window';
|
||||
import Notify from '../../../static/js/helpers/Notifier';
|
||||
|
||||
//var modifyAnimation = require('sources/modify_animation');
|
||||
|
||||
const pgBrowser = pgAdmin.Browser = pgAdmin.Browser || {};
|
||||
|
||||
/* Add cache related methods and properties */
|
||||
|
@ -373,8 +373,6 @@ define('misc.bgprocess', [
|
||||
ev = ev || window.event;
|
||||
ev.cancelBubble = true;
|
||||
ev.stopPropagation();
|
||||
|
||||
return;
|
||||
});
|
||||
|
||||
// On Click event to stop the process.
|
||||
|
@ -142,9 +142,7 @@ module.exports = Alertify.dialog('fileSelectionDlg', function() {
|
||||
Alertify.pgDialogBuild.apply(this);
|
||||
},
|
||||
hooks: {
|
||||
onshow: function() {
|
||||
// $(this.elements.body).addClass('pgadmin-storage-body');
|
||||
},
|
||||
onshow: function() {/* This is intentional (SonarQube) */},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
@ -1205,7 +1205,6 @@ define([
|
||||
});
|
||||
|
||||
}
|
||||
//input_object.set_cap(data_cap);
|
||||
})
|
||||
.fail(function() {
|
||||
$('.storage_dialog #uploader .input-path').prop('disabled', false);
|
||||
@ -1448,7 +1447,6 @@ define([
|
||||
}
|
||||
// Save it in preference
|
||||
save_show_hidden_file_option(tmp_data['is_checked'], pgAdmin.FileUtils.transId);
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
@ -1635,14 +1633,12 @@ define([
|
||||
if (config.options.dialog_type == 'create_file') {
|
||||
var status = checkPermission(path);
|
||||
if (status) {
|
||||
//$('.file_manager').trigger('enter-key');
|
||||
$('.file_manager_ok').trigger('click');
|
||||
}
|
||||
} else if (config.options.dialog_type == 'select_file') {
|
||||
var file_status = getFileInfo(path);
|
||||
if (file_status) {
|
||||
$('.file_manager_ok').trigger('click');
|
||||
//$('.file_manager').trigger('enter-key');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -615,9 +615,7 @@ define('pgadmin.preferences', [
|
||||
Alertify.pgDialogBuild.apply(this);
|
||||
},
|
||||
hooks: {
|
||||
onshow: function() {
|
||||
// $(this.elements.body).addClass('pgadmin-preference-body');
|
||||
},
|
||||
onshow: function() {/* This is intentional (SonarQube) */},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
@ -355,7 +355,7 @@ export default function DataGridView({
|
||||
disableResizing: false,
|
||||
sortable: true,
|
||||
...widthParms,
|
||||
Cell: ({value, row, ...other}) => {
|
||||
Cell: ({cellValue, row, ...other}) => {
|
||||
/* Make sure to take the latest field info from schema */
|
||||
field = _.find(schemaRef.current.fields, (f)=>f.id==field.id) || field;
|
||||
|
||||
@ -365,16 +365,16 @@ export default function DataGridView({
|
||||
console.error('cell is required ', field);
|
||||
}
|
||||
|
||||
return <MappedCellControl rowIndex={row.index} value={value}
|
||||
return <MappedCellControl rowIndex={row.index} value={cellValue}
|
||||
row={row.original} {...field}
|
||||
readonly={!editable}
|
||||
disabled={false}
|
||||
visible={true}
|
||||
onCellChange={(value)=>{
|
||||
onCellChange={(changeValue)=>{
|
||||
dataDispatch({
|
||||
type: SCHEMA_STATE_ACTIONS.SET_VALUE,
|
||||
path: accessPath.concat([row.index, field.id]),
|
||||
value: value,
|
||||
value: changeValue,
|
||||
});
|
||||
}}
|
||||
reRenderRow={other.reRenderRow}
|
||||
@ -385,6 +385,7 @@ export default function DataGridView({
|
||||
colInfo.Cell.propTypes = {
|
||||
row: PropTypes.object.isRequired,
|
||||
value: PropTypes.any,
|
||||
cellValue: PropTypes.any,
|
||||
onCellChange: PropTypes.func,
|
||||
};
|
||||
return colInfo;
|
||||
|
@ -69,12 +69,12 @@ export default function FieldSetView({
|
||||
readonly={readonly}
|
||||
disabled={disabled}
|
||||
visible={visible}
|
||||
onChange={(value)=>{
|
||||
onChange={(changeValue)=>{
|
||||
/* Get the changes on dependent fields as well */
|
||||
dataDispatch({
|
||||
type: SCHEMA_STATE_ACTIONS.SET_VALUE,
|
||||
path: accessPath.concat(field.id),
|
||||
value: value,
|
||||
value: changeValue,
|
||||
});
|
||||
}}
|
||||
hasError={hasError}
|
||||
|
@ -303,12 +303,12 @@ export default function FormView({
|
||||
readonly={readonly}
|
||||
disabled={disabled}
|
||||
visible={visible}
|
||||
onChange={(value)=>{
|
||||
onChange={(changeValue)=>{
|
||||
/* Get the changes on dependent fields as well */
|
||||
dataDispatch({
|
||||
type: SCHEMA_STATE_ACTIONS.SET_VALUE,
|
||||
path: accessPath.concat(id),
|
||||
value: value,
|
||||
value: changeValue,
|
||||
});
|
||||
}}
|
||||
hasError={hasError}
|
||||
|
@ -23,15 +23,15 @@ import { SelectRefresh} from '../components/SelectRefresh';
|
||||
function MappedFormControlBase({type, value, id, onChange, className, visible, inputRef, noLabel, ...props}) {
|
||||
const name = id;
|
||||
const onTextChange = useCallback((e) => {
|
||||
let value = e;
|
||||
let val = e;
|
||||
if(e && e.target) {
|
||||
value = e.target.value;
|
||||
val = e.target.value;
|
||||
}
|
||||
onChange && onChange(value);
|
||||
onChange && onChange(val);
|
||||
}, []);
|
||||
|
||||
const onSqlChange = useCallback((value) => {
|
||||
onChange && onChange(value);
|
||||
const onSqlChange = useCallback((changedValue) => {
|
||||
onChange && onChange(changedValue);
|
||||
}, []);
|
||||
|
||||
if(!visible) {
|
||||
@ -103,12 +103,12 @@ MappedFormControlBase.propTypes = {
|
||||
function MappedCellControlBase({cell, value, id, optionsLoaded, onCellChange, visible, reRenderRow,...props}) {
|
||||
const name = id;
|
||||
const onTextChange = useCallback((e) => {
|
||||
let value = e;
|
||||
let val = e;
|
||||
if(e && e.target) {
|
||||
value = e.target.value;
|
||||
val = e.target.value;
|
||||
}
|
||||
|
||||
onCellChange && onCellChange(value);
|
||||
onCellChange && onCellChange(val);
|
||||
}, []);
|
||||
|
||||
/* Some grid cells are based on options selected in other cells.
|
||||
|
@ -51,8 +51,8 @@ export default function CheckBoxTree({treeData, ...props}) {
|
||||
nodes={treeData}
|
||||
checked={checked}
|
||||
expanded={expanded}
|
||||
onCheck={checked => setChecked(checked)}
|
||||
onExpand={expanded => setExpanded(expanded)}
|
||||
onCheck={checkedVal => setChecked(checkedVal)}
|
||||
onExpand={expandedVal => setExpanded(expandedVal)}
|
||||
showNodeIcon={false}
|
||||
icons={{
|
||||
check: <CheckBoxIcon className={classes.checked}/>,
|
||||
|
@ -171,9 +171,9 @@ export default function PgTable({ columns, data, isSelectRow, ...props }) {
|
||||
return [...CLOUMNS];
|
||||
}
|
||||
});
|
||||
hooks.useInstanceBeforeDimensions.push(({ headerGroups }) => {
|
||||
hooks.useInstanceBeforeDimensions.push(({ tmpHeaderGroups }) => {
|
||||
// fix the parent group of the selection button to not be resizable
|
||||
const selectionGroupHeader = headerGroups[0].headers[0];
|
||||
const selectionGroupHeader = tmpHeaderGroups[0].headers[0];
|
||||
selectionGroupHeader.resizable = false;
|
||||
});
|
||||
}
|
||||
|
@ -864,7 +864,6 @@ import Notify from '../../../static/js/helpers/Notifier';
|
||||
};
|
||||
|
||||
this.isValueChanged = function() {
|
||||
// var select_value = this.serializeValue();
|
||||
var select_value = $select.data('checked');
|
||||
return (!(select_value === 2 && (defaultValue == null || defaultValue == undefined))) &&
|
||||
(select_value !== defaultValue);
|
||||
|
@ -209,7 +209,6 @@ let FilterDialog = {
|
||||
e.cancel = true;
|
||||
pgAdmin.Browser.showHelp(e.button.element.name, e.button.element.getAttribute('url'),
|
||||
null, null);
|
||||
return;
|
||||
} else if (e.button['data-btn-name'] === 'ok') {
|
||||
e.cancel = true; // Do not close dialog
|
||||
|
||||
|
@ -251,7 +251,6 @@ let MacroDialog = {
|
||||
e.cancel = true;
|
||||
pgAdmin.Browser.showHelp(e.button.element.name, e.button.element.getAttribute('url'),
|
||||
null, null);
|
||||
return;
|
||||
} else if (e.button['data-btn-name'] === 'ok') {
|
||||
e.cancel = true; // Do not close dialog
|
||||
|
||||
|
@ -192,7 +192,7 @@ let NewConnectionDialog = {
|
||||
self.showNewConnectionProgress[0]
|
||||
).addClass('d-none');
|
||||
},
|
||||
get_title: function(qt_title_placeholder, selected_database_name, newConnCollectionModel, response) {
|
||||
get_title: function(qt_title_placeholder, selected_database_name, newConnCollectionModel, tmpResponse) {
|
||||
qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%DATABASE%'), selected_database_name);
|
||||
if(newConnCollectionModel['role']) {
|
||||
qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%USERNAME%'), newConnCollectionModel['role']);
|
||||
@ -200,7 +200,7 @@ let NewConnectionDialog = {
|
||||
qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%USERNAME%'), newConnCollectionModel['user']);
|
||||
}
|
||||
|
||||
qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%SERVER%'), response.server_name);
|
||||
qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%SERVER%'), tmpResponse.server_name);
|
||||
return qt_title_placeholder;
|
||||
},
|
||||
callback: function(e) {
|
||||
@ -209,7 +209,6 @@ let NewConnectionDialog = {
|
||||
e.cancel = true;
|
||||
pgAdmin.Browser.showHelp(e.button.element.name, e.button.element.getAttribute('url'),
|
||||
null, null);
|
||||
return;
|
||||
} else if (e.button['data-btn-name'] === 'ok') {
|
||||
e.cancel = true; // Do not close dialog
|
||||
let newConnCollectionModel = this.newConnCollectionModel.toJSON();
|
||||
|
@ -65,7 +65,6 @@ let queryToolActions = {
|
||||
},
|
||||
|
||||
explain: function (sqlEditorController) {
|
||||
/* let explainQuery = `EXPLAIN (FORMAT JSON, ANALYZE OFF, VERBOSE ${verbose}, COSTS ${costEnabled}, BUFFERS OFF, TIMING OFF) `; */
|
||||
const explainObject = {
|
||||
format: 'json',
|
||||
analyze: false,
|
||||
|
42
web/pgadmin/static/vendor/require/require.js
vendored
42
web/pgadmin/static/vendor/require/require.js
vendored
@ -444,8 +444,8 @@ var requirejs, require, define;
|
||||
normalizedName = name;
|
||||
} else if (pluginModule && pluginModule.normalize) {
|
||||
//Plugin is loaded, use its normalize method.
|
||||
normalizedName = pluginModule.normalize(name, function (name) {
|
||||
return normalize(name, parentName, applyMap);
|
||||
normalizedName = pluginModule.normalize(name, function (tmpName) {
|
||||
return normalize(tmpName, parentName, applyMap);
|
||||
});
|
||||
} else {
|
||||
// If nested plugin references, then do not try to
|
||||
@ -966,8 +966,8 @@ var requirejs, require, define;
|
||||
if (this.map.unnormalized) {
|
||||
//Normalize the ID if the plugin allows it.
|
||||
if (plugin.normalize) {
|
||||
name = plugin.normalize(name, function (name) {
|
||||
return normalize(name, parentName, true);
|
||||
name = plugin.normalize(name, function (tmpName) {
|
||||
return normalize(tmpName, parentName, true);
|
||||
}) || '';
|
||||
}
|
||||
|
||||
@ -1277,20 +1277,20 @@ var requirejs, require, define;
|
||||
|
||||
/**
|
||||
* Set a configuration for the context.
|
||||
* @param {Object} cfg config object to integrate.
|
||||
* @param {Object} cnfg config object to integrate.
|
||||
*/
|
||||
configure: function (cfg) {
|
||||
configure: function (cnfg) {
|
||||
//Make sure the baseUrl ends in a slash.
|
||||
if (cfg.baseUrl) {
|
||||
if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
|
||||
cfg.baseUrl += '/';
|
||||
if (cnfg.baseUrl) {
|
||||
if (cnfg.baseUrl.charAt(cnfg.baseUrl.length - 1) !== '/') {
|
||||
cnfg.baseUrl += '/';
|
||||
}
|
||||
}
|
||||
|
||||
// Convert old style urlArgs string to a function.
|
||||
if (typeof cfg.urlArgs === 'string') {
|
||||
var urlArgs = cfg.urlArgs;
|
||||
cfg.urlArgs = function(id, url) {
|
||||
if (typeof cnfg.urlArgs === 'string') {
|
||||
var urlArgs = cnfg.urlArgs;
|
||||
cnfg.urlArgs = function(id, url) {
|
||||
return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs;
|
||||
};
|
||||
}
|
||||
@ -1305,7 +1305,7 @@ var requirejs, require, define;
|
||||
map: true
|
||||
};
|
||||
|
||||
eachProp(cfg, function (value, prop) {
|
||||
eachProp(cnfg, function (value, prop) {
|
||||
if (objs[prop]) {
|
||||
if (!config[prop]) {
|
||||
config[prop] = {};
|
||||
@ -1317,8 +1317,8 @@ var requirejs, require, define;
|
||||
});
|
||||
|
||||
//Reverse map the bundles
|
||||
if (cfg.bundles) {
|
||||
eachProp(cfg.bundles, function (value, prop) {
|
||||
if (cnfg.bundles) {
|
||||
eachProp(cnfg.bundles, function (value, prop) {
|
||||
each(value, function (v) {
|
||||
if (v !== prop) {
|
||||
bundlesMap[v] = prop;
|
||||
@ -1328,8 +1328,8 @@ var requirejs, require, define;
|
||||
}
|
||||
|
||||
//Merge shim
|
||||
if (cfg.shim) {
|
||||
eachProp(cfg.shim, function (value, id) {
|
||||
if (cnfg.shim) {
|
||||
eachProp(cnfg.shim, function (value, id) {
|
||||
//Normalize the structure
|
||||
if (isArray(value)) {
|
||||
value = {
|
||||
@ -1345,8 +1345,8 @@ var requirejs, require, define;
|
||||
}
|
||||
|
||||
//Adjust packages if necessary.
|
||||
if (cfg.packages) {
|
||||
each(cfg.packages, function (pkgObj) {
|
||||
if (cnfg.packages) {
|
||||
each(cnfg.packages, function (pkgObj) {
|
||||
var location, name;
|
||||
|
||||
pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj;
|
||||
@ -1383,8 +1383,8 @@ var requirejs, require, define;
|
||||
//If a deps array or a config callback is specified, then call
|
||||
//require with those args. This is useful when require is defined as a
|
||||
//config object before require.js is loaded.
|
||||
if (cfg.deps || cfg.callback) {
|
||||
context.require(cfg.deps || [], cfg.callback);
|
||||
if (cnfg.deps || cnfg.callback) {
|
||||
context.require(cnfg.deps || [], cnfg.callback);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -381,7 +381,7 @@ export function getMiscellaneousSchema(fieldOptions) {
|
||||
}
|
||||
|
||||
export default class BackupSchema extends BaseUISchema {
|
||||
constructor(getSectionSchema, getTypeObjSchema, getSaveOptSchema, getQueryOptionSchema, getDisabledOptionSchema, getMiscellaneousSchema, fieldOptions = {}, treeNodeInfo=[], pgBrowser=null, backupType='server') {
|
||||
constructor(sectionSchema, typeObjSchema, saveOptSchema, queryOptionSchema, disabledOptionSchema, miscellaneousSchema, fieldOptions = {}, treeNodeInfo=[], pgBrowser=null, backupType='server') {
|
||||
super({
|
||||
file: undefined,
|
||||
format: 'custom',
|
||||
@ -399,12 +399,12 @@ export default class BackupSchema extends BaseUISchema {
|
||||
this.treeNodeInfo = treeNodeInfo;
|
||||
this.pgBrowser = pgBrowser;
|
||||
this.backupType = backupType;
|
||||
this.getSectionSchema = getSectionSchema;
|
||||
this.getTypeObjSchema = getTypeObjSchema;
|
||||
this.getSaveOptSchema = getSaveOptSchema;
|
||||
this.getQueryOptionSchema = getQueryOptionSchema;
|
||||
this.getDisabledOptionSchema = getDisabledOptionSchema;
|
||||
this.getMiscellaneousSchema = getMiscellaneousSchema;
|
||||
this.getSectionSchema = sectionSchema;
|
||||
this.getTypeObjSchema = typeObjSchema;
|
||||
this.getSaveOptSchema = saveOptSchema;
|
||||
this.getQueryOptionSchema = queryOptionSchema;
|
||||
this.getDisabledOptionSchema = disabledOptionSchema;
|
||||
this.getMiscellaneousSchema = miscellaneousSchema;
|
||||
}
|
||||
|
||||
get idAttribute() {
|
||||
|
@ -46,7 +46,7 @@ export function getMiscellaneousSchema() {
|
||||
}
|
||||
|
||||
export default class BackupGlobalSchema extends BaseUISchema {
|
||||
constructor(getMiscellaneousSchema, fieldOptions = {}) {
|
||||
constructor(miscellaneousSchema, fieldOptions = {}) {
|
||||
super({
|
||||
id: null,
|
||||
verbose: true,
|
||||
@ -57,7 +57,7 @@ export default class BackupGlobalSchema extends BaseUISchema {
|
||||
...fieldOptions,
|
||||
};
|
||||
|
||||
this.getMiscellaneousSchema = getMiscellaneousSchema;
|
||||
this.getMiscellaneousSchema = miscellaneousSchema;
|
||||
}
|
||||
|
||||
get idAttribute() {
|
||||
|
@ -582,9 +582,9 @@ define([
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
})
|
||||
.done(function(res) {
|
||||
.done(function(result) {
|
||||
|
||||
var data = res.data;
|
||||
var data = result.data;
|
||||
|
||||
var url = url_for('debugger.direct', {
|
||||
'trans_id': trans_id,
|
||||
|
@ -311,8 +311,8 @@ export default class ERDCore {
|
||||
let sourceNode = tableNodesDict[onetomanyData.referenced_table_uid];
|
||||
let targetNode = tableNodesDict[onetomanyData.local_table_uid];
|
||||
|
||||
fkColumn.local_column = _.find(targetNode.getColumns(), (col)=>col.attnum==onetomanyData.local_column_attnum).name;
|
||||
fkColumn.referenced = _.find(sourceNode.getColumns(), (col)=>col.attnum==onetomanyData.referenced_column_attnum).name;
|
||||
fkColumn.local_column = _.find(targetNode.getColumns(), (colm)=>colm.attnum==onetomanyData.local_column_attnum).name;
|
||||
fkColumn.referenced = _.find(sourceNode.getColumns(), (colm)=>colm.attnum==onetomanyData.referenced_column_attnum).name;
|
||||
fkColumn.references = onetomanyData.referenced_table_uid;
|
||||
fkColumn.references_table_name = sourceNode.getData().name;
|
||||
|
||||
|
@ -142,7 +142,7 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
|
||||
}, [privileges]);
|
||||
|
||||
React.useEffect(() => {
|
||||
const privSchema = new PrivilegeSchema((privileges) => getNodePrivilegeRoleSchema('', nodeInfo, nodeData, privileges));
|
||||
const privSchema = new PrivilegeSchema((privs) => getNodePrivilegeRoleSchema('', nodeInfo, nodeData, privs));
|
||||
setPrivSchemaInstance(privSchema);
|
||||
setLoaderText('Loading...');
|
||||
|
||||
@ -288,13 +288,13 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
|
||||
selObj.push(row.values);
|
||||
});
|
||||
}
|
||||
var privileges = new Set();
|
||||
var privs = new Set();
|
||||
objectTypes.forEach((objType) => {
|
||||
privOptions[objType]?.acl.forEach((priv) => {
|
||||
privileges.add(priv);
|
||||
privs.add(priv);
|
||||
});
|
||||
});
|
||||
setPrivileges(Array.from(privileges));
|
||||
setPrivileges(Array.from(privs));
|
||||
setSelectedObject(selObj);
|
||||
setErrMsg(selObj.length === 0 ? gettext('Please select any database object.') : '');
|
||||
};
|
||||
|
@ -147,7 +147,6 @@ define([
|
||||
gettext('Utility not found'),
|
||||
res.data.errormsg
|
||||
);
|
||||
return;
|
||||
}else{
|
||||
// Open the Alertify dialog for the import/export module
|
||||
pgBrowser.Node.registerUtilityPanel();
|
||||
@ -179,7 +178,6 @@ define([
|
||||
gettext('Utility not found'),
|
||||
gettext('Failed to fetch Utility information')
|
||||
);
|
||||
return;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
@ -231,8 +231,8 @@ export default function ImportExportServers() {
|
||||
<WizardStep stepId={1} className={classes.noOverflow}>
|
||||
<Box className={classes.boxText}>{gettext('Select the Server Groups/Servers to import/export:')}</Box>
|
||||
<Box className={classes.treeContainer}>
|
||||
<CheckBoxTree treeData={serverData} getSelectedServers={(selectedServers) => {
|
||||
setSelectedServers(selectedServers);
|
||||
<CheckBoxTree treeData={serverData} getSelectedServers={(selServers) => {
|
||||
setSelectedServers(selServers);
|
||||
}}/>
|
||||
</Box>
|
||||
</WizardStep>
|
||||
|
@ -179,7 +179,7 @@ define([
|
||||
panel.focus();
|
||||
|
||||
let urlShortcut = 'maintenance.create_job',
|
||||
baseUrl = url_for(urlShortcut, {
|
||||
jobUrl = url_for(urlShortcut, {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id
|
||||
});
|
||||
@ -191,7 +191,7 @@ define([
|
||||
});
|
||||
|
||||
getUtilityView(
|
||||
schema, treeInfo, 'select', 'dialog', j[0], panel, that.saveCallBack, extraData, 'OK', baseUrl, sqlHelpUrl, helpUrl);
|
||||
schema, treeInfo, 'select', 'dialog', j[0], panel, that.saveCallBack, extraData, 'OK', jobUrl, sqlHelpUrl, helpUrl);
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
|
@ -76,7 +76,7 @@ export function getVacuumSchema(fieldOptions) {
|
||||
//Maintenance Schema
|
||||
export default class MaintenanceSchema extends BaseUISchema {
|
||||
|
||||
constructor(getVacuumSchema, fieldOptions = {}) {
|
||||
constructor(vacuumSchema, fieldOptions = {}) {
|
||||
super({
|
||||
op: 'VACUUM',
|
||||
verbose: true,
|
||||
@ -90,7 +90,7 @@ export default class MaintenanceSchema extends BaseUISchema {
|
||||
...fieldOptions,
|
||||
};
|
||||
|
||||
this.getVacuumSchema = getVacuumSchema;
|
||||
this.getVacuumSchema = vacuumSchema;
|
||||
this.nodeInfo = fieldOptions.nodeInfo;
|
||||
}
|
||||
|
||||
|
@ -214,21 +214,21 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
|
||||
}
|
||||
|
||||
},
|
||||
getPanelUrls: function(transId, panelTitle, parentData) {
|
||||
getPanelUrls: function(transId, panelTitle, pData) {
|
||||
let openUrl = url_for('psql.panel', {
|
||||
trans_id: transId,
|
||||
});
|
||||
const misc_preferences = pgBrowser.get_preferences_for_module('misc');
|
||||
var theme = misc_preferences.theme;
|
||||
|
||||
openUrl += `?sgid=${parentData.server_group._id}`
|
||||
+`&sid=${parentData.server._id}`
|
||||
+`&did=${parentData.database._id}`
|
||||
+`&server_type=${parentData.server.server_type}`
|
||||
openUrl += `?sgid=${pData.server_group._id}`
|
||||
+`&sid=${pData.server._id}`
|
||||
+`&did=${pData.database._id}`
|
||||
+`&server_type=${pData.server.server_type}`
|
||||
+ `&theme=${theme}`;
|
||||
let db_label = '';
|
||||
if(parentData.database && parentData.database._id) {
|
||||
db_label = _.escape(parentData.database._label.replace('\\', '\\\\'));
|
||||
if(pData.database && pData.database._id) {
|
||||
db_label = _.escape(pData.database._label.replace('\\', '\\\\'));
|
||||
db_label = db_label.replace('\'', '\'');
|
||||
db_label = db_label.replace('"', '\"');
|
||||
openUrl += `&db=${db_label}`;
|
||||
|
@ -331,7 +331,7 @@ export function getRestoreMiscellaneousSchema(fieldOptions) {
|
||||
//Restore Schema
|
||||
export default class RestoreSchema extends BaseUISchema {
|
||||
|
||||
constructor(getRestoreSectionSchema, getRestoreTypeObjSchema, getRestoreSaveOptSchema, getRestoreQueryOptionSchema, getRestoreDisableOptionSchema, getRestoreMiscellaneousSchema, fieldOptions = {}, treeNodeInfo=[], pgBrowser=null) {
|
||||
constructor(restoreSectionSchema, restoreTypeObjSchema, restoreSaveOptSchema, restoreQueryOptionSchema, restoreDisableOptionSchema, restoreMiscellaneousSchema, fieldOptions = {}, treeNodeInfo={}, pgBrowser=null) {
|
||||
super({
|
||||
custom: false,
|
||||
file: undefined,
|
||||
@ -355,12 +355,12 @@ export default class RestoreSchema extends BaseUISchema {
|
||||
...fieldOptions,
|
||||
};
|
||||
|
||||
this.getSectionSchema = getRestoreSectionSchema;
|
||||
this.getRestoreTypeObjSchema = getRestoreTypeObjSchema;
|
||||
this.getRestoreSaveOptSchema = getRestoreSaveOptSchema;
|
||||
this.getRestoreQueryOptionSchema = getRestoreQueryOptionSchema;
|
||||
this.getRestoreDisableOptionSchema = getRestoreDisableOptionSchema;
|
||||
this.getRestoreMiscellaneousSchema = getRestoreMiscellaneousSchema;
|
||||
this.getSectionSchema = restoreSectionSchema;
|
||||
this.getRestoreTypeObjSchema = restoreTypeObjSchema;
|
||||
this.getRestoreSaveOptSchema = restoreSaveOptSchema;
|
||||
this.getRestoreQueryOptionSchema = restoreQueryOptionSchema;
|
||||
this.getRestoreDisableOptionSchema = restoreDisableOptionSchema;
|
||||
this.getRestoreMiscellaneousSchema = restoreMiscellaneousSchema;
|
||||
this.treeNodeInfo = treeNodeInfo;
|
||||
this.pgBrowser = pgBrowser;
|
||||
}
|
||||
|
@ -860,7 +860,7 @@ export default class SchemaDiffUI {
|
||||
if (index === -1) self.sel_filters.push(filter);
|
||||
} else {
|
||||
$(filter_class).addClass('visibility-hidden');
|
||||
if(index !== -1 ) delete self.sel_filters[index];
|
||||
if(index !== -1 ) self.sel_filters.splice(index, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -136,7 +136,6 @@ describe('preferences related functions test', function() {
|
||||
|
||||
/* Tests */
|
||||
expect(pgBrowser.editor.getWrapperElement).toHaveBeenCalled();
|
||||
//expect($.fn.css).toHaveBeenCalledWith('font-size', '1.46em');
|
||||
|
||||
let setOptionCalls = pgBrowser.editor.setOption.calls;
|
||||
expect(setOptionCalls.count()).toEqual(Object.keys(editorOptions).length);
|
||||
|
@ -52,7 +52,7 @@ describe('ImportExportServers', () => {
|
||||
});
|
||||
|
||||
it('export', () => {
|
||||
let schemaObj = new ImportExportSelectionSchema(
|
||||
schemaObj = new ImportExportSelectionSchema(
|
||||
{imp_exp: 'e', filename: 'test.json'});
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
|
@ -136,7 +136,7 @@ describe('IndexSchema', ()=>{
|
||||
|
||||
columnSchemaObj.op_class_types = [];
|
||||
options.push({label: '', value: ''});
|
||||
status = columnSchemaObj.setOpClassTypes(options);
|
||||
columnSchemaObj.setOpClassTypes(options);
|
||||
expect(columnSchemaObj.op_class_types.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
@ -14,7 +14,6 @@ import { createMount } from '@material-ui/core/test-utils';
|
||||
import pgAdmin from 'sources/pgadmin';
|
||||
import {messages} from '../fake_messages';
|
||||
import SchemaView from '../../../pgadmin/static/js/SchemaView';
|
||||
//import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
||||
import RowSecurityPolicySchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/static/js/row_security_policy.ui';
|
||||
|
||||
|
||||
|
@ -14,7 +14,6 @@ import { createMount } from '@material-ui/core/test-utils';
|
||||
import pgAdmin from 'sources/pgadmin';
|
||||
import {messages} from '../fake_messages';
|
||||
import SchemaView from '../../../pgadmin/static/js/SchemaView';
|
||||
//import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
||||
import TriggerSchema, { EventSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.ui';
|
||||
|
||||
describe('TriggerSchema', ()=>{
|
||||
|
@ -25,7 +25,6 @@ describe('ExecuteQuery', () => {
|
||||
const startTime = new Date(2018, 1, 29, 12, 15, 52);
|
||||
beforeEach(() => {
|
||||
networkMock = new MockAdapter(axios);
|
||||
// jasmine.addMatchers({jQuerytoHaveBeenCalledWith: jQuerytoHaveBeenCalledWith});
|
||||
userManagementMock = jasmine.createSpyObj('UserManagement', [
|
||||
'isPgaLoginRequired',
|
||||
'pgaLogin',
|
||||
|
@ -62,7 +62,6 @@ describe('queryToolActions', () => {
|
||||
it('calls the execute function', () => {
|
||||
queryToolActions.explainAnalyze(sqlEditorController);
|
||||
|
||||
// let explainAnalyzeQuery = 'EXPLAIN (FORMAT JSON, ANALYZE ON, VERBOSE OFF, COSTS OFF, BUFFERS OFF, TIMING OFF) ';
|
||||
const explainObject = {
|
||||
format: 'json',
|
||||
analyze: true,
|
||||
|
Loading…
Reference in New Issue
Block a user