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

@@ -55,7 +55,8 @@ class SettingsModule(PgAdminModule):
"""
return [
'settings.store', 'settings.store_bulk', 'settings.reset_layout',
'settings.save_tree_state', 'settings.get_tree_state'
'settings.save_tree_state', 'settings.get_tree_state',
'settings.reset_tree_state'
]
@@ -150,6 +151,24 @@ def reset_layout():
return make_json_response(result=request.form)
@blueprint.route("/reset_tree_state", methods=['DELETE'], endpoint='reset_tree_state')
@login_required
def reset_tree_state():
"""Reset the saved tree state."""
data = Setting.query.filter_by(user_id=current_user.id, setting='browser_tree_state').first()
try:
if data is not None:
db.session.delete(data)
db.session.commit()
except Exception as e:
return make_json_response(
status=410, success=0, errormsg=str(e)
)
return success_return()
@blueprint.route("/save_tree_state/", endpoint="save_tree_state",
methods=['POST'])
@login_required