mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Keep all the information in the tree node data in the
getTreeNodeHierarchy(..) function, and make changes to make the generate_url function to work with it.
This commit is contained in:
@@ -118,7 +118,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) {
|
|||||||
function(o) { return o.priority; }
|
function(o) { return o.priority; }
|
||||||
),
|
),
|
||||||
function(o) {
|
function(o) {
|
||||||
ref = S('%s/%s').sprintf(ref, o.id).value();
|
ref = S('%s/%s').sprintf(ref, encodeURI(o._id)).value();
|
||||||
});
|
});
|
||||||
|
|
||||||
var args = {
|
var args = {
|
||||||
|
|||||||
@@ -784,7 +784,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
* Supports url generation for create, drop, edit, properties, sql,
|
* Supports url generation for create, drop, edit, properties, sql,
|
||||||
* depends, statistics
|
* depends, statistics
|
||||||
*/
|
*/
|
||||||
generate_url: function(item, type, d, with_id) {
|
generate_url: function(item, type, d, with_id, info) {
|
||||||
var url = pgAdmin.Browser.URL + '{TYPE}/{REDIRECT}{REF}',
|
var url = pgAdmin.Browser.URL + '{TYPE}/{REDIRECT}{REF}',
|
||||||
opURL = {
|
opURL = {
|
||||||
'create': 'obj', 'drop': 'obj', 'edit': 'obj',
|
'create': 'obj', 'drop': 'obj', 'edit': 'obj',
|
||||||
@@ -796,14 +796,16 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
_.sortBy(
|
_.sortBy(
|
||||||
_.values(
|
_.values(
|
||||||
_.pick(
|
_.pick(
|
||||||
this.getTreeNodeHierarchy(item), function(v, k, o) {
|
((_.isUndefined(item) || _.isNull(item)) ? info || {} :
|
||||||
|
this.getTreeNodeHierarchy(item)),
|
||||||
|
function(v, k, o) {
|
||||||
return (k != self.type);
|
return (k != self.type);
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
function(o) { return o.priority; }
|
function(o) { return o.priority; }
|
||||||
),
|
),
|
||||||
function(o) {
|
function(o) {
|
||||||
ref = S('%s/%s').sprintf(ref, o.id).value();
|
ref = S('%s/%s').sprintf(ref, encodeURI(o._id)).value();
|
||||||
});
|
});
|
||||||
|
|
||||||
ref = S('%s/%s').sprintf(
|
ref = S('%s/%s').sprintf(
|
||||||
@@ -1262,16 +1264,26 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
do {
|
do {
|
||||||
d = t.itemData(i);
|
d = t.itemData(i);
|
||||||
if (d._type in pgBrowser.Nodes && pgBrowser.Nodes[d._type].hasId) {
|
if (d._type in pgBrowser.Nodes && pgBrowser.Nodes[d._type].hasId) {
|
||||||
res[d._type] = {
|
res[d._type] = _.extend({}, d, {
|
||||||
'id': d._id,
|
|
||||||
'priority': idx
|
'priority': idx
|
||||||
};
|
});
|
||||||
idx -= 1;
|
idx -= 1;
|
||||||
}
|
}
|
||||||
i = t.hasParent(i) ? t.parent(i) : null;
|
i = t.hasParent(i) ? t.parent(i) : null;
|
||||||
} while (i);
|
} while (i);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
},
|
||||||
|
cache: function(url, data) {
|
||||||
|
var cached = this.cached = this.cached || {};
|
||||||
|
|
||||||
|
if (_.isUndefined(data)) {
|
||||||
|
return cached[url];
|
||||||
|
}
|
||||||
|
|
||||||
|
cached[url] = {data: data, at: Date()};
|
||||||
|
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user