Compare commits
No commits in common. "74c6a1930245b25a314cc6321357b19ce9222c5a" and "42ba485794ab43d1081476ccf0bfe0c361c2835d" have entirely different histories.
74c6a19302
...
42ba485794
25
dashboard.py
25
dashboard.py
|
@ -77,29 +77,7 @@ class Widget:
|
||||||
return f"hsl(0, 100%, {brightness}%)"
|
return f"hsl(0, 100%, {brightness}%)"
|
||||||
else:
|
else:
|
||||||
log.debug("the other side")
|
log.debug("the other side")
|
||||||
if self.lastvalue > self.stops[0]:
|
return "#CCC"
|
||||||
log.debug("definitely ok")
|
|
||||||
return f"hsl(120, 100%, {brightness}%)"
|
|
||||||
elif self.lastvalue > self.stops[1]:
|
|
||||||
log.debug("mostly ok")
|
|
||||||
hue = 120 - round(
|
|
||||||
(self.lastvalue - self.stops[0])
|
|
||||||
/ (self.stops[1] - self.stops[0])
|
|
||||||
* 60
|
|
||||||
)
|
|
||||||
return f"hsl({hue}, 100%, {brightness}%)"
|
|
||||||
elif self.lastvalue > self.stops[2]:
|
|
||||||
log.debug("maybe fail")
|
|
||||||
hue = 60 - round(
|
|
||||||
(self.lastvalue - self.stops[1])
|
|
||||||
/ (self.stops[2] - self.stops[1])
|
|
||||||
* 60
|
|
||||||
)
|
|
||||||
return f"hsl({hue}, 100%, {brightness}%)"
|
|
||||||
else:
|
|
||||||
log.debug("definitely fail")
|
|
||||||
return f"hsl(0, 100%, {brightness}%)"
|
|
||||||
|
|
||||||
|
|
||||||
class TimeSeries(Widget):
|
class TimeSeries(Widget):
|
||||||
def __init__(self, d):
|
def __init__(self, d):
|
||||||
|
@ -116,7 +94,6 @@ class Gauge(Widget):
|
||||||
@property
|
@property
|
||||||
def gaugepos(self):
|
def gaugepos(self):
|
||||||
max_value = max([d[1] for d in self.lts.data])
|
max_value = max([d[1] for d in self.lts.data])
|
||||||
max_value = max(max_value, 1) # ensure positive
|
|
||||||
log.debug("max_value = %s", max_value)
|
log.debug("max_value = %s", max_value)
|
||||||
return self.lastvalue / max_value * self.gaugesize
|
return self.lastvalue / max_value * self.gaugesize
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class DiskFullPredictor:
|
||||||
return
|
return
|
||||||
current_used_bytes = lts.data[-1][1]
|
current_used_bytes = lts.data[-1][1]
|
||||||
current_usable_bytes = usable_lts.data[-1][1]
|
current_usable_bytes = usable_lts.data[-1][1]
|
||||||
tuf = 1E9
|
tuf = float('inf')
|
||||||
for d in reversed(lts.data):
|
for d in reversed(lts.data):
|
||||||
if d[1] < current_usable_bytes * 0.1:
|
if d[1] < current_usable_bytes * 0.1:
|
||||||
continue # for sanity
|
continue # for sanity
|
||||||
|
|
Loading…
Reference in New Issue