diff options
Diffstat (limited to 'ogcp/templates')
-rw-r--r-- | ogcp/templates/commands.html | 44 | ||||
-rw-r--r-- | ogcp/templates/macros.html | 19 | ||||
-rw-r--r-- | ogcp/templates/nav.html | 2 | ||||
-rw-r--r-- | ogcp/templates/scopes.html | 47 |
4 files changed, 67 insertions, 45 deletions
diff --git a/ogcp/templates/commands.html b/ogcp/templates/commands.html new file mode 100644 index 0000000..27af1b1 --- /dev/null +++ b/ogcp/templates/commands.html @@ -0,0 +1,44 @@ +{% extends 'base.html' %} +{% import "macros.html" as macros %} + +{% block nav_scopes %}active{% endblock %} + +{% block container %} + <form id="scopesForm"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> + </form> + {{ super() }} +</form> +{% endblock %} + +{% block sidebar %} + {{ macros.print_scopes_tree(scopes["scope"]) }} +{% endblock %} + +{% block commands %} + <input class="btn btn-light" type="submit" value="{{ _('Power on (WoL)') }}" + form="scopesForm" formaction="{{ url_for('action_wol') }}" formmethod="get"> + <input class="btn btn-light" type="submit" value="{{ _('Power off') }}" + form="scopesForm" formaction="{{ url_for('action_poweroff') }}" formmethod="post"> + <input class="btn btn-light" type="submit" value="{{ _('Reboot') }}" + form="scopesForm" formaction="{{ url_for('action_reboot') }}" formmethod="post"> + <input class="btn btn-light" type="submit" value="{{ _('Refresh') }}" + form="scopesForm" formaction="{{ url_for('action_refresh') }}" formmethod="post"> + <input class="btn btn-light" type="submit" value="{{ _('Hardware') }}" + form="scopesForm" formaction="{{ url_for('action_hardware') }}" formmethod="get"> + <input class="btn btn-light" type="submit" value="{{ _('Software') }}" + form="scopesForm" formaction="{{ url_for('action_software') }}" formmethod="get"> + <input class="btn btn-light" type="submit" value="{{ _('Start session') }}" + form="scopesForm" formaction="{{ url_for('action_session') }}" formmethod="get"> + <input class="btn btn-light" type="submit" value="{{ _('Restore Image') }}" + form="scopesForm" formaction="{{ url_for('action_image_restore') }}" formmethod="get"> + <input class="btn btn-light" type="submit" value="{{ _('Partition & Format') }}" + form="scopesForm" formaction="{{ url_for('action_setup_show') }}" formmethod="get"> + <input class="btn btn-light" type="submit" value="{{ _('Client details') }}" + form="scopesForm" formaction="{{ url_for('action_client_info') }}" formmethod="get"> + <input class="btn btn-light" type="submit" value="{{ _('Create image') }}" + form="scopesForm" formaction="{{ url_for('action_image_create') }}" formmethod="get"> + <input class="btn btn-light" type="submit" value="{{ _('Set boot mode') }}" + form="scopesForm" formaction="{{ url_for('action_mode') }}" formmethod="get"> +{% endblock %} + diff --git a/ogcp/templates/macros.html b/ogcp/templates/macros.html new file mode 100644 index 0000000..d9d2997 --- /dev/null +++ b/ogcp/templates/macros.html @@ -0,0 +1,19 @@ +{% macro print_scopes_tree(scopes) -%} + + <ul class="list-group list-group-flush"> + {% for scope in scopes %} + <li class="list-group-item state--{{ scope['state'] | lower }}"> + <input class="form-check-input" type="checkbox" form="scopesForm" + value="{{ " ".join(scope["ip"]) }}" + name="{{ scope["name"] }}_{{ scope["id"] }}"> + {{ scope["name"] }} + {% if "state" in scope %} + -- STATE: {{ scope["state"] }} + {% endif %} + {{ print_scopes_tree(scope["scope"]) }} + </li> + {% endfor %} + </ul> + +{% endmacro %} + diff --git a/ogcp/templates/nav.html b/ogcp/templates/nav.html index f2ca3b5..dc40207 100644 --- a/ogcp/templates/nav.html +++ b/ogcp/templates/nav.html @@ -14,7 +14,7 @@ <a class="nav-link" href="{{ url_for('scopes') }}">{{ _('Scopes') }}</a> </li> <li class="nav-item {% if request.endpoint == "commands" %}active{% endif %}"> - <a class="nav-link" href="#">{{ _('Commands') }}</a> + <a class="nav-link" href="{{ url_for('commands') }}">{{ _('Commands') }}</a> </li> <li class="nav-item {% if request.endpoint == "images" %}active{% endif %}"> <a class="nav-link" href="#">{{ _('Images') }}</a> diff --git a/ogcp/templates/scopes.html b/ogcp/templates/scopes.html index 00f6883..1d931bb 100644 --- a/ogcp/templates/scopes.html +++ b/ogcp/templates/scopes.html @@ -1,24 +1,7 @@ {% extends 'base.html' %} -{% block nav_scopes %}active{% endblock %} - -{% macro print_scopes_tree(scopes) -%} +{% import "macros.html" as macros %} - <ul class="list-group list-group-flush"> - {% for scope in scopes %} - <li class="list-group-item state--{{ scope['state'] | lower }}"> - <input class="form-check-input" type="checkbox" form="scopesForm" - value="{{ " ".join(scope["ip"]) }}" - name="{{ scope["name"] }}_{{ scope["id"] }}"> - {{ scope["name"] }} - {% if "state" in scope %} - -- STATE: {{ scope["state"] }} - {% endif %} - {{ print_scopes_tree(scope["scope"]) }} - </li> - {% endfor %} - </ul> - -{% endmacro %} +{% block nav_scopes %}active{% endblock %} {% block container %} <form id="scopesForm"> @@ -29,36 +12,12 @@ {% endblock %} {% block sidebar %} - {{ print_scopes_tree(scopes["scope"]) }} + {{ macros.print_scopes_tree(scopes["scope"]) }} {% endblock %} {% block commands %} - <input class="btn btn-light" type="submit" value="{{ _('Power on (WoL)') }}" - form="scopesForm" formaction="{{ url_for('action_wol') }}" formmethod="get"> - <input class="btn btn-light" type="submit" value="{{ _('Power off') }}" - form="scopesForm" formaction="{{ url_for('action_poweroff') }}" formmethod="post"> - <input class="btn btn-light" type="submit" value="{{ _('Reboot') }}" - form="scopesForm" formaction="{{ url_for('action_reboot') }}" formmethod="post"> - <input class="btn btn-light" type="submit" value="{{ _('Refresh') }}" - form="scopesForm" formaction="{{ url_for('action_refresh') }}" formmethod="post"> - <input class="btn btn-light" type="submit" value="{{ _('Hardware') }}" - form="scopesForm" formaction="{{ url_for('action_hardware') }}" formmethod="get"> - <input class="btn btn-light" type="submit" value="{{ _('Software') }}" - form="scopesForm" formaction="{{ url_for('action_software') }}" formmethod="get"> - <input class="btn btn-light" type="submit" value="{{ _('Start session') }}" - form="scopesForm" formaction="{{ url_for('action_session') }}" formmethod="get"> - <input class="btn btn-light" type="submit" value="{{ _('Restore Image') }}" - form="scopesForm" formaction="{{ url_for('action_image_restore') }}" formmethod="get"> - <input class="btn btn-light" type="submit" value="{{ _('Partition & Format') }}" - form="scopesForm" formaction="{{ url_for('action_setup_show') }}" formmethod="get"> - <input class="btn btn-light" type="submit" value="{{ _('Client details') }}" - form="scopesForm" formaction="{{ url_for('action_client_info') }}" formmethod="get"> <input class="btn btn-light" type="submit" value="{{ _('Add client') }}" form="scopesForm" formaction="{{ url_for('action_client_add') }}" formmethod="get"> - <input class="btn btn-light" type="submit" value="{{ _('Create image') }}" - form="scopesForm" formaction="{{ url_for('action_image_create') }}" formmethod="get"> - <input class="btn btn-light" type="submit" value="{{ _('Set boot mode') }}" - form="scopesForm" formaction="{{ url_for('action_mode') }}" formmethod="get"> <input class="btn btn-light" type="submit" value="{{ _('Add room') }}" form="scopesForm" formaction="{{ url_for('action_room_add') }}" formmethod="get"> <input class="btn btn-light" type="submit" value="{{ _('Delete room') }}" |