Better persistence, better dashboard

This commit is contained in:
Remy Moll 2021-01-14 12:49:18 +01:00
parent 1c15bf4a4e
commit fbba5010a3
2 changed files with 18 additions and 8 deletions

View File

@ -64,6 +64,10 @@ class BotFramework():
def react_chats(self):
"""Checks unanswered messages and answers them"""
# HACKY: TODO remove
self.persistence.sync()
# writes persistent variables to file so that they ACTUALLY persist
num = self.telegram.fetch_updates()
for i in range(num):
self.react_command()

View File

@ -54,7 +54,7 @@ class DashBoard():
def launch_dashboard(self):
self.app.run_server(host=self.host_ip)#, debug=True)
self.app.run_server(host=self.host_ip, port=8080)#, debug=True)
def card_header(self):
@ -75,7 +75,7 @@ class DashBoard():
ret = []
for l in self.persistence["global"]["lists"].keys():
l_content = self.persistence["global"]["lists"][l]
html_content = [dbc.ListGroupItem(t) for t in l_content]
html_content = [html.A(t, href="#", className="list-group-item bg-dark list-group-item-action text-light") for t in l_content]
card = dbc.Card(
[
dbc.CardBody([
@ -99,12 +99,18 @@ class DashBoard():
ye = self.persistence["bot"]["execute_activity"]["count"]
fig = go.Figure()
fig.add_trace(go.Scatter(x=xr, y=yr, fill="tozeroy", mode="lines", text="Gelesen"))
fig.add_trace(go.Scatter(x=xs, y=ys, fill="tozeroy", mode="lines", text="Gesendet"))
fig.add_trace(go.Scatter(x=xe, y=ye, fill="tozeroy", mode="lines", text="Ausgeführt"))
fig.add_trace(go.Scatter(x=xr, y=yr, mode="lines", text="Gelesen", line=dict(width=4)))
fig.add_trace(go.Scatter(x=xs, y=ys, mode="lines", text="Gesendet", line=dict(width=4)))
fig.add_trace(go.Scatter(x=xe, y=ye, mode="lines", text="Ausgeführt", line=dict(width=4)))
fig.layout.update(showlegend=False,margin=dict(l=0, r=0, t=0, b=0),)
fig.update_xaxes(showgrid=False)
fig.update_yaxes(showgrid=False)
fig.layout.update(
showlegend=False,
margin=dict(l=0, r=0, t=0, b=0),
paper_bgcolor='rgba(0,0,0,0)',
plot_bgcolor='rgba(0,0,0,0)',
)
card = dbc.Card(
[