Skip to content

Commit 2c28b0e

Browse files
authored
Add restart button to UI, kill process on click (#12)
* Add restart button to UI, kill process on click * Run `npm run build` * Fix unit tests for dut identifier
1 parent ac229e9 commit 2c28b0e

16 files changed

+76
-41
lines changed

openhtf/core/test_record.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ class TestRecord(object):
169169
"""The record of a single run of a test."""
170170

171171
dut_id = attr.ib(type=Optional[Text])
172-
dut_extended_id = attr.ib(type=Optional[DutIdentifier])
173172
station_id = attr.ib(type=Text)
173+
dut_extended_id = attr.ib(type=Optional[DutIdentifier], default=None)
174174
start_time_millis = attr.ib(type=int, default=0)
175175
end_time_millis = attr.ib(type=Optional[int], default=None)
176176
outcome = attr.ib(type=Optional[Outcome], default=None)

openhtf/output/servers/station_server.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,19 @@ def get_test(self, test_uid):
328328
return test, test_state
329329

330330

331+
class CommandHandler(web_gui_server.CorsRequestHandler):
332+
"""POST endpoint for commands from web GUI"""
333+
334+
def post(self, command):
335+
if command == 'restart':
336+
def kill_thread():
337+
time.sleep(1)
338+
os.kill(os.getpid(), 9)
339+
threading.Thread(target=kill_thread).start()
340+
_LOG.warning('Request to restart the server received, killing the process in 1 second.')
341+
self.write('Restarting server')
342+
343+
331344
class AttachmentsHandler(BaseTestHandler):
332345
"""GET endpoint for a file attached to a test."""
333346

@@ -610,6 +623,7 @@ def __init__(
610623
PlugsHandler),
611624
(r'/tests/(?P<test_uid>[\w\d:]+)/phases/(?P<phase_descriptor_id>\d+)/'
612625
'attachments/(?P<attachment_name>.+)', AttachmentsHandler),
626+
(r'/commands/(?P<command>.+)', CommandHandler),
613627
))
614628

615629
# Optionally enable history from disk.

openhtf/output/web_gui/dist/css/app.77df9acbfc40a7330df9.css renamed to openhtf/output/web_gui/dist/css/app.25f3f3a128d326614a9c.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openhtf/output/web_gui/dist/css/app.77df9acbfc40a7330df9.css.map renamed to openhtf/output/web_gui/dist/css/app.25f3f3a128d326614a9c.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openhtf/output/web_gui/dist/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<head><link href="/css/app.77df9acbfc40a7330df9.css" rel="stylesheet"></head><!doctype html>
1+
<head><link href="/css/app.25f3f3a128d326614a9c.css" rel="stylesheet"></head><!doctype html>
22
<!--
33
Copyright 2022 Google LLC
44
@@ -22,4 +22,4 @@
2222

2323
<base href="/">
2424
<htf-app config="{{ json_encode(config) }}">Loading...</htf-app>
25-
<script type="text/javascript" src="/js/polyfills.77df9acbfc40a7330df9.js"></script><script type="text/javascript" src="/js/vendor.77df9acbfc40a7330df9.js"></script><script type="text/javascript" src="/js/app.77df9acbfc40a7330df9.js"></script>
25+
<script type="text/javascript" src="/js/polyfills.25f3f3a128d326614a9c.js"></script><script type="text/javascript" src="/js/vendor.25f3f3a128d326614a9c.js"></script><script type="text/javascript" src="/js/app.25f3f3a128d326614a9c.js"></script>

openhtf/output/web_gui/dist/js/app.77df9acbfc40a7330df9.js renamed to openhtf/output/web_gui/dist/js/app.25f3f3a128d326614a9c.js

Lines changed: 31 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openhtf/output/web_gui/dist/js/app.25f3f3a128d326614a9c.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openhtf/output/web_gui/dist/js/app.77df9acbfc40a7330df9.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

openhtf/output/web_gui/dist/js/polyfills.77df9acbfc40a7330df9.js renamed to openhtf/output/web_gui/dist/js/polyfills.25f3f3a128d326614a9c.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openhtf/output/web_gui/dist/js/polyfills.77df9acbfc40a7330df9.js.map renamed to openhtf/output/web_gui/dist/js/polyfills.25f3f3a128d326614a9c.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)