feat(static): adds new static origins feature

This commit is contained in:
Iain Learmonth 2023-05-25 15:32:31 +01:00
parent 6a29d68985
commit 15a85b1efe
20 changed files with 843 additions and 7 deletions

View file

@ -82,7 +82,7 @@
</h6>
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link{% if section == "cloud" %} active{% else %} disabled text-secondary{% endif %}"
<a class="nav-link{% if section == "cloud" %} active{% endif %}"
href="{{ url_for("portal.cloud.cloud_account_list") }}">
{{ icon("cloud") }} Cloud Accounts
</a>
@ -106,8 +106,8 @@
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if section == "origin" %} active{% endif %} disabled text-secondary"
href="{{ url_for("portal.origin.origin_list") }}">
<a class="nav-link{% if section == "static" %} active{% endif %}"
href="{{ url_for("portal.static.static_list") }}">
{{ icon("hdd") }} Static Origins
</a>
</li>

View file

@ -1,7 +1,7 @@
{% extends "base.html.j2" %}
{% from "tables.html.j2" import alarms_table, automations_table, bridgeconfs_table, bridges_table, cloud_accounts_table,
eotk_table, groups_table, instances_table, mirrorlists_table, origins_table, origin_onion_table, onions_table,
pools_table, proxies_table, webhook_table %}
pools_table, proxies_table, static_table, webhook_table %}
{% block content %}
<h1 class="h2 mt-3">{{ title }}</h1>
@ -35,6 +35,8 @@
{% endif %}
{% elif item == "origin" %}
{{ origins_table(items) }}
{% elif item == "static" %}
{{ static_table(items) }}
{% elif item == "pool" %}
{{ pools_table(items) }}
{% elif item == "proxy" %}

View file

@ -0,0 +1,15 @@
{% extends "base.html.j2" %}
{% from 'bootstrap5/form.html' import render_form %}
{% from "tables.html.j2" import static_table %}
{% block content %}
<h1 class="h2 mt-3">Static Origins</h1>
<h2 class="h3">
{{ static.group.group_name }}: {{ static.description }} (#{{ static.id }})
</h2>
<div style="border: 1px solid #666;" class="p-3">
{{ render_form(form) }}
</div>
{% endblock %}

View file

@ -633,6 +633,57 @@
</div>
{% endmacro %}
{% macro static_table(statics) %}
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Description</th>
<th scope="col">Origin URL</th>
<th scope="col">Keanu Convene</th>
<th scope="col">Auto-Rotation</th>
<th scope="col">Group</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% for static in statics %}
{% if not static.destroyed %}
<tr>
<td>{{ static.description }}</td>
<td>{% if static.origin_domain_name %}
<a href="https://{{ static.origin_domain_name }}" class="btn btn-secondary btn-sm"
target="_bypass"
rel="noopener noreferer">⎋</a>
{{ static.origin_domain_name }}
{% else %}
<em>Still deploying</em>
{% endif %}</td>
<td>{% if static.origin_domain_name and static.keanu_convene_path %}
<a href="https://{{ static.origin_domain_name }}/{{ static.keanu_convene_path }}/" class="btn btn-secondary btn-sm"
target="_bypass"
rel="noopener noreferer">⎋</a>
{% else %}
<em>Still deploying</em>
{% endif %}</td>
<td>{% if static.auto_rotate %}✅{% else %}❌{% endif %}</td>
<td>
<a href="{{ url_for("portal.group.group_edit", group_id=static.group.id) }}">{{ static.group.group_name }}</a>
</td>
<td>
<a href="{{ url_for("portal.static.static_edit", static_id=static.id) }}"
class="btn btn-primary btn-sm">View/Edit</a>
<a href="{{ url_for("portal.static.static_destroy", static_id=static.id) }}"
class="btn btn-danger btn-sm">Destroy</a>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% endmacro %}
{% macro webhook_table(webhooks) %}
<div class="table-responsive">
<table class="table table-striped table-sm">