feat: abstracting cloud providers

This commit is contained in:
Iain Learmonth 2023-02-26 12:52:08 +00:00
parent af36a545a1
commit 0a72aeed96
18 changed files with 629 additions and 181 deletions

View file

@ -185,6 +185,34 @@
</div>
{% endmacro %}
{% macro cloud_accounts_table(accounts) %}
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Provider</th>
<th scope="col">Description</th>
<th scope="col">Enabled</th>
</tr>
</thead>
<tbody>
{% for account in accounts %}
{% if not account.destroyed %}
<tr class="align-middle">
<td>{{ account.provider.description }}</td>
<td>{{ account.description }}</td>
<td>{% if account.enabled %}✅{% else %}❌{% endif %}</td>
<td>
<a href="{{ url_for("portal.cloud.cloud_account_edit", account_id=account.id) }}" class="btn btn-primary btn-sm">View/Edit</a>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% endmacro %}
{% macro groups_table(groups, pool=None) %}
<div class="table-responsive">
<table class="table table-striped table-sm">
@ -491,10 +519,11 @@
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Pool</th>
<th scope="col">Configuration</th>
<th scope="col">Nickname</th>
<th scope="col">Hashed Fingerprint</th>
<th scope="col">Pool</th>
<th scope="col">Configuration</th>
<th scope="col">Cloud Account</th>
<th scope="col">Alarms</th>
<th scope="col">Actions</th>
</tr>
@ -503,10 +532,6 @@
{% for bridge in bridges %}
{% if not bridge.destroyed %}
<tr class="align-middle{% if bridge.deprecated %} bg-warning{% endif %}">
<td>
<a href="{{ url_for("portal.pool.pool_edit", pool_id=bridge.conf.pool_id) }}">{{ bridge.conf.pool.pool_name }}</a>
</td>
<td>{{ bridge.conf.description }} ({{ bridge.provider }}/{{ bridge.conf.method }})</td>
<td>
<a href="https://metrics.torproject.org/rs.html#details/{{ bridge.hashed_fingerprint }}">
{{ bridge.nickname }}
@ -515,6 +540,15 @@
<td>
<code>{{ bridge.hashed_fingerprint }}</code>
</td>
<td>
<a href="{{ url_for("portal.pool.pool_edit", pool_id=bridge.conf.pool_id) }}">{{ bridge.conf.pool.pool_name }}</a>
</td>
<td>{{ bridge.conf.description }} ({{ bridge.conf.method }})</td>
<td>
<a href="{{ url_for("portal.cloud.cloud_account_edit", account_id=bridge.cloud_account_id) }}">
{{ bridge.cloud_account.provider.description }} ({{ bridge.cloud_account.description }})
</a>
</td>
<td>
{% for alarm in bridge.alarms %}
<span title="{{ alarm.alarm_type }}">