Automatically expand child nodes as well as the selected node on the treeview if there is only one. Fixes #3559

This also ensure the browser state is cleared if the save interval is set to -1.
This commit is contained in:
Khushboo Vashi
2019-02-14 09:18:08 +00:00
committed by Dave Page
parent 438116c574
commit 17694ab467
6 changed files with 65 additions and 1 deletions

View File

@@ -69,7 +69,27 @@ _.extend(pgBrowser.browserTreeState, {
this.remove_from_cache, this);
pgBrowser.Events.on('pgadmin:browser:tree:update-tree-state',
this.update_cache, this);
} else {
$.ajax({
url: url_for('settings.reset_tree_state'),
type: 'DELETE',
})
.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);
}
}
console.warn(
gettext('Error resetting the tree saved state."'), msg);
});
}
},
save_state: function() {