summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorJavier Hernandez <jhernandez@soleta.eu>2024-01-16 10:13:02 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-01-16 13:25:42 +0100
commit02b6059c70d5261a206c28b716512605e5dc4cdf (patch)
treec170b9b4d84510c7fe38ab462877855984b276c4 /ogcp/views.py
parentbf90e91e2474504bd7e810393c8e5d542a938d48 (diff)
views: add an action to view repo details1.1.3-11
Add an action to allow the user to view details (name and ip) of a particular repo.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 316f25c..9aaef17 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1845,6 +1845,32 @@ def action_repo_delete():
return render_template('actions/delete_repo.html', form=form,
repos_resp=responses)
+
+@app.route('/action/repo/info', methods=['GET'])
+@login_required
+def action_repo_info():
+ form = RepoForm()
+ params = request.args.to_dict()
+ repos = parse_elements(params)
+ if not validate_elements(repos, max_len=1):
+ return redirect(url_for('manage_repos'))
+ repo_id = repos.pop()
+ if not repo_id:
+ flash(_('Please, select a repo'), category='error')
+ return redirect(url_for('manage_repos'))
+ repo_id = int(repo_id)
+ server_ip_port = params.get('repos-server')
+ server = get_server_from_ip_port(server_ip_port)
+ repository = get_repository(repo_id, server)
+ form.name.data = repository['name']
+ form.name.render_kw = {'readonly': True}
+ form.ip.data = repository['ip']
+ form.ip.render_kw = {'readonly': True}
+ form.submit.render_kw = {"style": "visibility:hidden;"}
+ responses = multi_request('get', '/repositories')
+ return render_template('actions/repo_details.html', form=form,
+ repos_resp=responses)
+
@app.route('/servers/', methods=['GET'])
@login_required
def manage_servers():