From 92fc23102b30179984c66dece5f7b77a94db4b75 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Mon, 26 May 2025 10:45:11 -0600 Subject: [PATCH] add button and endpoint for starting a test --- ui/app.py | 19 +++++++++++++++++++ ui/index.html | 21 ++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/ui/app.py b/ui/app.py index 6b0cccf..78c8ff0 100755 --- a/ui/app.py +++ b/ui/app.py @@ -11,6 +11,7 @@ import gpiod from gpiod.line import Direction, Value import iio import json +import shutil import signal import sys import time @@ -109,6 +110,24 @@ class App: else: return "Method not allowed", 405 + # end point for starting a test + @cherrypy.expose + def starttest(self): + if cherrypy.request.method == 'GET': + # create a directory name for this test + t = time.localtime() + test_time = time.strftime("%Y:%m:%d_%H:%M:%S", t) + test_path = DATAPATH + test_time + # create a directory for this test + if not os.path.isdir(test_path): + os.makedirs(test_path) + # copy metadata into test directory + metadata_path = DATAPATH + "metadata.json" + shutil.copy(metadata_path, test_path) + return "Test " + test_path + " started" + else: + return "Method not allowed", 405 + # end point for handling AJAX requests for current status @cherrypy.expose @cherrypy.tools.json_out() diff --git a/ui/index.html b/ui/index.html index 9efde3c..58104a5 100644 --- a/ui/index.html +++ b/ui/index.html @@ -30,6 +30,15 @@ setInterval(updateContent, 1000); + @@ -84,7 +93,17 @@
+ class="w3-button w3-round-large w3-black w3-hover-orange w3-large w3-opacity"> + Configure Test +
+
+ + +
-- 2.47.2