mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Remove unused files.
This commit is contained in:
parent
7330b3520f
commit
71d7b14320
@ -6,5 +6,3 @@
|
|||||||
// This software is released under the PostgreSQL Licence
|
// This software is released under the PostgreSQL Licence
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
import 'server_groups';
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
/////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// pgAdmin 4 - PostgreSQL Tools
|
|
||||||
//
|
|
||||||
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
|
||||||
// This software is released under the PostgreSQL Licence
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
import 'servers';
|
|
@ -1,88 +0,0 @@
|
|||||||
/////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// pgAdmin 4 - PostgreSQL Tools
|
|
||||||
//
|
|
||||||
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
|
||||||
// This software is released under the PostgreSQL Licence
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
export function initialize(pgBrowser, gettext) {
|
|
||||||
if (!pgBrowser.Nodes['coll-external_table']) {
|
|
||||||
pgBrowser.Nodes['coll-external_table'] =
|
|
||||||
pgBrowser.Collection.extend({
|
|
||||||
node: 'external_table',
|
|
||||||
label: gettext('External Tables'),
|
|
||||||
type: 'coll-external_tables',
|
|
||||||
columns: ['name', 'fdwowner', 'description'],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['external_table']) {
|
|
||||||
pgBrowser.Nodes['external_table'] = pgBrowser.Node.extend({
|
|
||||||
parent_type: 'database',
|
|
||||||
type: 'external_table',
|
|
||||||
label: gettext('External Table'),
|
|
||||||
collection_type: 'coll-external_table',
|
|
||||||
hasSQL: true,
|
|
||||||
model: pgBrowser.Node.Model.extend({
|
|
||||||
defaults: {
|
|
||||||
name: undefined,
|
|
||||||
type: undefined,
|
|
||||||
encoding: undefined,
|
|
||||||
format_type: undefined,
|
|
||||||
format_option: undefined,
|
|
||||||
external_options: undefined,
|
|
||||||
command: undefined,
|
|
||||||
execute_on: undefined,
|
|
||||||
},
|
|
||||||
schema: [
|
|
||||||
{
|
|
||||||
id: 'name',
|
|
||||||
label: gettext('Name'),
|
|
||||||
type: 'text',
|
|
||||||
mode: ['properties'],
|
|
||||||
}, {
|
|
||||||
id: 'type',
|
|
||||||
label: gettext('Type'),
|
|
||||||
type: 'text',
|
|
||||||
mode: ['properties'],
|
|
||||||
}, {
|
|
||||||
id: 'encoding',
|
|
||||||
label: gettext('Encoding'),
|
|
||||||
type: 'text',
|
|
||||||
mode: ['properties'],
|
|
||||||
}, {
|
|
||||||
id: 'format_type',
|
|
||||||
label: gettext('Format Type'),
|
|
||||||
type: 'text',
|
|
||||||
mode: ['properties'],
|
|
||||||
}, {
|
|
||||||
id: 'format_option',
|
|
||||||
label: gettext('Format Options'),
|
|
||||||
type: 'text',
|
|
||||||
mode: ['properties'],
|
|
||||||
}, {
|
|
||||||
id: 'external_options',
|
|
||||||
label: gettext('External Options'),
|
|
||||||
type: 'text',
|
|
||||||
mode: ['properties'],
|
|
||||||
}, {
|
|
||||||
id: 'command',
|
|
||||||
label: gettext('Command'),
|
|
||||||
type: 'text',
|
|
||||||
mode: ['properties'],
|
|
||||||
}, {
|
|
||||||
id: 'execute_on',
|
|
||||||
label: gettext('Execute on'),
|
|
||||||
type: 'text',
|
|
||||||
mode: ['properties'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return pgBrowser;
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
/////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// pgAdmin 4 - PostgreSQL Tools
|
|
||||||
//
|
|
||||||
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
|
||||||
// This software is released under the PostgreSQL Licence
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
import pgBrowser from 'top/browser/static/js/browser';
|
|
||||||
import gettext from 'sources/gettext';
|
|
||||||
import {initialize} from './external_tables';
|
|
||||||
|
|
||||||
let pgBrowserOut = initialize(pgBrowser, gettext);
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
pgBrowser: pgBrowserOut,
|
|
||||||
};
|
|
@ -1,10 +0,0 @@
|
|||||||
/////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// pgAdmin 4 - PostgreSQL Tools
|
|
||||||
//
|
|
||||||
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
|
||||||
// This software is released under the PostgreSQL Licence
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
import 'external_tables';
|
|
@ -1,11 +0,0 @@
|
|||||||
/////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// pgAdmin 4 - PostgreSQL Tools
|
|
||||||
//
|
|
||||||
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
|
||||||
// This software is released under the PostgreSQL Licence
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
import 'databases';
|
|
||||||
import 'model_validation';
|
|
@ -1,147 +0,0 @@
|
|||||||
/////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// pgAdmin 4 - PostgreSQL Tools
|
|
||||||
//
|
|
||||||
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
|
||||||
// This software is released under the PostgreSQL Licence
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
import gettext from 'sources/gettext';
|
|
||||||
import _ from 'underscore';
|
|
||||||
import {Address4, Address6} from 'ip-address';
|
|
||||||
|
|
||||||
export class ModelValidation {
|
|
||||||
constructor(model) {
|
|
||||||
this.err = {};
|
|
||||||
this.errmsg = '';
|
|
||||||
this.model = model;
|
|
||||||
}
|
|
||||||
|
|
||||||
validate() {
|
|
||||||
const serviceId = this.model.get('service'),
|
|
||||||
pub = this.model.get('pub');
|
|
||||||
|
|
||||||
if (!this.model.isNew() && 'id' in this.model.sessAttrs) {
|
|
||||||
this.err['id'] = gettext('The ID cannot be changed.');
|
|
||||||
this.errmsg = this.err['id'];
|
|
||||||
} else {
|
|
||||||
this.model.errorModel.unset('id');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.checkForEmpty('name', gettext('Name must be specified.'));
|
|
||||||
|
|
||||||
if (ModelValidation.isEmptyString(serviceId)) {
|
|
||||||
// Do not sent empty string
|
|
||||||
this.setNullValueForEmptyString('service');
|
|
||||||
this.checkHostAndHostAddress();
|
|
||||||
|
|
||||||
this.checkForEmpty('db', gettext('Maintenance database must be specified.'));
|
|
||||||
this.checkForEmpty('username', gettext('Username must be specified.'));
|
|
||||||
this.checkForEmpty('port', gettext('Port must be specified.'));
|
|
||||||
if(!_.isUndefined(pub)){
|
|
||||||
this.checkForEmpty('pub', gettext('Publication must be specified.'));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.checkForEmpty('db', gettext('Maintenance database must be specified.'));
|
|
||||||
if(!_.isUndefined(pub)){
|
|
||||||
this.checkForEmpty('pub', gettext('Publication must be specified.'));
|
|
||||||
}
|
|
||||||
this.clearHostAddressAndDbErrors();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.model.get('use_ssh_tunnel')) {
|
|
||||||
this.checkForEmpty('tunnel_host', gettext('SSH Tunnel host must be specified.'));
|
|
||||||
this.checkForEmpty('tunnel_port', gettext('SSH Tunnel port must be specified.'));
|
|
||||||
this.checkForEmpty('tunnel_username', gettext('SSH Tunnel username must be specified.'));
|
|
||||||
if (this.model.get('tunnel_authentication')) {
|
|
||||||
this.checkForEmpty('tunnel_identity_file', gettext('SSH Tunnel identity file must be specified.'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.model.errorModel.set(this.err);
|
|
||||||
|
|
||||||
if (_.size(this.err)) {
|
|
||||||
return this.errmsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
setNullValueForEmptyString(field) {
|
|
||||||
let val = this.model.get(field);
|
|
||||||
if (_.isUndefined(val) || _.isNull(val))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// To avoid passing empty string to connection parameter
|
|
||||||
if(String(val).trim() === '') {
|
|
||||||
this.model.set(field, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
clearHostAddressAndDbErrors() {
|
|
||||||
_.each(['host', 'hostaddr', 'db', 'username', 'port'], (item) => {
|
|
||||||
this.setNullValueForEmptyString(item);
|
|
||||||
this.model.errorModel.unset(item);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
checkHostAndHostAddress() {
|
|
||||||
|
|
||||||
let pub = this.model.get('pub'),
|
|
||||||
errmsg;
|
|
||||||
if(!_.isUndefined(pub)){
|
|
||||||
errmsg = gettext('Host name, Address must ' +
|
|
||||||
'be specified.');
|
|
||||||
}else{
|
|
||||||
errmsg = gettext('Either Host name, Address or Service must ' +
|
|
||||||
'be specified.');
|
|
||||||
}
|
|
||||||
const translatedStr = errmsg;
|
|
||||||
if (this.checkForEmpty('host', translatedStr) &&
|
|
||||||
this.checkForEmpty('hostaddr', translatedStr)) {
|
|
||||||
this.errmsg = this.errmsg || translatedStr;
|
|
||||||
} else {
|
|
||||||
this.errmsg = undefined;
|
|
||||||
delete this.err['host'];
|
|
||||||
delete this.err['hostaddr'];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.checkForValidIp(this.model.get('hostaddr'),
|
|
||||||
gettext('Host address must be valid IPv4 or IPv6 address.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
checkForValidIp(ipAddress, msg) {
|
|
||||||
if (ipAddress) {
|
|
||||||
try {
|
|
||||||
new Address4(ipAddress);
|
|
||||||
} catch(e) {
|
|
||||||
try {
|
|
||||||
new Address6(ipAddress);
|
|
||||||
} catch(ex) {
|
|
||||||
this.err['hostaddr'] = msg;
|
|
||||||
this.errmsg = msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.model.errorModel.unset('hostaddr');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkForEmpty(id, msg) {
|
|
||||||
const value = this.model.get(id);
|
|
||||||
|
|
||||||
if (ModelValidation.isEmptyString(value)) {
|
|
||||||
this.err[id] = msg;
|
|
||||||
this.errmsg = this.errmsg || msg;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
this.model.errorModel.unset(id);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static isEmptyString(string) {
|
|
||||||
return _.isUndefined(string) || _.isNull(string) || String(string).trim() === '';
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user