fwdloop 0.26.2 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/fwdloop +23 -3
- package/package.json +1 -1
- package/src/authoring.js +10 -0
- package/src/canrun.js +20 -0
- package/src/declaration.js +98 -2
- package/src/drafter.js +23 -10
- package/src/learnstore.js +1 -1
- package/src/panel/author.js +18 -2
- package/src/panel/authorflows.js +9 -4
- package/src/panel/authorstart.js +10 -6
- package/src/panel/authortrigger.js +34 -10
- package/src/panel/data.js +39 -4
- package/src/panel/index.html +516 -60
- package/src/panel/scheduler.js +42 -6
- package/src/panel/server.js +21 -5
- package/src/panel/tickets.js +113 -0
- package/src/runner.js +51 -10
- package/src/schedule.js +5 -0
- package/src/summary-words.js +12 -4
- package/src/ticket-draft.js +87 -0
- package/src/ticket-labels.js +65 -0
- package/src/ticket-mcp.js +66 -0
- package/src/ticket-shape.js +24 -0
- package/src/trigger-files.js +1 -1
- package/src/trigger-line.js +2 -1
- package/src/trigger-tickets.js +209 -0
- package/types/canrun.d.ts +14 -0
- package/types/drafter.d.ts +186 -64
- package/types/panel/author.d.ts +8 -0
- package/types/panel/authorflows.d.ts +2 -0
- package/types/panel/authorstart.d.ts +3 -1
- package/types/panel/authortrigger.d.ts +11 -1
- package/types/panel/data.d.ts +22 -3
- package/types/panel/scheduler.d.ts +7 -2
- package/types/panel/server.d.ts +9 -2
- package/types/panel/tickets.d.ts +81 -0
- package/types/runner.d.ts +21 -3
- package/types/summary-words.d.ts +2 -1
- package/types/ticket-draft.d.ts +96 -0
- package/types/ticket-labels.d.ts +36 -0
- package/types/ticket-mcp.d.ts +40 -0
- package/types/ticket-shape.d.ts +25 -0
- package/types/trigger-files.d.ts +2 -0
- package/types/trigger-line.d.ts +7 -0
- package/types/trigger-tickets.d.ts +91 -0
package/src/panel/index.html
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
always-scrolling wrapper makes the header genuinely sticky on both
|
|
54
54
|
breakpoints, and also owns the horizontal scroll for the Path column
|
|
55
55
|
on narrow (390px) screens instead of leaving it to .pane-body. */
|
|
56
|
-
.audit-table-scroll{overflow:auto;max-height:min(60vh,520px);}
|
|
56
|
+
.audit-table-scroll{overflow:auto;max-height:min(60vh,520px);max-width:100%;}
|
|
57
57
|
[data-testid="audit-table"] td.am, .audit-group table td.am{display:none;}
|
|
58
58
|
/* z-index keeps rows from showing through the solid th background as
|
|
59
59
|
they scroll under it. */
|
|
@@ -128,6 +128,8 @@
|
|
|
128
128
|
.topbar .tagline::before{content:"· ";color:var(--text-faint);}
|
|
129
129
|
@media (max-width: 600px){ .topbar .tagline{display:none;} }
|
|
130
130
|
.topbar-right{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
|
|
131
|
+
#online-dot{font-size:12px;white-space:nowrap;flex:none;}
|
|
132
|
+
#online-dot.on{color:var(--green);} #online-dot.off{color:var(--red);}
|
|
131
133
|
|
|
132
134
|
[hidden]{display:none !important;}
|
|
133
135
|
.main{display:flex;flex:1;min-height:0;}
|
|
@@ -167,6 +169,8 @@
|
|
|
167
169
|
.dot.stuck::before{content:"[II]";color:var(--amber);}
|
|
168
170
|
/* M4e amendment 4: stopped — by you, or at the money cap; Resume goes on. Grey like the other quiet end, never the red [✗]. */
|
|
169
171
|
.dot.stopped::before{content:"[■]";color:var(--grey-dot);}
|
|
172
|
+
/* M12 p3: a skipped run (a ticket the signed labels do not match) wears [–], the sign the ticket list draws, grey like the other quiet end. */
|
|
173
|
+
.dot.skipped::before{content:"[–]";color:var(--grey-dot);}
|
|
170
174
|
/* the Run tab's top action row (Stop, Resume) */
|
|
171
175
|
.run-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:8px;}
|
|
172
176
|
.run-actions .answer-msg{margin-top:0;flex:1 1 100%;}
|
|
@@ -315,7 +319,7 @@
|
|
|
315
319
|
.ended-block.red{border-color:var(--red);}
|
|
316
320
|
.ended-text.is-red,.ended-label.is-red{color:var(--red);}
|
|
317
321
|
.ended-block.green{border-color:var(--green);}
|
|
318
|
-
.ended-block.grey,.ended-block.stopped{border-color:var(--grey-dot);}
|
|
322
|
+
.ended-block.grey,.ended-block.stopped,.ended-block.skipped{border-color:var(--grey-dot);}
|
|
319
323
|
.ended-block.amber,.ended-block.expired,.ended-block.stuck{border-color:var(--amber);}
|
|
320
324
|
.ended-row{display:flex;gap:10px;align-items:baseline;flex-wrap:wrap;margin-bottom:6px;}
|
|
321
325
|
.ended-row:last-child{margin-bottom:0;}
|
|
@@ -332,7 +336,7 @@
|
|
|
332
336
|
.summary-box{position:relative;border:1px solid var(--border-strong);padding:16px 12px 12px;margin-top:16px;background:var(--panel2);font-size:12px;}
|
|
333
337
|
.summary-box.red{border-color:var(--red);}
|
|
334
338
|
.summary-box.green{border-color:var(--green);}
|
|
335
|
-
.summary-box.grey,.summary-box.stopped{border-color:var(--grey-dot);}
|
|
339
|
+
.summary-box.grey,.summary-box.stopped,.summary-box.skipped{border-color:var(--grey-dot);}
|
|
336
340
|
.summary-box.amber,.summary-box.expired,.summary-box.stuck{border-color:var(--amber);}
|
|
337
341
|
.summary-box.magenta{border-color:var(--magenta);}
|
|
338
342
|
.summary-box::before{content:"┤ SUMMARY ├";position:absolute;top:-10px;left:10px;background:var(--panel2);padding:0 6px;font-size:11px;color:var(--text-faint);letter-spacing:0.08em;}
|
|
@@ -474,15 +478,66 @@
|
|
|
474
478
|
.audit-fold-who.model{color:var(--cyan);} .audit-fold-who.human{color:var(--magenta,#9854f1);}
|
|
475
479
|
.audit-tally{color:var(--text-dim);margin:2px 0 4px;}
|
|
476
480
|
.audit-try{margin:4px 0 2px;overflow-wrap:anywhere;}
|
|
477
|
-
.audit-
|
|
478
|
-
.audit-chk{overflow-wrap:anywhere;}
|
|
479
|
-
.audit-chk > span{margin-right:6px;}
|
|
480
|
-
.audit-chk .src,.audit-judged{color:var(--text-faint);}
|
|
481
|
+
.audit-judged{color:var(--text-faint);}
|
|
481
482
|
.audit-fold-label{color:var(--text-faint);text-transform:uppercase;font-size:10px;letter-spacing:.05em;margin-top:8px;}
|
|
482
483
|
.audit-fold-body table.rounds-table{width:100%;border-collapse:collapse;margin-top:4px;}
|
|
483
484
|
.audit-fold-body table.rounds-table th{position:sticky;top:0;z-index:1;}
|
|
484
485
|
.audit-fold-body table.rounds-table tr.trysep td{border-top:1px solid var(--border-strong);}
|
|
485
486
|
.rounds-pager{color:var(--text-faint);font-size:11px;margin-top:4px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
|
|
487
|
+
/* the Audit check grid (PRD: bareloop variant F), its errors list and the rounds folded per try.
|
|
488
|
+
borrowed-from: bareloop src/panel/index.html@c79d396 (the .grid/.cell/.fx-*/.rounds-fold rules); the pass/fail glyph colours are fwdloop's own `.mark` */
|
|
489
|
+
.glyph-q{color:var(--magenta);} .glyph-nr{color:var(--text-faint);}
|
|
490
|
+
.rounds-fold{margin:4px 0 6px 12px;font-size:12px;}
|
|
491
|
+
.rounds-fold>summary{cursor:pointer;color:var(--text-dim);min-height:28px;overflow-wrap:anywhere;}
|
|
492
|
+
.rounds-fold .rf-body{margin-top:4px;padding-left:8px;border-left:2px solid var(--border-strong);}
|
|
493
|
+
.grid-wrap{overflow:auto;max-width:100%;}
|
|
494
|
+
table.grid{width:100%;min-width:0;}
|
|
495
|
+
table.grid th.q,table.grid td.q{min-width:170px;max-width:340px;white-space:normal;overflow-wrap:anywhere;font-size:12px;}
|
|
496
|
+
table.grid th.t,table.grid td.c{text-align:center;width:64px;min-width:56px;white-space:nowrap;}
|
|
497
|
+
table.grid th.t .hint{display:block;text-transform:none;letter-spacing:0;font-weight:400;margin:0;}
|
|
498
|
+
table.grid td.c{padding:2px;}
|
|
499
|
+
.cell{border:1px solid transparent;background:none;min-width:44px;min-height:32px;color:var(--text-faint);font-size:14px;font-weight:700;}
|
|
500
|
+
.cell.fail{color:var(--red);border-color:var(--border-strong);background:var(--red-bg);}
|
|
501
|
+
.cell.pass{color:var(--green);cursor:default;}
|
|
502
|
+
.cell.notrun{color:var(--text-faint);cursor:default;}
|
|
503
|
+
.cell.unk{color:var(--magenta);cursor:default;}
|
|
504
|
+
.fold-list{margin-top:10px;}
|
|
505
|
+
.fgrid .cell.fail[aria-expanded="true"]{outline:2px solid var(--red);outline-offset:1px;}
|
|
506
|
+
.fx-errors{margin:8px 0 4px;min-width:0;}
|
|
507
|
+
.fx-label{font-size:11px;color:var(--text-faint);text-transform:uppercase;letter-spacing:0.06em;margin-bottom:2px;}
|
|
508
|
+
.fx-row{min-width:0;}
|
|
509
|
+
.fx-rowhead{display:flex;align-items:baseline;gap:8px;width:100%;min-width:0;min-height:32px;padding:3px 4px;border:0;background:none;color:var(--text);font:inherit;font-size:12px;text-align:left;}
|
|
510
|
+
button.fx-rowhead{cursor:pointer;}
|
|
511
|
+
button.fx-rowhead:hover{background:var(--panel2);}
|
|
512
|
+
button.fx-rowhead:focus-visible,.fx-more:focus-visible,.cell.fail:focus-visible{outline:2px solid var(--red);outline-offset:1px;}
|
|
513
|
+
.fx-caret{flex:none;width:12px;color:var(--text-faint);}
|
|
514
|
+
.fx-try{flex:none;font-weight:700;}
|
|
515
|
+
.fx-chk{flex:none;white-space:nowrap;}
|
|
516
|
+
.fx-first{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-dim);}
|
|
517
|
+
.fx-faint,.fx-count{color:var(--text-faint);}
|
|
518
|
+
.fx-count{flex:none;white-space:nowrap;}
|
|
519
|
+
.fx-row.open>.fx-rowhead{background:var(--red-bg);}
|
|
520
|
+
.fx-body{margin:0 0 6px 20px;border-left:2px solid var(--red);padding:4px 10px;background:var(--red-bg);min-width:0;}
|
|
521
|
+
.fx-sub{font-size:12px;color:var(--text);font-weight:700;margin:6px 0 2px;overflow-wrap:anywhere;}
|
|
522
|
+
.fx-lines{font-size:12px;color:var(--text-dim);}
|
|
523
|
+
.fx-lines div{margin:1px 0;overflow-wrap:anywhere;}
|
|
524
|
+
.fx-judged{overflow-wrap:anywhere;}
|
|
525
|
+
.fx-more{margin-top:4px;min-height:28px;padding:2px 8px;border:1px solid var(--border-strong);background:var(--panel2);color:var(--text);font-size:12px;}
|
|
526
|
+
/* M4d am36: the hints row and its text, the folded every-step row (mock: fwd-audit-grid-mock.html, variant A) */
|
|
527
|
+
.btn.hints[aria-expanded="true"]{outline:2px solid var(--accent);outline-offset:1px;}
|
|
528
|
+
.btn.hints:focus-visible{outline:2px solid var(--accent);outline-offset:1px;}
|
|
529
|
+
.cell.none{color:var(--text-faint);cursor:default;font-weight:400;}
|
|
530
|
+
tr.hint-row td{color:var(--text-faint);}
|
|
531
|
+
.fx-row.hintrow.open>.fx-rowhead{background:var(--panel2);}
|
|
532
|
+
.fx-row.hintrow .fx-body{border-left-color:var(--accent);background:var(--panel2);}
|
|
533
|
+
.fx-row.hintrow .fx-try{flex:1 1 auto;min-width:0;overflow-wrap:anywhere;}
|
|
534
|
+
.fx-lines div.ind{margin-left:16px;}
|
|
535
|
+
button.q-fold{border:0;background:none;color:var(--text);font:inherit;font-size:12px;text-align:left;padding:0;min-height:32px;width:100%;overflow-wrap:anywhere;cursor:pointer;}
|
|
536
|
+
button.q-fold::before{content:"\25B8 ";color:var(--text-faint);white-space:pre;}
|
|
537
|
+
button.q-fold[aria-expanded="true"]::before{content:"\25BE ";}
|
|
538
|
+
tr.step-sub td{background:var(--panel2);font-size:12px;color:var(--text-dim);padding:4px 8px;}
|
|
539
|
+
.sub-line{display:flex;gap:8px;align-items:baseline;flex-wrap:wrap;}
|
|
540
|
+
.sub-line .marks{margin-left:auto;white-space:nowrap;}
|
|
486
541
|
.step-card .step-head .who{font-weight:700;font-size:11px;}
|
|
487
542
|
.step-card .step-head .who.model{color:var(--cyan);} .step-card .step-head .who.human{color:var(--magenta,#9854f1);}
|
|
488
543
|
/* hamr's 2026-09-27 review: the group header's own state word (g.state,
|
|
@@ -516,6 +571,23 @@
|
|
|
516
571
|
#result-body details>summary{cursor:pointer;color:var(--text-dim);min-height:28px;}
|
|
517
572
|
.rs-warn{color:var(--amber);overflow-wrap:anywhere;}
|
|
518
573
|
/* M10 am5 item 2: the Your-call card. borrowed-from: bareloop src/panel/index.html@2959217 :401-403 :407 */
|
|
574
|
+
/* M12 piece 3: the ticket list in the Result tab (mockup docs/product/m12-ticket-results-mock.html, variant E). Its boxes are the panel's own: .audit-group, .filterbar, .chips, .btn.small. */
|
|
575
|
+
.tk-fold{display:block;width:100%;text-align:left;background:none;border:0;color:var(--text-dim);font:inherit;font-size:12px;padding:4px 0;cursor:pointer;min-height:32px;}
|
|
576
|
+
.tk-fold:hover{color:var(--accent);}
|
|
577
|
+
.tk-fold:focus-visible,.tk-rl:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
|
|
578
|
+
.tk{padding:6px 0;border-bottom:1px dotted var(--border-strong);min-width:0;}
|
|
579
|
+
.tk:last-child{border-bottom:0;}
|
|
580
|
+
.tk-1{display:flex;gap:6px;align-items:baseline;min-width:0;}
|
|
581
|
+
.tk-n{color:var(--accent);font-weight:700;flex:none;}
|
|
582
|
+
.tk-t{color:var(--text);min-width:0;flex:1 1 0;overflow-wrap:anywhere;}
|
|
583
|
+
.tk-when{color:var(--text-faint);font-size:12px;flex:none;}
|
|
584
|
+
.tk-2{font-size:12px;color:var(--text-dim);margin-top:2px;display:flex;gap:6px;align-items:center;flex-wrap:wrap;min-width:0;overflow-wrap:anywhere;}
|
|
585
|
+
.tk-state.green{color:var(--green);} .tk-state.red{color:var(--red);} .tk-state.amber{color:var(--amber);} .tk-state.grey{color:var(--text-faint);}
|
|
586
|
+
.tk-rl{color:var(--accent);text-decoration:underline;cursor:pointer;background:none;border:0;padding:0;font:inherit;}
|
|
587
|
+
.tk-chg{font-size:12px;color:var(--amber);}
|
|
588
|
+
.tk-anyway{margin-top:6px;}
|
|
589
|
+
.tk-anyway textarea{width:100%;min-height:52px;margin:4px 0;background:var(--bg);color:var(--text);border:1px solid var(--text-dim);font:inherit;font-size:16px;padding:6px;box-sizing:border-box;}
|
|
590
|
+
.tk-msg{font-size:12px;overflow-wrap:anywhere;}
|
|
519
591
|
#result-door-card{border-color:var(--amber);}
|
|
520
592
|
#result-door-card .st-word{color:var(--amber);}
|
|
521
593
|
#result-door-card textarea{width:100%;min-height:60px;margin:6px 0;background:var(--bg);color:var(--text);border:1px solid var(--text-dim);font:inherit;padding:6px;box-sizing:border-box;}
|
|
@@ -656,6 +728,7 @@
|
|
|
656
728
|
#details-schedule{overflow-wrap:anywhere;} /* M10: a page input's full address in the Schedule field wraps, never spills */
|
|
657
729
|
.jf-inrow .jf-path{text-overflow:ellipsis;} /* M10: a web page's address is cut with an ellipsis (the whole is the title) */
|
|
658
730
|
.jf-inrow .jf-err{grid-column:1 / -1;}
|
|
731
|
+
.jf-ticket{width:11ch;min-width:0;} /* M12 p3: the ticket # box */
|
|
659
732
|
/* M4e amendment 4/5: what a Run or a Resume cannot change shows dimmed (the signature fixes it); only the open boxes are bright */
|
|
660
733
|
.field.dimmed{opacity:.6;}
|
|
661
734
|
/* borrowed-from: bareloop src/panel/index.html@b5e37b8 — the Reuse workflow picker (search box + list, then the picked box) */
|
|
@@ -760,6 +833,13 @@
|
|
|
760
833
|
.audit-group table.rounds-table tbody{display:table-row-group;}
|
|
761
834
|
.audit-group table.rounds-table tr{display:table-row;padding:0;overflow:visible;}
|
|
762
835
|
.audit-group table.rounds-table td{display:table-cell;padding:4px 6px;white-space:normal;overflow-wrap:anywhere;border-right:1px dotted var(--border);}
|
|
836
|
+
/* the check grid keeps its real table layout on a phone and scrolls inside its own box (.grid-wrap), never the page */
|
|
837
|
+
.audit-group table.grid{display:table;width:100%;max-width:none;}
|
|
838
|
+
.audit-group table.grid thead{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal;}
|
|
839
|
+
.audit-group table.grid tbody{display:table-row-group;}
|
|
840
|
+
.audit-group table.grid tr{display:table-row;padding:0;overflow:visible;}
|
|
841
|
+
.audit-group table.grid td{display:table-cell;white-space:normal;border-right:1px dotted var(--border);}
|
|
842
|
+
.audit-group table.grid td.c{white-space:nowrap;padding:2px;}
|
|
763
843
|
/* M8 item 6: a hint's table fits the box and wraps (as bareloop's does at 320), it does not scroll sideways */
|
|
764
844
|
.audit-part table.learn-hint{display:table;width:100%;min-width:0;max-width:100%;}
|
|
765
845
|
.audit-part table.learn-hint tbody{display:table-row-group;}
|
|
@@ -824,7 +904,10 @@
|
|
|
824
904
|
.pv-knote > .hint:empty{display:none;}
|
|
825
905
|
.pv-key[data-open="0"] .pv-models{display:none;}
|
|
826
906
|
.pv-mrow{border-top:1px dotted var(--border-strong);min-height:32px;}
|
|
827
|
-
|
|
907
|
+
/* borrowed-from: bareloop src/panel/index.html@357a482 (hamr: same exact change) — a clicked model row turns blue; tabindex -1 on the row makes a click on its name focusable */
|
|
908
|
+
.pv-mrow:hover{background:var(--panel2);}
|
|
909
|
+
.pv-mrow:focus-within,.pv-mrow:focus-within:hover{background:var(--rl-accent-bg-strong);box-shadow:inset 0 0 0 2px var(--accent);}
|
|
910
|
+
.pv-mrow:focus{outline:none;}
|
|
828
911
|
.pv-um{grid-column:1;display:flex;align-items:center;gap:0;min-width:0;}
|
|
829
912
|
.pv-uh,.pv-m-use{flex:0 0 44px;width:44px;display:flex;align-items:center;justify-content:center;}
|
|
830
913
|
.pv-m-use{min-height:32px;}
|
|
@@ -890,6 +973,7 @@
|
|
|
890
973
|
</div>
|
|
891
974
|
<div class="topbar-right">
|
|
892
975
|
<span class="hint" id="host-line"></span>
|
|
976
|
+
<span id="online-dot" class="on" data-testid="online-dot" role="status">● online</span>
|
|
893
977
|
<button class="btn small" id="settings-open" type="button" data-testid="settings-open">⚙ Settings</button>
|
|
894
978
|
<button class="theme-toggle" id="theme-toggle" type="button" aria-label="Toggle light/dark theme">☽</button>
|
|
895
979
|
</div>
|
|
@@ -1087,6 +1171,7 @@
|
|
|
1087
1171
|
<option value="weekly">Every <day> at HH:MM</option>
|
|
1088
1172
|
<option value="file-updated">When <file> is updated</option>
|
|
1089
1173
|
<option value="new-file">When a new file arrives in <folder></option>
|
|
1174
|
+
<option value="new-ticket">When a new ticket arrives in <input name></option>
|
|
1090
1175
|
</select>
|
|
1091
1176
|
<div class="when-sub" id="jf-when-clock" hidden>
|
|
1092
1177
|
<select id="jf-when-day" data-testid="jf-when-day" aria-label="Day of the week">
|
|
@@ -1175,6 +1260,8 @@
|
|
|
1175
1260
|
action handlers, never cleared by the poll (the poll owns #chat-card-error instead) -->
|
|
1176
1261
|
<div class="hint" id="chat-action-error" data-testid="chat-action-error"></div>
|
|
1177
1262
|
|
|
1263
|
+
<!-- M12 piece 3: a green ticket job takes its ticket number here, beside Sign & run (the Run card's ticket # box, same class) -->
|
|
1264
|
+
<input type="text" class="jf-ticket" id="chat-sign-ticket" data-testid="jf-sign-ticket" inputmode="numeric" placeholder="ticket #" aria-label="Ticket number to run" autocomplete="off" spellcheck="false" hidden>
|
|
1178
1265
|
<button class="btn primary wide" type="button" id="chat-main-btn" data-testid="chat-main" disabled>Draft</button>
|
|
1179
1266
|
<div class="hint" id="chat-main-hint" data-testid="chat-main-hint"></div>
|
|
1180
1267
|
<!-- M4e amendment 14 item 2: on a green plan, Revise opens every card field (the main button then reads Draft) -->
|
|
@@ -1717,6 +1804,7 @@
|
|
|
1717
1804
|
if(g === "[!]") return "expired";
|
|
1718
1805
|
if(g === "[II]") return "stuck";
|
|
1719
1806
|
if(g === "[■]") return "stopped";
|
|
1807
|
+
if(g === "[–]") return "skipped";
|
|
1720
1808
|
return "grey"; // "[·]" — waiting on a human, or answered-not-resumed
|
|
1721
1809
|
}
|
|
1722
1810
|
|
|
@@ -2551,6 +2639,89 @@
|
|
|
2551
2639
|
(line.kind === "facts" ? resultFactsLine(line) : resultTextLine(line)) + (line.sheet ? resultSheetBlock(line.sheet) : resultChecksList(line)) +
|
|
2552
2640
|
resultNotChecked("Not checked", line.notChecked, "result-line-notchecked") + '</div>';
|
|
2553
2641
|
}
|
|
2642
|
+
// ---- M12 piece 3: the ticket list (item 9, mockup E). The server decides every group, row, reason and sentence (src/panel/tickets.js); this only draws,
|
|
2643
|
+
// filters by the chips and the search, and posts "Run it anyway" with its reason. The filter bar is the panel's own markup (.filterbar, .search-input, .chips, .chip.fchip).
|
|
2644
|
+
var ticketUi = { chips: {}, q: "", open: {}, anyway: null, msg: "" };
|
|
2645
|
+
var TICKET_STATE = { "[✓]": ["green", "passed"], "[–]": ["grey", "skipped"], "[✗]": ["red", "stopped"], "[■]": ["red", "stopped"], "[?]": ["red", "stopped"], "[·]": ["amber", "waiting"], "[▶]": ["amber", "running"], "[II]": ["amber", "stuck"], "[!]": ["amber", "expired"] };
|
|
2646
|
+
function ticketWhen(ms){ return rlShortDate(new Date(ms).toISOString()); }
|
|
2647
|
+
function ticketRowHTML(r, flow){
|
|
2648
|
+
var st = TICKET_STATE[r.glyph] || ["grey", ""];
|
|
2649
|
+
var h = '<div class="tk" data-testid="ticket-row" data-number="' + r.number + '"><div class="tk-1"><span class="tk-when">' + escapeXml(ticketWhen(r.at)) + '</span><span class="tk-n">#' + r.number + '</span><span class="tk-t">' + escapeXml(r.title || "") + '</span></div><div class="tk-2">';
|
|
2650
|
+
if(r.changed) h += '<span class="tk-chg" data-testid="ticket-changed">' + escapeXml(r.changed) + '</span><br>';
|
|
2651
|
+
h += '<span class="tk-state ' + st[0] + '"><b>' + escapeXml(r.glyph) + '</b> ' + escapeXml(st[1]) + '</span>';
|
|
2652
|
+
if(r.group === "skip"){
|
|
2653
|
+
h += ' \u00b7 <span data-testid="ticket-reason">' + escapeXml(r.reason || "") + ' \u00b7 $0</span> <button class="btn small" type="button" data-testid="ticket-anyway-open" data-number="' + r.number + '">Run it anyway</button>';
|
|
2654
|
+
} else {
|
|
2655
|
+
h += ' \u00b7 <button class="tk-rl" type="button" data-testid="ticket-run" data-run="' + escapeXml(r.runId) + '">' + escapeXml(r.runId) + '</button>';
|
|
2656
|
+
}
|
|
2657
|
+
h += '</div>';
|
|
2658
|
+
if(r.group === "skip" && ticketUi.anyway && ticketUi.anyway.number === r.number){
|
|
2659
|
+
h += '<div class="tk-anyway" data-testid="ticket-anyway-box"><textarea data-testid="ticket-anyway-text" aria-label="reason (needed to run it anyway)" placeholder="reason (needed to run it anyway)">' + escapeXml(ticketUi.anyway.text) + '</textarea>' +
|
|
2660
|
+
'<button class="btn small" type="button" data-testid="ticket-anyway-go"' + (ticketUi.anyway.text.trim() === "" ? " disabled" : "") + '>Run it anyway</button></div>';
|
|
2661
|
+
}
|
|
2662
|
+
return h + '</div>';
|
|
2663
|
+
}
|
|
2664
|
+
function ticketGroupsHTML(t, flow){
|
|
2665
|
+
var any = t.groups.some(function(g){ return ticketUi.chips[g.key]; });
|
|
2666
|
+
var q = ticketUi.q.trim().toLowerCase();
|
|
2667
|
+
return t.groups.map(function(g){
|
|
2668
|
+
if(any && !ticketUi.chips[g.key]) return "";
|
|
2669
|
+
var rows = g.rows.filter(function(r){ return !q || ("#" + r.number + " " + r.number + " " + (r.title || "")).toLowerCase().indexOf(q) !== -1; });
|
|
2670
|
+
var open = ticketUi.open[g.key] === undefined ? g.open : ticketUi.open[g.key];
|
|
2671
|
+
return '<button class="tk-fold" type="button" data-testid="ticket-fold-' + g.key + '" data-group="' + g.key + '" aria-expanded="' + open + '">' + (open ? "\u25be" : "\u25b8") + " " + escapeXml(g.label) + " (" + rows.length + ")</button>" +
|
|
2672
|
+
(open ? rows.map(function(r){ return ticketRowHTML(r, flow); }).join("") : "");
|
|
2673
|
+
}).join("");
|
|
2674
|
+
}
|
|
2675
|
+
function ticketCardHTML(t, flow){
|
|
2676
|
+
return '<div class="field"><label>Schedule</label><div class="ro-value" data-testid="ticket-schedule">' + escapeXml(t.line) + '</div></div>' +
|
|
2677
|
+
'<div class="audit-group" data-testid="result-tickets"><h4><span class="badge grey">tickets</span></h4>' +
|
|
2678
|
+
'<div class="filterbar" data-scope="tickets" data-testid="tickets-filters"><input type="text" class="search-input" id="tickets-filter-search" data-testid="tickets-filter-search" placeholder="ticket number or title" autocomplete="off" value="' + escapeXml(ticketUi.q) + '">' +
|
|
2679
|
+
'<div class="chips" role="group" aria-label="Filter">' + t.groups.map(function(g){
|
|
2680
|
+
return '<button class="chip fchip" type="button" aria-pressed="' + (ticketUi.chips[g.key] ? "true" : "false") + '" data-ticket-chip="' + g.key + '" data-testid="chip-tickets-' + g.key + '">' + escapeXml(g.label) + '</button>';
|
|
2681
|
+
}).join("") + '</div></div>' +
|
|
2682
|
+
'<div id="ticket-groups" data-testid="ticket-groups">' + ticketGroupsHTML(t, flow) + '</div>' +
|
|
2683
|
+
'<div class="tk-msg" id="ticket-msg" data-testid="ticket-msg">' + escapeXml(ticketUi.msg) + '</div>' +
|
|
2684
|
+
'<div class="hint">newest first inside each group \u00b7 each ticket opens its own run</div></div>';
|
|
2685
|
+
}
|
|
2686
|
+
function wireTickets(body, data){
|
|
2687
|
+
var t = data.tickets;
|
|
2688
|
+
var host = body.querySelector("#ticket-groups");
|
|
2689
|
+
if(!t || !host) return;
|
|
2690
|
+
function repaint(){ host.innerHTML = ticketGroupsHTML(t, data.flow); wireRows(); }
|
|
2691
|
+
function wireRows(){
|
|
2692
|
+
host.querySelectorAll(".tk-fold").forEach(function(b){
|
|
2693
|
+
b.addEventListener("click", function(){ var k = b.getAttribute("data-group"); var g = t.groups.filter(function(x){ return x.key === k; })[0]; var cur = ticketUi.open[k] === undefined ? g.open : ticketUi.open[k]; ticketUi.open[k] = !cur; repaint(); });
|
|
2694
|
+
});
|
|
2695
|
+
host.querySelectorAll("[data-testid=ticket-run]").forEach(function(b){
|
|
2696
|
+
b.addEventListener("click", function(){ var id = b.getAttribute("data-run"); selectRun(data.flow, id, null, ".hist-row"); document.getElementById("tab-run").click(); });
|
|
2697
|
+
});
|
|
2698
|
+
host.querySelectorAll("[data-testid=ticket-anyway-open]").forEach(function(b){
|
|
2699
|
+
b.addEventListener("click", function(){ var n = Number(b.getAttribute("data-number")); ticketUi.anyway = (ticketUi.anyway && ticketUi.anyway.number === n) ? null : { number: n, text: "" }; ticketUi.msg = ""; repaint(); var ta = host.querySelector("[data-testid=ticket-anyway-text]"); if(ta) ta.focus(); });
|
|
2700
|
+
});
|
|
2701
|
+
var ta = host.querySelector("[data-testid=ticket-anyway-text]");
|
|
2702
|
+
var go = host.querySelector("[data-testid=ticket-anyway-go]");
|
|
2703
|
+
if(ta && go){
|
|
2704
|
+
ta.addEventListener("input", function(){ ticketUi.anyway.text = ta.value; go.disabled = ta.value.trim() === ""; });
|
|
2705
|
+
go.addEventListener("click", function(){
|
|
2706
|
+
var a = ticketUi.anyway;
|
|
2707
|
+
if(!a || a.text.trim() === ""){ ticketUi.msg = "Please write a reason to run it anyway."; document.getElementById("ticket-msg").textContent = ticketUi.msg; return; }
|
|
2708
|
+
go.disabled = true;
|
|
2709
|
+
postJSON("/api/author/ticket-anyway", { flow: data.flow, runId: data.runId, number: a.number, reason: a.text.trim() }).then(function(r){
|
|
2710
|
+
var ok = r.status >= 200 && r.status < 300 && r.body && r.body.ok === true;
|
|
2711
|
+
ticketUi.msg = (r.body && r.body.say) || (ok ? "Queued." : "Not queued. Nothing started.");
|
|
2712
|
+
if(ok) ticketUi.anyway = null;
|
|
2713
|
+
repaint(); document.getElementById("ticket-msg").textContent = ticketUi.msg;
|
|
2714
|
+
}).catch(function(){ ticketUi.msg = "Could not reach the panel. Nothing started."; document.getElementById("ticket-msg").textContent = ticketUi.msg; go.disabled = false; });
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
wireRows();
|
|
2719
|
+
body.querySelectorAll("[data-ticket-chip]").forEach(function(c){
|
|
2720
|
+
c.addEventListener("click", function(){ var k = c.getAttribute("data-ticket-chip"); ticketUi.chips[k] = !ticketUi.chips[k]; c.setAttribute("aria-pressed", ticketUi.chips[k] ? "true" : "false"); repaint(); });
|
|
2721
|
+
});
|
|
2722
|
+
var search = body.querySelector("#tickets-filter-search");
|
|
2723
|
+
if(search) search.addEventListener("input", function(){ ticketUi.q = search.value; repaint(); });
|
|
2724
|
+
}
|
|
2554
2725
|
function renderResult(){
|
|
2555
2726
|
var detail = resultDetail, data = resultData;
|
|
2556
2727
|
var body = document.getElementById("result-body");
|
|
@@ -2568,6 +2739,7 @@
|
|
|
2568
2739
|
'<div class="field-row">' + resultField("Money", '<div class="ro-value" data-testid="result-counters">' + escapeXml(counters[0] || "") + '</div>') +
|
|
2569
2740
|
resultField("Time", '<div class="ro-value">' + escapeXml((counters[1] || "").replace(/^took /, "")) + '</div>') + '</div>' +
|
|
2570
2741
|
((data.pages || []).length === 1 ? resultPageLink(data.pages[0], data.pageNote, "result-page-top") : "") + '</div>';
|
|
2742
|
+
if(data.tickets) h += ticketCardHTML(data.tickets, data.flow);
|
|
2571
2743
|
var ownPages = (data.pages || []).length >= 2;
|
|
2572
2744
|
(data.lines || []).forEach(function(line){ h += resultLineCard(line, ownPages, data.pageNote); });
|
|
2573
2745
|
if(data.gap){
|
|
@@ -2588,6 +2760,7 @@
|
|
|
2588
2760
|
}).join("") + '</div>';
|
|
2589
2761
|
}
|
|
2590
2762
|
body.innerHTML = h;
|
|
2763
|
+
wireTickets(body, data);
|
|
2591
2764
|
var ta = body.querySelector("#result-rerun-text");
|
|
2592
2765
|
if(ta){
|
|
2593
2766
|
ta.value = typed;
|
|
@@ -3237,46 +3410,14 @@
|
|
|
3237
3410
|
if(testId) e.setAttribute("data-testid", testId);
|
|
3238
3411
|
return e;
|
|
3239
3412
|
}
|
|
3240
|
-
|
|
3413
|
+
// an ask step's try: the answer and the file it was about (a model step's tries are the grid's columns)
|
|
3414
|
+
function foldTryEl(t){
|
|
3241
3415
|
var wrap = document.createElement("div");
|
|
3242
3416
|
var line = foldEl("div", "audit-try", null, "audit-try-line");
|
|
3243
3417
|
line.appendChild(document.createTextNode("try " + t.n + " "));
|
|
3244
3418
|
line.appendChild(foldEl("span", "mark " + auditMarkClass(t.mark), t.mark));
|
|
3245
|
-
|
|
3246
|
-
? [t.answer, t.about ? "about " + t.about : null]
|
|
3247
|
-
: [t.thinking, t.gap];
|
|
3248
|
-
rest.forEach(function(x){ if(x) line.appendChild(document.createTextNode(" \u00b7 " + x)); });
|
|
3419
|
+
[t.answer, t.about ? "about " + t.about : null].forEach(function(x){ if(x) line.appendChild(document.createTextNode(" \u00b7 " + x)); });
|
|
3249
3420
|
wrap.appendChild(line);
|
|
3250
|
-
// M8 am7 item 4: this try was handed the earlier runs' block - one line, a click opens the exact text (the learnings box's own fold classes); hidden when nothing was handed
|
|
3251
|
-
if(!human && t.hints && t.hints.text){
|
|
3252
|
-
var hk = "\u0000hints:" + stepKey + ":" + t.n;
|
|
3253
|
-
var hpart = foldEl("div", "audit-part", null, "audit-try-hints");
|
|
3254
|
-
var hhead = foldEl("button", "btn audit-part-toggle", "told from earlier runs \u00B7 " + t.hints.n + (t.hints.n === 1 ? " hint" : " hints"), "audit-try-hints-head");
|
|
3255
|
-
hhead.type = "button";
|
|
3256
|
-
var hbody = foldEl("div", "audit-part-body", null, "audit-try-hints-text");
|
|
3257
|
-
hbody.style.cssText = "white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0";
|
|
3258
|
-
hbody.textContent = t.hints.text;
|
|
3259
|
-
var paintHints = function(open){ hbody.hidden = !open; hhead.setAttribute("aria-expanded", open ? "true" : "false"); };
|
|
3260
|
-
paintHints(auditExpanded[hk] === true);
|
|
3261
|
-
hhead.addEventListener("click", function(ev){ ev.stopPropagation(); var open = hbody.hidden; auditExpanded[hk] = open; paintHints(open); });
|
|
3262
|
-
hpart.appendChild(hhead); hpart.appendChild(hbody);
|
|
3263
|
-
wrap.appendChild(hpart);
|
|
3264
|
-
}
|
|
3265
|
-
if(!human && t.checks && t.checks.length){
|
|
3266
|
-
var box = foldEl("div", "audit-checks", null, "audit-checks");
|
|
3267
|
-
t.checks.forEach(function(c){
|
|
3268
|
-
var row = foldEl("div", "audit-chk", null, "audit-check");
|
|
3269
|
-
row.appendChild(foldEl("span", "mark " + (c.ok ? "green" : "red"), c.ok ? "\u2713" : "\u2717"));
|
|
3270
|
-
row.appendChild(foldEl("span", null, "#" + c.n + " " + c.text + (c.result ? " (" + c.result + ")" : "")));
|
|
3271
|
-
row.appendChild(foldEl("span", "src", "\u00b7 from " + c.source));
|
|
3272
|
-
box.appendChild(row);
|
|
3273
|
-
});
|
|
3274
|
-
if(t.output){
|
|
3275
|
-
var sha = String(t.output.sha256);
|
|
3276
|
-
box.appendChild(foldEl("div", "audit-judged", "output judged: " + t.output.file + " \u00b7 " + foldSize(t.output.bytes) + " \u00b7 sha256 " + sha.slice(0, 4) + "\u2026" + sha.slice(-2), "audit-judged"));
|
|
3277
|
-
}
|
|
3278
|
-
wrap.appendChild(box);
|
|
3279
|
-
}
|
|
3280
3421
|
return wrap;
|
|
3281
3422
|
}
|
|
3282
3423
|
var ROUNDS_PAGE = 20;
|
|
@@ -3290,13 +3431,17 @@
|
|
|
3290
3431
|
}
|
|
3291
3432
|
// the Round table, 20 rows at a time (bareloop's "showing A\u2013B of N" + load more), table scrolling inside its own box
|
|
3292
3433
|
function foldRoundsEl(g){
|
|
3293
|
-
var rows = g.fold.rows || [];
|
|
3294
3434
|
var wrap = document.createElement("div");
|
|
3295
3435
|
wrap.appendChild(foldEl("div", "audit-fold-label", "rounds"));
|
|
3436
|
+
wrap.appendChild(foldRoundsTableEl(g.step, g.fold.rows || []));
|
|
3437
|
+
return wrap;
|
|
3438
|
+
}
|
|
3439
|
+
function foldRoundsTableEl(stepKey, rows){
|
|
3440
|
+
var wrap = document.createElement("div");
|
|
3296
3441
|
var scroll = foldEl("div", "audit-table-scroll");
|
|
3297
3442
|
var table = document.createElement("table");
|
|
3298
3443
|
table.className = "rounds-table";
|
|
3299
|
-
table.setAttribute("data-testid", "rounds-table-" +
|
|
3444
|
+
table.setAttribute("data-testid", "rounds-table-" + stepKey);
|
|
3300
3445
|
table.innerHTML = "<thead><tr><th>Round</th><th>Try</th><th>Action</th><th>Path</th><th>Decision</th><th>Time</th></tr></thead><tbody></tbody>";
|
|
3301
3446
|
var tbody = table.querySelector("tbody");
|
|
3302
3447
|
scroll.appendChild(table);
|
|
@@ -3320,12 +3465,279 @@
|
|
|
3320
3465
|
more();
|
|
3321
3466
|
return wrap;
|
|
3322
3467
|
}
|
|
3468
|
+
// The Audit check grid: one grid per model step (rows = the step's checks by their number, columns = tries), under it an "errors" area (one line per red try, plus any hints text opened), then the rounds folded per try. Every word comes from the server's `fold` (src/audit-fold.js: `tries`, `rows`); the page
|
|
3469
|
+
// types none of them. A check is the same row in every try by its NUMBER (#1 output exists, #2 done, #3 and up the close's checks, src/try-checks.js).
|
|
3470
|
+
// borrowed-from: bareloop src/panel/index.html@c79d396 (gridGlyph, gridPlural, gridCellOf, gridFailsOf, gridDefaultOpen, gridTableHtml, gridErrorsHtml, gridRoundsHtml, renderGridErrors, the
|
|
3471
|
+
// click wiring), adapted: fwdloop's try/check shape (`fold.tries[].checks`), its `.mark` glyph colours, the failing lines are the try's gap, rounds come from the fold's own rows.
|
|
3472
|
+
function gridGlyph(g){
|
|
3473
|
+
if(g === "\u2713") return '<span class="mark green">' + g + '</span>';
|
|
3474
|
+
if(g === "\u2717") return '<span class="mark red">' + g + '</span>';
|
|
3475
|
+
if(g === "?") return '<span class="glyph-q">' + g + '</span>';
|
|
3476
|
+
if(g === "\u00b7") return '<span class="glyph-nr">' + g + '</span>';
|
|
3477
|
+
return escapeXml(g);
|
|
3478
|
+
}
|
|
3479
|
+
function gridPlural(n, w){ return n + " " + w + (n === 1 ? "" : "s"); }
|
|
3480
|
+
// the try's gap as error lines: one per non-blank line, as the audit row holds it
|
|
3481
|
+
function gridGapLines(gap){
|
|
3482
|
+
return typeof gap === "string" ? gap.split("\n").filter(function(l){ return l.trim() !== ""; }) : [];
|
|
3483
|
+
}
|
|
3484
|
+
// a graded try (`fold.tries[i]`) as one grid column. The lines of its gap belong to its first failing check (all of the close's lines are one text; none is guessed per check).
|
|
3485
|
+
// `red` = that first failing check with the try's error lines (the errors list's one line per red try); null when no check failed.
|
|
3486
|
+
function gridTryOf(t){
|
|
3487
|
+
var out = {
|
|
3488
|
+
n: t.n, glyph: t.mark, hint: t.thinking || "", noVerdict: null, known: Array.isArray(t.checks) && t.checks.length > 0, inflight: t.mark === "·",
|
|
3489
|
+
cells: {}, order: [], output: t.output || null, hints: t.hints && t.hints.text ? t.hints : null, red: null
|
|
3490
|
+
};
|
|
3491
|
+
if(out.known){
|
|
3492
|
+
t.checks.forEach(function(c){
|
|
3493
|
+
var cell = { name: String(c.n), n: c.n, question: c.text, source: c.source, status: c.ok ? "pass" : "fail", number: c.ok && c.result ? c.result : null };
|
|
3494
|
+
if(!c.ok && !out.red){
|
|
3495
|
+
var lines = gridGapLines(t.gap);
|
|
3496
|
+
out.red = { lines: lines.length ? lines : [c.text] };
|
|
3497
|
+
}
|
|
3498
|
+
out.cells[cell.name] = cell;
|
|
3499
|
+
out.order.push(cell.name);
|
|
3500
|
+
});
|
|
3501
|
+
} else if(t.mark === "✗"){
|
|
3502
|
+
// red with no check record: no check ran, so no verdict; its own gap words stay
|
|
3503
|
+
out.glyph = "?";
|
|
3504
|
+
out.noVerdict = gridGapLines(t.gap)[0] || "no verdict";
|
|
3505
|
+
}
|
|
3506
|
+
return out;
|
|
3507
|
+
}
|
|
3508
|
+
// rows: checks #1 and #2 are ONE row `every step: exists, done` (`parts` = the two checks, for its fold); #3 and up are one row each, by number
|
|
3509
|
+
function gridModelOf(f){
|
|
3510
|
+
var tries = (f.tries || []).map(gridTryOf);
|
|
3511
|
+
var byN = {};
|
|
3512
|
+
tries.forEach(function(t){ t.order.forEach(function(nm){ if(!byN[nm]) byN[nm] = t.cells[nm]; }); });
|
|
3513
|
+
var rows = Object.keys(byN).filter(function(nm){ return byN[nm].n > 2; }).map(function(nm){ return { n: byN[nm].n, name: nm, question: byN[nm].question, source: byN[nm].source }; }).sort(function(a, b){ return a.n - b.n; });
|
|
3514
|
+
var parts = [byN["1"], byN["2"]].filter(Boolean);
|
|
3515
|
+
if(parts.length) rows.unshift({ n: 1, every: true, parts: parts });
|
|
3516
|
+
var rounds = {};
|
|
3517
|
+
(f.rows || []).forEach(function(r){ (rounds[r.try] = rounds[r.try] || []).push(r); });
|
|
3518
|
+
tries.forEach(function(t){
|
|
3519
|
+
t.rows = rounds[t.n] || [];
|
|
3520
|
+
t.calls = t.rows.filter(function(r){ return r.action === "model call"; }).length;
|
|
3521
|
+
});
|
|
3522
|
+
return { tries: tries, rows: rows };
|
|
3523
|
+
}
|
|
3524
|
+
// one cell: pass, fail, not run (the done check halted before the rest) or no verdict. The every-step row fails when either of its two checks failed.
|
|
3525
|
+
function gridCellOf(t, row){
|
|
3526
|
+
if(t.noVerdict) return { s: "unk" };
|
|
3527
|
+
if(row.every){
|
|
3528
|
+
var cs = ["1", "2"].map(function(nm){ return t.cells[nm]; }).filter(Boolean);
|
|
3529
|
+
if(cs.some(function(c){ return c.status === "fail"; })) return { s: "fail" };
|
|
3530
|
+
if(cs.length === 2) return { s: "pass", number: cs.map(function(c){ return c.number; }).filter(Boolean).join(" · ") };
|
|
3531
|
+
if(cs.length === 0 && !t.known) return { s: t.inflight ? "notrun" : "unk" };
|
|
3532
|
+
return { s: "notrun" };
|
|
3533
|
+
}
|
|
3534
|
+
var c = t.cells[row.name];
|
|
3535
|
+
if(c) return { s: c.status, number: c.number };
|
|
3536
|
+
if(!t.known) return { s: t.inflight ? "notrun" : "unk" };
|
|
3537
|
+
return { s: "notrun" };
|
|
3538
|
+
}
|
|
3539
|
+
// default on load: only the LAST red try's row is open; no hints are
|
|
3540
|
+
function gridDefaultOpen(model){
|
|
3541
|
+
var open = {};
|
|
3542
|
+
var last = null;
|
|
3543
|
+
model.tries.forEach(function(t){ if(t.red) last = t.n; });
|
|
3544
|
+
if(last !== null) open[last] = true;
|
|
3545
|
+
return open;
|
|
3546
|
+
}
|
|
3547
|
+
function gridHintsWord(h){ return h.n + (h.n === 1 ? " hint" : " hints"); }
|
|
3548
|
+
function gridTableHtml(pid, model){
|
|
3549
|
+
if(model.rows.length === 0) return "";
|
|
3550
|
+
var head = '<tr><th class="q">check</th>' + model.tries.map(function(t){
|
|
3551
|
+
return '<th class="t">try ' + t.n + " " + gridGlyph(t.glyph) + (t.hint ? '<span class="hint">' + escapeXml(t.hint) + "</span>" : "") + "</th>";
|
|
3552
|
+
}).join("") + "</tr>";
|
|
3553
|
+
var hrow = "";
|
|
3554
|
+
if(model.tries.some(function(t){ return !!t.hints; })){
|
|
3555
|
+
hrow = '<tr class="hint-row"><td class="q">told from earlier runs</td>' + model.tries.map(function(t){
|
|
3556
|
+
return '<td class="c">' + (t.hints ? '<button type="button" class="btn small hints" data-hint="' + t.n + '" aria-expanded="false" aria-controls="fxerr-' + pid + '" title="try ' + t.n + ' · told from earlier runs">' + gridHintsWord(t.hints) + "</button>" : '<span class="cell none">—</span>') + "</td>";
|
|
3557
|
+
}).join("") + "</tr>";
|
|
3558
|
+
}
|
|
3559
|
+
var sub = "";
|
|
3560
|
+
var body = model.rows.map(function(r){
|
|
3561
|
+
var tds = model.tries.map(function(t){
|
|
3562
|
+
var c = gridCellOf(t, r);
|
|
3563
|
+
if(c.s === "unk") return '<td class="c"><span class="cell unk" title="try ' + t.n + ': no verdict">' + gridGlyph("?") + "</span></td>";
|
|
3564
|
+
if(c.s === "notrun") return '<td class="c"><span class="cell notrun" title="not run (first-red-wins stopped the close)">' + gridGlyph("·") + "</span></td>";
|
|
3565
|
+
if(c.s === "pass") return '<td class="c"><span class="cell pass" title="passed' + (c.number ? ": " + escapeXml(c.number) : "") + '">' + gridGlyph("✓") + "</span></td>";
|
|
3566
|
+
return '<td class="c"><button type="button" class="cell fail" aria-expanded="false" aria-controls="fxerr-' + pid + '" data-fx="' + t.n + ":" + r.n + '" title="try ' + t.n + ", " + (r.every ? "every step" : "check #" + r.n) + ': failed - click to read its errors">' + gridGlyph("✗") + "</button></td>";
|
|
3567
|
+
}).join("");
|
|
3568
|
+
if(r.every){
|
|
3569
|
+
sub = '<tr class="step-sub" id="fxev-' + pid + '" hidden><td colspan="' + (model.tries.length + 1) + '">' + r.parts.map(function(p){
|
|
3570
|
+
return '<div class="sub-line"><span>' + p.n + " " + escapeXml(p.question) + '</span><span class="marks">' + model.tries.map(function(t){
|
|
3571
|
+
var pc = t.noVerdict ? { s: "unk" } : t.cells[String(p.n)] ? { s: t.cells[String(p.n)].status } : { s: t.known ? "notrun" : "unk" };
|
|
3572
|
+
return gridGlyph(pc.s === "pass" ? "✓" : pc.s === "fail" ? "✗" : pc.s === "notrun" ? "·" : "?");
|
|
3573
|
+
}).join("") + "</span></div>";
|
|
3574
|
+
}).join("") + "</td></tr>";
|
|
3575
|
+
return '<tr><td class="q"><button type="button" class="q-fold" data-every aria-expanded="false" aria-controls="fxev-' + pid + '">every step: exists, done</button></td>' + tds + "</tr>" + sub;
|
|
3576
|
+
}
|
|
3577
|
+
return '<tr><td class="q"' + (r.source ? ' title="' + escapeXml(r.source) + '"' : "") + ">" + r.n + " " + escapeXml(r.question) + "</td>" + tds + "</tr>";
|
|
3578
|
+
}).join("");
|
|
3579
|
+
return '<div class="grid-wrap audit-table-scroll"><table class="grid fgrid" data-testid="audit-grid-table"><thead>' + head + "</thead><tbody>" + hrow + body + "</tbody></table></div>";
|
|
3580
|
+
}
|
|
3581
|
+
// up to 8 lines of a text, then a button for the rest; `key` names the button's data attribute
|
|
3582
|
+
var GRID_CAP = 8;
|
|
3583
|
+
function gridLinesHtml(lines, more, attr, key){
|
|
3584
|
+
var shown = more ? lines : lines.slice(0, GRID_CAP);
|
|
3585
|
+
return '<div class="fx-lines">' + shown.map(function(l){ return /^\s/.test(l) ? '<div class="ind">' + escapeXml(l.replace(/^\s+/, "")) + "</div>" : "<div>" + escapeXml(l) + "</div>"; }).join("") + "</div>" +
|
|
3586
|
+
(lines.length > GRID_CAP ? '<button type="button" class="fx-more" ' + attr + '="' + key + '">' + (more ? "show first " + GRID_CAP + " only" : "+" + (lines.length - GRID_CAP) + " more lines") + "</button>" : "");
|
|
3587
|
+
}
|
|
3588
|
+
// the exact hints text a try was handed, one div per line (trailing blank lines dropped)
|
|
3589
|
+
function gridHintLines(h){
|
|
3590
|
+
var lines = String(h.text).split("\n");
|
|
3591
|
+
while(lines.length && lines[lines.length - 1].trim() === "") lines.pop();
|
|
3592
|
+
return lines;
|
|
3593
|
+
}
|
|
3594
|
+
// the errors area: the hints texts opened by their buttons, then one line per red try (`try N ✗ <first error line>`).
|
|
3595
|
+
// `st` = {open: {tryN: true}, more: {tryN: true}, hint: {tryN: true}, hmore: {tryN: true}}
|
|
3596
|
+
function gridErrorsHtml(pid, model, st){
|
|
3597
|
+
var hrows = model.tries.filter(function(t){ return t.hints && st.hint[t.n]; }).map(function(t){
|
|
3598
|
+
return '<div class="fx-row hintrow open"><button type="button" class="fx-rowhead" id="fxhint-' + pid + "-" + t.n + '" data-hrow="' + t.n + '" aria-expanded="true"><span class="fx-caret">▾</span><span class="fx-try">try ' + t.n + " · told from earlier runs · " + gridHintsWord(t.hints) + '</span></button><div class="fx-body">' +
|
|
3599
|
+
gridLinesHtml(gridHintLines(t.hints), !!st.hmore[t.n], "data-hmore", t.n) + "</div></div>";
|
|
3600
|
+
}).join("");
|
|
3601
|
+
var rows = model.tries.map(function(t){
|
|
3602
|
+
if(t.noVerdict){
|
|
3603
|
+
return '<div class="fx-row fx-row-q"><span class="fx-rowhead"><span class="fx-caret"></span><span class="fx-try">try ' + t.n + '</span><span class="fx-chk">' + gridGlyph("?") + '</span><span class="fx-first fx-faint" title="' + escapeXml(t.noVerdict) + '">' + escapeXml(t.noVerdict) + "</span></span></div>";
|
|
3604
|
+
}
|
|
3605
|
+
if(!t.red) return "";
|
|
3606
|
+
var lines = t.red.lines;
|
|
3607
|
+
var rest = lines.length - 1;
|
|
3608
|
+
var open = !!st.open[t.n];
|
|
3609
|
+
var head = '<button type="button" class="fx-rowhead" id="fxrow-' + pid + "-" + t.n + '" data-fxrow="' + t.n + '" aria-expanded="' + (open ? "true" : "false") + '"><span class="fx-caret">' + (open ? "▾" : "▸") +
|
|
3610
|
+
'</span><span class="fx-try">try ' + t.n + '</span><span class="fx-chk">' + gridGlyph("✗") +
|
|
3611
|
+
'</span><span class="fx-first" title="' + escapeXml(lines[0]) + '">' + escapeXml(lines[0]) + "</span>" + (rest ? '<span class="fx-count">(+' + rest + " more)</span>" : "") + "</button>";
|
|
3612
|
+
// fwdloop's close reports ONE text for the try (its gap), not one per check: it is shown once, however many checks failed
|
|
3613
|
+
var body = open ? '<div class="fx-body">' + gridLinesHtml(lines, !!st.more[t.n], "data-fxmore", t.n) + "</div>" : "";
|
|
3614
|
+
return '<div class="fx-row' + (open ? " open" : "") + '">' + head + body + "</div>";
|
|
3615
|
+
}).join("");
|
|
3616
|
+
return hrows + rows ? '<div class="fx-label">errors</div>' + hrows + rows : "";
|
|
3617
|
+
}
|
|
3618
|
+
// the rounds, folded per try: each fold builds its own try's rows (20 a page) the first time it opens
|
|
3619
|
+
function gridRoundsHtml(model){
|
|
3620
|
+
return '<div class="audit-fold-label">rounds per try</div><div class="fold-list">' + model.tries.map(function(t){
|
|
3621
|
+
var line = '<div class="audit-try">try ' + t.n + " " + gridGlyph(t.glyph) + "</div>";
|
|
3622
|
+
if(t.rows.length === 0) return line + '<div class="hint">no rounds recorded</div>';
|
|
3623
|
+
return line + '<details class="rounds-fold" data-fxrounds="' + t.n + '"><summary>try ' + t.n + " rounds (" + gridPlural(t.calls, "call") + ")" +
|
|
3624
|
+
'</summary><div class="rf-body"></div></details>';
|
|
3625
|
+
}).join("") + "</div>";
|
|
3626
|
+
}
|
|
3627
|
+
// the file a try's checks read (its own `output judged` words): shown once, for the last try that has one; an `all tries` fold lists every try's
|
|
3628
|
+
function gridJudgedLine(t){
|
|
3629
|
+
var sha = String(t.output.sha256);
|
|
3630
|
+
return '<div class="hint fx-judged audit-judged" data-testid="audit-judged">try ' + t.n + " · output judged: " + escapeXml(t.output.file) + " · " + foldSize(t.output.bytes) + " · sha256 " + escapeXml(sha.slice(0, 4)) + "…" + escapeXml(sha.slice(-2)) + "</div>";
|
|
3631
|
+
}
|
|
3632
|
+
function gridJudgedHtml(model){
|
|
3633
|
+
var withOut = model.tries.filter(function(t){ return !!t.output; });
|
|
3634
|
+
if(withOut.length === 0) return "";
|
|
3635
|
+
var html = gridJudgedLine(withOut[withOut.length - 1]);
|
|
3636
|
+
if(withOut.length > 1) html += '<details class="rounds-fold" style="margin-left:0" data-testid="judged-all"><summary>all tries</summary><div class="rf-body">' + withOut.map(gridJudgedLine).join("") + "</div></details>";
|
|
3637
|
+
return html;
|
|
3638
|
+
}
|
|
3639
|
+
function renderGridErrors(wrap, pid, model, st){
|
|
3640
|
+
var host = wrap.querySelector(".fx-errors");
|
|
3641
|
+
var html = gridErrorsHtml(pid, model, st);
|
|
3642
|
+
host.hidden = html === "";
|
|
3643
|
+
host.innerHTML = html;
|
|
3644
|
+
Array.prototype.forEach.call(wrap.querySelectorAll("[data-fx]"), function(b){
|
|
3645
|
+
b.setAttribute("aria-expanded", st.open[b.getAttribute("data-fx").split(":")[0]] ? "true" : "false");
|
|
3646
|
+
});
|
|
3647
|
+
Array.prototype.forEach.call(wrap.querySelectorAll("[data-hint]"), function(b){
|
|
3648
|
+
b.setAttribute("aria-expanded", st.hint[b.getAttribute("data-hint")] ? "true" : "false");
|
|
3649
|
+
});
|
|
3650
|
+
}
|
|
3651
|
+
// a model step's body below its tally: the grid (hints row, every-step row, the close's checks), the errors area, the judged line, then the rounds folds
|
|
3652
|
+
function buildGridEl(g){
|
|
3653
|
+
var pid = String(g.step).replace(/[^A-Za-z0-9_-]/g, "_");
|
|
3654
|
+
var model = gridModelOf(g.fold);
|
|
3655
|
+
var st = { open: gridDefaultOpen(model), more: {}, hint: {}, hmore: {} };
|
|
3656
|
+
var wrap = document.createElement("div");
|
|
3657
|
+
wrap.setAttribute("data-fxpart", pid);
|
|
3658
|
+
wrap.setAttribute("data-testid", "audit-grid-" + g.step);
|
|
3659
|
+
wrap.innerHTML = gridTableHtml(pid, model) + '<div class="fx-errors" id="fxerr-' + pid + '" hidden></div>' + gridJudgedHtml(model);
|
|
3660
|
+
wrap.insertAdjacentHTML("beforeend", gridRoundsHtml(model));
|
|
3661
|
+
renderGridErrors(wrap, pid, model, st);
|
|
3662
|
+
var toggle = function(tn, force, focusRow){
|
|
3663
|
+
st.open[tn] = force === undefined ? !st.open[tn] : force;
|
|
3664
|
+
renderGridErrors(wrap, pid, model, st);
|
|
3665
|
+
var el = document.getElementById("fxrow-" + pid + "-" + tn);
|
|
3666
|
+
if(el && focusRow){ el.scrollIntoView({ block: "nearest" }); el.focus(); } else if(el){ el.focus(); }
|
|
3667
|
+
};
|
|
3668
|
+
wrap.addEventListener("click", function(e){
|
|
3669
|
+
var hmore = e.target.closest("[data-hmore]");
|
|
3670
|
+
if(hmore){
|
|
3671
|
+
var hk = hmore.getAttribute("data-hmore");
|
|
3672
|
+
st.hmore[hk] = !st.hmore[hk];
|
|
3673
|
+
renderGridErrors(wrap, pid, model, st);
|
|
3674
|
+
var hagain = wrap.querySelector('[data-hmore="' + hk + '"]');
|
|
3675
|
+
if(hagain) hagain.focus();
|
|
3676
|
+
return;
|
|
3677
|
+
}
|
|
3678
|
+
var hrow = e.target.closest("[data-hrow]");
|
|
3679
|
+
if(hrow){
|
|
3680
|
+
var hn = hrow.getAttribute("data-hrow");
|
|
3681
|
+
st.hint[hn] = false;
|
|
3682
|
+
renderGridErrors(wrap, pid, model, st);
|
|
3683
|
+
var hb = wrap.querySelector('[data-hint="' + hn + '"]');
|
|
3684
|
+
if(hb) hb.focus();
|
|
3685
|
+
return;
|
|
3686
|
+
}
|
|
3687
|
+
var hint = e.target.closest("[data-hint]");
|
|
3688
|
+
if(hint){
|
|
3689
|
+
var tn2 = hint.getAttribute("data-hint");
|
|
3690
|
+
st.hint[tn2] = !st.hint[tn2];
|
|
3691
|
+
renderGridErrors(wrap, pid, model, st);
|
|
3692
|
+
var he = document.getElementById("fxhint-" + pid + "-" + tn2);
|
|
3693
|
+
if(he) he.scrollIntoView({ block: "nearest" });
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3696
|
+
var more = e.target.closest("[data-fxmore]");
|
|
3697
|
+
if(more){
|
|
3698
|
+
var key = more.getAttribute("data-fxmore");
|
|
3699
|
+
st.more[key] = !st.more[key];
|
|
3700
|
+
renderGridErrors(wrap, pid, model, st);
|
|
3701
|
+
var again = wrap.querySelector('[data-fxmore="' + key + '"]');
|
|
3702
|
+
if(again) again.focus();
|
|
3703
|
+
return;
|
|
3704
|
+
}
|
|
3705
|
+
var ev = e.target.closest("[data-every]");
|
|
3706
|
+
if(ev){
|
|
3707
|
+
var sub = document.getElementById("fxev-" + pid);
|
|
3708
|
+
sub.hidden = !sub.hidden;
|
|
3709
|
+
ev.setAttribute("aria-expanded", sub.hidden ? "false" : "true");
|
|
3710
|
+
return;
|
|
3711
|
+
}
|
|
3712
|
+
var row = e.target.closest("[data-fxrow]");
|
|
3713
|
+
if(row){ toggle(parseInt(row.getAttribute("data-fxrow"), 10), undefined, false); return; }
|
|
3714
|
+
var cell = e.target.closest("[data-fx]");
|
|
3715
|
+
if(cell){
|
|
3716
|
+
var tn = parseInt(cell.getAttribute("data-fx").split(":")[0], 10);
|
|
3717
|
+
toggle(tn, st.open[tn] ? false : true, true);
|
|
3718
|
+
}
|
|
3719
|
+
});
|
|
3720
|
+
Array.prototype.forEach.call(wrap.querySelectorAll("details[data-fxrounds]"), function(d){
|
|
3721
|
+
var t = model.tries.filter(function(x){ return x.n === parseInt(d.getAttribute("data-fxrounds"), 10); })[0];
|
|
3722
|
+
var built = false;
|
|
3723
|
+
d.addEventListener("toggle", function(){
|
|
3724
|
+
if(!d.open || built) return;
|
|
3725
|
+
built = true;
|
|
3726
|
+
d.querySelector(".rf-body").appendChild(foldRoundsTableEl(g.step + "-try-" + t.n, t.rows));
|
|
3727
|
+
});
|
|
3728
|
+
});
|
|
3729
|
+
return wrap;
|
|
3730
|
+
}
|
|
3323
3731
|
function buildFoldBodyEl(g){
|
|
3324
3732
|
var f = g.fold, human = f.who === "human";
|
|
3325
3733
|
var body = foldEl("div", "audit-fold-body", null, "audit-fold-body-" + g.step);
|
|
3326
3734
|
if(f.tally) body.appendChild(foldEl("div", "audit-tally", f.tally, "audit-tally"));
|
|
3327
|
-
(
|
|
3328
|
-
|
|
3735
|
+
if(human){
|
|
3736
|
+
(f.tries || []).forEach(function(t){ body.appendChild(foldTryEl(t)); });
|
|
3737
|
+
body.appendChild(foldRoundsEl(g));
|
|
3738
|
+
} else {
|
|
3739
|
+
body.appendChild(buildGridEl(g));
|
|
3740
|
+
}
|
|
3329
3741
|
return body;
|
|
3330
3742
|
}
|
|
3331
3743
|
var auditExpanded = {}; // step -> true/false once a human toggled it; reset when the run changes
|
|
@@ -3815,6 +4227,13 @@
|
|
|
3815
4227
|
document.getElementById("update-bar").hidden = text === null;
|
|
3816
4228
|
if(text !== null) document.getElementById("update-text").textContent = text;
|
|
3817
4229
|
}
|
|
4230
|
+
// M4d am35: the Inbox poll (every LISTS_POLL_MS) is the panel's heartbeat. A reply of any kind (even an HTTP error) means node answered = online; only a
|
|
4231
|
+
// failed read with no HTTP status (the network, a dead panel) = offline. ONE painter writes the dot; the served page starts online.
|
|
4232
|
+
function paintOnline(isOnline){
|
|
4233
|
+
var el = document.getElementById("online-dot");
|
|
4234
|
+
el.className = isOnline ? "on" : "off";
|
|
4235
|
+
el.textContent = isOnline ? "\u25CF online" : "\u25CF offline";
|
|
4236
|
+
}
|
|
3818
4237
|
document.getElementById("update-reload").addEventListener("click", function(){ location.reload(); });
|
|
3819
4238
|
function tickLeft(){
|
|
3820
4239
|
document.querySelectorAll(".live-left").forEach(function(el){ el._say(Math.max(0, el._endsAt - Date.now())); });
|
|
@@ -3915,7 +4334,8 @@
|
|
|
3915
4334
|
// Immediate (every user action that re-reads calls this); the tick uses `listsDue` to throttle.
|
|
3916
4335
|
function reloadLists(){
|
|
3917
4336
|
lastListsAt = Date.now();
|
|
3918
|
-
getJSON("/api/inbox").then(function(r){ renderInbox(r.rows || [], r.openCount); paintUpdateBar(r.version); })
|
|
4337
|
+
getJSON("/api/inbox").then(function(r){ renderInbox(r.rows || [], r.openCount); paintUpdateBar(r.version); })
|
|
4338
|
+
.then(function(){ paintOnline(true); }, function(err){ paintOnline(!!(err && typeof err.status === "number")); }).catch(function(){});
|
|
3919
4339
|
getJSON("/api/runs").then(function(r){
|
|
3920
4340
|
var next = sig(r);
|
|
3921
4341
|
if(next !== null && next === lastSig.runs) return;
|
|
@@ -4822,6 +5242,7 @@
|
|
|
4822
5242
|
var destEl = document.getElementById("jf-dest-folder");
|
|
4823
5243
|
var askWaitEl = document.getElementById("jf-ask-wait");
|
|
4824
5244
|
var mainBtn = document.getElementById("chat-main-btn");
|
|
5245
|
+
var signTicketEl = document.getElementById("chat-sign-ticket"); // M12 p3: the ticket # box of a green ticket job
|
|
4825
5246
|
var mainHint = document.getElementById("chat-main-hint");
|
|
4826
5247
|
var startOverBtn = document.getElementById("chat-startover-btn");
|
|
4827
5248
|
var reviseBtn = document.getElementById("chat-revise-btn");
|
|
@@ -5202,6 +5623,13 @@
|
|
|
5202
5623
|
var pathEl = makeInput("jf-path", "/full/path/to/file", sources ? sources[role] : "");
|
|
5203
5624
|
if(f && f.pages && f.pages[role]){ pathEl.value = f.pages[role]; pathEl.readOnly = true; pathEl.setAttribute("data-page", "1"); pathEl.title = "A web page: its address is signed with the job and can't be changed here."; } // M10 am3
|
|
5204
5625
|
row.appendChild(pathEl);
|
|
5626
|
+
// M12 piece 3 (hamr 2026-10-29): a ticket-list input takes ONE ticket per hand run, picked by number; Run stays off until it is filled
|
|
5627
|
+
if(f && f.tickets && f.tickets.indexOf(role) !== -1){
|
|
5628
|
+
var tk = makeInput("jf-ticket", "ticket #", "");
|
|
5629
|
+
tk.inputMode = "numeric"; tk.setAttribute("data-testid", "jf-run-ticket"); tk.setAttribute("aria-label", "Ticket number to run");
|
|
5630
|
+
tk.addEventListener("input", function(){ clearFieldErrors(); refreshStartEnabled(); });
|
|
5631
|
+
row.appendChild(tk);
|
|
5632
|
+
}
|
|
5205
5633
|
row.appendChild(makeErr());
|
|
5206
5634
|
runInputsEl.appendChild(row);
|
|
5207
5635
|
});
|
|
@@ -5233,8 +5661,14 @@
|
|
|
5233
5661
|
runWaitsEl.querySelectorAll("input.jf-wait").forEach(function(el){ waits[el.getAttribute("data-line")] = el.value.trim(); });
|
|
5234
5662
|
return waits;
|
|
5235
5663
|
}
|
|
5664
|
+
// M12 piece 3: the ticket number box of a ticket-list input; one function reads it, "" = none given (and no box = null)
|
|
5665
|
+
function ticketBoxValue(){
|
|
5666
|
+
var el = runInputsEl.querySelector(".jf-ticket");
|
|
5667
|
+
return el ? el.value.trim() : null;
|
|
5668
|
+
}
|
|
5236
5669
|
function currentRun(){
|
|
5237
5670
|
return {
|
|
5671
|
+
...(ticketBoxValue() === null ? {} : { ticket: ticketBoxValue() }),
|
|
5238
5672
|
flow: pickedFlow || "", inputs: readRows(runInputsEl), runId: (byId("jf-run-id").value.trim() === autoRunId ? "" : byId("jf-run-id").value.trim()),
|
|
5239
5673
|
destination: runDestEl.value.trim(), capUsd: runCapEl.value.trim(), askWaits: runWaits(),
|
|
5240
5674
|
// a flow with no recorded model runs with the pick (am7b); a flow with one sends none
|
|
@@ -5268,7 +5702,7 @@
|
|
|
5268
5702
|
function startReady(){
|
|
5269
5703
|
if(moneyRed) return false; // amendment 4 item 1: a cap that does not fit this month stops you before the click (the server still refuses)
|
|
5270
5704
|
if(mode === "run"){
|
|
5271
|
-
return !!selectedFlow() && readRows(runInputsEl).every(function(r){ return r.path !== ""; }) && capValid(runCapEl.value.trim()) && (reuseKind !== "draft" || reuseRunOf || newNameEl.value.trim() !== "");
|
|
5705
|
+
return !!selectedFlow() && readRows(runInputsEl).every(function(r){ return r.path !== ""; }) && (ticketBoxValue() === null || /^[1-9][0-9]{0,8}$/.test(ticketBoxValue())) && capValid(runCapEl.value.trim()) && (reuseKind !== "draft" || reuseRunOf || newNameEl.value.trim() !== "");
|
|
5272
5706
|
}
|
|
5273
5707
|
if(mode === "resume"){
|
|
5274
5708
|
return !!resumeCtx && capValid(resumeCapEl.value.trim());
|
|
@@ -5530,7 +5964,10 @@
|
|
|
5530
5964
|
var whenConfirmText = ""; // the words the button shows after click 1 ("every day at 13:15", "cancel schedule"); read only while whenHash is set
|
|
5531
5965
|
var whenLocked = false; // ~1.5 s after a successful sign the main button is disabled, so a fast extra click cannot start a run
|
|
5532
5966
|
var whenReady = false; // the lock sync can run before this block has
|
|
5533
|
-
function whenCanon(t){
|
|
5967
|
+
function whenCanon(t){
|
|
5968
|
+
if(t !== null && t.kind === "new-ticket") t = {kind: t.kind, role: t.role}; // M12: the list, server and tool are filled by the server from the signed job
|
|
5969
|
+
return t === null ? "null" : JSON.stringify(Object.keys(t).sort().map(function(k){ return [k, t[k]]; }));
|
|
5970
|
+
}
|
|
5534
5971
|
function whenTriggerFromBoxes(){
|
|
5535
5972
|
var kind = byId("jf-when").value;
|
|
5536
5973
|
if(kind === "hand") return null;
|
|
@@ -5540,6 +5977,7 @@
|
|
|
5540
5977
|
if(kind === "weekly") o.day = byId("jf-when-day").value;
|
|
5541
5978
|
return o;
|
|
5542
5979
|
}
|
|
5980
|
+
if(kind === "new-ticket") return {kind: kind, role: byId("jf-when-role").value}; // M12: the person picks the input; the server fills the rest
|
|
5543
5981
|
var q = {kind: kind, role: byId("jf-when-role").value};
|
|
5544
5982
|
q[kind === "new-file" ? "folder" : "path"] = byId("jf-when-path").value.trim();
|
|
5545
5983
|
return q;
|
|
@@ -5548,7 +5986,8 @@
|
|
|
5548
5986
|
var kind = byId("jf-when").value;
|
|
5549
5987
|
byId("jf-when-clock").hidden = !(kind === "daily" || kind === "weekdays" || kind === "weekly");
|
|
5550
5988
|
byId("jf-when-day").hidden = kind !== "weekly";
|
|
5551
|
-
byId("jf-when-filebox").hidden = !(kind === "file-updated" || kind === "new-file");
|
|
5989
|
+
byId("jf-when-filebox").hidden = !(kind === "file-updated" || kind === "new-file" || kind === "new-ticket");
|
|
5990
|
+
byId("jf-when-path").hidden = kind === "new-ticket";
|
|
5552
5991
|
byId("jf-when-path").placeholder = kind === "new-file" ? "/full/path/to/folder" : "/full/path/to/file";
|
|
5553
5992
|
}
|
|
5554
5993
|
// M9 am4: is When changed from the signed value? The ONE reader; the main button turns into Sign schedule while it is.
|
|
@@ -5562,6 +6001,17 @@
|
|
|
5562
6001
|
if(!whenReady) return;
|
|
5563
6002
|
renderMain();
|
|
5564
6003
|
}
|
|
6004
|
+
// M10: a file trigger watches a FILE; a web-page input is never offered. M12: a ticket trigger offers the page inputs that are a GitHub issues list.
|
|
6005
|
+
var TICKET_LIST = /^https:\/\/github\.com\/[^\/\s]+\/[^\/\s]+\/issues\/?$/;
|
|
6006
|
+
function whenFileRoles(f){ return ((f && f.roles) || []).filter(function(r){ return !(f.pages && f.pages[r]); }); }
|
|
6007
|
+
function whenTicketRoles(f){ return ((f && f.roles) || []).filter(function(r){ return f.pages && f.pages[r] && TICKET_LIST.test(String(f.pages[r]).trim()); }); }
|
|
6008
|
+
function whenFillRoles(){
|
|
6009
|
+
var f = selectedFlow(), roleSel = byId("jf-when-role"), keep = roleSel.value;
|
|
6010
|
+
var roles = byId("jf-when").value === "new-ticket" ? whenTicketRoles(f) : whenFileRoles(f);
|
|
6011
|
+
roleSel.innerHTML = "";
|
|
6012
|
+
roles.forEach(function(r){ var o = document.createElement("option"); o.value = r; o.textContent = r; roleSel.appendChild(o); });
|
|
6013
|
+
if(roles.indexOf(keep) >= 0) roleSel.value = keep;
|
|
6014
|
+
}
|
|
5565
6015
|
function paintWhen(){
|
|
5566
6016
|
var f = selectedFlow();
|
|
5567
6017
|
var c = f ? f.trigger : null;
|
|
@@ -5569,14 +6019,13 @@
|
|
|
5569
6019
|
whenHash = null; whenBusy = false;
|
|
5570
6020
|
byId("jf-err-when").textContent = "";
|
|
5571
6021
|
var roleSel = byId("jf-when-role");
|
|
5572
|
-
|
|
5573
|
-
// M10: a file trigger watches a FILE; a web-page input is never offered (a job with only page inputs gets the clock options only)
|
|
5574
|
-
var fileRoles = ((f && f.roles) || []).filter(function(r){ return !(f.pages && f.pages[r]); });
|
|
5575
|
-
fileRoles.forEach(function(r){ var o = document.createElement("option"); o.value = r; o.textContent = r; roleSel.appendChild(o); });
|
|
6022
|
+
var fileRoles = whenFileRoles(f), ticketRoles = whenTicketRoles(f);
|
|
5576
6023
|
["file-updated", "new-file"].forEach(function(k){ var o = byId("jf-when").querySelector('option[value="' + k + '"]'); o.hidden = o.disabled = fileRoles.length === 0; });
|
|
6024
|
+
var tk = byId("jf-when").querySelector('option[value="new-ticket"]'); tk.hidden = tk.disabled = ticketRoles.length === 0; // M12: only a job with a ticket-list input offers it
|
|
5577
6025
|
var t = c ? c.trigger : null;
|
|
5578
6026
|
sel.querySelector('option[value="hand"]').textContent = t ? "Cancel schedule" : "By hand"; // M9 am5: on a scheduled job, By hand reads Cancel schedule
|
|
5579
6027
|
sel.value = t ? t.kind : "hand";
|
|
6028
|
+
whenFillRoles();
|
|
5580
6029
|
if(t && t.hour !== undefined){ byId("jf-when-time").value = ("0" + t.hour).slice(-2) + ":" + ("0" + t.minute).slice(-2); }
|
|
5581
6030
|
if(t && t.day) byId("jf-when-day").value = t.day;
|
|
5582
6031
|
if(t && t.role) roleSel.value = t.role;
|
|
@@ -5587,7 +6036,7 @@
|
|
|
5587
6036
|
byId("jf-when-now").textContent = !c ? "" : (c.refusal ? c.refusal : (c.words ? "Now: " + c.words : ""));
|
|
5588
6037
|
whenShowSubs(); whenSyncButton();
|
|
5589
6038
|
}
|
|
5590
|
-
function whenEdited(){ whenHash = null; byId("jf-err-when").textContent = ""; whenShowSubs(); whenSyncButton(); }
|
|
6039
|
+
function whenEdited(){ whenHash = null; byId("jf-err-when").textContent = ""; if(this && this.id === "jf-when") whenFillRoles(); whenShowSubs(); whenSyncButton(); }
|
|
5591
6040
|
["jf-when", "jf-when-day", "jf-when-time", "jf-when-role"].forEach(function(id){ document.getElementById(id).addEventListener("change", whenEdited); });
|
|
5592
6041
|
document.getElementById("jf-when-path").addEventListener("input", whenEdited);
|
|
5593
6042
|
function doWhenSign(){
|
|
@@ -5884,8 +6333,12 @@
|
|
|
5884
6333
|
st.capUsd = lastState.card.capUsd;
|
|
5885
6334
|
}
|
|
5886
6335
|
var b = mainButtonFor(st);
|
|
6336
|
+
// M12 piece 3: the ticket # box shows on a green plan whose job reads a ticket list; Sign & run stays off until it holds a whole number from 1
|
|
6337
|
+
var needTicket = mode === "new" && sessionLive && !!lastState && lastState.phase === "green" && !!lastState.ticketRole;
|
|
6338
|
+
signTicketEl.hidden = !needTicket;
|
|
6339
|
+
if(!needTicket) signTicketEl.value = "";
|
|
5887
6340
|
mainBtn.textContent = b.text;
|
|
5888
|
-
mainBtn.disabled = b.disabled;
|
|
6341
|
+
mainBtn.disabled = b.disabled || (needTicket && (b.action === "sign-prepare" || b.action === "sign") && !/^[1-9][0-9]{0,8}$/.test(signTicketEl.value.trim()));
|
|
5889
6342
|
mainAction = b.action; mainStartOver = !!b.startOver;
|
|
5890
6343
|
// amendment 14 item 3: the count shows while a draft has revises to count; at 0 the way on is Start over
|
|
5891
6344
|
mainHint.textContent = (mode === "new" && sessionLive && st.revisable && st.phase !== "signed" && st.phase !== "questions-open") ? (st.left > 0 ? revisesLeftText(st.left) : "No revises left: Start over keeps the fields and gives 2 new ones.") : "";
|
|
@@ -6193,7 +6646,7 @@
|
|
|
6193
6646
|
// click 2: the ONLY call that signs. It carries the hash this page showed; the server signs only if it is still the draft's hash on disk.
|
|
6194
6647
|
busy = true;
|
|
6195
6648
|
refreshStartEnabled();
|
|
6196
|
-
authorPost("/api/author/" + id + "/sign", {hash: signInfo.hash}).then(function(r){
|
|
6649
|
+
authorPost("/api/author/" + id + "/sign", signTicketEl.hidden ? {hash: signInfo.hash} : {hash: signInfo.hash, ticket: signTicketEl.value.trim()}).then(function(r){
|
|
6197
6650
|
var o = chatPostOutcome(r);
|
|
6198
6651
|
if(!o.ok){
|
|
6199
6652
|
busy = false;
|
|
@@ -6288,6 +6741,7 @@
|
|
|
6288
6741
|
startOverBtn.addEventListener("click", function(){ if(!startOverBtn.disabled) doDraft(sessionId); });
|
|
6289
6742
|
qSend.addEventListener("click", doAnswer);
|
|
6290
6743
|
qAnswer.addEventListener("keydown", function(e){ if(e.key === "Enter" && !e.shiftKey){ e.preventDefault(); doAnswer(); } });
|
|
6744
|
+
signTicketEl.addEventListener("input", function(){ renderMain(); }); // M12 p3
|
|
6291
6745
|
mainBtn.addEventListener("click", function(){
|
|
6292
6746
|
if(mainBtn.disabled) return;
|
|
6293
6747
|
if(mainAction === "draft") doDraft(mainStartOver ? sessionId : null);
|
|
@@ -6408,7 +6862,8 @@
|
|
|
6408
6862
|
// M4d Providers layout F. One parent block per key (.pv-key): its key band (name, API shape select, Base URL box, the legacy tick, tokens,
|
|
6409
6863
|
// the Refresh button), a folded summary, and its model lines as child rows (.pv-mrow). The key row owns shape, Base URL and the legacy
|
|
6410
6864
|
// tick, so a model line can never drift from them. Shape and Base URL are always editable; a change of either saves both (judged together).
|
|
6411
|
-
|
|
6865
|
+
// slot -> true (unfolded) / false (folded): set once, on first paint (every key starts folded; borrowed-from: bareloop src/panel/index.html@357a482), then only the person changes it
|
|
6866
|
+
var folds = {};
|
|
6412
6867
|
var typedOpen = {}; // slot -> true while "+ type a model name" is open
|
|
6413
6868
|
function buildProviderRow(row){
|
|
6414
6869
|
var key = document.createElement("div");
|
|
@@ -6443,6 +6898,7 @@
|
|
|
6443
6898
|
function buildModelLine(slot, m){
|
|
6444
6899
|
var d = document.createElement("div");
|
|
6445
6900
|
d.className = "pv-mrow";
|
|
6901
|
+
d.tabIndex = -1;
|
|
6446
6902
|
d.setAttribute("data-model", m.model);
|
|
6447
6903
|
d.setAttribute("data-testid", "model-line");
|
|
6448
6904
|
d.innerHTML =
|
|
@@ -6554,7 +7010,7 @@
|
|
|
6554
7010
|
data.rows.forEach(function(row){
|
|
6555
7011
|
var key = pvRows.querySelector('.pv-key[data-slot="' + row.slot + '"]');
|
|
6556
7012
|
if(!key){ key = buildProviderRow(row); pvRows.appendChild(key); }
|
|
6557
|
-
if(folds[row.slot] === undefined) folds[row.slot] =
|
|
7013
|
+
if(folds[row.slot] === undefined) folds[row.slot] = false;
|
|
6558
7014
|
key.setAttribute("data-open", folds[row.slot] ? "1" : "0");
|
|
6559
7015
|
var fold = key.querySelector("[data-act=fold]");
|
|
6560
7016
|
fold.textContent = folds[row.slot] ? "▾" : "▸";
|