eotk: import instance information from terraform
This commit is contained in:
parent
567fcce0bb
commit
ce520b87a5
11 changed files with 233 additions and 74 deletions
|
@ -10,6 +10,7 @@ from app.portal.list import NewMirrorListForm
|
|||
from app.portal.automation import bp as automation
|
||||
from app.portal.bridgeconf import bp as bridgeconf
|
||||
from app.portal.bridge import bp as bridge
|
||||
from app.portal.eotk import bp as eotk
|
||||
from app.portal.group import bp as group
|
||||
from app.portal.list import bp as list_
|
||||
from app.portal.origin import bp as origin
|
||||
|
@ -20,6 +21,7 @@ portal = Blueprint("portal", __name__, template_folder="templates", static_folde
|
|||
portal.register_blueprint(automation, url_prefix="/automation")
|
||||
portal.register_blueprint(bridgeconf, url_prefix="/bridgeconf")
|
||||
portal.register_blueprint(bridge, url_prefix="/bridge")
|
||||
portal.register_blueprint(eotk, url_prefix="/eotk")
|
||||
portal.register_blueprint(group, url_prefix="/group")
|
||||
portal.register_blueprint(list_, url_prefix="/list")
|
||||
portal.register_blueprint(origin, url_prefix="/origin")
|
||||
|
|
16
app/portal/eotk.py
Normal file
16
app/portal/eotk.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from flask import render_template, Blueprint
|
||||
from sqlalchemy import desc
|
||||
|
||||
from app.models.onions import Eotk
|
||||
|
||||
bp = Blueprint("eotk", __name__)
|
||||
|
||||
|
||||
@bp.route("/list")
|
||||
def eotk_list():
|
||||
instances = Eotk.query.filter(Eotk.destroyed == None).order_by(desc(Eotk.added)).all()
|
||||
return render_template("list.html.j2",
|
||||
section="eotk",
|
||||
title="EOTK Instances",
|
||||
item="eotk",
|
||||
items=instances)
|
|
@ -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>
|
||||
|
|
|
@ -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 %}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue