mirror of
https://github.com/FAUSheppy/icinga-webhook-gateway
synced 2025-12-06 07:21:38 +01:00
update: improve visuals & status list
This commit is contained in:
@@ -51,7 +51,7 @@ class Status(db.Model):
|
||||
|
||||
def human_date(self):
|
||||
dt = datetime.datetime.fromtimestamp(self.timestamp)
|
||||
return dt.strftime("%d-%m%-%y %H:%M")
|
||||
return dt.strftime("%d. %B %Y at %H:%M")
|
||||
|
||||
def buildReponseDict(status, service=None):
|
||||
|
||||
@@ -91,7 +91,6 @@ def overview():
|
||||
status_age = datetime.datetime.now() - status_time_parsed
|
||||
|
||||
# check service timeout #
|
||||
print(service.timeout, service, service.token)
|
||||
timeout = datetime.timedelta(seconds=service.timeout)
|
||||
if status_age > timeout:
|
||||
status.status = "WARNING"
|
||||
@@ -134,10 +133,10 @@ def service_details():
|
||||
if service.owner and service.owner != user:
|
||||
return ("Services is not owned by {}".format(user))
|
||||
|
||||
status_list = db.session.query()
|
||||
status_list = db.session.query(Status).filter(Status.service==service.service).all()
|
||||
|
||||
return flask.render_template("service_info.html", service=service, flask=flask,
|
||||
user=user)
|
||||
user=user, status_list=status_list)
|
||||
|
||||
|
||||
@app.route("/entry-form", methods=["GET", "POST", "DELETE"])
|
||||
|
||||
@@ -68,6 +68,10 @@ body{
|
||||
color: pink;
|
||||
}
|
||||
|
||||
.ok{
|
||||
color: #5aff5a;
|
||||
}
|
||||
|
||||
.warning{
|
||||
color: orange;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{% if status.timestamp == 0 %}
|
||||
Service never reported in
|
||||
{% else %}
|
||||
{{ datetime.fromtimestamp(status.timestamp).strftime("%H:%M on %d.%b.%y") }}
|
||||
{{ status.human_date() }}
|
||||
{% endif %}
|
||||
</small>
|
||||
</a>
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
|
||||
<div class="last-status">
|
||||
{% if status_list | length > 0 %}
|
||||
<p>{{ status_list[0].status }} submitted on {{ status_list[0].timestamp }}</i>
|
||||
<p class="{{ status_list[0].status }}">
|
||||
{{ status_list[0].status }} submitted on {{ status_list[0].human_date() }}
|
||||
</p>
|
||||
{% else %}
|
||||
<p style="color: darkred;">No status for this service submitted</i>
|
||||
<p style="color: darkred;">No status for this service submitted</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -58,11 +60,13 @@
|
||||
<th>Info</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tbody class="mt-2">
|
||||
{% for status in status_list %}
|
||||
<td>status.human_date()<td>
|
||||
<td>status.status</td>
|
||||
<td>status.info</td>
|
||||
<tr>
|
||||
<td>{{ status.human_date() }}</td>
|
||||
<td class="{{ status.status }}">{{ status.status }}</td>
|
||||
<td>{{ status.info_text }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user