eotk: import instance information from terraform

This commit is contained in:
Iain Learmonth 2022-05-13 15:40:59 +01:00
parent 567fcce0bb
commit ce520b87a5
11 changed files with 233 additions and 74 deletions

View file

@ -132,8 +132,8 @@
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if section == "eotk" %} active{% endif %} disabled text-secondary"
href="#">
<a class="nav-link{% if section == "eotk" %} active{% endif %}"
href="{{ url_for("portal.eotk.eotk_list") }}">
{{ icon("server") }} EOTK Instances
</a>
</li>

View file

@ -1,5 +1,5 @@
{% extends "base.html.j2" %}
{% from "tables.html.j2" import alarms_table, automations_table, bridgeconfs_table, bridges_table,
{% from "tables.html.j2" import alarms_table, automations_table, bridgeconfs_table, bridges_table, eotk_table,
groups_table, mirrorlists_table, origins_table, origin_onion_table, onions_table, proxies_table %}
{% block content %}

View file

@ -55,12 +55,62 @@
</div>
{% endmacro %}
{% macro eotk_table(eotks) %}
<div class="alert alert-danger">Not implemented yet.</div>
{% macro eotk_table(instances) %}
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Group</th>
<th scope="col">Provider</th>
<th scope="col">Region</th>
<th scope="col">Instance ID</th>
<th scope="col">Created</th>
<th scope="col">Alarms</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% for instance in instances %}
{% if not instance.destroyed %}
<tr class="align-middle{% if instance.deprecated %} bg-warning{% endif %}">
<td>
<a href="{{ url_for("portal.group.group_edit", group_id=instance.group.id) }}">{{ instance.group.group_name }}</a>
</td>
<td>{{ instance.provider }}</td>
<td>{{ instance.region }}</td>
<td>
<code>{{ instance.instance_id }}</code>
</td>
<td>
{{ instance.added | format_datetime }}
</td>
<td>
{% for alarm in [] %}
<span title="{{ alarm.alarm_type }}">
{% if alarm.alarm_state.name == "OK" %}
{{ alarm_ok() }}
{% elif alarm.alarm_state.name == "UNKNOWN" %}
{{ alarm_unknown() }}
{% else %}
{{ alarm_critical() }}
{% endif %}
</span>
{% endfor %}
</td>
<td>
<a href="#"
class="btn btn-primary btn-sm">Generate Configuration</a>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% endmacro %}
{% macro automations_table(automations) %}
<div class="table-responsive">
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>