Skip to content

Commit

Permalink
Merge pull request #110 from phate999/master
Browse files Browse the repository at this point in the history
Added clear results button
  • Loading branch information
phate999 authored Feb 16, 2024
2 parents cfef2a3 + 090c791 commit b2266bd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
15 changes: 12 additions & 3 deletions Mobile_Site_Survey/Mobile_Site_Survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ def get(self):
self.redirect('/')
return

class ClearHandler(tornado.web.RequestHandler):
"""Handles clear/ endpoint requests."""

def get(self):
"""Clear the dispatcher results"""
dispatcher.results = ''
self.redirect('/')
return

class ConfigHandler(tornado.web.RequestHandler):
"""Handles config/ endpoint requests."""
Expand Down Expand Up @@ -246,12 +254,12 @@ def loop(self):
executor.map(run_tests, self.modems)
pretty_timestamp = datetime.datetime.fromtimestamp(self.timestamp).strftime(
'%I:%M:%S%p %m/%d/%Y')
pretty_lat = '{:.6f}'.format(self.lat)
pretty_lon = '{:.6f}'.format(self.long)
pretty_lat = '{:.6f}'.format(float(self.lat))
pretty_lon = '{:.6f}'.format(float(self.long))
title = f' ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' \
f' ┣┅ {pretty_timestamp}{pretty_lat}, {pretty_lon} \n' \
f' ┃\n'
self.results = f'{title}' + self.results
self.results = title + self.results
cp.put('config/routing/policies', routing_policies)
cp.put('config/routing/tables', routing_tables)
cp.log('---> Survey Complete <---')
Expand Down Expand Up @@ -830,6 +838,7 @@ def manual_test(path, value, *args):
(r"/submit", SubmitHandler),
(r"/results", ResultsHandler),
(r"/test", TestHandler),
(r"/clear", ClearHandler),
(r"/(.*)", tornado.web.StaticFileHandler,
{"path": os.path.dirname(__file__), "default_filename": "index.html"})
])
Expand Down
15 changes: 9 additions & 6 deletions Mobile_Site_Survey/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<center><h2 id="version">Mobile Site Survey</h2></center>
<table>
<tr>
<td>
<td valign=top>
<form action="/test" id="test" style="display: inline" onsubmit="swal({title: 'Running Manual Survey!', buttons: false});">
<input type="submit" value="Run Survey Now" name="test">
</form>
Expand Down Expand Up @@ -88,14 +88,17 @@ <h4>Send to Server - Powered by <a href="https://5g-ready.io">5g-ready.io</a></h
Server URL: <input type="text" name="server_url" id="server_url" value="https://5g-ready.io/injector" size="31"><br>
Server Token: <input type="text" name="server_token" id="server_token"><br>
<h4>Surveyors</h4>
<input type="checkbox" name="enable_surveyors" id="enable_surveyors" value=1>
<label for="enable_surveyors">Enable Surveyors</label><br>
Enter IP Addresses separated by commas:<br>
Surveyors: <input type="text" name="surveyors" id="surveyors" size="32"><br>
<br>
<input type="checkbox" name="enable_surveyors" id="enable_surveyors" value=1>
<label for="enable_surveyors">Enable Surveyors</label><br>
Enter IP Addresses separated by commas:<br>
Surveyors: <input type="text" name="surveyors" id="surveyors" size="32"><br>
<br>
</form>
</td>
<td valign=top>
<form action="/clear" id="clear" style="display: inline">
<input type="submit" value="Clear Results" id="clear_results_btn">
<br><br>
<textarea id="results" name="results" rows=37 cols=59>
Waiting for test results...
</textarea>
Expand Down
4 changes: 2 additions & 2 deletions Mobile_Site_Survey/package.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ auto_start = True
reboot = True
restart = True
firmware_major = 7
firmware_minor = 23
firmware_minor = 24
version_major = 2
version_minor = 5
version_patch = 6
version_patch = 7
uuid = 98b31c39-f649-43f3-b9f4-276a5d8824bf

0 comments on commit b2266bd

Please sign in to comment.