Skip to content

Commit

Permalink
sort by duration (#169)
Browse files Browse the repository at this point in the history
fixes #154
  • Loading branch information
furlongm authored Sep 2, 2020
1 parent 272ef33 commit a23d13d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions openvpn-monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,13 @@ def print_html_header(self):
output('<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/jquery.tablesorter.min.js" integrity="sha256-dtGH1XcAyKopMui5x20KnPxuGuSx9Rs6piJB/4Oqu6I=" crossorigin="anonymous"></script>') # noqa
output('<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/jquery.tablesorter.widgets.min.js" integrity="sha256-GxbszpUzg+iYIcyDGyNVLz9Y0dQvzmQgXXVk5cHJbw0=" crossorigin="anonymous"></script>') # noqa
output('<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/parsers/parser-network.min.js" integrity="sha256-rV5r5lDTGqNm0Nw6Q/uRKvlco8igIg2PSo3daI1vykA=" crossorigin="anonymous"></script>') # noqa
output('<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>') # noqa
output('<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/parsers/parser-duration.min.js" integrity="sha256-2S5Bce79Ixl5XxjV4ppO7JN8GVi19fMxXZfw1lHS+3Y=" crossorigin="anonymous"></script>') # noqa
output('<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>') # noqa
output('<script>$(document).ready(function(){')
output('$("table.tablesorter").tablesorter({sortList: [[0,0]], theme:"bootstrap", headerTemplate:"{content} {icon}", widgets:["uitheme"]});')
output('$("table.tablesorter").tablesorter({')
output('sortList: [[0,0]], theme:"bootstrap", headerTemplate:"{content} {icon}", widgets:["uitheme"],')
output('durationLabels : "(?:years|year|y),(?:days|day|d),(?:hours|hour|h),(?:minutes|minute|min|m),(?:seconds|second|sec|s)"')
output('});')
output('});</script>')
if self.maps:
output('<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.6.0/leaflet.js" integrity="sha256-fNoRrwkP2GuYPbNSJmMJOCyfRB2DhPQe0rGTgzRsyso=" crossorigin="anonymous"></script>') # noqa
Expand Down Expand Up @@ -643,7 +647,10 @@ def print_session_table_headers(vpn_mode, show_disconnect):
output('tablesorter tablesorter-bootstrap">')
output('<thead><tr>')
for header in headers:
output('<th>{0!s}</th>'.format(header))
if header == 'Time Online':
output('<th class="sorter-duration">{0!s}</th>'.format(header))
else:
output('<th>{0!s}</th>'.format(header))
output('</tr></thead><tbody>')

@staticmethod
Expand Down

0 comments on commit a23d13d

Please sign in to comment.