From 4af5338fe92698fff27f8690938843c051dbf000 Mon Sep 17 00:00:00 2001 From: Alex Faircloth <41074440+afairclo@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:21:47 -0400 Subject: [PATCH 1/5] Remove device role if role not sent [mqtt.py](https://github.com/MeshAddicts/meshinfo/blob/43ae523acd59c1c1042d4ed45633c8e4b3e81dcc/mqtt.py#L406) is updating node role info when a role is included with the nodeinfo message, but it appears nodes that are set to Client don't send a "role: 0" in the message. If device is configured for any other role and is ingested by Meshinfo, and later configured for client, Meshinfo is not removing the set role. --- mqtt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mqtt.py b/mqtt.py index ee5101a..c2a457d 100644 --- a/mqtt.py +++ b/mqtt.py @@ -405,6 +405,8 @@ async def handle_nodeinfo(self, msg): if 'role' in msg['payload']: node['role'] = msg['payload']['role'] + else + node['role'] = 0 self.data.update_node(id, node) print(f"Node {id} added") From 5c3f33933df4e2fc923d69c6a826a22ea29a1e3d Mon Sep 17 00:00:00 2001 From: Alex Faircloth <41074440+afairclo@users.noreply.github.com> Date: Wed, 28 Aug 2024 12:08:02 -0400 Subject: [PATCH 2/5] Set z-index for node status --- templates/static/map.html.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/static/map.html.j2 b/templates/static/map.html.j2 index 624216c..ae0f852 100644 --- a/templates/static/map.html.j2 +++ b/templates/static/map.html.j2 @@ -87,6 +87,7 @@ stroke: new ol.style.Stroke({ color: 'white', width: 2 + zIndex:0 }) }) }); @@ -100,6 +101,7 @@ stroke: new ol.style.Stroke({ color: 'white', width: 2 + zIndex: 1 }) }) }); @@ -113,6 +115,7 @@ stroke: new ol.style.Stroke({ color: 'white', width: 2 + zIndex: 2 }) }) }); From 8383d37262f89d9476e0e74287ab2b7cccad791d Mon Sep 17 00:00:00 2001 From: Alex Faircloth <41074440+afairclo@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:19:11 -0400 Subject: [PATCH 3/5] Missing colon on else statement --- mqtt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mqtt.py b/mqtt.py index c2a457d..cb6fcd7 100644 --- a/mqtt.py +++ b/mqtt.py @@ -405,7 +405,7 @@ async def handle_nodeinfo(self, msg): if 'role' in msg['payload']: node['role'] = msg['payload']['role'] - else + else: node['role'] = 0 self.data.update_node(id, node) From e5318ec211ebddf4a8c230283def3975d5f3e184 Mon Sep 17 00:00:00 2001 From: Alex Faircloth <41074440+afairclo@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:14:45 -0400 Subject: [PATCH 4/5] Fix zIndex placement Should be a property of the style and not the image (I believe) --- templates/static/map.html.j2 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/static/map.html.j2 b/templates/static/map.html.j2 index ae0f852..96a9ea0 100644 --- a/templates/static/map.html.j2 +++ b/templates/static/map.html.j2 @@ -87,9 +87,9 @@ stroke: new ol.style.Stroke({ color: 'white', width: 2 - zIndex:0 }) - }) + }), + zIndex: 0 }); var offlineStyle = new ol.style.Style({ @@ -101,9 +101,9 @@ stroke: new ol.style.Stroke({ color: 'white', width: 2 - zIndex: 1 }) - }) + }), + zIndex: 1 }); var onlineStyle = new ol.style.Style({ @@ -115,9 +115,9 @@ stroke: new ol.style.Stroke({ color: 'white', width: 2 - zIndex: 2 }) - }) + }), + zIndex: 2 }); const nodes = {}; From 8ef29f808975ea8b5799f1f8c1e0b2c4f020be0f Mon Sep 17 00:00:00 2001 From: Alex Faircloth <41074440+afairclo@users.noreply.github.com> Date: Wed, 4 Sep 2024 13:58:02 -0400 Subject: [PATCH 5/5] Indentation adjustment --- templates/static/map.html.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/static/map.html.j2 b/templates/static/map.html.j2 index 96a9ea0..fd5aa84 100644 --- a/templates/static/map.html.j2 +++ b/templates/static/map.html.j2 @@ -89,7 +89,7 @@ width: 2 }) }), - zIndex: 0 + zIndex: 0 }); var offlineStyle = new ol.style.Style({ @@ -103,7 +103,7 @@ width: 2 }) }), - zIndex: 1 + zIndex: 1 }); var onlineStyle = new ol.style.Style({ @@ -117,7 +117,7 @@ width: 2 }) }), - zIndex: 2 + zIndex: 2 }); const nodes = {};