diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-08-31 17:45:20 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-09-27 09:48:36 +0200 |
commit | 3459de36f35839e98e894ae3b58c4f4374d90913 (patch) | |
tree | 80136e41ad43c3500ee584a61181b58deaa7303b /ogcp/templates | |
parent | 07c5cb25d2281d2253729ecc7b7b40efdf6db140 (diff) |
Add Servers section
In Servers section/view, users can add or delete ogServers from ogCP
configuration file.
Replaces Repositories views and recycle some of its code.
Diffstat (limited to 'ogcp/templates')
-rw-r--r-- | ogcp/templates/actions/add_server.html (renamed from ogcp/templates/actions/add_repository.html) | 8 | ||||
-rw-r--r-- | ogcp/templates/actions/delete_server.html (renamed from ogcp/templates/actions/delete_repository.html) | 6 | ||||
-rw-r--r-- | ogcp/templates/base.html | 4 | ||||
-rw-r--r-- | ogcp/templates/repositories.html | 37 | ||||
-rw-r--r-- | ogcp/templates/servers.html | 38 |
5 files changed, 47 insertions, 46 deletions
diff --git a/ogcp/templates/actions/add_repository.html b/ogcp/templates/actions/add_server.html index e7c50fa..c86dcba 100644 --- a/ogcp/templates/actions/add_repository.html +++ b/ogcp/templates/actions/add_server.html @@ -1,16 +1,16 @@ -{% extends 'repositories.html' %} +{% extends 'servers.html' %} {% import "bootstrap/wtf.html" as wtf %} {% set sidebar_state = 'disabled' %} {% set btn_back = true %} -{% block nav_repository_add %}active{% endblock %} +{% block nav_server_add %}active{% endblock %} {% block content %} -<h1 class="m-5">{{_('Add a repository')}}</h1> +<h1 class="m-5">{{_('Add a server')}}</h1> {{ wtf.quick_form(form, - action=url_for('repository_add_post'), + action=url_for('server_add_post'), method='post', button_map={'submit_btn':'primary'}) }} diff --git a/ogcp/templates/actions/delete_repository.html b/ogcp/templates/actions/delete_server.html index 82177a3..8f9417e 100644 --- a/ogcp/templates/actions/delete_repository.html +++ b/ogcp/templates/actions/delete_server.html @@ -1,4 +1,4 @@ -{% extends 'repositories.html' %} +{% extends 'servers.html' %} {% import "bootstrap/wtf.html" as wtf %} {% set sidebar_state = 'disabled' %} @@ -9,11 +9,11 @@ {{ args }} <h1 class="m-5"> - {{ _('Delete repository %(repo_name)s', repo_name=repo_name) }} +{{ _('Delete server %(server_name)s', server_name=form.name.data) }} </h1> {{ wtf.quick_form(form, - action=url_for('repository_delete_post'), + action=url_for('server_delete_post'), method='post', button_map={'submit': 'primary'}, extra_classes="mx-5") }} diff --git a/ogcp/templates/base.html b/ogcp/templates/base.html index dca6fda..da5f1db 100644 --- a/ogcp/templates/base.html +++ b/ogcp/templates/base.html @@ -36,8 +36,8 @@ <li class="nav-item {% block nav_images%}{% endblock %}"> <a class="nav-link" href="{{ url_for('images') }}">{{ _('Images') }}</a> </li> - <li class="nav-item {% block nav_repositories %}{% endblock %}"> - <a class="nav-link" href="{{ url_for('repositories') }}">{{ _('Repositories') }}</a> + <li class="nav-item {% block nav_servers %}{% endblock %}"> + <a class="nav-link" href="{{ url_for('manage_servers') }}">{{ _('Servers') }}</a> </li> {% if current_user.admin %} <li class="nav-item {% block nav_users %}{% endblock %}"> diff --git a/ogcp/templates/repositories.html b/ogcp/templates/repositories.html deleted file mode 100644 index 7aa2d06..0000000 --- a/ogcp/templates/repositories.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends 'base.html' %} - -{% block nav_repositories %}active{% endblock %} - -{% block container %} - <form id="repositoriesForm"> - <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> - </form> - {{ super() }} -</form> -{% endblock %} - -{% block sidebar %} - <ul id="repositories-list" class="nav flex-column nav-pills"> - {% for repository in repositories %} - <li id="repository-{{ repository['id'] }}" class="nav-item"> - <input class="form-check-input" type="checkbox" form="repositoriesForm" - value="{{ repository['id'] }}" - name="{{ repository['name'] }}" /> - {{ repository['name'] }} - </li> - {% endfor %} - </ul> -{% endblock %} - -{% block commands %} - <input class="btn btn-light {% block nav_repository_add %}{% endblock %}" type="submit" value="{{ _('Add repository') }}" - form="repositoriesForm" formaction="{{ url_for('repository_add_get') }}" formmethod="get"> - <input class="btn btn-light {% block nav_repository_delete %}{% endblock %}" type="submit" value="{{ _('Delete repository') }}" - form="repositoriesForm" formaction="{{ url_for('repository_delete_get') }}" formmethod="get"> - {% if btn_back %} - <button class="btn btn-danger ml-3" type="button" id="backButton" onclick="history.back()"> - {{ _("Back") }} - </button> - {% endif %} -{% endblock %} - diff --git a/ogcp/templates/servers.html b/ogcp/templates/servers.html new file mode 100644 index 0000000..05b7c18 --- /dev/null +++ b/ogcp/templates/servers.html @@ -0,0 +1,38 @@ +{% extends 'base.html' %} + +{% block nav_servers %}active{% endblock %} + +{% block container %} + <form id="serversForm"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> + </form> + {{ super() }} +</form> +{% endblock %} + +{% block sidebar %} + <ul id="servers-list" class="nav flex-column nav-pills"> + {% for server in servers %} + {% set server_str = server["ip"] ~ ":" ~ server["port"] %} + <li class="nav-item"> + <input class="form-check-input" type="checkbox" form="serversForm" + value="{{ server_str }}" + name="selected-server" /> + {{ server["name"] }} + </li> + {% endfor %} + </ul> +{% endblock %} + +{% block commands %} + <input class="btn btn-light {% block nav_server_add %}{% endblock %}" type="submit" value="{{ _('Add server') }}" + form="serversForm" formaction="{{ url_for('server_add_get') }}" formmethod="get"> + <input class="btn btn-light {% block nav_server_delete %}{% endblock %}" type="submit" value="{{ _('Delete server') }}" + form="serversForm" formaction="{{ url_for('server_delete_get') }}" formmethod="get"> + {% if btn_back %} + <button class="btn btn-danger ml-3" type="button" id="backButton" onclick="history.back()"> + {{ _("Back") }} + </button> + {% endif %} +{% endblock %} + |