From dc9b71ae01f433d6ebf99b1e0338bd6f9bdeb5a4 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Fri, 23 Nov 2018 20:06:10 +0100 Subject: [PATCH] router/router_list/user.html: Indicate missing coordinates This also indicates missing coordinates without a previous reset. The router detail page shows different messages for both cases (missing coords and reset). The lists show the "Reset!" warning in both cases (previously only for real reset). Signed-off-by: Adrian Schmutzler --- ffmap/web/application.py | 4 ++-- ffmap/web/templates/router.html | 2 ++ ffmap/web/templates/router_list.html | 2 +- ffmap/web/templates/user.html | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ffmap/web/application.py b/ffmap/web/application.py index 63f078d..2e11f12 100755 --- a/ffmap/web/application.py +++ b/ffmap/web/application.py @@ -52,7 +52,7 @@ def router_list(): mysql = FreifunkMySQL() routers = mysql.fetchall(""" - SELECT router.id, hostname, status, hoods.id AS hoodid, hoods.name AS hood, contact, nickname, hardware, router.created, sys_uptime, last_contact, clients, reset, blocked, v2, local + SELECT router.id, hostname, status, hoods.id AS hoodid, hoods.name AS hood, contact, nickname, hardware, router.created, sys_uptime, last_contact, clients, router.lat, router.lng, reset, blocked, v2, local FROM router INNER JOIN hoods ON router.hood = hoods.id LEFT JOIN users ON router.contact = users.email @@ -490,7 +490,7 @@ def user_info(nickname): else: flash("You are not authorized to perform this action!", "danger") routers = mysql.fetchall(""" - SELECT router.id, hostname, status, hoods.id AS hoodid, hoods.name AS hood, firmware, hardware, created, sys_uptime, clients, reset, blocked, v2, local + SELECT router.id, hostname, status, hoods.id AS hoodid, hoods.name AS hood, firmware, hardware, created, sys_uptime, clients, router.lat, router.lng, reset, blocked, v2, local FROM router INNER JOIN hoods ON router.hood = hoods.id LEFT JOIN ( diff --git a/ffmap/web/templates/router.html b/ffmap/web/templates/router.html index 4e38c00..9ecf3f9 100644 --- a/ffmap/web/templates/router.html +++ b/ffmap/web/templates/router.html @@ -153,6 +153,8 @@ {%- endif -%} {%- if router.reset %} - Router has lost its position! + {%- elif not router.lat and not router.lng %} + - Router has no position! {%- endif -%} {%- endif %} diff --git a/ffmap/web/templates/router_list.html b/ffmap/web/templates/router_list.html index 6a2e966..c173b3b 100644 --- a/ffmap/web/templates/router_list.html +++ b/ffmap/web/templates/router_list.html @@ -44,7 +44,7 @@ {%- for router in routers %} {{ router.hostname }} - {%- if router.reset %} - Reset!{%- endif %}{%- if router.blocked and not router.v2 %} - Blocked!{%- endif %} + {%- if not router.lat and not router.lng %} - Reset!{%- endif %}{%- if router.blocked and not router.v2 %} - Blocked!{%- endif %} {{ router.status }} {{ router.hood }} diff --git a/ffmap/web/templates/user.html b/ffmap/web/templates/user.html index ade7a80..b798947 100644 --- a/ffmap/web/templates/user.html +++ b/ffmap/web/templates/user.html @@ -104,7 +104,7 @@ {%- for router in routers %} {{ router.hostname }} - {%- if router.reset %} - Reset!{%- endif %}{%- if router.blocked and not router.v2 %} - Blocked!{%- endif %} + {%- if not router.lat and not router.lng %} - Reset!{%- endif %}{%- if router.blocked and not router.v2 %} - Blocked!{%- endif %} {{ router.status }} {{ router.hood }}