capsul-flask/capsulflask/templates/admin.html

174 lines
5.3 KiB
HTML

{% 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 %}
</div>
{% if in_db_but_not_in_virt|length > 0 %}
<div class="row third-margin">
<h1>🚨 in the database but not in the virtualization model 🚨</h1>
</div>
{% for vm in in_db_but_not_in_virt %}
<div class="row">
{{vm['id']}} ({{vm['email']}}) {{vm['public_ipv4']}}
</div>
{% endfor %}
<hr/>
{% endif %}
{% if state_not_equal_to_desired_state|length > 0 %}
<div class="row third-margin">
<h1>😴 vm state != desired state 😴</h1>
</div>
{% for vm in state_not_equal_to_desired_state %}
<div class="row">
<div>{{vm['id']}} ({{vm['email']}}): state={{vm['state']}} desired_state={{vm['desired_state']}}</div>
<form method="post">
<input type="hidden" name="action" value="start_or_stop"></input>
<input type="hidden" name="id" value="{{vm['id']}}"></input>
<input type="hidden" name="desired_state" value="{{vm['desired_state']}}"></input>
<input type="hidden" name="csrf-token" value="{{ csrf_token }}"/>
<input type="submit" value="🚦 START/STOP"/>
</form>
</div>
{% endfor %}
<hr/>
{% endif %}
{% if has_no_desired_ip_address|length > 0 %}
<div class="row third-margin">
<h1>🐣 has no desired ip address 🐣</h1>
</div>
{% for vm in has_no_desired_ip_address %}
<div class="row">
{{vm['id']}} ({{vm['email']}})
</div>
{% endfor %}
<hr/>
{% endif %}
{% if has_not_aquired_ip_address_yet|length > 0 %}
<div class="row third-margin">
<h1>🏃 hasn't aquired an ip address yet 🏃</h1>
</div>
{% for vm in has_not_aquired_ip_address_yet %}
<div class="row">
{{vm['id']}} ({{vm['email']}}) desired_ipv4={{vm['public_ipv4']}}
</div>
{% endfor %}
<hr/>
{% endif %}
{% if stole_someone_elses_ip_and_own_ip_avaliable|length > 0 %}
<div class="row third-margin">
<h1>👻 stole someone elses ip and own desired ip is avaliable 👻</h1>
</div>
{% for vm in stole_someone_elses_ip_and_own_ip_avaliable %}
<div class="row">
<div>{{vm['id']}} ({{vm['email']}}): 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>
{% endfor %}
<hr/>
{% endif %}
{% if has_wrong_ip|length > 0 %}
<div class="row third-margin">
<h1>🥴 has wrong ip address 🥴</h1>
</div>
{% for vm in has_wrong_ip %}
<div class="row">
<div>{{vm['id']}} ({{vm['email']}}): 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>
{% endfor %}
<hr/>
{% endif %}
{% if stole_someone_elses_ip_but_own_ip_also_stolen|length > 0 %}
<div class="row third-margin">
<h1>💀 stole someone elses ip but own desired ip was also stolen 💀</h1>
</div>
{% for vm in stole_someone_elses_ip_but_own_ip_also_stolen %}
<div class="row">
<div>{{vm['id']}} ({{vm['email']}}): 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/>
{% endif %}
<div class="third-margin">
<div class="row">
<h1>📢 Admin Megaphone: Email All Users who have 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>
{% endblock %}
{% block pagesource %}/templates/admin.html{% endblock %}