aboutsummaryrefslogtreecommitdiff
path: root/salis.py
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-04-16 18:04:07 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-04-16 23:43:17 +0200
commite5b983979162cfadb628a835f666278700414e64 (patch)
tree25f88282f406dc2d4e164758b2cda617dbe4f1c3 /salis.py
parent33976c784facea8294c84f4c0eacb7e3bb052728 (diff)
Improves web-ui input form usability
Diffstat (limited to 'salis.py')
-rwxr-xr-xsalis.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/salis.py b/salis.py
index 7a0eb3b..6fbe763 100755
--- a/salis.py
+++ b/salis.py
@@ -363,29 +363,29 @@ if args.command in ["serve"]:
if bits.path == "/data":
http_query = urllib.parse.parse_qs(bits.query)
table = http_query["table"][0]
- entries = http_query["entries"][0]
+ rows = http_query["rows"][0]
nth = http_query["nth"][0]
- x_axis = http_query["x_axis"][0]
- x_low = http_query["x_low"][0]
- x_high = http_query["x_high"][0]
+ axis = http_query["axis"][0]
+ low = http_query["low"][0]
+ high = http_query["high"][0]
is_eva = http_query["is_eva"][0]
if is_eva == "true":
- hm_left = http_query["hm_left"][0]
- hm_px_count = http_query["hm_px_count"][0]
- hm_px_pow = http_query["hm_px_pow"][0]
- selects = ", ".join([f"cycl_{i}" for i in range(args.cores)]) + f", eva_render({hm_left}, {hm_px_count}, {hm_px_pow}, evts) as eva_render, step"
+ left = http_query["left"][0]
+ pixels = http_query["pixels"][0]
+ pixel_pow = http_query["pixel_pow"][0]
+ selects = ", ".join([f"cycl_{i}" for i in range(args.cores)]) + f", eva_render({left}, {pixels}, {pixel_pow}, evts) as eva_render, step"
else:
selects = "*"
- sql_query = f"SELECT * FROM (SELECT rowid, {selects} FROM {table} WHERE {x_axis} >= {x_low} AND {x_axis} <= {x_high} AND rowid % {nth} == 0 ORDER BY {x_axis} DESC LIMIT {entries}) ORDER BY {x_axis} ASC;"
+ sql_query = f"SELECT * FROM (SELECT rowid, {selects} FROM {table} WHERE {axis} >= {low} AND {axis} <= {high} AND rowid % {nth} == 0 ORDER BY {axis} DESC LIMIT {rows}) ORDER BY {axis} ASC;"
with Handler.sqlite_connect() as db_con: sql_list = [dict(row) for row in db_con.execute(sql_query).fetchall()]
return self.send_as_json(sql_list)
- if bits.path == "/x_high":
+ if bits.path == "/high":
http_query = urllib.parse.parse_qs(bits.query)
- x_axis = http_query["x_axis"][0]
- sql_query = f"SELECT {x_axis} as x_high FROM general ORDER BY {x_axis} DESC LIMIT 1;"
+ axis = http_query["axis"][0]
+ sql_query = f"SELECT {axis} as high FROM general ORDER BY {axis} DESC LIMIT 1;"
with Handler.sqlite_connect() as db_con: sql_dict = dict(db_con.execute(sql_query).fetchone())
return self.send_as_json(sql_dict)