summaryrefslogtreecommitdiffstats
path: root/dash/pages/satellites.py
diff options
context:
space:
mode:
Diffstat (limited to 'dash/pages/satellites.py')
-rw-r--r--dash/pages/satellites.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/dash/pages/satellites.py b/dash/pages/satellites.py
index 37a1f61..681c70b 100644
--- a/dash/pages/satellites.py
+++ b/dash/pages/satellites.py
@@ -19,7 +19,7 @@ def layout():
html.Div(className='table-responsive-lg', children=[dtbl.DataTable(
id='satellites-table',
columns=[
- {'id': 'ip', 'name': 'IP', 'type': 'text'},
+ {'id': 'name', 'name': 'Name', 'type': 'text'},
{'id': 'date', 'name': 'Last Report', 'type': 'text'},
{'id': 'version', 'name': 'Version', 'type': 'text'},
{'id': 'numReports', 'name': '#Reports'},
@@ -52,7 +52,7 @@ def load_table(sort):
sortstr = "ORDER BY r.date DESC"
if sort != None and len(sort) > 0:
mappings = {
- 'ip': 'r.ip',
+ 'name': 'name',
'date': 'r.date',
'version': 'r.version',
'numReports': 'n.numReports',
@@ -67,10 +67,12 @@ def load_table(sort):
cursor.execute("""
SELECT
- r.ip, r.version, r.date, s.cpuCount, s.cpuModel, s.uptime, n.numReports,
+ COALESCE(nm.name, r.ip) AS name,
+ r.version, r.date, s.cpuCount, s.cpuModel, s.uptime, n.numReports,
ROUND(100 - s.memFree / s.memTotal * 100, 1) as memPercent,
ROUND(s.swapUsed / s.swapTotal * 100, 1) as swapPercent
FROM reports_newest r
+ LEFT OUTER JOIN names nm ON r.ip = nm.ip
LEFT OUTER JOIN server s ON r.id = s.report
LEFT OUTER JOIN (SELECT ip, COUNT(date) AS numReports FROM reports GROUP BY ip) n ON r.ip = n.ip
""" + sortstr)