Skip to content

armgit / moss

Public Imported from GitHub
0

MOSS: a small, mostly 3D-printed litter-picking rover. Cleaner streets, one maker at a time.

Python

cockpit page: the decision panel sits under the map, above the cameras, with a bounded scrolling feed

metroxc3f955696530
diff --git a/benches/bench_moss_cockpit_page_cold.py b/benches/bench_moss_cockpit_page_cold.py
index af30963..c299f43 100644
--- a/benches/bench_moss_cockpit_page_cold.py
+++ b/benches/bench_moss_cockpit_page_cold.py
@@ -127,10 +127,12 @@ check("index.html has #mod-decisions, #now-word, #now-detail, #now-since, #decis
all(i in E for i in need), ", ".join(i for i in need if i not in E))
dups = sorted({i for i in el.ids if el.ids.count(i) > 1})
check("every id in index.html is unique", not dups, ", ".join(dups))
-md, ml = E.get("mod-decisions", {}), E.get("mod-log", {})
-check("#mod-decisions sits ABOVE #mod-log, both in the right column (#col-right)",
- md and ml and md["pos"] < ml["pos"] and "col-right" in md["in"] and "col-right" in ml["in"],
- f"decisions {md.get('pos')} {md.get('in')}, log {ml.get('pos')} {ml.get('in')}")
+md, ml, mc = E.get("mod-decisions", {}), E.get("mod-log", {}), E.get("cams", {})
+check("#mod-decisions sits in the map column (#col-map), under the run banner and BEFORE the cameras (#cams); the log stays in the right column",
+ md and ml and mc and "col-map" in md["in"] and md["pos"] < mc["pos"] and "col-right" in ml["in"],
+ f"decisions {md.get('pos')} {md.get('in')}, cams {mc.get('pos')}, log {ml.get('pos')} {ml.get('in')}")
+check("the feed scrolls inside a bounded height under the map (#decisions max-height + overflow-y)",
+ bool(re.search(r"#decisions \{[^}]*max-height: \d+px;[^}]*overflow-y: auto", html)))
title = re.search(r'<h2 class="title" id="dec-title">([^<]*)</h2>', html)
check('the module is titled "What it decides." and is labelled by that title',
bool(title) and title.group(1) == "What it decides."
@@ -155,9 +157,9 @@ check("before the first answer the panel says it does not know: '--' dim, 'Waiti
json.dumps([nw0.groups() if nw0 else None, nd0.group(1) if nd0 else None, feed0.group(1) if feed0 else None]))
mob = re.search(r"@media \(max-width: 1099px\) \{([\s\S]*?)\n \}", html)
orders = dict(re.findall(r"#(mod-[a-z]+) \{ order: (\d+); \}", mob.group(1))) if mob else {}
-check("phone layout: the decisions stack after the controls and before the log (order 3 < 4 < log)",
- {"mod-controls", "mod-decisions", "mod-log"} <= set(orders)
- and int(orders["mod-controls"]) < int(orders["mod-decisions"]) < int(orders["mod-log"])
+check("phone layout: the decisions follow the map (no order rule of their own: they are inside #col-map, which comes first); controls before the log",
+ "mod-decisions" not in orders and {"mod-controls", "mod-log"} <= set(orders)
+ and int(orders["mod-controls"]) < int(orders["mod-log"])
and len(set(orders.values())) == len(orders), json.dumps(orders))
read_ids = set(re.findall(r'\$\("([\w-]+)"\)', js)) | set(re.findall(r'setText\("([\w-]+)"', js)) \
| set(re.findall(r'meter\("([\w-]+)"', js))
diff --git a/tools/moss_cockpit/index.html b/tools/moss_cockpit/index.html
index 5aefc1b..c730edd 100644
--- a/tools/moss_cockpit/index.html
+++ b/tools/moss_cockpit/index.html
@@ -228,7 +228,8 @@
#now-word.dim { color: var(--ui-dim); }
#now-detail { font-size: 14px; margin-top: 6px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#now-since { margin-top: 2px; }
- #decisions { list-style: none; margin: 0; padding: 0; font-size: 12.5px; line-height: 1.4; }
+ #decisions { list-style: none; margin: 0; padding: 0; font-size: 12.5px; line-height: 1.4; max-height: 200px; overflow-y: auto; scrollbar-width: thin; }
+ #col-map #mod-decisions { flex: none; margin: 14px 0 8px; }
#decisions li { display: grid; grid-template-columns: 38px 78px 1fr; column-gap: 8px; align-items: baseline;
padding: 3px 0; border-bottom: 1px solid rgba(106, 135, 151, .3); }
#decisions li:last-child { border-bottom: 0; }
@@ -276,7 +277,6 @@
#col-map { display: flex; order: 1; height: 86vh; min-height: 520px; margin-bottom: 28px; }
.cams { height: 24vh; column-gap: 10px; }
#mod-controls { order: 3; }
- #mod-decisions { order: 4; }
#mod-flight { order: 5; }
#mod-base { order: 6; }
#mod-system { order: 7; }
@@ -409,6 +409,18 @@
</div>
<div class="brule" aria-hidden="true"><i id="cap-progress"></i></div>
<div class="brule-cap"><span id="cap-left">no episode</span><span id="cap-right"></span></div>
+ <section class="mod" id="mod-decisions" aria-labelledby="dec-title">
+ <div class="mod-head">
+ <p class="kicker">DECISIONS</p>
+ <h2 class="title" id="dec-title">What it decides.</h2>
+ </div>
+ <div class="now" data-live>
+ <p id="now-word" class="dim" role="status" aria-live="polite">--</p>
+ <p id="now-detail">Waiting for the cockpit.</p>
+ <p id="now-since" class="small dim num"></p>
+ </div>
+ <ol id="decisions" data-live aria-label="Decisions, newest first"></ol>
+ </section>
<div class="cams" id="cams" data-live>
<div class="cam" id="cam-nose">
<img id="cam-img" alt="Nose camera, live">
@@ -424,7 +436,7 @@
<div class="cam-cap"><span>Nose camera (RealSense) and wrist camera (arm), 5 fps.</span><button class="btn link" id="b-cam" type="button">Pause video</button></div>
</div>
- <!-- column 3: controls, decisions, log -->
+ <!-- column 3: controls, log -->
<div class="col" id="col-right">
<section class="mod" id="mod-controls" aria-labelledby="ctl-title">
<div class="mod-head">
@@ -472,18 +484,6 @@
</div>
</section>
- <section class="mod" id="mod-decisions" aria-labelledby="dec-title">
- <div class="mod-head">
- <p class="kicker">DECISIONS</p>
- <h2 class="title" id="dec-title">What it decides.</h2>
- </div>
- <div class="now" data-live>
- <p id="now-word" class="dim" role="status" aria-live="polite">--</p>
- <p id="now-detail">Waiting for the cockpit.</p>
- <p id="now-since" class="small dim num"></p>
- </div>
- <ol id="decisions" data-live aria-label="Decisions, newest first"></ol>
- </section>
<section class="mod" id="mod-log" aria-labelledby="log-title">
<div class="mod-head alt">