From 285843634162860b1ba19f71834f06f4fca54583 Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Fri, 1 Dec 2023 15:55:15 +0100 Subject: src: add menu to manage repos The menu includes a list of the repos of each server. The user can select a server or a repo to make changes. As of now, the only action possible is to add a repo to selected server. The work contained in this commit can be structured in: 1. Add the repos menu: - Add a 'repos' button in the menus bar (base.html). - Add repos.html template to create the management repos menu. - In ogcp.js, add function to store in browser's local storage which elements of the sidebar are uncollapsed. This saves the sidebar state after a page refresh. - Add manage_repos() in views.py 2. Allow to add a repo: - Add template with form to add a repo (repos_details.html) - Create RepoForm(FlaskForm) in action_forms.py - Add repo_add_get() and repo_add_post() in views.py --- ogcp/static/js/ogcp.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'ogcp/static') diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index 6473373..5028993 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -136,6 +136,25 @@ function keepSelectedClients() { }); } +function keepReposTreeState() { + const repos_tree = $('#repos-list .collapse') + + repos_tree.on('hidden.bs.collapse', function (event) { + event.stopPropagation(); + localStorage.removeItem(this.id); + }); + repos_tree.on('shown.bs.collapse', function (event) { + event.stopPropagation(); + localStorage.setItem(this.id, 'show'); + }); + + repos_tree.each(function () { + if (localStorage.getItem(this.id) == 'show') { + $(this).collapse('show'); + } + }); +} + function keepScopesTreeState() { const scopes_tree = $('#scopes .collapse') -- cgit v1.2.3-18-g5258