From c969bb6b50d86518cb7d726bc397994f07c5e4d4 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Tue, 19 Sep 2023 09:40:26 -0500 Subject: [PATCH] hide field column if absent from all trackers --- plugins/posistagenet/main.js | 1 + plugins/posistagenet/template.ejs | 168 ++++++++++++++++++++---------- 2 files changed, 114 insertions(+), 55 deletions(-) diff --git a/plugins/posistagenet/main.js b/plugins/posistagenet/main.js index 9f34741..e6c169a 100644 --- a/plugins/posistagenet/main.js +++ b/plugins/posistagenet/main.js @@ -47,6 +47,7 @@ exports.data = function data(_device, buf, info) { device.data[address] = { trackers: device.decoders[address].trackers, system_name: device.decoders[address].system_name, + fields: device.decoders[address].getTrackerFields(), }; }); device.draw(); diff --git a/plugins/posistagenet/template.ejs b/plugins/posistagenet/template.ejs index b66d422..a372298 100644 --- a/plugins/posistagenet/template.ejs +++ b/plugins/posistagenet/template.ejs @@ -13,77 +13,135 @@ - - - - - - - + <% if(instanceData.fields.has('tracker_name')) { %> + + <% } %> + + <% if(instanceData.fields.has('pos')) { %> + + <% } %> + + <% if(instanceData.fields.has('speed')) { %> + + <% } %> + + <% if(instanceData.fields.has('ori')) { %> + + <% } %> + + <% if(instanceData.fields.has('status')) { %> + + <% } %> + + <% if(instanceData.fields.has('accel')) { %> + + <% } %> + + <% if(instanceData.fields.has('trgtpos')) { %> + + <% } %> + + <% if(instanceData.fields.has('timestamp')) { %> + + <% } %> - - - - - - - - - - - - - - - - - - - - - - - - + <% if(instanceData.fields.has('tracker_name')) { %> + + <% } %> + + <% if(instanceData.fields.has('pos')) { %> + + + + <% } %> + + <% if(instanceData.fields.has('speed')) { %> + + + + <% } %> + + <% if(instanceData.fields.has('ori')) { %> + + + + <% } %> + + <% if(instanceData.fields.has('status')) { %> + + <% } %> + + <% if(instanceData.fields.has('accel')) { %> + + + + <% } %> + + <% if(instanceData.fields.has('trgtpos')) { %> + + + + <% } %> + + <% if(instanceData.fields.has('timestamp')) { %> + + <% } %> + <% Object.entries(instanceData.trackers).forEach(([trackerId,trackerData]) => { %> - + <% if(instanceData.fields.has('tracker_name')) { %> + + <% } %> + + <% if(instanceData.fields.has('pos')) { %> + + + + + <% } %> - - - - + <% if(instanceData.fields.has('speed')) { %> + + + + + <% } %> - - - - + <% if(instanceData.fields.has('ori')) { %> + + + + + <% } %> - - - - + <% if(instanceData.fields.has('status')) { %> + + <% } %> - + <% if(instanceData.fields.has('accel')) { %> + + + + + <% } %> - - - - + <% if(instanceData.fields.has('trgtpos')) { %> + + + + + <% } %> - - - - + <% if(instanceData.fields.has('timestamp')) { %> + + <% } %> - - <% }); %>
POSSPEEDORIACCELTRGTPOSPOSSPEEDORIACCELTRGTPOS
IDNamexyzxyzxyzvalidityxyzxyztracker_timestampNamexyzxyzxyzvalidityxyzxyztracker_timestamp
<%= trackerId %><%= trackerData.tracker_name?.tracker_name%><%= trackerData.tracker_name?.tracker_name%><%= trackerData.pos?.pos_x?.toFixed(2) %><%= trackerData.pos?.pos_y?.toFixed(2) %><%= trackerData.pos?.pos_z?.toFixed(2) %><%= trackerData.pos?.pos_x?.toFixed(2) %><%= trackerData.pos?.pos_y?.toFixed(2) %><%= trackerData.pos?.pos_z?.toFixed(2) %><%= trackerData.speed?.speed_x?.toFixed(2) %><%= trackerData.speed?.speed_y?.toFixed(2) %><%= trackerData.speed?.speed_z?.toFixed(2) %><%= trackerData.speed?.speed_x?.toFixed(2) %><%= trackerData.speed?.speed_y?.toFixed(2) %><%= trackerData.speed?.speed_z?.toFixed(2) %><%= trackerData.ori?.ori_x?.toFixed(2) %><%= trackerData.ori?.ori_y?.toFixed(2) %><%= trackerData.ori?.ori_z?.toFixed(2) %><%= trackerData.ori?.ori_x?.toFixed(2) %><%= trackerData.ori?.ori_y?.toFixed(2) %><%= trackerData.ori?.ori_z?.toFixed(2) %><%= trackerData.status?.validity?.toFixed(2) %><%= trackerData.status?.validity?.toFixed(2) %><%= trackerData.accel?.accel_x?.toFixed(2) %><%= trackerData.accel?.accel_y?.toFixed(2) %><%= trackerData.accel?.accel_z?.toFixed(2) %><%= trackerData.accel?.accel_x?.toFixed(2) %><%= trackerData.accel?.accel_y?.toFixed(2) %><%= trackerData.accel?.accel_z?.toFixed(2) %><%= trackerData.trgtpos?.trgtpos_x?.toFixed(2) %><%= trackerData.trgtpos?.trgtpos_y?.toFixed(2) %><%= trackerData.trgtpos?.trgtpos_z?.toFixed(2) %><%= trackerData.trgtpos?.trgtpos_x?.toFixed(2) %><%= trackerData.trgtpos?.trgtpos_y?.toFixed(2) %><%= trackerData.trgtpos?.trgtpos_z?.toFixed(2) %><%= trackerData.timestamp?.tracker_timestamp %><%= trackerData.timestamp?.tracker_timestamp %>