format home.jinja2

This commit is contained in:
Robert Resch 2021-09-20 22:00:45 +02:00
parent aaf34097b4
commit a76d64429d
No known key found for this signature in database
GPG key ID: 6B360759EB2ACAEE

View file

@ -1,7 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title>Bumper</title> <title>Bumper</title>
<meta http-equiv="refresh" content="5"/> <meta http-equiv="refresh" content="5"/>
<script> <script>
@ -15,7 +16,6 @@
alert("Restarting " + service + ": " + myJson["status"]) alert("Restarting " + service + ": " + myJson["status"])
console.log("restart", service, "-", myJson["status"]); console.log("restart", service, "-", myJson["status"]);
}); });
} }
function removeBot(did) { function removeBot(did) {
@ -28,12 +28,9 @@
alert("Removing Bot (DID) - " + did + " - " + myJson["status"]) alert("Removing Bot (DID) - " + did + " - " + myJson["status"])
console.log("remove bot", did, myJson["status"]); console.log("remove bot", did, myJson["status"]);
}); });
} }
function removeClient(resource) { function removeClient(resource) {
console.log("remove client", resource); console.log("remove client", resource);
fetch('client/remove/' + resource) fetch('client/remove/' + resource)
.then((response) => { .then((response) => {
@ -43,9 +40,7 @@
alert("Removing Client - resource - " + resource + " - " + myJson["status"]) alert("Removing Client - resource - " + resource + " - " + myJson["status"])
console.log("remove client", resource, myJson["status"]); console.log("remove client", resource, myJson["status"]);
}); });
} }
</script> </script>
</head> </head>
<body> <body>
@ -68,66 +63,94 @@
<div class="card border border-dark"> <div class="card border border-dark">
<div class="card card-header"> <div class="card card-header">
<h3 class="card-title">MQTT Server</h3> <h3 class="card-title">MQTT Server</h3>
<div>Action: <button type="button" class="btn btn-outline-danger btn-sm" onclick="restartService('MQTTServer');">Restart Service</button></div> <div>Action:
<button type="button" class="btn btn-outline-danger btn-sm"
onclick="restartService('MQTTServer');">Restart Service
</button>
</div>
</div> </div>
<div class="card-body"> <div class="card-body">
Status: {% if mqtt_server[0].state == "started" %} <span class="badge badge-success">{{ mqtt_server[0].state }}</span> {% else %} <span class="badge badge-danger">{{ mqtt_server[0].state }}</span> {% endif %} Status: {% if mqtt_server[0].state == "started" %}
<span class="badge badge-success">{{ mqtt_server[0].state }}</span> {% else %}
<span class="badge badge-danger">{{ mqtt_server[0].state }}</span> {% endif %}
Sessions: {{ mqtt_server[1].sessions[0].count }} Sessions: {{ mqtt_server[1].sessions[0].count }}
<table class="table table-striped table-bordered table-responsive-lg"> <table class="table table-striped table-bordered table-responsive-lg">
<thead class="thead-dark"> <thead class="thead-dark">
<TH>username</TH><TH>clientid</TH><TH>state</TH> <tr>
<th>username</th>
<th>clientid</th>
<th>state</th>
</tr>
</thead> </thead>
{% for sess in mqtt_server[1].sessions[1].clients %} {% for sess in mqtt_server[1].sessions[1].clients %}
<TR> <tr>
<TD>{{ sess[0].username }}</TD> <td>{{ sess[0].username }}</td>
<TD>{{ sess[0].client_id }}</TD> <td>{{ sess[0].client_id }}</td>
<TD {% if sess[0].state == "connected" %} class="table-success" {% endif %}> {{ sess[0].state }} </TD> <td {% if sess[0].state == "connected" %}
</TR> class="table-success" {% endif %}> {{ sess[0].state }} </td>
</tr>
{% endfor %} {% endfor %}
</table> </table>
</div> </div>
</div> </div>
</br> <br/>
<div class="card border border-dark"> <div class="card border border-dark">
<div class="card card-header"> <div class="card card-header">
<h3 class="card-title">XMPP Server</h3> <h3 class="card-title">XMPP Server</h3>
<div>Action: <button type="button" class="btn btn-outline-danger btn-sm" onclick="restartService('XMPPServer');">Restart Service</button></div> <div>Action:
<button type="button" class="btn btn-outline-danger btn-sm"
onclick="restartService('XMPPServer');">Restart Service
</button>
</div>
</div> </div>
<div class="card-body"> <div class="card-body">
Status: {% if xmpp_server.server._serving == True %} <span class="badge badge-success">running</span> {% else %} <span class="badge badge-danger">not running</span> {% endif %} Status: {% if xmpp_server.server._serving == True %}
<span class="badge badge-success">running</span> {% else %}
<span class="badge badge-danger">not running</span> {% endif %}
Clients: {{ xmpp_server.clients | length }} Clients: {{ xmpp_server.clients | length }}
<table class="table table-striped table-bordered table-responsive-lg"> <table class="table table-striped table-bordered table-responsive-lg">
<thead class="thead-dark"> <thead class="thead-dark">
<TH>uid</TH><TH>jid</TH><TH>state</TH> <tr>
<th>uid</th>
<th>jid</th>
<th>state</th>
</tr>
</thead> </thead>
{% for client in xmpp_server.clients %} {% for client in xmpp_server.clients %}
<TR> <tr>
<TD>{{ client.uid }}</TD> <td>{{ client.uid }}</td>
<TD>{{ client.bumper_jid }}</TD> <td>{{ client.bumper_jid }}</td>
<TD {% if client.state == 4 %} class="table-success" {% endif %}>{% if client.state == 4 %} connected {% else %} not connected {% endif %}</TD> <td {% if client.state == 4 %} class="table-success" {% endif %}>
</TR> {% if client.state == 4 %} connected {% else %} not connected {% endif %}</td>
</tr>
{% endfor %} {% endfor %}
</table> </table>
</div> </div>
</div> </div>
</br> <br/>
<div class="card border border-dark"> <div class="card border border-dark">
<div class="card card-header"> <div class="card card-header">
<h3 class="card-title">Helperbot</h3> <h3 class="card-title">Helperbot</h3>
<div>Action: <button type="button" class="btn btn-outline-danger btn-sm" onclick="restartService('Helperbot');">Restart Service</button></div> <div>Action:
<button type="button" class="btn btn-outline-danger btn-sm"
onclick="restartService('Helperbot');">Restart Service
</button>
</div>
</div> </div>
<div class="card-body"> <div class="card-body">
Status: {% if helperbot[0].state == "connected" %} <span class="badge badge-success">{{ helperbot[0].state }}</span> {% else %} <span class="badge badge-danger">{{ helperbot[0].state }}</span> {% endif %} Status: {% if helperbot[0].state == "connected" %}
<span class="badge badge-success">{{ helperbot[0].state }}</span> {% else %}
<span class="badge badge-danger">{{ helperbot[0].state }}</span> {% endif %}
</div> </div>
</div> </div>
@ -135,7 +158,7 @@
</div> </div>
</div> </div>
</br> <br/>
<!-- Section Bots --> <!-- Section Bots -->
<div class="card border-dark"> <div class="card border-dark">
@ -145,27 +168,43 @@
<div class="card-body"> <div class="card-body">
<table class="table table-striped table-bordered table-responsive-lg"> <table class="table table-striped table-bordered table-responsive-lg">
<thead class="thead-dark"> <thead class="thead-dark">
<TH>SN</TH><TH>Nickname</TH><TH>Class</TH><TH>DID</TH><TH>Resource</TH><TH>Company</TH><TH>MQTT Connected</TH><TH>XMPP Connected</TH><TH>Action</TH> <tr>
<th>SN</th>
<th>Nickname</th>
<th>Class</th>
<th>DID</th>
<th>Resource</th>
<th>Company</th>
<th>MQTT Connected</th>
<th>XMPP Connected</th>
<th>Action</th>
</tr>
</thead> </thead>
{% for bot in bots %} {% for bot in bots %}
<TR> <tr>
<TD>{{ bot.name }}</TD> <td>{{ bot.name }}</td>
<TD>{{ bot.nick }}</TD> <td>{{ bot.nick }}</td>
<TD>{{ bot.class }}</TD> <td>{{ bot.class }}</td>
<TD>{{ bot.did }}</TD> <td>{{ bot.did }}</td>
<TD>{{ bot.resource }} </TD> <td>{{ bot.resource }} </td>
<TD>{{ bot.company}} </TD> <td>{{ bot.company }} </td>
<TD {% if bot.mqtt_connection == True %} class="table-success" {% endif %}> {{ bot.mqtt_connection }} </TD> <td {% if bot.mqtt_connection == True %}
<TD {% if bot.xmpp_connection == True %} class="table-success" {% endif %}> {{ bot.xmpp_connection }}</TD> class="table-success" {% endif %}> {{ bot.mqtt_connection }} </td>
<TD> <button type="button" class="btn btn-outline-danger btn-sm" onclick="removeBot('{{ bot.did }}');">Remove</button> </TD> <td {% if bot.xmpp_connection == True %}
</TR> class="table-success" {% endif %}> {{ bot.xmpp_connection }}</td>
<td>
<button type="button" class="btn btn-outline-danger btn-sm"
onclick="removeBot('{{ bot.did }}');">Remove
</button>
</td>
</tr>
{% endfor %} {% endfor %}
</table> </table>
</div> </div>
</div> </div>
</br> <br />
<!-- Section Clients --> <!-- Section Clients -->
<div class="card border-dark"> <div class="card border-dark">
@ -175,17 +214,30 @@
<div class="card-body"> <div class="card-body">
<table class="table table-striped table-bordered table-responsive-lg"> <table class="table table-striped table-bordered table-responsive-lg">
<thead class="thead-dark"> <thead class="thead-dark">
<TH>User ID</TH><TH>Realm</TH><TH>Resource</TH><TH>MQTT Connected</TH><TH>XMPP Connected</TH><TH>Action</TH> <tr>
<th>User ID</th>
<th>Realm</th>
<th>Resource</th>
<th>MQTT Connected</th>
<th>XMPP Connected</th>
<th>Action</th>
</tr>
</thead> </thead>
{% for client in clients %} {% for client in clients %}
<TR> <tr>
<TD>{{ client.userid }}</TD> <td>{{ client.userid }}</td>
<TD>{{ client.realm }}</TD> <td>{{ client.realm }}</td>
<TD>{{ client.resource }}</TD> <td>{{ client.resource }}</td>
<TD {% if client.mqtt_connection == True %} class="table-success" {% endif %}> {{ client.mqtt_connection }} </TD> <td {% if client.mqtt_connection == True %}
<TD {% if client.xmpp_connection == True %} class="table-success" {% endif %}> {{ client.xmpp_connection }}</TD> class="table-success" {% endif %}> {{ client.mqtt_connection }} </td>
<TD> <button type="button" class="btn btn-outline-danger btn-sm" onclick="removeClient('{{ client.resource }}');">Remove</button> </TD> <td {% if client.xmpp_connection == True %}
</TR> class="table-success" {% endif %}> {{ client.xmpp_connection }}</td>
<td>
<button type="button" class="btn btn-outline-danger btn-sm"
onclick="removeClient('{{ client.resource }}');">Remove
</button>
</td>
</tr>
{% endfor %} {% endfor %}
</table> </table>
</div> </div>