improve formatting and output

This commit is contained in:
n0mjs710 2018-12-11 16:29:10 -06:00
parent 8e7e12bb36
commit aa9467daa4
3 changed files with 138 additions and 23 deletions

View File

@ -1,15 +1,14 @@
<h3>HBlink Status Tables:</h3>
<table style="width:100%; font: 10pt arial, sans-serif">
<colgroup>
<col style="width: 15%" />
<col style="width: 30%" />
<col style="width: 10%" />
<col style="width: 20%" />
<col style="width: 8%" />
<col style="width: 5%" />
<col style="width: 3%" />
<col style="width: 9%" />
<col style="width: 15%" />
<col style="width: 15%" />
<col style="width: 4%" />
<col style="width: 4%" />
<col style="width: 12%" />
<col style="width: 15%" />
<col style="width: 10%" />
</colgroup>
<tr style="width:100%; font: 10pt arial, sans-serif; background-color:#666666; color:white">
<th>Homebrew Protocol<br>Master Systems</th>
@ -19,7 +18,6 @@
<th>Slot</th>
<th>Call<br>Type</th>
<th>Source<br>Subscriber</th>
<th>Source<br>Peer</th>
<th>Destination</th>
</tr>
@ -37,13 +35,11 @@
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">TS1</td>
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">{{ _cdata[1]['TYPE'] }}</td>
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">{{ _cdata[1]['SUB'] }}</td>
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">{{ _cdata[1]['SRC'] }}</td>
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">{{ _cdata[1]['DEST'] }}</td>
<tr>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">TS2</td>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">{{ _cdata[2]['TYPE'] }}</td>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">{{ _cdata[2]['SUB'] }}</td>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">{{ _cdata[2]['SRC'] }}</td>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">{{ _cdata[2]['DEST'] }}</td>
</tr>
@ -54,25 +50,23 @@
<br>
<table style="width:100%; font: 10pt arial, sans-serif">
<colgroup>
<col style="width: 15%" />
<col style="width: 30%" />
<col style="width: 10%" />
<col style="width: 20%" />
<col style="width: 8%" />
<col style="width: 5%" />
<col style="width: 3%" />
<col style="width: 9%" />
<col style="width: 15%" />
<col style="width: 15%" />
<col style="width: 4%" />
<col style="width: 4%" />
<col style="width: 12%" />
<col style="width: 15%" />
<col style="width: 10%" />
</colgroup>
<tr style="width:100%; font: 10pt arial, sans-serif; background-color:#666666; color:white">
<th>Homebrew Protocol<br>Peer Systems</th>
<th>ID/Callsign/Location<br>Master IP:Port</th>
<th>Connected<br>Sent/Ack/Missed</th>
<th>Connected<br>TX/RX/Lost</th>
<th>LinkedTS</th>
<th>Slot</th>
<th>Call<br>Type</th>
<th>Source<br>Subscriber</th>
<th>Source<br>Peer</th>
<th>Destination</th>
</tr>
@ -86,13 +80,11 @@
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">TS1</td>
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">{{ _pdata[1]['TYPE'] }}</td>
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">{{ _pdata[1]['SUB'] }}</td>
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">{{ _pdata[1]['SRC'] }}</td>
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">{{ _pdata[1]['DEST'] }}</td>
<tr>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">TS2</td>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">{{ _pdata[2]['TYPE'] }}</td>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">{{ _pdata[2]['SUB'] }}</td>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">{{ _pdata[2]['SRC'] }}</td>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">{{ _pdata[2]['DEST'] }}</td>
</tr>
</tr>

View File

@ -0,0 +1,123 @@
<h3>HBlink Status Tables:</h3>
<table style="width:100%; font: 10pt arial, sans-serif">
<colgroup>
<col style="width: 10%" />
<col style="width: 20%" />
<col style="width: 10%" />
<col style="width: 3%" />
<col style="width: 3%" />
<col style="width: 9%" />
<col style="width: 15%" />
<col style="width: 15%" />
<col style="width: 15%" />
</colgroup>
<tr style="width:100%; font: 10pt arial, sans-serif; background-color:#666666; color:white">
<th>Homebrew Protocol<br>Master Systems</th>
<th>ID/Callsign/Location<br>IP:Port/Time Connected</th>
<th>Frequency</th>
<th>ColorCode<br>LinkedTS</th>
<th>Slot</th>
<th>Call<br>Type</th>
<th>Source<br>Subscriber</th>
<th>Source<br>Peer</th>
<th>Destination</th>
</tr>
{% for _master in _table['MASTERS'] %}
<tr>
<td style="font-weight:bold" rowspan="{{ (_table['MASTERS'][_master]['PEERS']|length * 2) +1 }}"> {{_master}}<br><div style="font: 8pt arial, sans-serif">{{_table['MASTERS'][_master]['REPEAT']}}</div></td>
</tr>
{% for _client, _cdata in _table['MASTERS'][_master]['PEERS'].iteritems() %}
<tr>
<td rowspan="2">{{ _client }}, {{ _cdata['CALLSIGN'] }}, {{ _cdata['LOCATION'] }}<br><div style="font: 8pt arial, sans-serif">{{ _cdata['IP'] }}:{{ _cdata['PORT'] }} / {{ _cdata['CONNECTED'] }}</div></td>
<td rowspan="2">{{ _cdata['RX_FREQ'] }}<br>{{ _cdata['TX_FREQ'] }}</td>
<td rowspan="2">{{ _cdata['COLORCODE'] }}<br>{{ _cdata['SLOTS'] }}</td>
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">TS1</td>
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">{{ _cdata[1]['TYPE'] }}</td>
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">{{ _cdata[1]['SUB'] }}</td>
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">{{ _cdata[1]['SRC'] }}</td>
<td style="background-color:#{{ _cdata[1]['BGCOLOR'] }}; color:#{{ _cdata[1]['COLOR'] }}">{{ _cdata[1]['DEST'] }}</td>
<tr>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">TS2</td>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">{{ _cdata[2]['TYPE'] }}</td>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">{{ _cdata[2]['SUB'] }}</td>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">{{ _cdata[2]['SRC'] }}</td>
<td style="background-color:#{{ _cdata[2]['BGCOLOR'] }}; color:#{{ _cdata[2]['COLOR'] }}">{{ _cdata[2]['DEST'] }}</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</table>
<br>
<table style="width:100%; font: 10pt arial, sans-serif">
<colgroup>
<col style="width: 10%" />
<col style="width: 20%" />
<col style="width: 10%" />
<col style="width: 3%" />
<col style="width: 3%" />
<col style="width: 9%" />
<col style="width: 15%" />
<col style="width: 15%" />
<col style="width: 15%" />
</colgroup>
<tr style="width:100%; font: 10pt arial, sans-serif; background-color:#666666; color:white">
<th>Homebrew Protocol<br>Peer Systems</th>
<th>ID/Callsign/Location<br>Master IP:Port</th>
<th>Connected<br>Sent/Ack/Missed</th>
<th>LinkedTS</th>
<th>Slot</th>
<th>Call<br>Type</th>
<th>Source<br>Subscriber</th>
<th>Source<br>Peer</th>
<th>Destination</th>
</tr>
{% for _peer, _pdata in _table['PEERS'].iteritems() %}
<tr>
<td style="font-weight:bold" rowspan="2"> {{ _peer}}</td>
<td rowspan="2">{{ _table['PEERS'][_peer]['RADIO_ID'] }}, {{_table['PEERS'][_peer]['CALLSIGN']}}, {{_table['PEERS'][_peer]['LOCATION']}}<br><div style="font: 8pt arial, sans-serif">Master: {{ _table['PEERS'][_peer]['MASTER_IP'] }}:{{ _table['PEERS'][_peer]['MASTER_PORT'] }}</div></td>
<td rowspan="2"; style={{ 'background-color:#00ff00' if _table['PEERS'][_peer]['STATS']['CONNECTION'] == 'YES' else ';background-color:#ff0000' }}>{{ _table['PEERS'][_peer]['STATS']['CONNECTED'] }}<br><div style="font: 8pt arial, sans-serif">{{ _table['PEERS'][_peer]['STATS']['PINGS_SENT'] }} / {{ _table['PEERS'][_peer]['STATS']['PINGS_ACKD'] }} / {{ _table['PEERS'][_peer]['STATS']['PINGS_SENT'] - _table['PEERS'][_peer]['STATS']['PINGS_ACKD'] }}</div></td>
<td rowspan="2"> {{ _table['PEERS'][_peer]['SLOTS'] }}</td>
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">TS1</td>
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">{{ _pdata[1]['TYPE'] }}</td>
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">{{ _pdata[1]['SUB'] }}</td>
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">{{ _pdata[1]['SRC'] }}</td>
<td style="background-color:#{{ _pdata[1]['BGCOLOR'] }}; color:#{{ _pdata[1]['COLOR'] }}">{{ _pdata[1]['DEST'] }}</td>
<tr>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">TS2</td>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">{{ _pdata[2]['TYPE'] }}</td>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">{{ _pdata[2]['SUB'] }}</td>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">{{ _pdata[2]['SRC'] }}</td>
<td style="background-color:#{{ _pdata[2]['BGCOLOR'] }}; color:#{{ _pdata[2]['COLOR'] }}">{{ _pdata[2]['DEST'] }}</td>
</tr>
</tr>
{% endfor %}
</table>
<br>
<table style="width:100%; font: 10pt arial, sans-serif">
<colgroup>
<col style="width: 10%" />
<col style="width: 20%" />
<col style="width: 70%" />
</colgroup>
<tr style="width:100%; font: 10pt arial, sans-serif; background-color:#666666; color:white">
<th>OpenBridge Systems</th>
<th>Network ID<br>Target IP:Port</th>
<th>Active Calls</th>
</tr>
{% for _openbridge in _table['OPENBRIDGES'] %}
<tr>
<td style="font-weight:bold"> {{ _openbridge}} </td>
<td>{{ _table['OPENBRIDGES'][_openbridge]['NETWORK_ID'] }}<br><div style="font: 8pt arial, sans-serif">{{ _table['OPENBRIDGES'][_openbridge]['TARGET_IP'] }}:{{ _table['OPENBRIDGES'][_openbridge]['TARGET_PORT'] }}</div></td>
<td>{% for entry in _table['OPENBRIDGES'][_openbridge]['STREAMS'] %}({{ _table['OPENBRIDGES'][_openbridge]['STREAMS'][entry][0] }} >> {{ _table['OPENBRIDGES'][_openbridge]['STREAMS'][entry][1] }}) {% endfor %}</td>
</tr>
{% endfor %}
</table>

View File

@ -367,7 +367,7 @@ def rts_update(p):
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['COLOR'] = color
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['BGCOLOR'] = bgcolor
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['TYPE'] = callType
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['SUB'] = sourceSub
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['SUB'] = '{} ({})'.format(alias_call(sourceSub, subscriber_ids), sourceSub)
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['SRC'] = peer
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['DEST'] = destination
if action == 'END':
@ -403,7 +403,7 @@ def rts_update(p):
CTABLE['PEERS'][system][timeSlot]['COLOR'] = color
CTABLE['PEERS'][system][timeSlot]['BGCOLOR'] = bgcolor
CTABLE['PEERS'][system][timeSlot]['TYPE'] = callType
CTABLE['PEERS'][system][timeSlot]['SUB'] = sourceSub
CTABLE['PEERS'][system][timeSlot]['SUB'] = '{} ({})'.format(alias_call(sourceSub, subscriber_ids), sourceSub)
CTABLE['PEERS'][system][timeSlot]['SRC'] = sourcePeer
CTABLE['PEERS'][system][timeSlot]['DEST'] = destination
if action == 'END':