mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
Fixed code smell reported by SonarQube.
This commit is contained in:
parent
d945c6f843
commit
1013d7ccdd
@ -29,6 +29,9 @@ from pgadmin.utils.constants import LDAP
|
||||
ERROR_SEARCHING_LDAP_DIRECTORY = gettext(
|
||||
"Error searching the LDAP directory: {}")
|
||||
|
||||
ERROR_CONNECTING_LDAP_SERVER = gettext(
|
||||
"Error connecting to the LDAP server: {}\n")
|
||||
|
||||
|
||||
class LDAPAuthentication(BaseAuthentication):
|
||||
"""Ldap Authentication Class"""
|
||||
@ -122,18 +125,16 @@ class LDAPAuthentication(BaseAuthentication):
|
||||
|
||||
except LDAPSocketOpenError as e:
|
||||
current_app.logger.exception(
|
||||
"Error connecting to the LDAP server: {}\n".format(e))
|
||||
return False, gettext("Error connecting to the LDAP server: {}\n"
|
||||
).format(e.args[0])
|
||||
ERROR_CONNECTING_LDAP_SERVER.format(e))
|
||||
return False, ERROR_CONNECTING_LDAP_SERVER.format(e.args[0])
|
||||
except LDAPBindError as e:
|
||||
current_app.logger.exception(
|
||||
"Error binding to the LDAP server.")
|
||||
return False, gettext("Error binding to the LDAP server.")
|
||||
except Exception as e:
|
||||
current_app.logger.exception(
|
||||
"Error connecting to the LDAP server: {}\n".format(e))
|
||||
return False, gettext("Error connecting to the LDAP server: {}\n"
|
||||
).format(e.args[0])
|
||||
ERROR_CONNECTING_LDAP_SERVER.format(e))
|
||||
return False, ERROR_CONNECTING_LDAP_SERVER.format(e.args[0])
|
||||
|
||||
# Enable TLS if STARTTLS is configured
|
||||
if self.start_tls:
|
||||
|
@ -1512,10 +1512,10 @@ class ServerNode(PGChildNodeView):
|
||||
# Check if any psql terminal is running for the current disconnecting
|
||||
# server. If any terminate the psql tool connection.
|
||||
if 'sid_soid_mapping' in current_app.config and str(sid) in \
|
||||
current_app.config['sid_soid_mapping']:
|
||||
if str(sid) in current_app.config['sid_soid_mapping']:
|
||||
for i in current_app.config['sid_soid_mapping'][str(sid)]:
|
||||
sio.emit('disconnect-psql', namespace='/pty', to=i)
|
||||
current_app.config['sid_soid_mapping'] and \
|
||||
str(sid) in current_app.config['sid_soid_mapping']:
|
||||
for i in current_app.config['sid_soid_mapping'][str(sid)]:
|
||||
sio.emit('disconnect-psql', namespace='/pty', to=i)
|
||||
|
||||
status = manager.release()
|
||||
|
||||
|
@ -38,13 +38,10 @@ export default class LanguageSchema extends BaseUISchema {
|
||||
}
|
||||
// This function check whether the server is less than 13 or not.
|
||||
isLessThan13(){
|
||||
if(!_.isUndefined(this.node_info)
|
||||
return !_.isUndefined(this.node_info)
|
||||
&& !_.isUndefined(this.node_info['node_info'])
|
||||
&& !_.isUndefined(this.node_info['node_info'].version)
|
||||
&& this.node_info['node_info'].version < 130000)
|
||||
{ return true; }
|
||||
else{ return false; }
|
||||
|
||||
&& this.node_info['node_info'].version < 130000;
|
||||
}
|
||||
isDisabled(state){
|
||||
if (this.templateList.some(template => template.tmplname === state.name)){
|
||||
|
@ -70,11 +70,7 @@ export default class SynonymSchema extends BaseUISchema {
|
||||
readonly: function(state) {
|
||||
// If tagetType is synonym then disable it
|
||||
if(!obj.inCatalog()) {
|
||||
if(state.targettype == 's') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return state.targettype == 's';
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
@ -196,12 +196,12 @@ export default class ColumnSchema extends BaseUISchema {
|
||||
editable: function(state) {
|
||||
// If primary key already exist then disable.
|
||||
if (
|
||||
obj.top && ((
|
||||
obj.top && (
|
||||
!_.isUndefined(obj.top.origData['oid'])
|
||||
&& !_.isUndefined(obj.top.origData['primary_key'])
|
||||
&& obj.top.origData['primary_key'].length > 0
|
||||
&& !_.isUndefined(obj.top.origData['primary_key'][0]['oid'])
|
||||
))
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
@ -325,11 +325,7 @@ export default class ExclusionConstraintSchema extends BaseUISchema {
|
||||
deps: ['condeferrable'],
|
||||
disabled: function(state) {
|
||||
// Disable if condeferred is false or unselected.
|
||||
if(state.condeferrable) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return !state.condeferrable;
|
||||
},
|
||||
readonly: obj.isReadonly,
|
||||
depChange: (state)=>{
|
||||
|
@ -204,11 +204,7 @@ export default class ForeignKeySchema extends BaseUISchema {
|
||||
deps: ['condeferrable'],
|
||||
disabled: function(state) {
|
||||
// Disable if condeferred is false or unselected.
|
||||
if(state.condeferrable) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return !state.condeferrable;
|
||||
},
|
||||
readonly: obj.isReadonly,
|
||||
depChange: (state)=>{
|
||||
@ -284,11 +280,7 @@ export default class ForeignKeySchema extends BaseUISchema {
|
||||
mode: ['properties', 'create', 'edit'], group: gettext('Definition'),
|
||||
deps:['autoindex', 'hasindex'],
|
||||
disabled: (state)=>{
|
||||
if(!state.autoindex && !state.hasindex) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return !state.autoindex && !state.hasindex;
|
||||
},
|
||||
readonly: this.isReadonly,
|
||||
},{
|
||||
|
@ -27,7 +27,7 @@ export function getColumnSchema(nodeObj, treeNodeInfo, itemNodeData) {
|
||||
}
|
||||
|
||||
export class ColumnSchema extends BaseUISchema {
|
||||
constructor(fieldOptions = {}, nodeData, initValues={}) {
|
||||
constructor(fieldOptions = {}, nodeData = [], initValues={}) {
|
||||
super({
|
||||
name: null,
|
||||
oid: undefined,
|
||||
@ -121,7 +121,6 @@ export class ColumnSchema extends BaseUISchema {
|
||||
_.each(this.op_class_types, function(v, k) {
|
||||
if(amname === k) {
|
||||
options = v;
|
||||
return;
|
||||
}
|
||||
});
|
||||
return options;
|
||||
@ -209,7 +208,7 @@ function inSchema(node_info) {
|
||||
}
|
||||
|
||||
export default class IndexSchema extends BaseUISchema {
|
||||
constructor(getColumnSchema, fieldOptions = {}, nodeData, initValues={}) {
|
||||
constructor(getColumnSchema, fieldOptions = {}, nodeData = [], initValues={}) {
|
||||
super({
|
||||
name: undefined,
|
||||
oid: undefined,
|
||||
|
@ -4,7 +4,7 @@ import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
||||
import { emptyValidator, isEmptyString } from '../../../../../../../../static/js/validators';
|
||||
|
||||
export class PartitionKeysSchema extends BaseUISchema {
|
||||
constructor(columns=[], getCollations, getOperatorClass) {
|
||||
constructor(columns=[], getCollations=[], getOperatorClass=[]) {
|
||||
super({
|
||||
key_type: 'column',
|
||||
});
|
||||
@ -424,7 +424,9 @@ export class PartitionsSchema extends BaseUISchema {
|
||||
msg = gettext('For hash partition Modulus field cannot be empty.');
|
||||
setError('values_modulus', msg);
|
||||
return true;
|
||||
} if(isEmptyString(state.values_remainder)) {
|
||||
}
|
||||
|
||||
if(isEmptyString(state.values_remainder)) {
|
||||
msg = gettext('For hash partition Remainder field cannot be empty.');
|
||||
setError('values_remainder', msg);
|
||||
return true;
|
||||
|
@ -333,10 +333,10 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
|
||||
:return: True or False based on condition
|
||||
"""
|
||||
# check whether the table is partition or not, then check conislocal
|
||||
if 'relispartition' in data and data['relispartition'] is True:
|
||||
if 'conislocal' in constraint \
|
||||
and constraint['conislocal'] is False:
|
||||
return True
|
||||
if 'relispartition' in data and data['relispartition'] is True and \
|
||||
'conislocal' in constraint and \
|
||||
constraint['conislocal'] is False:
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_table_dependents(self, tid):
|
||||
|
@ -958,7 +958,6 @@ class CompositeSchema extends BaseUISchema {
|
||||
// set the values in state
|
||||
state.is_tlength = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1306,7 +1305,6 @@ export default class TypeSchema extends BaseUISchema {
|
||||
tempCol.forEach(function(enumVal) {
|
||||
if(enumVal == undefined) {
|
||||
dontAddColumn = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1314,7 +1312,7 @@ export default class TypeSchema extends BaseUISchema {
|
||||
}
|
||||
|
||||
schemaCheck(state) {
|
||||
if(this.fieldOptions.node_info && 'schema' in this.fieldOptions.node_info)
|
||||
if(this.fieldOptions.node_info && this.fieldOptions.node_info.indexOf('schema') >= 0)
|
||||
{
|
||||
if(!state)
|
||||
return true;
|
||||
|
@ -19,7 +19,7 @@ import current_user from 'pgadmin.user_management.current_user';
|
||||
import { isEmptyString } from 'sources/validators';
|
||||
|
||||
export default class ServerSchema extends BaseUISchema {
|
||||
constructor(serverGroupOptions=[], userId, initValues={}) {
|
||||
constructor(serverGroupOptions=[], userId=0, initValues={}) {
|
||||
super({
|
||||
gid: undefined,
|
||||
id: undefined,
|
||||
|
@ -68,9 +68,7 @@ _.extend(pgBrowser, {
|
||||
// clear the wcDocker before reset layout.
|
||||
docker.clear();
|
||||
Notify.info(gettext('pgAdmin has reset the layout because the previously saved layout is invalid.'), null);
|
||||
if(defaultLayoutCallback){
|
||||
defaultLayoutCallback(docker);
|
||||
}
|
||||
defaultLayoutCallback(docker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,9 +171,6 @@ define(
|
||||
p.pgResizeTimeout = null;
|
||||
|
||||
/** Calculations based on https://getbootstrap.com/docs/4.1/layout/grid/#grid-options **/
|
||||
if (w < 480) {
|
||||
elAttr = 'xs';
|
||||
}
|
||||
if (w >= 480) {
|
||||
elAttr = 'sm';
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ SCHEMA_VERSION = 32
|
||||
|
||||
db = SQLAlchemy()
|
||||
USER_ID = 'user.id'
|
||||
SERVER_ID = 'server.id'
|
||||
|
||||
# Define models
|
||||
roles_users = db.Table(
|
||||
@ -341,7 +342,7 @@ class QueryHistoryModel(db.Model):
|
||||
db.Integer, db.ForeignKey(USER_ID), nullable=False, primary_key=True
|
||||
)
|
||||
sid = db.Column(
|
||||
db.Integer(), db.ForeignKey('server.id'), nullable=False,
|
||||
db.Integer(), db.ForeignKey(SERVER_ID), nullable=False,
|
||||
primary_key=True)
|
||||
dbname = db.Column(db.String(), nullable=False, primary_key=True)
|
||||
query_info = db.Column(db.String(), nullable=False)
|
||||
@ -357,7 +358,7 @@ class Database(db.Model):
|
||||
schema_res = db.Column(db.String(256), nullable=True)
|
||||
server = db.Column(
|
||||
db.Integer,
|
||||
db.ForeignKey('server.id'),
|
||||
db.ForeignKey(SERVER_ID),
|
||||
nullable=False,
|
||||
primary_key=True
|
||||
)
|
||||
@ -370,7 +371,7 @@ class SharedServer(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
osid = db.Column(
|
||||
db.Integer,
|
||||
db.ForeignKey('server.id'),
|
||||
db.ForeignKey(SERVER_ID),
|
||||
nullable=False
|
||||
)
|
||||
user_id = db.Column(
|
||||
|
@ -11,8 +11,8 @@ import React, { useCallback } from 'react';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { FormInputText, FormInputSelect, FormInputSwitch, FormInputCheckbox, FormInputColor,
|
||||
FormInputFileSelect, FormInputToggle, InputSwitch, FormInputSQL, FormNote, FormInputDateTimePicker, PlainString } from '../components/FormComponents';
|
||||
import { InputSelect, InputText, InputCheckbox, InputDateTimePicker } from '../components/FormComponents';
|
||||
FormInputFileSelect, FormInputToggle, InputSwitch, FormInputSQL, FormNote, FormInputDateTimePicker, PlainString,
|
||||
InputSelect, InputText, InputCheckbox, InputDateTimePicker } from '../components/FormComponents';
|
||||
import Privilege from '../components/Privilege';
|
||||
import { evalFunc } from 'sources/utils';
|
||||
import PropTypes from 'prop-types';
|
||||
|
@ -89,15 +89,11 @@ function isValueEqual(val1, val2) {
|
||||
/* If the orig value was null and new one is empty string, then its a "no change" */
|
||||
/* If the orig value and new value are of different datatype but of same value(numeric) "no change" */
|
||||
/* If the orig value is undefined or null and new value is boolean false "no change" */
|
||||
if ((_.isEqual(val1, val2)
|
||||
return (_.isEqual(val1, val2)
|
||||
|| ((val1 === null || _.isUndefined(val1)) && val2 === '')
|
||||
|| ((val1 === null || _.isUndefined(val1)) && typeof(val2) === 'boolean' && !val2)
|
||||
|| (attrDefined ? _.isEqual(val1.toString(), val2.toString()) : false
|
||||
))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
function getChangedData(topSchema, viewHelperProps, sessData, stringify=false, includeSkipChange=true) {
|
||||
|
@ -74,8 +74,7 @@ define([
|
||||
return m;
|
||||
}
|
||||
|
||||
var idx = 1,
|
||||
len = _.size(m);
|
||||
var idx, len = _.size(m);
|
||||
|
||||
switch (mode) {
|
||||
case 'properties':
|
||||
|
@ -1589,9 +1589,10 @@ define([
|
||||
if (_.isUndefined(rawValue) || _.isNull(rawValue)) return '';
|
||||
|
||||
var pass = '';
|
||||
for (var i = 0; i < rawValue.length; i++) {
|
||||
rawValue.forEach(() => {
|
||||
pass += '*';
|
||||
}
|
||||
});
|
||||
|
||||
return pass;
|
||||
},
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ import axios from 'axios';
|
||||
export function setPGCSRFToken(header, token) {
|
||||
if (!token) {
|
||||
// Throw error message.
|
||||
throw 'csrf-token meta tag has not been set';
|
||||
throw new Error('csrf-token meta tag has not been set');
|
||||
}
|
||||
|
||||
// Configure Backbone.sync to set CSRF-Token-header request header for
|
||||
|
@ -9,8 +9,7 @@
|
||||
|
||||
import $ from 'jquery';
|
||||
import Mousetrap from 'mousetrap';
|
||||
import { findAndSetFocus } from './utils';
|
||||
import { parseShortcutValue } from './utils';
|
||||
import { findAndSetFocus, parseShortcutValue } from './utils';
|
||||
|
||||
class dialogTabNavigator {
|
||||
constructor(dialogContainer, backwardShortcut, forwardShortcut) {
|
||||
|
@ -220,7 +220,7 @@ var Notifier = {
|
||||
}
|
||||
this.alert(promptmsg, msg.replace(new RegExp(/\r?\n/, 'g'), '<br />'));
|
||||
},
|
||||
alert: (title, text, okLabel=gettext('OK'), onOkClick)=>{
|
||||
alert: (title, text, onOkClick, okLabel=gettext('OK'))=>{
|
||||
if(!modalInitialized) {
|
||||
initializeModalProvider();
|
||||
}
|
||||
|
@ -12,9 +12,8 @@ import { render } from 'react-dom';
|
||||
import { FileTreeX, TreeModelX } from 'pgadmin4-tree';
|
||||
import {Tree} from './tree';
|
||||
|
||||
import { IBasicFileSystemHost } from 'react-aspen';
|
||||
import { IBasicFileSystemHost, Directory } from 'react-aspen';
|
||||
import { ManageTreeNodes } from './tree_nodes';
|
||||
import { Directory } from 'react-aspen';
|
||||
import pgAdmin from 'sources/pgadmin';
|
||||
|
||||
var initBrowserTree = async (pgBrowser) => {
|
||||
@ -29,8 +28,7 @@ var initBrowserTree = async (pgBrowser) => {
|
||||
const host: IBasicFileSystemHost = {
|
||||
pathStyle: 'unix',
|
||||
getItems: async (path) => {
|
||||
let nodes = await mtree.readNode(path);
|
||||
return nodes;
|
||||
return await mtree.readNode(path);
|
||||
},
|
||||
sortComparator: (a: FileEntry | Directory, b: FileEntry | Directory) => {
|
||||
// No nee to sort columns
|
||||
@ -39,9 +37,13 @@ var initBrowserTree = async (pgBrowser) => {
|
||||
if (a.constructor === b.constructor) {
|
||||
return pgAdmin.natural_sort(a.fileName, b.fileName);
|
||||
}
|
||||
return a.constructor === Directory ? -1
|
||||
: b.constructor === Directory ? 1
|
||||
: 0
|
||||
let retval = 0;
|
||||
if (a.constructor === Directory) {
|
||||
retval = -1;
|
||||
} else if (b.constructor === Directory) {
|
||||
retval = 1;
|
||||
}
|
||||
return retval;
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import _ from 'underscore';
|
||||
import { FileType } from 'react-aspen'
|
||||
import { findInTree } from './tree';
|
||||
|
||||
import { dirname, unix } from 'path-fx';
|
||||
import { unix } from 'path-fx';
|
||||
|
||||
export class ManageTreeNodes {
|
||||
constructor(fs) {
|
||||
@ -115,17 +115,17 @@ export class ManageTreeNodes {
|
||||
}
|
||||
}
|
||||
|
||||
async function jsonData(url) {
|
||||
let res = await fetch(url, {
|
||||
async function jsonData(fetch_url) {
|
||||
let result = await fetch(fetch_url, {
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'X-pgA-CSRFToken': pgAdmin.csrf_token
|
||||
},
|
||||
});
|
||||
|
||||
if (res.status == 200) {
|
||||
if (result.status == 200) {
|
||||
try {
|
||||
let json = await res.json();
|
||||
let json = await result.json();
|
||||
return json.data;
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
@ -146,7 +146,7 @@ export class ManageTreeNodes {
|
||||
}
|
||||
}
|
||||
|
||||
let d = await fill(treeData);
|
||||
await fill(treeData);
|
||||
if (node.children.length > 0) res(node.children);
|
||||
else res(null);
|
||||
|
||||
|
@ -318,7 +318,7 @@ div.jsoneditor-value[contenteditable=true]:hover
|
||||
.jsoneditor .jsoneditor-text-errors {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-top: 1px solid $color-gray;;
|
||||
border-top: 1px solid $color-gray;
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,9 +62,6 @@
|
||||
|
||||
display: -webkit-flex; /* Safari */
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.wcFrameButtonBar {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
|
@ -363,10 +363,10 @@
|
||||
keyPathAccessor: function(obj, path) {
|
||||
var res = obj;
|
||||
path = path.split('.');
|
||||
for (var i = 0; i < path.length; i++) {
|
||||
for (let path_val of path) {
|
||||
if (_.isNull(res)) return null;
|
||||
if (_.isEmpty(path[i])) continue;
|
||||
if (!_.isUndefined(res[path[i]])) res = res[path[i]];
|
||||
if (_.isEmpty(path_val)) continue;
|
||||
if (!_.isUndefined(res[path_val])) res = res[path_val];
|
||||
}
|
||||
return _.isObject(res) && !_.isArray(res) ? null : res;
|
||||
},
|
||||
|
@ -381,7 +381,7 @@ export function getMiscellaneousSchema(fieldOptions) {
|
||||
}
|
||||
|
||||
export default class BackupSchema extends BaseUISchema {
|
||||
constructor(getSectionSchema, getTypeObjSchema, getSaveOptSchema, getQueryOptionSchema, getDisabledOptionSchema, getMiscellaneousSchema, fieldOptions = {}, treeNodeInfo, pgBrowser, backupType) {
|
||||
constructor(getSectionSchema, getTypeObjSchema, getSaveOptSchema, getQueryOptionSchema, getDisabledOptionSchema, getMiscellaneousSchema, fieldOptions = {}, treeNodeInfo=[], pgBrowser=null, backupType='server') {
|
||||
super({
|
||||
file: undefined,
|
||||
format: 'custom',
|
||||
|
@ -10,8 +10,7 @@
|
||||
/*
|
||||
* The ERDCore is the middleware between the canvas engine and the UI DOM.
|
||||
*/
|
||||
import createEngine from '@projectstorm/react-diagrams';
|
||||
import {DagreEngine, PathFindingLinkFactory, PortModelAlignment} from '@projectstorm/react-diagrams';
|
||||
import createEngine, {DagreEngine, PathFindingLinkFactory, PortModelAlignment} from '@projectstorm/react-diagrams';
|
||||
import { ZoomCanvasAction } from '@projectstorm/react-canvas-core';
|
||||
import _ from 'lodash';
|
||||
|
||||
|
@ -189,8 +189,7 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
|
||||
}, [nodeData]);
|
||||
|
||||
const wizardStepChange = (data) => {
|
||||
switch (data.currentStep) {
|
||||
case 2:
|
||||
if (data.currentStep == 2) {
|
||||
setLoaderText('Loading SQL ...');
|
||||
var msql_url = url_for(
|
||||
'grant_wizard.modified_sql', {
|
||||
@ -209,9 +208,6 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
|
||||
.catch(() => {
|
||||
Notify.error(gettext('Error while fetching SQL.'));
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -131,8 +131,7 @@ export default function ImportExportServers() {
|
||||
});
|
||||
|
||||
const wizardStepChange= (data) => {
|
||||
switch (data.currentStep) {
|
||||
case 2: {
|
||||
if (data.currentStep == 2) {
|
||||
let sumData = [],
|
||||
serverSerialNumber = 0;
|
||||
serverData.forEach((server_group) => {
|
||||
@ -158,10 +157,6 @@ export default function ImportExportServers() {
|
||||
setNoteText('On a successful import process, the browser tree will be refreshed.');
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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) {
|
||||
constructor(getRestoreSectionSchema, getRestoreTypeObjSchema, getRestoreSaveOptSchema, getRestoreQueryOptionSchema, getRestoreDisableOptionSchema, getRestoreMiscellaneousSchema, fieldOptions = {}, treeNodeInfo=[], pgBrowser=null) {
|
||||
super({
|
||||
custom: false,
|
||||
file: undefined,
|
||||
|
@ -569,18 +569,17 @@ WHERE db.datname = current_database()""")
|
||||
FROM
|
||||
pg_catalog.pg_stat_gssapi
|
||||
WHERE pid = pg_backend_pid()""")
|
||||
if status is None:
|
||||
if cur.rowcount > 0:
|
||||
res_enc = cur.fetchmany(1)[0]
|
||||
manager.db_info[res['did']]['gss_authenticated'] =\
|
||||
res_enc['gss_authenticated']
|
||||
manager.db_info[res['did']]['gss_encrypted'] = \
|
||||
res_enc['encrypted']
|
||||
if status is None and cur.rowcount > 0:
|
||||
res_enc = cur.fetchmany(1)[0]
|
||||
manager.db_info[res['did']]['gss_authenticated'] =\
|
||||
res_enc['gss_authenticated']
|
||||
manager.db_info[res['did']]['gss_encrypted'] = \
|
||||
res_enc['encrypted']
|
||||
|
||||
if len(manager.db_info) == 1:
|
||||
manager.gss_authenticated = \
|
||||
res_enc['gss_authenticated']
|
||||
manager.gss_encrypted = res_enc['encrypted']
|
||||
if len(manager.db_info) == 1:
|
||||
manager.gss_authenticated = \
|
||||
res_enc['gss_authenticated']
|
||||
manager.gss_encrypted = res_enc['encrypted']
|
||||
|
||||
self._set_user_info(cur, manager, **kwargs)
|
||||
|
||||
|
@ -3,8 +3,7 @@ import React from 'react';
|
||||
import {mount} from 'enzyme';
|
||||
import '../helper/enzyme.helper';
|
||||
|
||||
import Graphs, {GraphsWrapper} from '../../../pgadmin/dashboard/static/js/Graphs';
|
||||
import {X_AXIS_LENGTH, POINT_SIZE, transformData, legendCallback,
|
||||
import Graphs, {GraphsWrapper, X_AXIS_LENGTH, POINT_SIZE, transformData, legendCallback,
|
||||
getStatsUrl, statsReducer} from '../../../pgadmin/dashboard/static/js/Graphs';
|
||||
|
||||
describe('Graphs.js', ()=>{
|
||||
@ -166,4 +165,4 @@ describe('Graphs.js', ()=>{
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -15,8 +15,7 @@ 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 DomainSchema from '../../../pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain.ui';
|
||||
import { DomainConstSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain.ui';
|
||||
import DomainSchema, { DomainConstSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain.ui';
|
||||
|
||||
describe('DomainSchema', ()=>{
|
||||
let mount;
|
||||
|
@ -14,8 +14,7 @@ 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 PgaJobScheduleSchema from '../../../pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.ui';
|
||||
import { ExceptionsSchema } from '../../../pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.ui';
|
||||
import PgaJobScheduleSchema, { ExceptionsSchema } from '../../../pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.ui';
|
||||
|
||||
describe('PgaJobScheduleSchema', ()=>{
|
||||
let mount;
|
||||
|
@ -73,7 +73,7 @@ describe('SearchObjectsDialogWrapper', () => {
|
||||
},
|
||||
keyboardNavigation: jasmine.createSpyObj('keyboardNavigation', ['getDialogTabNavigator']),
|
||||
};
|
||||
pgBrowser.tree = new TreeFake(pgBrowser),
|
||||
pgBrowser.tree = new TreeFake(pgBrowser);
|
||||
noDataNode = pgBrowser.tree.addNewNode('level1.1', undefined, [{id: 'level1'}]);
|
||||
serverTreeNode = pgBrowser.tree.addNewNode('level2.1', {
|
||||
_type: 'server',
|
||||
|
@ -26,9 +26,7 @@ describe('#enableTriggers', () => {
|
||||
tree = new TreeFake();
|
||||
|
||||
spyOn(tree, 'unload').and.callFake(function() {
|
||||
return new Promise((resolve)=>{
|
||||
resolve('Success!');
|
||||
});
|
||||
return Promise.resolve('Success!');
|
||||
});
|
||||
|
||||
const server1 = tree.addNewNode('server1', {_id: 1}, ['<li>server1</li>']);
|
||||
@ -180,9 +178,7 @@ describe('#disableTriggers', () => {
|
||||
generateUrlSpy = jasmine.createSpy('generateUrl');
|
||||
generateUrlSpy.and.returnValue('/some/place');
|
||||
spyOn(tree, 'unload').and.callFake(function() {
|
||||
return new Promise((resolve)=>{
|
||||
resolve('Success!');
|
||||
});
|
||||
return Promise.resolve('Success!');
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -181,9 +181,7 @@ describe('tree tests', () => {
|
||||
'setActiveFile', 'closeDirectory', 'getActiveFile',
|
||||
'deSelectActiveFile']);
|
||||
tree.tree.unload.and.callFake(function() {
|
||||
return new Promise((resolve)=>{
|
||||
resolve('Success!');
|
||||
});
|
||||
return Promise.resolve('Success!');
|
||||
});
|
||||
});
|
||||
|
||||
@ -260,9 +258,7 @@ describe('tree tests', () => {
|
||||
tree.addNewNode('level3', {data: 'more data'}, ['<li>level3</li>'], ['level1','level2']);
|
||||
tree.tree = jasmine.createSpyObj('tree', ['unload']);
|
||||
tree.tree.unload.and.callFake(() => {
|
||||
return new Promise((resolve)=>{
|
||||
resolve('Success!');
|
||||
});
|
||||
return Promise.resolve('Success!');
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user