capsul-flask/capsulflask/templates/admin.html

188 lines
5.3 KiB
HTML
Raw Normal View History

{% extends 'base.html' %}
{% block title %}Capsul Admin{% endblock %}
{% block content %}
<style nonce="{{csp_inline_style_nonce}}">
{{inline_style}}
</style>
<div class="row third-margin">
<h1>Capsul Admin</h1>
</div>
<div class="third-margin">
{% for display_host in display_hosts %}
<div class="row">
<h1>{{ display_host["name"] }}</h1>
</div>
{% for network in display_host["networks"] %}
<div class="row network-row">
<i>{{ network["network_name"] }}</i>
<span>{{ network["public_ipv4_cidr_block"] }}</span>
<div class="network-display">
{% for allocation in network["allocations"] %}
{# This outer div is used as an abs position container & selected by CSS so don't remove it pls. #}
<div>
<div class="{{allocation}}">
</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
<hr/>
{% endfor %}
2021-12-09 20:38:17 +00:00
</div>
2021-12-09 20:38:17 +00:00
{% if in_db_but_not_in_virt|length > 0 %}
<div class="third-margin">
2021-12-09 20:41:25 +00:00
<div class="row">
2021-12-09 20:38:17 +00:00
<h1>🚨 in the database but not in the virtualization model 🚨</h1>
2021-12-09 20:41:25 +00:00
</div>
2021-12-09 20:38:17 +00:00
{% for vm in in_db_but_not_in_virt %}
<div class="row">
2021-12-09 20:38:17 +00:00
{{vm['id']}} {{vm['public_ipv4']}}
</div>
2021-12-09 20:38:17 +00:00
{% endfor %}
<hr/>
</div>
{% endif %}
{% if state_not_equal_to_desired_state|length > 0 %}
<div class="third-margin">
2021-12-09 20:41:25 +00:00
<div class="row">
2021-12-09 20:38:17 +00:00
<h1>😴 vm state != desired state 😴</h1>
2021-12-09 20:41:25 +00:00
</div>
2021-12-09 20:38:17 +00:00
{% for vm in state_not_equal_to_desired_state %}
<div class="row">
2021-12-09 20:38:17 +00:00
<div>{{vm['id']}}: state={{vm['state']}} desired_state={{vm['desired_state']}}</div>
<form method="post">
<input type="hidden" name="action" value="set_state"></input>
<input type="hidden" name="id" value="{{vm['id']}}"></input>
<input type="hidden" name="state" value="{{vm['desired_state']}}"></input>
<input type="hidden" name="csrf-token" value="{{ csrf_token }}"/>
<input type="submit" value="🚦 START/STOP"/>
</form>
</div>
2021-12-09 20:38:17 +00:00
{% endfor %}
<hr/>
</div>
{% endif %}
2021-12-09 20:38:17 +00:00
{% if has_no_desired_ip_address|length > 0 %}
<div class="third-margin">
<div class="row">
<h1>🐣 has no desired ip address 🐣</h1>
</div>
{% for vm in has_no_desired_ip_address %}
<div class="row">
{{vm['id']}}
</div>
{% endfor %}
<hr/>
</div>
{% endif %}
{% if has_not_aquired_ip_address_yet|length > 0 %}
<div class="third-margin">
<div class="row">
<h1>🏃 hasn't aquired an ip address yet 🏃</h1>
</div>
{% for vm in has_not_aquired_ip_address_yet %}
<div class="row">
{{vm['id']}} desired_ipv4={{vm['public_ipv4']}}
</div>
{% endfor %}
<hr/>
</div>
{% endif %}
2021-12-09 20:38:17 +00:00
{% if stole_someone_elses_ip_and_own_ip_avaliable|length > 0 %}
<div class="third-margin">
2021-12-09 20:41:25 +00:00
<div class="row">
2021-12-09 20:38:17 +00:00
<h1>👻 stole someone elses ip and own desired ip is avaliable 👻</h1>
2021-12-09 20:41:25 +00:00
</div>
2021-12-09 20:38:17 +00:00
{% for vm in stole_someone_elses_ip_and_own_ip_avaliable %}
<div class="row">
2021-12-09 20:38:17 +00:00
<div>{{vm['id']}}: current_ipv4={{vm['current_ipv4']}} desired_ipv4={{vm['desired_ipv4']}}</div>
<form method="post">
<input type="hidden" name="action" value="dhcp_reset"></input>
<input type="hidden" name="id" value="{{vm['id']}}"></input>
<input type="hidden" name="csrf-token" value="{{ csrf_token }}"/>
<input type="submit" value="🔨 DHCP RESET"/>
</form>
</div>
2021-12-09 20:38:17 +00:00
{% endfor %}
<hr/>
</div>
{% endif %}
{% if has_wrong_ip|length > 0 %}
<div class="third-margin">
2021-12-09 20:41:25 +00:00
<div class="row">
2021-12-09 20:38:17 +00:00
<h1>🥴 has wrong ip address 🥴</h1>
2021-12-09 20:41:25 +00:00
</div>
2021-12-09 20:38:17 +00:00
{% for vm in has_wrong_ip %}
<div class="row">
2021-12-09 20:38:17 +00:00
<div>{{vm['id']}}: current_ipv4={{vm['current_ipv4']}} desired_ipv4={{vm['desired_ipv4']}}</div>
<form method="post">
<input type="hidden" name="action" value="dhcp_reset"></input>
<input type="hidden" name="id" value="{{vm['id']}}"></input>
<input type="hidden" name="csrf-token" value="{{ csrf_token }}"/>
<input type="submit" value="🔨 DHCP RESET"/>
</form>
</div>
2021-12-09 20:38:17 +00:00
{% endfor %}
<hr/>
</div>
{% endif %}
2021-12-09 20:38:17 +00:00
{% if stole_someone_elses_ip_but_own_ip_also_stolen|length > 0 %}
<div class="third-margin">
2021-12-09 20:41:25 +00:00
<div class="row">
2021-12-09 20:38:17 +00:00
<h1>💀 stole someone elses ip but own desired ip was also stolen 💀</h1>
2021-12-09 20:41:25 +00:00
</div>
2021-12-09 20:38:17 +00:00
{% for vm in stole_someone_elses_ip_but_own_ip_also_stolen %}
<div class="row">
<div>{{vm['id']}}: current_ipv4={{vm['current_ipv4']}} desired_ipv4={{vm['desired_ipv4']}}</div>
<form method="post">
<input type="hidden" name="action" value="stop_and_expire"></input>
<input type="hidden" name="id" value="{{vm['id']}}"></input>
<input type="hidden" name="csrf-token" value="{{ csrf_token }}"/>
<input type="submit" value="🛑 STOP AND EXPIRE DHCP LEASE"/>
</form>
</div>
{% endfor %}
<hr/>
</div>
2021-12-09 20:38:17 +00:00
{% endif %}
<div class="third-margin">
<div class="row">
<h1>📢 Admin Megaphone: Email All Users With Active Capsuls 📢</h1>
</div>
<div class="row">
<form method="post" class="megaphone">
<input type="hidden" name="action" value="megaphone"></input>
<input type="hidden" name="csrf-token" value="{{ csrf_token }}"/>
<input type="text" name="subject" placeholder="Capsul Maintenance blahblahblah" />
<textarea name="body" placeholder="Hello, ..."></textarea>
<input type="submit" value="SEND"/>
</form>
</div>
</div>
2021-12-09 20:38:17 +00:00
{% endblock %}
{% block pagesource %}/templates/admin.html{% endblock %}