mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Update all Python and JS dependencies. Fixes #4019
This commit is contained in:
committed by
Dave Page
parent
c7b29d35ae
commit
e4417229aa
@@ -45,7 +45,7 @@ define('pgadmin.browser', [
|
||||
if (d && obj.Nodes[d._type].callbacks['selected'] &&
|
||||
_.isFunction(obj.Nodes[d._type].callbacks['selected'])) {
|
||||
return obj.Nodes[d._type].callbacks['selected'].apply(
|
||||
obj.Nodes[d._type], [i, d, obj]);
|
||||
obj.Nodes[d._type], [i, d, obj]);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -492,7 +492,7 @@ define('pgadmin.browser', [
|
||||
if (d && obj.Nodes[d._type]) {
|
||||
node = obj.Nodes[d._type];
|
||||
|
||||
/* If the node specific callback returns false, we will also return
|
||||
/* If the node specific callback returns false, we will also return
|
||||
* false for further processing.
|
||||
*/
|
||||
if (_.isObject(node.callbacks) &&
|
||||
@@ -535,8 +535,8 @@ define('pgadmin.browser', [
|
||||
url: url_for('misc.cleanup'),
|
||||
type:'POST',
|
||||
})
|
||||
.done(function() {})
|
||||
.fail(function() {});
|
||||
.done(function() {})
|
||||
.fail(function() {});
|
||||
}, 300000);
|
||||
|
||||
obj.Events.on('pgadmin:browser:tree:add', obj.onAddTreeNode, obj);
|
||||
@@ -571,13 +571,13 @@ define('pgadmin.browser', [
|
||||
'management', 'tools', 'help']) >= 0) {
|
||||
var menus;
|
||||
|
||||
// If current node is not visible in browser tree
|
||||
// then return from here
|
||||
// If current node is not visible in browser tree
|
||||
// then return from here
|
||||
if(!checkNodeVisibility(self, m.node)) {
|
||||
return;
|
||||
} else if(_.has(m, 'module') && !_.isUndefined(m.module)) {
|
||||
// If module to which this menu applies is not visible in
|
||||
// browser tree then also we do not display menu
|
||||
// If module to which this menu applies is not visible in
|
||||
// browser tree then also we do not display menu
|
||||
if(!checkNodeVisibility(self, m.module.type)) {
|
||||
return;
|
||||
}
|
||||
@@ -601,16 +601,16 @@ define('pgadmin.browser', [
|
||||
target: m.target, icon: m.icon,
|
||||
enable: (m.enable == '' ? true : (_.isString(m.enable) &&
|
||||
m.enable.toLowerCase() == 'false') ?
|
||||
false : m.enable),
|
||||
false : m.enable),
|
||||
node: m.node,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.warn(
|
||||
'Developer warning: Category \'' +
|
||||
'Developer warning: Category \'' +
|
||||
a +
|
||||
'\' is not supported!\nSupported categories are: context, file, edit, object, tools, management, help'
|
||||
);
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -628,17 +628,17 @@ define('pgadmin.browser', [
|
||||
{menu: 'management', id: '#mnu_management'},
|
||||
{menu: 'tools', id: '#mnu_tools'},
|
||||
{menu: 'help', id:'#mnu_help'}],
|
||||
function(o) {
|
||||
var $mnu = navbar.children(o.id).first(),
|
||||
$dropdown = $mnu.children('.dropdown-menu').first();
|
||||
$dropdown.empty();
|
||||
function(o) {
|
||||
var $mnu = navbar.children(o.id).first(),
|
||||
$dropdown = $mnu.children('.dropdown-menu').first();
|
||||
$dropdown.empty();
|
||||
|
||||
if (pgAdmin.Browser.MenuCreator(
|
||||
$dropdown, obj.menus[o.menu], obj.menu_categories
|
||||
)) {
|
||||
$mnu.removeClass('d-none');
|
||||
}
|
||||
});
|
||||
if (pgAdmin.Browser.MenuCreator(
|
||||
$dropdown, obj.menus[o.menu], obj.menu_categories
|
||||
)) {
|
||||
$mnu.removeClass('d-none');
|
||||
}
|
||||
});
|
||||
|
||||
navbar.children('#mnu_obj').removeClass('d-none');
|
||||
obj.enable_disable_menus();
|
||||
@@ -739,12 +739,12 @@ define('pgadmin.browser', [
|
||||
hasId: true,
|
||||
i: null, // current item
|
||||
p: _.toArray(_hierarchy || {}).sort(
|
||||
function(a, b) {
|
||||
return (a.priority === b.priority) ? 0 : (
|
||||
a.priority < b.priority ? -1 : 1
|
||||
);
|
||||
}
|
||||
), // path of the parent
|
||||
function(a, b) {
|
||||
return (a.priority === b.priority) ? 0 : (
|
||||
a.priority < b.priority ? -1 : 1
|
||||
);
|
||||
}
|
||||
), // path of the parent
|
||||
pathOfTreeItems: [], // path Item
|
||||
t: this.tree, // Tree Api
|
||||
o: _opts,
|
||||
@@ -893,8 +893,8 @@ define('pgadmin.browser', [
|
||||
if(
|
||||
is_parent_loaded_before &&
|
||||
_parent_data && _parent_data._type.search(
|
||||
_data._type
|
||||
) > -1
|
||||
_data._type
|
||||
) > -1
|
||||
) {
|
||||
ctx.t.openPath(i);
|
||||
ctx.t.select(i);
|
||||
@@ -988,12 +988,12 @@ define('pgadmin.browser', [
|
||||
i: null, // current item
|
||||
hasId: true,
|
||||
p: _.toArray(_hierarchy || {}).sort(
|
||||
function(a, b) {
|
||||
return (a.priority === b.priority) ? 0 : (
|
||||
a.priority < b.priority ? -1 : 1
|
||||
);
|
||||
}
|
||||
), // path of the old object
|
||||
function(a, b) {
|
||||
return (a.priority === b.priority) ? 0 : (
|
||||
a.priority < b.priority ? -1 : 1
|
||||
);
|
||||
}
|
||||
), // path of the old object
|
||||
pathOfTreeItems: [], // path items
|
||||
t: this.tree, // Tree Api
|
||||
o: _opts,
|
||||
@@ -1035,9 +1035,9 @@ define('pgadmin.browser', [
|
||||
&& this.t.hasParent(this.i)
|
||||
&& this.t.parent(this.i)) || null,
|
||||
_item_grand_parent = _item_parent ?
|
||||
(this.t.hasParent(_item_parent)
|
||||
(this.t.hasParent(_item_parent)
|
||||
&& this.t.parent(_item_parent))
|
||||
: null;
|
||||
: null;
|
||||
|
||||
// Remove the current node first.
|
||||
if (
|
||||
@@ -1147,7 +1147,7 @@ define('pgadmin.browser', [
|
||||
self.t.unload(_parent, {success: function() {
|
||||
setTimeout(postRemove);
|
||||
}}
|
||||
);
|
||||
);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
@@ -1541,73 +1541,73 @@ define('pgadmin.browser', [
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
})
|
||||
.done(function(res) {
|
||||
.done(function(res) {
|
||||
// Node information can come as result/data
|
||||
var newData = res.result || res.data;
|
||||
var newData = res.result || res.data;
|
||||
|
||||
newData._label = newData.label;
|
||||
newData.label = _.escape(newData.label);
|
||||
newData._label = newData.label;
|
||||
newData.label = _.escape(newData.label);
|
||||
|
||||
ctx.t.setLabel(ctx.i, {label: newData.label});
|
||||
ctx.t.addIcon(ctx.i, {icon: newData.icon});
|
||||
ctx.t.setId(ctx.i, {id: newData.id});
|
||||
if (newData.inode)
|
||||
ctx.t.setInode(ctx.i, {inode: true});
|
||||
ctx.t.setLabel(ctx.i, {label: newData.label});
|
||||
ctx.t.addIcon(ctx.i, {icon: newData.icon});
|
||||
ctx.t.setId(ctx.i, {id: newData.id});
|
||||
if (newData.inode)
|
||||
ctx.t.setInode(ctx.i, {inode: true});
|
||||
|
||||
// This will update the tree item data.
|
||||
var itemData = ctx.t.itemData(ctx.i);
|
||||
_.extend(itemData, newData);
|
||||
// This will update the tree item data.
|
||||
var itemData = ctx.t.itemData(ctx.i);
|
||||
_.extend(itemData, newData);
|
||||
|
||||
if (
|
||||
_n.can_expand && typeof(_n.can_expand) == 'function'
|
||||
) {
|
||||
if (!_n.can_expand(itemData)) {
|
||||
ctx.t.unload(ctx.i);
|
||||
return;
|
||||
if (
|
||||
_n.can_expand && typeof(_n.can_expand) == 'function'
|
||||
) {
|
||||
if (!_n.can_expand(itemData)) {
|
||||
ctx.t.unload(ctx.i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
ctx.b._refreshNode(ctx, ctx.branch);
|
||||
var success = (ctx.o && ctx.o.success) || ctx.success;
|
||||
if (success && typeof(success) == 'function') {
|
||||
success();
|
||||
}
|
||||
})
|
||||
.fail(function(xhr, error, status) {
|
||||
if (
|
||||
!Alertify.pgHandleItemError(
|
||||
xhr, error, status, {item: _i, info: info}
|
||||
)
|
||||
) {
|
||||
var contentType = xhr.getResponseHeader('Content-Type'),
|
||||
jsonResp = (
|
||||
contentType &&
|
||||
ctx.b._refreshNode(ctx, ctx.branch);
|
||||
var success = (ctx.o && ctx.o.success) || ctx.success;
|
||||
if (success && typeof(success) == 'function') {
|
||||
success();
|
||||
}
|
||||
})
|
||||
.fail(function(xhr, error, status) {
|
||||
if (
|
||||
!Alertify.pgHandleItemError(
|
||||
xhr, error, status, {item: _i, info: info}
|
||||
)
|
||||
) {
|
||||
var contentType = xhr.getResponseHeader('Content-Type'),
|
||||
jsonResp = (
|
||||
contentType &&
|
||||
contentType.indexOf('application/json') == 0 &&
|
||||
JSON.parse(xhr.responseText)
|
||||
) || {};
|
||||
) || {};
|
||||
|
||||
if (xhr.status == 410 && jsonResp.success == 0) {
|
||||
var p = ctx.t.parent(ctx.i);
|
||||
if (xhr.status == 410 && jsonResp.success == 0) {
|
||||
var p = ctx.t.parent(ctx.i);
|
||||
|
||||
ctx.t.remove(ctx.i, {
|
||||
success: function() {
|
||||
if (p) {
|
||||
ctx.t.remove(ctx.i, {
|
||||
success: function() {
|
||||
if (p) {
|
||||
// Try to refresh the parent on error
|
||||
try {
|
||||
pgBrowser.Events.trigger(
|
||||
'pgadmin:browser:tree:refresh', p
|
||||
);
|
||||
} catch (e) { console.warn(e.stack || e); }
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
try {
|
||||
pgBrowser.Events.trigger(
|
||||
'pgadmin:browser:tree:refresh', p
|
||||
);
|
||||
} catch (e) { console.warn(e.stack || e); }
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Alertify.pgNotifier(
|
||||
error, xhr, gettext('Error retrieving details for the node.'),
|
||||
function() { console.warn(arguments); }
|
||||
);
|
||||
}
|
||||
});
|
||||
Alertify.pgNotifier(
|
||||
error, xhr, gettext('Error retrieving details for the node.'),
|
||||
function() { console.warn(arguments); }
|
||||
);
|
||||
}
|
||||
});
|
||||
}.bind(this);
|
||||
|
||||
if (n && n.collection_node) {
|
||||
@@ -1792,16 +1792,16 @@ define('pgadmin.browser', [
|
||||
url: childNodeUrl,
|
||||
dataType: 'json',
|
||||
})
|
||||
.done(function(res) {
|
||||
if (res.success) {
|
||||
arrayChildNodeData.push(res.data);
|
||||
}
|
||||
fetchNodeInfo(_callback);
|
||||
})
|
||||
.fail(function(xhr, status, error) {
|
||||
Alertify.pgRespErrorNotify(xhr, error);
|
||||
fetchNodeInfo(_callback);
|
||||
});
|
||||
.done(function(res) {
|
||||
if (res.success) {
|
||||
arrayChildNodeData.push(res.data);
|
||||
}
|
||||
fetchNodeInfo(_callback);
|
||||
})
|
||||
.fail(function(xhr, status, error) {
|
||||
Alertify.pgRespErrorNotify(xhr, error);
|
||||
fetchNodeInfo(_callback);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1885,33 +1885,33 @@ define('pgadmin.browser', [
|
||||
'Ctrl-Space': 'autocomplete',
|
||||
'Cmd-Space': 'autocomplete',
|
||||
|
||||
// Select All text
|
||||
// Select All text
|
||||
'Ctrl-A': 'selectAll',
|
||||
'Cmd-A': 'selectAll',
|
||||
|
||||
// Redo text
|
||||
// Redo text
|
||||
'Ctrl-Y': 'redo',
|
||||
'Cmd-Y': 'redo',
|
||||
|
||||
// Undo text
|
||||
// Undo text
|
||||
'Ctrl-Z': 'undo',
|
||||
'Cmd-Z': 'undo',
|
||||
|
||||
// Delete Line
|
||||
// Delete Line
|
||||
'Ctrl-D': 'deleteLine',
|
||||
'Cmd-D': 'deleteLine',
|
||||
|
||||
// Go to start/end of Line
|
||||
// Go to start/end of Line
|
||||
'Alt-Left': 'goLineStart',
|
||||
'Alt-Right': 'goLineEnd',
|
||||
|
||||
// Move word by word left/right
|
||||
// Move word by word left/right
|
||||
'Ctrl-Alt-Left': 'goGroupLeft',
|
||||
'Cmd-Alt-Left': 'goGroupLeft',
|
||||
'Ctrl-Alt-Right': 'goGroupRight',
|
||||
'Cmd-Alt-Right': 'goGroupRight',
|
||||
|
||||
// Allow user to delete Tab(s)
|
||||
// Allow user to delete Tab(s)
|
||||
'Shift-Tab': 'indentLess',
|
||||
},
|
||||
editor_options: {
|
||||
@@ -1944,7 +1944,7 @@ define('pgadmin.browser', [
|
||||
},
|
||||
});
|
||||
|
||||
/* Remove paste event mapping from CodeMirror's emacsy KeyMap binding
|
||||
/* Remove paste event mapping from CodeMirror's emacsy KeyMap binding
|
||||
* specific to Mac LineNumber:5797 - lib/Codemirror.js
|
||||
* It is preventing default paste event(Cmd-V) from triggering
|
||||
* in runtime.
|
||||
|
||||
@@ -76,7 +76,7 @@ define([
|
||||
j = panel.$container.find('.obj_properties').first(),
|
||||
view = j.data('obj-view'),
|
||||
content = $('<div></div>')
|
||||
.addClass('pg-prop-content col-12 has-pg-prop-btn-group'),
|
||||
.addClass('pg-prop-content col-12 has-pg-prop-btn-group'),
|
||||
node = pgBrowser.Nodes[that.node],
|
||||
$msgContainer = '',
|
||||
// This will be the URL, used for object manipulation.
|
||||
@@ -136,9 +136,9 @@ define([
|
||||
}))();
|
||||
// Add the new column for the multi-select menus
|
||||
if((_.isFunction(that.canDrop) ?
|
||||
that.canDrop.apply(that, [data, item]) : that.canDrop) ||
|
||||
that.canDrop.apply(that, [data, item]) : that.canDrop) ||
|
||||
(_.isFunction(that.canDropCascade) ?
|
||||
that.canDropCascade.apply(that, [data, item]) : that.canDropCascade)) {
|
||||
that.canDropCascade.apply(that, [data, item]) : that.canDropCascade)) {
|
||||
gridSchema.columns.unshift({
|
||||
name: 'oid',
|
||||
cell: Backgrid.Extension.SelectRowCell.extend({
|
||||
@@ -178,7 +178,7 @@ define([
|
||||
headerCell: Backgrid.Extension.SelectAllHeaderCell,
|
||||
});
|
||||
}
|
||||
// Initialize a new Grid instance
|
||||
// Initialize a new Grid instance
|
||||
that.grid = new Backgrid.Grid({
|
||||
emptyText: 'No data found',
|
||||
columns: gridSchema.columns,
|
||||
@@ -224,10 +224,10 @@ define([
|
||||
$msgContainer = $($msgContainer).appendTo(j);
|
||||
|
||||
that.header = $('<div></div>').addClass(
|
||||
'pg-prop-header'
|
||||
'pg-prop-header'
|
||||
);
|
||||
|
||||
// Render the buttons
|
||||
// Render the buttons
|
||||
var buttons = [];
|
||||
|
||||
buttons.push({
|
||||
@@ -282,51 +282,51 @@ define([
|
||||
}, 1000);
|
||||
},
|
||||
})
|
||||
.done(function(res) {
|
||||
clearTimeout(timer);
|
||||
.done(function(res) {
|
||||
clearTimeout(timer);
|
||||
|
||||
if (_.isUndefined(that.grid) || _.isNull(that.grid)) return;
|
||||
if (_.isUndefined(that.grid) || _.isNull(that.grid)) return;
|
||||
|
||||
that.data = res;
|
||||
that.data = res;
|
||||
|
||||
if (that.data.length > 0) {
|
||||
if (that.data.length > 0) {
|
||||
|
||||
if (!$msgContainer.hasClass('d-none')) {
|
||||
$msgContainer.addClass('d-none');
|
||||
}
|
||||
that.header.appendTo(j);
|
||||
j.append(content);
|
||||
if (!$msgContainer.hasClass('d-none')) {
|
||||
$msgContainer.addClass('d-none');
|
||||
}
|
||||
that.header.appendTo(j);
|
||||
j.append(content);
|
||||
|
||||
// Listen scroll event to load more rows
|
||||
$('.pg-prop-content').on('scroll', that.__loadMoreRows.bind(that));
|
||||
// Listen scroll event to load more rows
|
||||
$('.pg-prop-content').on('scroll', that.__loadMoreRows.bind(that));
|
||||
|
||||
that.collection.reset(that.data.splice(0, 50));
|
||||
} else {
|
||||
that.collection.reset(that.data.splice(0, 50));
|
||||
} else {
|
||||
// Do not listen the scroll event
|
||||
$('.pg-prop-content').off('scroll', that.__loadMoreRows);
|
||||
$('.pg-prop-content').off('scroll', that.__loadMoreRows);
|
||||
|
||||
$msgContainer.text(gettext('No properties are available for the selected object.'));
|
||||
$msgContainer.text(gettext('No properties are available for the selected object.'));
|
||||
|
||||
}
|
||||
})
|
||||
.fail(function(xhr, error) {
|
||||
pgBrowser.Events.trigger(
|
||||
'pgadmin:node:retrieval:error', 'properties', xhr, error.message, item, that
|
||||
);
|
||||
if (!Alertify.pgHandleItemError(xhr, error.message, {
|
||||
item: item,
|
||||
info: info,
|
||||
})) {
|
||||
Alertify.pgNotifier(
|
||||
error, xhr,
|
||||
S(gettext('Error retrieving properties - %s')).sprintf(
|
||||
error.message || that.label).value(), function() {
|
||||
console.warn(arguments);
|
||||
});
|
||||
}
|
||||
// show failed message.
|
||||
$msgContainer.text(gettext('Failed to retrieve data from the server.'));
|
||||
});
|
||||
}
|
||||
})
|
||||
.fail(function(xhr, error) {
|
||||
pgBrowser.Events.trigger(
|
||||
'pgadmin:node:retrieval:error', 'properties', xhr, error.message, item, that
|
||||
);
|
||||
if (!Alertify.pgHandleItemError(xhr, error.message, {
|
||||
item: item,
|
||||
info: info,
|
||||
})) {
|
||||
Alertify.pgNotifier(
|
||||
error, xhr,
|
||||
S(gettext('Error retrieving properties - %s')).sprintf(
|
||||
error.message || that.label).value(), function() {
|
||||
console.warn(arguments);
|
||||
});
|
||||
}
|
||||
// show failed message.
|
||||
$msgContainer.text(gettext('Failed to retrieve data from the server.'));
|
||||
});
|
||||
|
||||
var onDrop = function(type) {
|
||||
let sel_row_models = this.grid.getSelectedModels(),
|
||||
@@ -366,45 +366,45 @@ define([
|
||||
data: JSON.stringify({'ids': sel_rows}),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
})
|
||||
.done(function(res) {
|
||||
if (res.success == 0) {
|
||||
pgBrowser.report_error(res.errormsg, res.info);
|
||||
} else {
|
||||
.done(function(res) {
|
||||
if (res.success == 0) {
|
||||
pgBrowser.report_error(res.errormsg, res.info);
|
||||
} else {
|
||||
$(pgBrowser.panels['properties'].panel).removeData('node-prop');
|
||||
pgBrowser.Events.trigger(
|
||||
'pgadmin:browser:tree:refresh', item || pgBrowser.tree.selected(), {
|
||||
success: function() {
|
||||
node.callbacks.selected.apply(node, [item]);
|
||||
},
|
||||
});
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.fail(function(jqx) {
|
||||
var msg = jqx.responseText;
|
||||
/* Error from the server */
|
||||
if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
|
||||
try {
|
||||
var data = JSON.parse(jqx.responseText);
|
||||
msg = data.errormsg;
|
||||
} catch (e) {
|
||||
console.warn(e.stack || e);
|
||||
}
|
||||
}
|
||||
pgBrowser.report_error(
|
||||
S(gettext('Error dropping %s'))
|
||||
.sprintf(d._label.toLowerCase())
|
||||
.value(), msg);
|
||||
|
||||
$(pgBrowser.panels['properties'].panel).removeData('node-prop');
|
||||
pgBrowser.Events.trigger(
|
||||
'pgadmin:browser:tree:refresh', item || pgBrowser.tree.selected(), {
|
||||
success: function() {
|
||||
node.callbacks.selected.apply(node, [item]);
|
||||
},
|
||||
});
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.fail(function(jqx) {
|
||||
var msg = jqx.responseText;
|
||||
/* Error from the server */
|
||||
if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
|
||||
try {
|
||||
var data = JSON.parse(jqx.responseText);
|
||||
msg = data.errormsg;
|
||||
} catch (e) {
|
||||
console.warn(e.stack || e);
|
||||
}
|
||||
}
|
||||
pgBrowser.report_error(
|
||||
S(gettext('Error dropping %s'))
|
||||
.sprintf(d._label.toLowerCase())
|
||||
.value(), msg);
|
||||
|
||||
$(pgBrowser.panels['properties'].panel).removeData('node-prop');
|
||||
pgBrowser.Events.trigger(
|
||||
'pgadmin:browser:tree:refresh', item || pgBrowser.tree.selected(), {
|
||||
success: function() {
|
||||
node.callbacks.selected.apply(node, [item]);
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
'pgadmin:browser:tree:refresh', item || pgBrowser.tree.selected(), {
|
||||
success: function() {
|
||||
node.callbacks.selected.apply(node, [item]);
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
null).show();
|
||||
return;
|
||||
|
||||
@@ -36,7 +36,7 @@ define([
|
||||
obj = new(pgBrowser.Node.Collection)(val, {
|
||||
model: ((_.isString(s.model) &&
|
||||
s.model in pgBrowser.Nodes) ?
|
||||
pgBrowser.Nodes[s.model].model : s.model),
|
||||
pgBrowser.Nodes[s.model].model : s.model),
|
||||
top: self.top || self,
|
||||
handler: self,
|
||||
parse: true,
|
||||
@@ -44,7 +44,7 @@ define([
|
||||
attrName: s.id,
|
||||
});
|
||||
|
||||
/*
|
||||
/*
|
||||
* Nested collection models may or may not have idAttribute.
|
||||
* So to decide whether model is new or not set 'on_server'
|
||||
* flag on such models.
|
||||
@@ -56,7 +56,7 @@ define([
|
||||
on_server: true,
|
||||
});
|
||||
} else {
|
||||
/*
|
||||
/*
|
||||
* Nested collection models may or may not have idAttribute.
|
||||
* So to decide whether model is new or not set 'on_server'
|
||||
* flag on such models.
|
||||
@@ -83,13 +83,13 @@ define([
|
||||
if (_.isString(s.model) &&
|
||||
s.model in pgBrowser.Nodes[s.model]) {
|
||||
obj = new(pgBrowser.Nodes[s.model].Model)(
|
||||
obj, {
|
||||
silent: true,
|
||||
top: self.top || self,
|
||||
handler: self,
|
||||
attrName: s.id,
|
||||
}
|
||||
);
|
||||
obj, {
|
||||
silent: true,
|
||||
top: self.top || self,
|
||||
handler: self,
|
||||
attrName: s.id,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
obj = new(s.model)(obj, {
|
||||
silent: true,
|
||||
@@ -163,7 +163,7 @@ define([
|
||||
self.objects = [];
|
||||
self.arrays = [];
|
||||
self.attrName = options.attrName,
|
||||
self.top = (options.top || self.collection && self.collection.top || self.collection || self);
|
||||
self.top = (options.top || self.collection && self.collection.top || self.collection || self);
|
||||
self.handler = options.handler ||
|
||||
(self.collection && self.collection.handler);
|
||||
self.trackChanges = false;
|
||||
@@ -234,19 +234,19 @@ define([
|
||||
if (_.isString(s.model) &&
|
||||
s.model in pgBrowser.Nodes[s.model]) {
|
||||
obj = new(pgBrowser.Nodes[s.model].Model)(
|
||||
obj, {
|
||||
top: self.top || self,
|
||||
handler: self,
|
||||
attrName: s.id,
|
||||
}
|
||||
);
|
||||
obj, {
|
||||
top: self.top || self,
|
||||
handler: self,
|
||||
attrName: s.id,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
obj = new(s.model)(
|
||||
obj, {
|
||||
top: self.top || self,
|
||||
handler: self,
|
||||
attrName: s.id,
|
||||
});
|
||||
obj, {
|
||||
top: self.top || self,
|
||||
handler: self,
|
||||
attrName: s.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,26 +549,26 @@ define([
|
||||
typeof(obj.primary_key) === 'function';
|
||||
var key = hasPrimaryKey ? obj.primary_key() : obj.cid,
|
||||
comparator = hasPrimaryKey ?
|
||||
function(k) {
|
||||
var o = self.get('k');
|
||||
function(k) {
|
||||
var o = self.get('k');
|
||||
|
||||
if (o && o.primary_key() === key) {
|
||||
objName = k;
|
||||
return true;
|
||||
}
|
||||
if (o && o.primary_key() === key) {
|
||||
objName = k;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} :
|
||||
function(k) {
|
||||
var o = self.get(k);
|
||||
return false;
|
||||
} :
|
||||
function(k) {
|
||||
var o = self.get(k);
|
||||
|
||||
if (o.cid === key) {
|
||||
objName = k;
|
||||
return true;
|
||||
}
|
||||
if (o.cid === key) {
|
||||
objName = k;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
return false;
|
||||
};
|
||||
_.findIndex(self.objects, comparator);
|
||||
}
|
||||
|
||||
@@ -599,26 +599,26 @@ define([
|
||||
(typeof(obj.primary_key) === 'function'));
|
||||
var key = hasPrimaryKey ? obj.primary_key() : obj.cid,
|
||||
comparator = hasPrimaryKey ?
|
||||
function(k) {
|
||||
var o = self.get('k');
|
||||
function(k) {
|
||||
var o = self.get('k');
|
||||
|
||||
if (o && o.primary_key() === key) {
|
||||
objName = k;
|
||||
return true;
|
||||
}
|
||||
if (o && o.primary_key() === key) {
|
||||
objName = k;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} :
|
||||
function(k) {
|
||||
var o = self.get('k');
|
||||
return false;
|
||||
} :
|
||||
function(k) {
|
||||
var o = self.get('k');
|
||||
|
||||
if (o && o.cid === key) {
|
||||
objName = k;
|
||||
return true;
|
||||
}
|
||||
if (o && o.cid === key) {
|
||||
objName = k;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
return false;
|
||||
};
|
||||
|
||||
_.findIndex(self.objects, comparator);
|
||||
}
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
define(
|
||||
['sources/gettext', 'underscore', 'alertify', 'sources/pgadmin'],
|
||||
function(gettext, _, alertify, pgAdmin) {
|
||||
pgAdmin.Browser = pgAdmin.Browser || {};
|
||||
['sources/gettext', 'underscore', 'alertify', 'sources/pgadmin'],
|
||||
function(gettext, _, alertify, pgAdmin) {
|
||||
pgAdmin.Browser = pgAdmin.Browser || {};
|
||||
|
||||
_.extend(pgAdmin.Browser, {
|
||||
report_error: function(title, message, info) {
|
||||
title = _.escape(title);
|
||||
message = _.escape(message);
|
||||
info = _.escape(info);
|
||||
let text = '<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">\
|
||||
_.extend(pgAdmin.Browser, {
|
||||
report_error: function(title, message, info) {
|
||||
title = _.escape(title);
|
||||
message = _.escape(message);
|
||||
info = _.escape(info);
|
||||
let text = '<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">\
|
||||
<div class="panel panel-default">\
|
||||
<div class="panel-heading" role="tab" id="headingOne">\
|
||||
<h4 class="panel-title">\
|
||||
@@ -30,8 +30,8 @@ function(gettext, _, alertify, pgAdmin) {
|
||||
</div>\
|
||||
</div>';
|
||||
|
||||
if (info != null && info != '') {
|
||||
text += '<div class="panel panel-default">\
|
||||
if (info != null && info != '') {
|
||||
text += '<div class="panel panel-default">\
|
||||
<div class="panel-heading" role="tab" id="headingTwo">\
|
||||
<h4 class="panel-title">\
|
||||
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">\
|
||||
@@ -43,15 +43,15 @@ function(gettext, _, alertify, pgAdmin) {
|
||||
</div>\
|
||||
</div>\
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
text += '</div>';
|
||||
alertify.alert(
|
||||
title,
|
||||
text
|
||||
).set('closable', true);
|
||||
},
|
||||
text += '</div>';
|
||||
alertify.alert(
|
||||
title,
|
||||
text
|
||||
).set('closable', true);
|
||||
},
|
||||
});
|
||||
|
||||
return pgAdmin.Browser.report_error;
|
||||
});
|
||||
|
||||
return pgAdmin.Browser.report_error;
|
||||
});
|
||||
|
||||
@@ -113,8 +113,8 @@ define([
|
||||
cb;
|
||||
|
||||
if (o.module['callbacks'] && (
|
||||
o.callback in o.module['callbacks']
|
||||
)) {
|
||||
o.callback in o.module['callbacks']
|
||||
)) {
|
||||
cb = o.module['callbacks'][o.callback];
|
||||
} else if (o.callback in o.module) {
|
||||
cb = o.module[o.callback];
|
||||
@@ -141,8 +141,8 @@ define([
|
||||
return true;
|
||||
}
|
||||
if (_.isArray(this.node) ? (
|
||||
_.indexOf(this.node, node) == -1
|
||||
) : (this.node != node._type)) {
|
||||
_.indexOf(this.node, node) == -1
|
||||
) : (this.node != node._type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,11 +423,11 @@ define('pgadmin.browser.node', [
|
||||
xhr, error, message, item
|
||||
);
|
||||
if (!Alertify.pgHandleItemError(
|
||||
xhr, error, message, {
|
||||
item: item,
|
||||
info: info,
|
||||
}
|
||||
)) {
|
||||
xhr, error, message, {
|
||||
item: item,
|
||||
info: info,
|
||||
}
|
||||
)) {
|
||||
Alertify.pgNotifier(
|
||||
error, xhr,
|
||||
S(
|
||||
@@ -738,10 +738,10 @@ define('pgadmin.browser.node', [
|
||||
title = S(gettext('DROP CASCADE %s?')).sprintf(obj.label).value();
|
||||
|
||||
if (!(_.isFunction(obj.canDropCascade) ?
|
||||
obj.canDropCascade.apply(obj, [d, i]) : obj.canDropCascade)) {
|
||||
obj.canDropCascade.apply(obj, [d, i]) : obj.canDropCascade)) {
|
||||
Alertify.error(
|
||||
S(gettext('The %s "%s" cannot be dropped.'))
|
||||
.sprintf(obj.label, d.label).value(),
|
||||
.sprintf(obj.label, d.label).value(),
|
||||
10
|
||||
);
|
||||
return;
|
||||
@@ -752,10 +752,10 @@ define('pgadmin.browser.node', [
|
||||
title = S(gettext('DROP %s?')).sprintf(obj.label).value();
|
||||
|
||||
if (!(_.isFunction(obj.canDrop) ?
|
||||
obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) {
|
||||
obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) {
|
||||
Alertify.error(
|
||||
S(gettext('The %s "%s" cannot be dropped.'))
|
||||
.sprintf(obj.label, d.label).value(),
|
||||
.sprintf(obj.label, d.label).value(),
|
||||
10
|
||||
);
|
||||
return;
|
||||
@@ -767,30 +767,30 @@ define('pgadmin.browser.node', [
|
||||
url: obj.generate_url(i, input.url, d, true),
|
||||
type: 'DELETE',
|
||||
})
|
||||
.done(function(res) {
|
||||
if (res.success == 0) {
|
||||
pgBrowser.report_error(res.errormsg, res.info);
|
||||
} else {
|
||||
pgBrowser.removeTreeNode(i, true);
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.fail(function(jqx) {
|
||||
var msg = jqx.responseText;
|
||||
/* Error from the server */
|
||||
if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
|
||||
try {
|
||||
var data = JSON.parse(jqx.responseText);
|
||||
msg = data.errormsg;
|
||||
} catch (e) {
|
||||
console.warn(e.stack || e);
|
||||
.done(function(res) {
|
||||
if (res.success == 0) {
|
||||
pgBrowser.report_error(res.errormsg, res.info);
|
||||
} else {
|
||||
pgBrowser.removeTreeNode(i, true);
|
||||
}
|
||||
}
|
||||
pgBrowser.report_error(
|
||||
S(gettext('Error dropping %s: "%s"'))
|
||||
.sprintf(obj.label, objName)
|
||||
.value(), msg);
|
||||
});
|
||||
return true;
|
||||
})
|
||||
.fail(function(jqx) {
|
||||
var msg = jqx.responseText;
|
||||
/* Error from the server */
|
||||
if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
|
||||
try {
|
||||
var data = JSON.parse(jqx.responseText);
|
||||
msg = data.errormsg;
|
||||
} catch (e) {
|
||||
console.warn(e.stack || e);
|
||||
}
|
||||
}
|
||||
pgBrowser.report_error(
|
||||
S(gettext('Error dropping %s: "%s"'))
|
||||
.sprintf(obj.label, objName)
|
||||
.value(), msg);
|
||||
});
|
||||
},
|
||||
null).show();
|
||||
},
|
||||
@@ -913,7 +913,7 @@ define('pgadmin.browser.node', [
|
||||
}
|
||||
|
||||
pgBrowser.Events.trigger('pgadmin:browser:tree:expand-from-previous-tree-state',
|
||||
item);
|
||||
item);
|
||||
pgBrowser.Node.callbacks.change_server_background(item, data);
|
||||
},
|
||||
// Callback called - when a node is selected in browser tree.
|
||||
@@ -944,7 +944,7 @@ define('pgadmin.browser.node', [
|
||||
}
|
||||
|
||||
pgBrowser.Events.trigger('pgadmin:browser:tree:update-tree-state',
|
||||
item);
|
||||
item);
|
||||
return true;
|
||||
},
|
||||
removed: function(item) {
|
||||
@@ -1003,7 +1003,7 @@ define('pgadmin.browser.node', [
|
||||
auto_expand = pgBrowser.get_preference('browser', 'auto_expand_sole_children');
|
||||
|
||||
pgBrowser.Events.trigger('pgadmin:browser:tree:update-tree-state',
|
||||
item);
|
||||
item);
|
||||
|
||||
if (auto_expand && auto_expand.value == true && tree.children(item).length == 1) {
|
||||
// Automatically expand the child node, if a treeview node has only a single child.
|
||||
@@ -1013,7 +1013,7 @@ define('pgadmin.browser.node', [
|
||||
},
|
||||
closed: function(item) {
|
||||
pgBrowser.Events.trigger('pgadmin:browser:tree:remove-from-tree-state',
|
||||
item);
|
||||
item);
|
||||
},
|
||||
},
|
||||
/**********************************************************************
|
||||
@@ -1029,7 +1029,7 @@ define('pgadmin.browser.node', [
|
||||
j = panel.$container.find('.obj_properties').first(),
|
||||
view = j.data('obj-view'),
|
||||
content = $('<div tabindex="1"></div>')
|
||||
.addClass('pg-prop-content col-12');
|
||||
.addClass('pg-prop-content col-12');
|
||||
|
||||
// Handle key press events for Cancel, save and help button
|
||||
var handleKeyDown = function(event, context) {
|
||||
@@ -1041,12 +1041,12 @@ define('pgadmin.browser.node', [
|
||||
closePanel();
|
||||
break;
|
||||
case keyCode.ENTER:
|
||||
// Return if event is fired from child element
|
||||
// Return if event is fired from child element
|
||||
if (event.target !== context) return;
|
||||
if (view && view.model && view.model.sessChanged()) {
|
||||
var btn = $(event.target).closest('.obj_properties')
|
||||
.find('.pg-prop-btn-group')
|
||||
.find('button.btn-primary');
|
||||
.find('.pg-prop-btn-group')
|
||||
.find('button.btn-primary');
|
||||
onSave.call(this, view, btn);
|
||||
}
|
||||
break;
|
||||
@@ -1364,8 +1364,8 @@ define('pgadmin.browser.node', [
|
||||
|
||||
panel.icon(
|
||||
_.isFunction(that['node_image']) ?
|
||||
(that['node_image']).apply(that, [data, view.model]) :
|
||||
(that['node_image'] || ('icon-' + that.type))
|
||||
(that['node_image']).apply(that, [data, view.model]) :
|
||||
(that['node_image'] || ('icon-' + that.type))
|
||||
);
|
||||
|
||||
// Create proper buttons
|
||||
|
||||
@@ -165,16 +165,16 @@ define([
|
||||
async: false,
|
||||
url: full_url,
|
||||
})
|
||||
.done(function(res) {
|
||||
.done(function(res) {
|
||||
/*
|
||||
* We will cache this data for short period of time for avoiding
|
||||
* same calls.
|
||||
*/
|
||||
data = cache_node.cache(node.type + '#' + url, node_info, cache_level, res.data);
|
||||
})
|
||||
.fail(function() {
|
||||
m.trigger('pgadmin:view:fetch:error', m, self.field);
|
||||
});
|
||||
data = cache_node.cache(node.type + '#' + url, node_info, cache_level, res.data);
|
||||
})
|
||||
.fail(function() {
|
||||
m.trigger('pgadmin:view:fetch:error', m, self.field);
|
||||
});
|
||||
m.trigger('pgadmin:view:fetched', m, self.field);
|
||||
}
|
||||
// To fetch only options from cache, we do not need time from 'at'
|
||||
@@ -406,16 +406,16 @@ define([
|
||||
async: false,
|
||||
url: full_url,
|
||||
})
|
||||
.done(function(res) {
|
||||
.done(function(res) {
|
||||
/*
|
||||
* We will cache this data for short period of time for avoiding
|
||||
* same calls.
|
||||
*/
|
||||
data = cache_node.cache(node.type + '#' + url, node_info, cache_level, res.data);
|
||||
})
|
||||
.fail(function() {
|
||||
eventHandler.trigger('pgadmin:view:fetch:error', m, column);
|
||||
});
|
||||
data = cache_node.cache(node.type + '#' + url, node_info, cache_level, res.data);
|
||||
})
|
||||
.fail(function() {
|
||||
eventHandler.trigger('pgadmin:view:fetch:error', m, column);
|
||||
});
|
||||
eventHandler.trigger('pgadmin:view:fetched', m, column);
|
||||
}
|
||||
// To fetch only options from cache, we do not need time from 'at'
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
import pgAdmin from 'sources/pgadmin';
|
||||
import url_for from 'sources/url_for';
|
||||
import * as modifyAnimation from 'sources/modify_animation';
|
||||
import $ from 'jquery';
|
||||
import * as Alertify from 'pgadmin.alertifyjs';
|
||||
import * as SqlEditorUtils from 'sources/sqleditor_utils';
|
||||
var modifyAnimation = require('sources/modify_animation');
|
||||
|
||||
const pgBrowser = pgAdmin.Browser = pgAdmin.Browser || {};
|
||||
|
||||
@@ -51,8 +51,8 @@ _.extend(pgBrowser, {
|
||||
if(self.preferences_cache.length > 0) {
|
||||
clearInterval(preferenceTimeout);
|
||||
return _.findWhere(
|
||||
self.preferences_cache, {'module': module, 'name': preference}
|
||||
);
|
||||
self.preferences_cache, {'module': module, 'name': preference}
|
||||
);
|
||||
}
|
||||
},
|
||||
preferenceTimeout = setInterval(check_preference, 1000);
|
||||
@@ -93,35 +93,35 @@ _.extend(pgBrowser, {
|
||||
$.ajax({
|
||||
url: url_for('preferences.get_all'),
|
||||
})
|
||||
.done(function(res) {
|
||||
self.preferences_cache = res;
|
||||
self.preference_version(self.generate_preference_version());
|
||||
.done(function(res) {
|
||||
self.preferences_cache = res;
|
||||
self.preference_version(self.generate_preference_version());
|
||||
|
||||
pgBrowser.keyboardNavigation.init();
|
||||
if(pgBrowser.tree) {
|
||||
modifyAnimation.modifyAcitreeAnimation(self);
|
||||
modifyAnimation.modifyAlertifyAnimation(self);
|
||||
}
|
||||
pgBrowser.keyboardNavigation.init();
|
||||
if(pgBrowser.tree) {
|
||||
modifyAnimation.modifyAcitreeAnimation(self);
|
||||
modifyAnimation.modifyAlertifyAnimation(self);
|
||||
}
|
||||
|
||||
// Initialize Tree saving/reloading
|
||||
pgBrowser.browserTreeState.init();
|
||||
// Initialize Tree saving/reloading
|
||||
pgBrowser.browserTreeState.init();
|
||||
|
||||
/* Once the cache is loaded after changing the preferences,
|
||||
/* Once the cache is loaded after changing the preferences,
|
||||
* notify the modules of the change
|
||||
*/
|
||||
if(modulesChanged) {
|
||||
if(typeof modulesChanged === 'string'){
|
||||
$.event.trigger('prefchange:'+modulesChanged);
|
||||
} else {
|
||||
_.each(modulesChanged, (val, key)=> {
|
||||
$.event.trigger('prefchange:'+key);
|
||||
});
|
||||
if(modulesChanged) {
|
||||
if(typeof modulesChanged === 'string'){
|
||||
$.event.trigger('prefchange:'+modulesChanged);
|
||||
} else {
|
||||
_.each(modulesChanged, (val, key)=> {
|
||||
$.event.trigger('prefchange:'+key);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail(function(xhr, status, error) {
|
||||
Alertify.pgRespErrorNotify(xhr, error);
|
||||
});
|
||||
})
|
||||
.fail(function(xhr, status, error) {
|
||||
Alertify.pgRespErrorNotify(xhr, error);
|
||||
});
|
||||
}, 500);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user