summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ogcp/templates/actions/repo_details.html13
-rw-r--r--ogcp/templates/repos.html2
-rw-r--r--ogcp/views.py26
3 files changed, 41 insertions, 0 deletions
diff --git a/ogcp/templates/actions/repo_details.html b/ogcp/templates/actions/repo_details.html
new file mode 100644
index 0000000..ee45a97
--- /dev/null
+++ b/ogcp/templates/actions/repo_details.html
@@ -0,0 +1,13 @@
+{% extends 'repos.html' %}
+{% import "bootstrap/wtf.html" as wtf %}
+{% set btn_back = true %}
+
+{% block nav_repos %} active{% endblock %}
+{% block nav_repos_details %} active{% endblock %}
+{% block nav_repos_info %}active{% endblock %}
+{% block content %}
+
+<h1 class="m-5">{{_('Repo details')}}</h1>
+
+{{ wtf.quick_form(form, extra_classes="mx-5") }}
+{% endblock %}
diff --git a/ogcp/templates/repos.html b/ogcp/templates/repos.html
index 5ca33fe..ef56d2a 100644
--- a/ogcp/templates/repos.html
+++ b/ogcp/templates/repos.html
@@ -50,6 +50,8 @@
{% endblock %}
{% block commands %}
+ <input class="btn btn-light {% block nav_repo_info %}{% endblock %}" type="submit" value="{{ _('Repo details') }}"
+ form="reposForm" formaction="{{ url_for('action_repo_info') }}" formmethod="get">
<input class="btn btn-light {% block nav_repo_add %}{% endblock %}" type="submit" value="{{ _('Add repo') }}"
form="reposForm" formaction="{{ url_for('action_repo_add') }}" formmethod="get">
<input class="btn btn-light {% block nav_repo_delete %}{% endblock %}" type="submit" value="{{ _('Delete repo') }}"
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():