From c6b1ee42d14d360d88361737ac94cb576cfcb185 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Thu, 31 Jan 2019 19:25:54 +0100 Subject: Add horizontal / vertical param Small design bugfixes. Add horizontal param: Overrides min-width >1500px media Add vertical param: Overrides max-width 850px media Remove images in the header when the side gets to small --- bwLpStatus.py | 12 ++++- bwlpMonitor_template.html | 116 ++++++++++++++++++++++++++++++++++------------ style.css | 47 +++++-------------- 3 files changed, 107 insertions(+), 68 deletions(-) diff --git a/bwLpStatus.py b/bwLpStatus.py index 882ec1f..59f37b8 100755 --- a/bwLpStatus.py +++ b/bwLpStatus.py @@ -131,7 +131,7 @@ def thrift(name, ip, port, server): elif server == 'MASTER': masterserver = make_client(bwlp_thrift.MasterServer, ip, port, trans_factory=TFramedTransportFactory()) organisations = masterserver.getOrganizations() - print(organisations) + organisationList = [] for org in organisations: organisationList.append(Organisation(org.organizationId, org.displayName)) @@ -149,6 +149,7 @@ def thrift(name, ip, port, server): # Parses the log from the logfile. Fills the logEntries array. def parseLog(): + global logEntries if not (os.path.exists('bwLpStatusLog.txt')): return with open('bwLpStatusLog.txt', 'r') as log: @@ -157,6 +158,7 @@ def parseLog(): entry = line.split('\t') if len(entry) < 4: continue logEntries.append(LogEntry(entry[0], entry[1], entry[2], entry[3], '' if len(entry) < 5 else entry[4], [] if len(entry) < 6 else entry[5])) + global newLogIndex newLogIndex = len(logEntries) @@ -243,7 +245,13 @@ for status in statusList: # Generate the html code for the log. log = '\r\n' -for entry in reversed(logEntries): + +# Cut the log to the last n entries +n = 500 +cut_amount = 0 +if len(logEntries) >= n: + cut_amount = len(logEntries) - n +for entry in reversed(logEntries[cut_amount:]): log += ('