public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group
3+ messages / 2 participants
[nested] [flat]
* [pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group
@ 2021-11-29 05:03 Nikhil Mohite <[email protected]>
2021-11-29 05:26 ` Re: [pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group Nikhil Mohite <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: Nikhil Mohite @ 2021-11-29 05:03 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Please find the attached patch for RM-6955:
<https://redmine.postgresql.org/issues/6955; pgadmin 6.1: browser tree
sort order not updating when renaming a server group
--
*Thanks & Regards,*
*Nikhil Mohite*
*Senior Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*
Attachments:
[application/octet-stream] RM-6955.patch (4.2K, 3-RM-6955.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index ac7222ea..c2ad41d6 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -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
diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js
index 4445892a..586cf26e 100644
--- a/web/pgadmin/browser/static/js/collection.js
+++ b/web/pgadmin/browser/static/js/collection.js
@@ -428,6 +428,7 @@ define([
pgBrowser.report_error(res.errormsg, res.info);
} else {
$(pgBrowser.panels['properties'].panel).removeData('node-prop');
+ //pgBrowser.Events.trigger('pgadmin:browser:tree:refresh-tree-state');
pgBrowser.Events.trigger(
'pgadmin:browser:tree:refresh', sel_item || pgBrowser.tree.selected(), {
success: function() {
diff --git a/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js b/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js
index 950d0052..2f802820 100644
--- a/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js
+++ b/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js
@@ -69,6 +69,8 @@ _.extend(pgBrowser.browserTreeState, {
this.remove_from_cache, this);
pgBrowser.Events.on('pgadmin:browser:tree:update-tree-state',
this.update_cache, this);
+ /*pgBrowser.Events.on('pgadmin:browser:tree:refresh-tree-state',
+ this.refresh_cache, this);*/
} else if (!_.isUndefined(save_tree_state_period)) {
$.ajax({
url: url_for('settings.reset_tree_state'),
@@ -302,7 +304,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 +366,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 +374,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');
}
}
}
diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index 42c8b129..c527ffc8 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -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);
}
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group
2021-11-29 05:03 [pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group Nikhil Mohite <[email protected]>
@ 2021-11-29 05:26 ` Nikhil Mohite <[email protected]>
2021-11-29 08:38 ` Re: [pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group Akshay Joshi <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: Nikhil Mohite @ 2021-11-29 05:26 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Please ignore the earlier patch. Find the updated patch attached.
On Mon, Nov 29, 2021 at 10:33 AM Nikhil Mohite <
[email protected]> wrote:
> Hi Hackers,
>
> Please find the attached patch for RM-6955:
> <https://redmine.postgresql.org/issues/6955; pgadmin 6.1: browser tree
> sort order not updating when renaming a server group
>
>
> --
> *Thanks & Regards,*
> *Nikhil Mohite*
> *Senior Software Engineer.*
> *EDB Postgres* <https://www.enterprisedb.com/;
> *Mob.No: +91-7798364578.*
>
Regards,
Nikhil Mohite
Attachments:
[application/octet-stream] RM-6955_v2.patch (3.1K, 3-RM-6955_v2.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index ac7222ea..c2ad41d6 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -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
diff --git a/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js b/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js
index 950d0052..0c811949 100644
--- a/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js
+++ b/web/pgadmin/static/js/tree/pgadmin_tree_save_state.js
@@ -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');
}
}
}
diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index 42c8b129..c527ffc8 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -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);
}
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group
2021-11-29 05:03 [pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group Nikhil Mohite <[email protected]>
2021-11-29 05:26 ` Re: [pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group Nikhil Mohite <[email protected]>
@ 2021-11-29 08:38 ` Akshay Joshi <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: Akshay Joshi @ 2021-11-29 08:38 UTC (permalink / raw)
To: Nikhil Mohite <[email protected]>; +Cc: pgadmin-hackers
Thanks, the patch applied.
On Mon, Nov 29, 2021 at 10:56 AM Nikhil Mohite <
[email protected]> wrote:
> Hi Hackers,
>
> Please ignore the earlier patch. Find the updated patch attached.
>
>
> On Mon, Nov 29, 2021 at 10:33 AM Nikhil Mohite <
> [email protected]> wrote:
>
>> Hi Hackers,
>>
>> Please find the attached patch for RM-6955:
>> <https://redmine.postgresql.org/issues/6955; pgadmin 6.1: browser tree
>> sort order not updating when renaming a server group
>>
>>
>> --
>> *Thanks & Regards,*
>> *Nikhil Mohite*
>> *Senior Software Engineer.*
>> *EDB Postgres* <https://www.enterprisedb.com/;
>> *Mob.No: +91-7798364578.*
>>
>
> Regards,
> Nikhil Mohite
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-11-29 08:38 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 05:03 [pgAdmin][RM-6955]: pgadmin 6.1: browser tree sort order not updating when renaming a server group Nikhil Mohite <[email protected]>
2021-11-29 05:26 ` Nikhil Mohite <[email protected]>
2021-11-29 08:38 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox