diff options
Diffstat (limited to 'dash/pages/dozmod.py')
-rw-r--r-- | dash/pages/dozmod.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/dash/pages/dozmod.py b/dash/pages/dozmod.py index 4d9fb24..d7db6b5 100644 --- a/dash/pages/dozmod.py +++ b/dash/pages/dozmod.py @@ -40,7 +40,7 @@ def layout(): dbc.Col(width=12, lg=6, children=[ dcc.Dropdown( id='dozmod-satellites', - options=[{'label': s, 'value': s} for s in get_satellites()], + options=[{'label': name, 'value': ip} for ip, name in get_satellites()], multi=True, value=[], placeholder='All Satellites', @@ -193,9 +193,13 @@ def get_satellites(): dbcon = db.getConnection() cursor = dbcon.cursor() - cursor.execute("""SELECT DISTINCT ip FROM reports""") + cursor.execute(""" + SELECT DISTINCT r.ip, COALESCE(nm.name, r.ip) AS name FROM reports r + LEFT OUTER JOIN names nm ON r.ip = nm.ip + ORDER BY name ASC + """) - data = [item['ip'] for item in cursor.fetchall()] + data = [(item['ip'], item['name']) for item in cursor.fetchall()] db.closeConnection(dbcon) return data |