mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-27 00:36:52 -06:00
Ensure that sort order should be maintained when renaming a server group. Fixes #6955
This commit is contained in:
parent
fbd10ef4b6
commit
61b440261f
@ -1274,7 +1274,14 @@ define('pgadmin.browser', [
|
||||
// If there is no parent then just update the node
|
||||
if(this.t.isRootNode(_parent) ||
|
||||
(_parent && _parent.length == 0 && ctx.op == 'UPDATE')) {
|
||||
updateNode();
|
||||
var that = this;
|
||||
this.t.remove(this.i).then(() => {
|
||||
that.t.before(that.i, that.new).then((new_item) => {
|
||||
that.t.select(new_item);
|
||||
}, () => {
|
||||
console.warn('Failed to add before..', arguments);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
var postRemove = function() {
|
||||
// If item has parent but no grand parent
|
||||
|
@ -302,7 +302,7 @@ _.extend(pgBrowser.browserTreeState, {
|
||||
let index = tmpItemData.indexOf(data.id);
|
||||
|
||||
pgBrowser.tree.open(item);
|
||||
|
||||
pgBrowser.tree.ensureLoaded(item);
|
||||
if (index == (tmpItemData.length - 1 )) {
|
||||
let tIndex = treeData[treeHierarchy[self.parent]['_id']]['paths'].indexOf(tData);
|
||||
treeData[treeHierarchy[self.parent]['_id']]['paths'].splice(tIndex, 1);
|
||||
@ -364,7 +364,6 @@ _.extend(pgBrowser.browserTreeState, {
|
||||
if (!_.isUndefined(databaseItem))
|
||||
this.current_state[topParent]['selected'][databaseItem] = selectedItem;
|
||||
}
|
||||
|
||||
},
|
||||
select_tree_item(item) {
|
||||
let treeData = this.stored_state || {},
|
||||
@ -373,12 +372,12 @@ _.extend(pgBrowser.browserTreeState, {
|
||||
tmpTreeData = treeData[treeHierarchy[this.parent]['_id']];
|
||||
|
||||
|
||||
if (treeHierarchy.hasOwnProperty('database')) {
|
||||
let databaseItem = treeHierarchy['database']['id'];
|
||||
if (treeHierarchy.hasOwnProperty('server')) {
|
||||
let selectedItem = treeHierarchy['server']['id'];
|
||||
|
||||
if (tmpTreeData && 'selected' in tmpTreeData && databaseItem in tmpTreeData['selected']) {
|
||||
if (tmpTreeData['selected'][databaseItem] == data.id) {
|
||||
pgBrowser.tree.select(item);
|
||||
if (tmpTreeData && 'selected' in tmpTreeData && selectedItem in tmpTreeData['selected']) {
|
||||
if (tmpTreeData['selected'][selectedItem] == data.id) {
|
||||
pgBrowser.tree.select(item, true, 'center');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,10 @@ export class Tree {
|
||||
await this.tree.toggleDirectory(item);
|
||||
}
|
||||
|
||||
async ensureLoaded(item) {
|
||||
await item.ensureLoaded();
|
||||
}
|
||||
|
||||
async ensureVisible(item){
|
||||
await this.tree.ensureVisible(item);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user