updates to formatting

This commit is contained in:
n0mjs710 2018-12-07 20:09:25 -06:00
parent 26200dceb8
commit f6ae338fc5
4 changed files with 129 additions and 91 deletions

View File

@ -79,5 +79,10 @@
<hr>
<h3>Call Log Window:</h3>
<pre id="log" style="height: 10em; overflow-y: scroll; background-color: #ccc;"></pre>
<hr>
<center>
Copyright (c) 2016, 2027, 2018<br>The Regents of the K0USY Group. All rights reserved.
<!-- THIS COPYRIGHT NOTICE MUST BE DISPLAYED AS A CONDITOIN OF THE LICENCE GRANT FOR THIS SOFTWARE. ALL DERIVATEIVES WORKS MUST CARRY THIS NOTICE -->
</body>
</html>

View File

@ -28,7 +28,7 @@
<td>{{ system }}</td>
<td>{{ _table[_bridge][system]['TS'] }}</td>
<td>{{ _table[_bridge][system]['TGID'] }}</td>
<td style="background-color:{{ _table[_bridge][system]['COLOR'] }}">{{ _table[_bridge][system]['ACTIVE'] }}</td>
<td style="background-color:#{{ _table[_bridge][system]['BGCOLOR'] }}; color:#{{ _table[_bridge][system]['COLOR'] }}">{{ _table[_bridge][system]['ACTIVE'] }}</td>
<td>{{ _table[_bridge][system]['EXP_TIME'] }}</td>
<td>{{ _table[_bridge][system]['TO_ACTION'] }}</td>
<td>{{ _table[_bridge][system]['TRIG_ON'] }}</td>

View File

@ -1,19 +1,18 @@
<h3>HBlink Status Tables:</h3>
<h4>Master Systems</h4>
<table style="width:100%; font: 10pt arial, sans-serif">
<colgroup>
<col style="width: 10%" />
<col style="width: 20%" />
<col style="width: 8%" />
<col style="width: 4%" />
<col style="width: 5%" />
<col style="width: 3%" />
<col style="width: 10%" />
<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>HBP System</th>
<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>
@ -35,39 +34,38 @@
<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]['COLOR'] }}; color:#{{ _cdata[1]['BGCOLOR'] }}">TS1</td>
<td style="background-color:#{{ _cdata[1]['COLOR'] }}; color:#{{ _cdata[1]['BGCOLOR'] }}">{{ _cdata[1]['TYPE'] }}</td>
<td style="background-color:#{{ _cdata[1]['COLOR'] }}; color:#{{ _cdata[1]['BGCOLOR'] }}">{{ _cdata[1]['SUB'] }}</td>
<td style="background-color:#{{ _cdata[1]['COLOR'] }}; color:#{{ _cdata[1]['BGCOLOR'] }}">{{ _cdata[1]['SRC'] }}</td>
<td style="background-color:#{{ _cdata[1]['COLOR'] }}; color:#{{ _cdata[1]['BGCOLOR'] }}">{{ _cdata[1]['DEST'] }}</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]['COLOR'] }}; color:#{{ _cdata[2]['BGCOLOR'] }}">TS2</td>
<td style="background-color:#{{ _cdata[2]['COLOR'] }}; color:#{{ _cdata[2]['BGCOLOR'] }}">{{ _cdata[2]['TYPE'] }}</td>
<td style="background-color:#{{ _cdata[2]['COLOR'] }}; color:#{{ _cdata[2]['BGCOLOR'] }}">{{ _cdata[2]['SUB'] }}</td>
<td style="background-color:#{{ _cdata[2]['COLOR'] }}; color:#{{ _cdata[2]['BGCOLOR'] }}">{{ _cdata[2]['SRC'] }}</td>
<td style="background-color:#{{ _cdata[2]['COLOR'] }}; color:#{{ _cdata[2]['BGCOLOR'] }}">{{ _cdata[2]['DEST'] }}</td>
<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>
<h4>Client Systems</h4>
<br>
<table style="width:100%; font: 10pt arial, sans-serif">
<colgroup>
<col style="width: 10%" />
<col style="width: 20%" />
<col style="width: 8%" />
<col style="width: 4%" />
<col style="width: 5%" />
<col style="width: 3%" />
<col style="width: 10%" />
<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>HBP System</th>
<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>
@ -78,39 +76,37 @@
<th>Destination</th>
</tr>
{% for _peer in _table['PEERS'] %}
{% 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>TS1</td>
<td></td>
<td></td>
<td></td>
<td></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>TS2</td>
<td></td>
<td></td>
<td></td>
<td></td>
<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>
<h4>OpenBridge Systems</h4>
<br>
<table style="width:100%; font: 10pt arial, sans-serif">
<colgroup>
<col style="width: 10%" />
<col style="width: 15%" />
<col style="width: 75%" />
<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 System</th>
<th>OpenBridge Systems</th>
<th>Network ID<br>Target IP:Port</th>
<th>Active Calls</th>
</tr>
@ -120,8 +116,8 @@
<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>
<th />
<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

@ -75,12 +75,12 @@ BTABLE['BRIDGES'] = {}
BRIDGES_RX = ''
CONFIG_RX = ''
LOGBUF = deque(100*[''], 100)
RED = '#ff0000'
BLACK = '#000000'
GREEN = '#00ff00'
BLUE = '#0000ff'
ORANGE = '#ff8000'
WHITE = '#ffffff'
RED = 'ff0000'
BLACK = '000000'
GREEN = '00ff00'
BLUE = '0000ff'
ORANGE = 'ff8000'
WHITE = 'ffffff'
# For importing HTML templates
@ -199,16 +199,17 @@ def build_hblink_table(_config, _stats_table):
# Proccess Peer Systems
elif _hbp_data['MODE'] == 'PEER':
pprint(_hbp_data)
_stats_table['PEERS'][_hbp] = {}
_stats_table['PEERS'][_hbp]['CALLSIGN'] = _hbp_data['CALLSIGN']
_stats_table['PEERS'][_hbp]['LOCATION'] = _hbp_data['LOCATION']
_stats_table['PEERS'][_hbp]['RADIO_ID'] = int_id(_hbp_data['RADIO_ID'])
_stats_table['PEERS'][_hbp]['MASTER_IP'] = _hbp_data['MASTER_IP']
_stats_table['PEERS'][_hbp]['MASTER_PORT'] = _hbp_data['MASTER_PORT']
_stats_table['PEERS'][_hbp]['STATS'] = _hbp_data['STATS']
_stats_table['PEERS'][_hbp]['STATS'] = {}
_stats_table['PEERS'][_hbp]['STATS']['CONNECTION'] = _hbp_data['STATS']['CONNECTION']
_stats_table['PEERS'][_hbp]['STATS']['CONNECTED'] = since(_hbp_data['STATS']['CONNECTED'])
_stats_table['PEERS'][_hbp]['STATS']['PINGS_SENT'] = _hbp_data['STATS']['PINGS_SENT']
_stats_table['PEERS'][_hbp]['STATS']['PINGS_ACKD'] = _hbp_data['STATS']['PINGS_ACKD']
if _hbp_data['SLOTS'] == 0:
_stats_table['PEERS'][_hbp]['SLOTS'] = 'NONE'
elif _hbp_data['SLOTS'] <= '2':
@ -217,6 +218,17 @@ def build_hblink_table(_config, _stats_table):
_stats_table['PEERS'][_hbp]['SLOTS'] = 'BOTH'
else:
_stats_table['SLOTS'][_hbp]['SLOTS'] = 'DMO'
# SLOT 1&2 - for real-time montior: make the structure for later use
for ts in range(1,3):
_stats_table['PEERS'][_hbp][ts]= {}
_stats_table['PEERS'][_hbp][ts]['COLOR'] = ''
_stats_table['PEERS'][_hbp][ts]['BGCOLOR'] = ''
_stats_table['PEERS'][_hbp][ts]['TS'] = ''
_stats_table['PEERS'][_hbp][ts]['TYPE'] = ''
_stats_table['PEERS'][_hbp][ts]['SUB'] = ''
_stats_table['PEERS'][_hbp][ts]['SRC'] = ''
_stats_table['PEERS'][_hbp][ts]['DEST'] = ''
# Process OpenBridge systems
@ -225,10 +237,11 @@ def build_hblink_table(_config, _stats_table):
_stats_table['OPENBRIDGES'][_hbp]['NETWORK_ID'] = int_id(_hbp_data['NETWORK_ID'])
_stats_table['OPENBRIDGES'][_hbp]['TARGET_IP'] = _hbp_data['TARGET_IP']
_stats_table['OPENBRIDGES'][_hbp]['TARGET_PORT'] = _hbp_data['TARGET_PORT']
return(_stats_table)
_stats_table['OPENBRIDGES'][_hbp]['STREAMS'] = {}
#return(_stats_table)
def update_hblink_table(_config, _stats_table):
logger.info('running update table')
# Is there a system in HBlink's config monitor doesn't know about?
for _hbp in _config:
add_list = []
@ -238,7 +251,6 @@ def update_hblink_table(_config, _stats_table):
logger.info('Adding peer to CTABLE that has registerred: %s', int_id(_peer))
add_hb_peer(_config[_hbp]['PEERS'][_peer], _stats_table['MASTERS'][_hbp]['PEERS'], _peer)
# Is there a system in monitor that's been removed from HBlink's config?
for _hbp in _stats_table['MASTERS']:
remove_list = []
@ -253,11 +265,15 @@ def update_hblink_table(_config, _stats_table):
# Update connection time
for _hbp in _stats_table['MASTERS']:
if _config[_hbp]['MODE'] == 'MASTER':
for _peer in _stats_table['MASTERS'][_hbp]['PEERS']:
if hex_str_4(_peer) in _config[_hbp]['PEERS']:
_stats_table['MASTERS'][_hbp]['PEERS'][_peer]['CONNECTED'] = since(_config[_hbp]['PEERS'][hex_str_4(_peer)]['CONNECTED'])
for _hbp in _stats_table['PEERS']:
_stats_table['PEERS'][_hbp]['STATS']['CONNECTED'] = since(_config[_hbp]['STATS']['CONNECTED'])
_stats_table['PEERS'][_hbp]['STATS']['PINGS_SENT'] = _config[_hbp]['STATS']['PINGS_SENT']
_stats_table['PEERS'][_hbp]['STATS']['PINGS_ACKD'] = _config[_hbp]['STATS']['PINGS_ACKD']
build_stats()
#
@ -291,12 +307,12 @@ def build_bridge_table(_bridges):
if system['ACTIVE'] == True:
_stats_table[_bridge][system['SYSTEM']]['ACTIVE'] = 'Connected'
_stats_table[_bridge][system['SYSTEM']]['COLOR'] = GREEN
_stats_table[_bridge][system['SYSTEM']]['BGCOLOR'] = BLACK
_stats_table[_bridge][system['SYSTEM']]['COLOR'] = BLACK
_stats_table[_bridge][system['SYSTEM']]['BGCOLOR'] = GREEN
elif system['ACTIVE'] == False:
_stats_table[_bridge][system['SYSTEM']]['ACTIVE'] = 'Disconnected'
_stats_table[_bridge][system['SYSTEM']]['COLOR'] = RED
_stats_table[_bridge][system['SYSTEM']]['BGCOLOR'] = WHITE
_stats_table[_bridge][system['SYSTEM']]['COLOR'] = WHITE
_stats_table[_bridge][system['SYSTEM']]['BGCOLOR'] = RED
for i in range(len(system['ON'])):
system['ON'][i] = str(int_id(system['ON'][i]))
@ -340,12 +356,12 @@ def rts_update(p):
if system in CTABLE['MASTERS']:
for peer in CTABLE['MASTERS'][system]['PEERS']:
if sourcePeer == peer:
color = '00ff00'
bgcolor = '000000'
bgcolor = GREEN
color = BLACK
else:
color = 'ff0000'
bgcolor = 'ffffff'
#color, bgcolor = '00ff00', '000000' if sourcePeer == peer else 'ff0000', '000000'
bgcolor = RED
color = WHITE
if action == 'START':
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['TS'] = True
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['COLOR'] = color
@ -356,8 +372,8 @@ def rts_update(p):
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['DEST'] = destination
if action == 'END':
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['TS'] = False
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['COLOR'] = 'ffffff'
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['BGCOLOR'] = '000000'
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['COLOR'] = BLACK
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['BGCOLOR'] = WHITE
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['TYPE'] = ''
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['SUB'] = ''
CTABLE['MASTERS'][system]['PEERS'][peer][timeSlot]['SRC'] = ''
@ -367,10 +383,31 @@ def rts_update(p):
logger.warning('tried to update a tranmission for a peer not yet listed: system %s, action %s, callType %s, tx/rx %s, streamid %s, sourcePeer %s, sourceSub %s, timeSlot %s, destination %s ', system, action, callType, trx, streamId, sourcePeer, sourceSub, timeSlot, destination)
if system in CTABLE['OPENBRIDGES']:
pass
if action == 'START':
CTABLE['OPENBRIDGES'][system]['STREAMS'][streamId] = (alias_call(sourceSub, subscriber_ids), destination)
if action == 'END':
if streamId in CTABLE['OPENBRIDGES'][system]['STREAMS']:
del CTABLE['OPENBRIDGES'][system]['STREAMS'][streamId]
if system in CTABLE['PEERS']:
pass
bgcolor = GREEN
if action == 'START':
CTABLE['PEERS'][system][timeSlot]['TS'] = True
CTABLE['PEERS'][system][timeSlot]['COLOR'] = BLACK
CTABLE['PEERS'][system][timeSlot]['BGCOLOR'] = bgcolor
CTABLE['PEERS'][system][timeSlot]['TYPE'] = callType
CTABLE['PEERS'][system][timeSlot]['SUB'] = sourceSub
CTABLE['PEERS'][system][timeSlot]['SRC'] = sourcePeer
CTABLE['PEERS'][system][timeSlot]['DEST'] = destination
if action == 'END':
CTABLE['PEERS'][system][timeSlot]['TS'] = False
CTABLE['PEERS'][system][timeSlot]['COLOR'] = BLACK
CTABLE['PEERS'][system][timeSlot]['BGCOLOR'] = WHITE
CTABLE['PEERS'][system][timeSlot]['TYPE'] = ''
CTABLE['PEERS'][system][timeSlot]['SUB'] = ''
CTABLE['PEERS'][system][timeSlot]['SRC'] = ''
CTABLE['PEERS'][system][timeSlot]['DEST'] = ''
build_stats()