From 31766a3d07549e846c61ead624b4a45f88948fc0 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Fri, 23 Aug 2024 12:17:41 +0200 Subject: ogcp: add support for multi-ip repositories Add support for the new API REST for repository management where the address is a list of ips instead of a single string. Add dynamic address creation in /action/repo/update and /action/repo/add forms through delete and add buttons in the form. Update /image/restore and /cache/fetch to use repository_id. Add additional repository form validations. --- ogcp/templates/actions/delete_repo.html | 29 ++++++++++++--- ogcp/templates/actions/repo_details.html | 20 +++++++++- ogcp/templates/actions/repos_add.html | 7 +--- ogcp/templates/actions/repos_update.html | 7 +--- ogcp/templates/repo_inspector.html | 63 ++++++++++++++++++++++++++++++++ 5 files changed, 110 insertions(+), 16 deletions(-) create mode 100644 ogcp/templates/repo_inspector.html (limited to 'ogcp/templates') diff --git a/ogcp/templates/actions/delete_repo.html b/ogcp/templates/actions/delete_repo.html index 17902dd..8c32a8c 100644 --- a/ogcp/templates/actions/delete_repo.html +++ b/ogcp/templates/actions/delete_repo.html @@ -9,9 +9,28 @@

{{_('Delete repo')}}

-{{ wtf.quick_form(form, - action=url_for('action_repo_delete'), - method='post', - button_map={'submit': 'danger'}, - extra_classes="mx-5") }} +
+ {{ form.hidden_tag() }} + + {{ form.server() }} + {{ form.repo_id() }} + +
+ {{ form.name.label }} + {{ form.name(class="form-control") }} +
+ +
+ {{ form.addr.label }} + {% for addr in form.addr %} + {{ addr(class="form-control mb-2") }} + {% endfor %} +
+ +
+ {{ form.submit(class="btn btn-primary") }} +
+ +
+ {% endblock %} diff --git a/ogcp/templates/actions/repo_details.html b/ogcp/templates/actions/repo_details.html index 674abc2..212a63b 100644 --- a/ogcp/templates/actions/repo_details.html +++ b/ogcp/templates/actions/repo_details.html @@ -9,5 +9,23 @@

{{_('Repo details')}}

-{{ wtf.quick_form(form, extra_classes="mx-5") }} +
+ {{ form.hidden_tag() }} + + {{ form.server() }} + {{ form.repo_id() }} + +
+ {{ form.name.label }} + {{ form.name(class="form-control") }} +
+ +
+ {{ form.addr.label }} + {% for addr in form.addr %} + {{ addr(class="form-control mb-2") }} + {% endfor %} +
+
+ {% endblock %} diff --git a/ogcp/templates/actions/repos_add.html b/ogcp/templates/actions/repos_add.html index 338f96c..19f02bf 100644 --- a/ogcp/templates/actions/repos_add.html +++ b/ogcp/templates/actions/repos_add.html @@ -9,9 +9,6 @@

{{_('Add repo')}}

-{{ wtf.quick_form(form, - action=url_for('action_repo_add'), - method='post', - button_map={'submit': 'primary'}, - extra_classes="mx-5") }} +{% include 'repo_inspector.html' %} + {% endblock %} diff --git a/ogcp/templates/actions/repos_update.html b/ogcp/templates/actions/repos_update.html index 15c6b64..1278648 100644 --- a/ogcp/templates/actions/repos_update.html +++ b/ogcp/templates/actions/repos_update.html @@ -9,9 +9,6 @@

{{_('Update repo')}}

-{{ wtf.quick_form(form, - action=url_for('action_repo_update'), - method='post', - button_map={'submit': 'primary'}, - extra_classes="mx-5") }} +{% include 'repo_inspector.html' %} + {% endblock %} diff --git a/ogcp/templates/repo_inspector.html b/ogcp/templates/repo_inspector.html new file mode 100644 index 0000000..ccedf5f --- /dev/null +++ b/ogcp/templates/repo_inspector.html @@ -0,0 +1,63 @@ +
+ {{ form.hidden_tag() }} + + {{ form.server() }} + {{ form.repo_id() }} + +
+ {{ form.name.label }} + {{ form.name(class="form-control", required=True) }} +
+ +
+ {{ form.addr.label }} +
+ {% for addr in form.addr %} +
+ {{ addr(class="form-control me-2", placeholder=_("Enter IP Address"), required=True) }} + +
+ {% endfor %} +
+ + + {{ form.submit(class="btn btn-success") }} +
+
+ + \ No newline at end of file -- cgit v1.2.3-18-g5258