@@ -53,7 +53,7 @@ class dev_online_settings
5353 persist.dvo_lines = webserver.arg ( 'dvo11' )
5454 persist.dvo_online_window = webserver.arg ( 'dvo12' )
5555 persist.dvo_time_highlight = webserver.arg ( 'dvo13' )
56- persist.dvo_offline = webserver.arg ( 'dvo15' )
56+ persist.dvo_offline = str ( int ( webserver.arg ( 'dvo15' ))) # Only allow numbers
5757 persist.dvo_hostname_suffix = webserver.arg ( 'dvo14' )
5858 persist.dvo_devicename = ( webserver.arg ( 'dvo1' )) ? 1 : 0
5959 persist.dvo_ipaddress = ( webserver.arg ( 'dvo3' )) ? 1 : 0
@@ -107,7 +107,7 @@ class dev_online_settings
107107 "</tr>"
108108 "<tr>"
109109 "<td style='width:250px'><b>Keep offline visible (sec)</b></td>"
110- "<td style='width:80px'><input id='dvo15' name='dvo15' type='number' value='{dvo_offline}'></td>"
110+ "<td style='width:80px'><input id='dvo15' name='dvo15' value='{dvo_offline}'></td>"
111111 "</tr>"
112112 "<tr>"
113113 "<td style='width:250px'><b>Hostname suffix</b></td>"
@@ -665,41 +665,49 @@ class devices_online
665665 var dvo_wifirssi = persist.find ( "dvo_wifirssi" , 0 )
666666 var dvo_wifichnl = persist.find ( "dvo_wifichnl" , 0 )
667667
668- var msg = "</table><table style='width:100%;font-size:80%'>" # Terminate two column table and open new table
668+ var msg = "</table>" # Terminate two column table and open new table
669+ msg += "<style>" # Add style increasing space between columns
670+ msg += ".dvo{width:100%;font-size:80%;border-spacing:0px;}"
671+ msg += ".dvo td,.dvo th{padding:0px 3px;}" # Column space
672+ msg += ".dvo td:first-child,.dvo th:first-child{padding-left:2px;}"
673+ msg += ".dvo td:last-child,.dvo th:last-child{padding-right:2px;}"
674+ msg += "</style>"
675+ msg += "<table class='dvo'>" # Open new condensed table
676+
669677 msg += "<tr>"
670678
671679 if dvo_lines > 0 # Fixed number of last updated lines
672680 self .sort_col ( self .list_devices , 6 , 1 ) # Sort list by last_seen and down
673681
674682 if dvo_devicename
675- msg += "<th>Device Name  </th>"
683+ msg += "<th>Device Name</th>"
676684 end
677- msg += "<th>Hostname  </th>"
685+ msg += "<th>Hostname</th>"
678686 if dvo_ipaddress
679- msg += "<th>IP Address  </th>"
687+ msg += "<th>IP Address</th>"
680688 end
681689 if dvo_power
682- msg += "<th>Power  </th>"
690+ msg += "<th>Power</th>"
683691 end
684692 if dvo_version
685- msg += "<th>Version  </th>"
693+ msg += "<th>Version</th>"
686694 end
687695 if dvo_heap
688- msg += "<th align='right'>Heap  </th>"
696+ msg += "<th align='right'>Heap</th>"
689697 end
690698 if dvo_berryheap
691- msg += "<th align='right'>BHeap  </th>"
699+ msg += "<th align='right'>BHeap</th>"
692700 end
693701 if dvo_berryobject
694- msg += "<th align='right'>BObject  </th>"
702+ msg += "<th align='right'>BObject</th>"
695703 end
696704 if dvo_wifirssi
697- msg += "<th align='right'>RSSI  </th>"
705+ msg += "<th align='right'>RSSI</th>"
698706 end
699707 if dvo_wifichnl
700- msg += "<th align='right'>Ch  </th>"
708+ msg += "<th align='right'>Ch</th>"
701709 end
702- msg += "<th align='right'>Uptime  </th>"
710+ msg += "<th align='right'>Uptime</th>"
703711 else # All devices sorted by user selected column
704712 # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
705713 var list_dvo = [ 0 , 1 , dvo_ipaddress, dvo_devicename, 0 , dvo_version, 0 , 0 , 1 , dvo_berryheap, dvo_wifirssi, dvo_heap, dvo_berryobject, 0 , dvo_wifichnl]
@@ -717,34 +725,34 @@ class devices_online
717725
718726 var icon_direction = persist.dvo_direction ? "▼" : "▲"
719727 if dvo_devicename
720- msg += format ( "<th><a href='#p' onclick='la(\"&sd_sort=3\");'>Device Name</a>%s  </th>" , persist.dvo_column == 3 ? icon_direction : "" )
728+ msg += format ( "<th><a href='#p' onclick='la(\"&sd_sort=3\");'>Device Name</a>%s</th>" , persist.dvo_column == 3 ? icon_direction : "" )
721729 end
722- msg += format ( "<th><a href='#p' onclick='la(\"&sd_sort=1\");'>Hostname</a>%s  </th>" , persist.dvo_column == 1 ? icon_direction : "" )
730+ msg += format ( "<th><a href='#p' onclick='la(\"&sd_sort=1\");'>Hostname</a>%s</th>" , persist.dvo_column == 1 ? icon_direction : "" )
723731 if dvo_ipaddress
724- msg += format ( "<th><a href='#p' onclick='la(\"&sd_sort=2\");'>IP Address</a>%s  </th>" , persist.dvo_column == 2 ? icon_direction : "" )
732+ msg += format ( "<th><a href='#p' onclick='la(\"&sd_sort=2\");'>IP Address</a>%s</th>" , persist.dvo_column == 2 ? icon_direction : "" )
725733 end
726734 if dvo_power
727- msg += format ( "<th>Power  </th>" )
735+ msg += format ( "<th>Power</th>" )
728736 end
729737 if dvo_version
730- msg += format ( "<th><a href='#p' onclick='la(\"&sd_sort=5\");'>Version</a>%s  </th>" , persist.dvo_column == 5 ? icon_direction : "" )
738+ msg += format ( "<th><a href='#p' onclick='la(\"&sd_sort=5\");'>Version</a>%s</th>" , persist.dvo_column == 5 ? icon_direction : "" )
731739 end
732740 if dvo_heap
733- msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=11\");'>Heap</a>%s  </th>" , persist.dvo_column == 11 ? icon_direction : "" )
741+ msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=11\");'>Heap</a>%s</th>" , persist.dvo_column == 11 ? icon_direction : "" )
734742 end
735743 if dvo_berryheap
736- msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=9\");'>BHeap</a>%s  </th>" , persist.dvo_column == 9 ? icon_direction : "" )
744+ msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=9\");'>BHeap</a>%s</th>" , persist.dvo_column == 9 ? icon_direction : "" )
737745 end
738746 if dvo_berryobject
739- msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=12\");'>BObject</a>%s  </th>" , persist.dvo_column == 12 ? icon_direction : "" )
747+ msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=12\");'>BObject</a>%s</th>" , persist.dvo_column == 12 ? icon_direction : "" )
740748 end
741749 if dvo_wifirssi
742- msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=10\");'>RSSI</a>%s  </th>" , persist.dvo_column == 10 ? icon_direction : "" )
750+ msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=10\");'>RSSI</a>%s</th>" , persist.dvo_column == 10 ? icon_direction : "" )
743751 end
744752 if dvo_wifichnl
745- msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=14\");'>Ch</a>%s  </th>" , persist.dvo_column == 14 ? icon_direction : "" )
753+ msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=14\");'>Ch</a>%s</th>" , persist.dvo_column == 14 ? icon_direction : "" )
746754 end
747- msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=8\");'>Uptime</a>%s  </th>" , persist.dvo_column == 8 ? icon_direction : "" )
755+ msg += format ( "<th align='right'><a href='#p' onclick='la(\"&sd_sort=8\");'>Uptime</a>%s</th>" , persist.dvo_column == 8 ? icon_direction : "" )
748756 end
749757
750758 msg += "</tr>"
@@ -793,61 +801,59 @@ class devices_online
793801
794802 msg = "<tr>"
795803 if dvo_devicename
796- msg += f"<td{color}>{devicename}  </td>"
804+ msg += f"<td{color}>{devicename}</td>"
797805 end
798806 if offline
799- msg += f"<td{color}>{hostname}  </td>"
807+ msg += f"<td{color}>{hostname}</td>"
800808 else
801- msg += f"<td><a target=_blank href='http://{hostname}{dvo_hostname_suffix}'>{hostname}  </a></td>"
809+ msg += f"<td><a target=_blank href='http://{hostname}{dvo_hostname_suffix}'>{hostname}</a></td>"
802810 end
803811 if dvo_ipaddress
804812 if offline
805- msg += f"<td{color}>{ipaddress}  </td>"
813+ msg += f"<td{color}>{ipaddress}</td>"
806814 else
807- msg += f"<td><a target=_blank href='http://{ipaddress}'>{ipaddress}  </a></td>"
815+ msg += f"<td><a target=_blank href='http://{ipaddress}'>{ipaddress}</a></td>"
808816 end
809817 end
810818 if dvo_power
819+ msg += "<td>"
811820 if ! offline && power.size ()
812- msg += "<td>"
813821 for p: power.keys ()
814822 var hcolor = ( power[ p]) ? "txtscc" : "btn"
815823 var picon = ( power[ p]) ? "☒" : "☐"
816- msg += f"<a href='#p' style='color:var(--c_{hcolor});' title='Toggle POWER{p +1}' onclick='la(\"&sd_pow={topic}_{p +1}\");'>{picon} </a>"
824+ msg += f"<a href='#p' style='color:var(--c_{hcolor});' title='Toggle POWER{p +1}' onclick='la(\"&sd_pow={topic}_{p +1}\");'>{picon} </a>"
817825 end
818- msg += "</td>"
819- else
820- msg += "<td> </td>"
821826 end
827+ msg += "</td>"
822828 end
823829 if dvo_version
824- msg += f"<td{color}>{version}  </td>"
830+ msg += f"<td{color}>{version}</td>"
825831 end
826832 var svar
827833 if dvo_heap
828834 var iheap = int ( heap) # Workaround to remove leading zeros
829835 svar = ( iheap > 0 ) ? str ( iheap) : ""
830- msg += f"<td align='right'{color}>{svar}  </td>"
836+ msg += f"<td align='right'{color}>{svar}</td>"
831837 end
832838 if dvo_berryheap
833839 var bheap = int ( berryheap) # Workaround to remove leading zeros
834840 svar = ( bheap > 0 ) ? str ( bheap) : ""
835- msg += f"<td align='right'{color}>{svar}  </td>"
841+ msg += f"<td align='right'{color}>{svar}</td>"
836842 end
837843 if dvo_berryobject
838844 var bobject = int ( berryobject) # Workaround to remove leading zeros
839845 svar = ( bobject > 0 ) ? str ( bobject) : ""
840- msg += f"<td align='right'{color}>{svar}  </td>"
846+ msg += f"<td align='right'{color}>{svar}</td>"
841847 end
842848 if dvo_wifirssi
843849 var wrssi = int ( wifirssi) # Workaround to remove leading zeros
844850 svar = str ( wrssi)
845- msg += f"<td align='right'{color}>{svar}%  </td>"
851+ msg += f"<td align='right'{color}>{svar}%</td>"
846852 end
847853 if dvo_wifichnl
848854 var wchnl = int ( wifichnl) # Workaround to remove leading zeros
849855 svar = str ( wchnl)
850- msg += f"<td align='right'{color}>{svar}  </td>"
856+ msg += f"<td align='right'{color}>{svar}</td>"
851857 end
852858 if int ( last_seen) >= ( now - dvo_time_highlight) # Highlight changes within latest seconds
853859 color = " style='color:var(--c_btnsv);'"
0 commit comments