add restart services

restart services from status page
This commit is contained in:
Brian Martin 2020-01-02 23:56:30 -05:00
parent 2d5e4e17a0
commit c77f464c9d
3 changed files with 117 additions and 31 deletions

View file

@ -3,6 +3,48 @@
<head>
<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>
<meta http-equiv="refresh" content="5" />
<script>
function restartHelperbot() {
console.log("restart helperbot");
fetch('restart_Helperbot')
.then((response) => {
return response.json();
})
.then((myJson) => {
alert("Restarting Helperbot: " + myJson["status"])
console.log("restart helperbot - " + myJson["status"]);
});
}
function restartMQTTServer() {
console.log("restart mqtt server");
fetch('restart_MQTTServer')
.then((response) => {
return response.json();
})
.then((myJson) => {
alert("Restarting MQTT Server: " + myJson["status"])
console.log("restart mqtt server - " + myJson["status"]);
});
}
function restartXMPPServer() {
console.log("restart xmpp server");
fetch('restart_XMPPServer')
.then((response) => {
return response.json();
})
.then((myJson) => {
alert("Restarting XMPP Server: " + myJson["status"])
console.log("restart xmpp server - " + myJson["status"]);
});
}
</script>
</head>
<body>
<ul id="navigation">
@ -11,21 +53,26 @@
{% endfor %}
</ul>
<div class="container-fluid col-8">
<div class="col-8">
<h1>Bumper</h1>
<!-- Section Stats -->
<div class="card bg-light border-dark">
<div class="card-header">
<h2 class="card-title">Bumper Server Status</h2>
<h2 class="card-title">Server Status</h2>
</div>
<div class="card-body">
<h3>MQTT Server</h3>
<div class="card border border-dark">
<div class="card card-header">
<h3 class="card-title">MQTT Server</h3>
<div>Action: <button type="button" class="btn btn-outline-danger btn-sm" onclick="restartMQTTServer();">Restart Service</button></div>
</div>
<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 %}
Sessions: {{ mqtt_server[1].sessions[0].count }}
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered table-responsive-lg">
<thead class="thead-dark">
<TH>username</TH><TH>clientid</TH><TH>state</TH>
</thead>
@ -37,12 +84,22 @@
</TR>
{% endfor %}
</table>
</div>
</div>
<h3>XMPP Server</h3>
</br>
<div class="card border border-dark">
<div class="card card-header">
<h3 class="card-title">XMPP Server</h3>
<div>Action: <button type="button" class="btn btn-outline-danger btn-sm" onclick="restartXMPPServer();">Restart Service</button></div>
</div>
<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 %}
Clients: {{ xmpp_server.clients | length }}
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered table-responsive-lg">
<thead class="thead-dark">
<TH>uid</TH><TH>jid</TH><TH>state</TH>
</thead>
@ -55,23 +112,36 @@
{% endfor %}
</table>
</div>
</div>
</br>
<div class="card border border-dark">
<div class="card card-header">
<h3 class="card-title">Helperbot</h3>
<div>Action: <button type="button" class="btn btn-outline-danger btn-sm" onclick="restartHelperbot();">Restart Service</button></div>
</div>
<h3>Helperbot</h3>
<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 %}
</div>
</div>
</div>
</div>
</br>
<!-- Section Bots -->
<div class="card bg-light border-dark">
<div class="card border-dark">
<div class="card-header">
<h2 class="card-title">Bots</h2>
</div>
<div class="card-body">
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered table-responsive-lg">
<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>
</thead>
@ -95,12 +165,12 @@
</br>
<!-- Section Clients -->
<div class="card bg-light border-dark">
<div class="card border-dark">
<div class="card-header">
<h2 class="card-title">Clients</h2>
</div>
<div class="card-body">
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered table-responsive-lg">
<thead class="thead-dark">
<TH>User ID</TH><TH>Realm</TH><TH>Resource</TH><TH>MQTT Connected</TH><TH>XMPP Connected</TH>
</thead>