-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestbed-console.html
More file actions
3900 lines (3610 loc) · 195 KB
/
Copy pathtestbed-console.html
File metadata and controls
3900 lines (3610 loc) · 195 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CVMFS Testbed Console</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.umd.min.js"></script>
<link rel="stylesheet" href="cvmfs-elements/css/console.css">
</head>
<body>
<!-- Header -->
<div id="header">
<div>
<div class="logo" id="hdr-logo-name">CVMFS <span>Testbed</span></div>
<div class="subtitle" id="hdr-sub">Initialising…</div>
</div>
<div id="env-badge"></div>
<div class="spacer"></div>
<span id="mode-badge">direct</span>
<span class="dot" id="dot-main"></span>
<span style="font-size:11px;color:#8b949e" id="hdr-ts"></span>
<span id="hdr-refresh-in"></span>
<button id="hdr-refresh" onclick="refreshAll()">↻ Refresh</button>
</div>
<!-- Layout -->
<div id="layout">
<!-- Sidebar -->
<div id="sidebar">
<div class="nav-section">Monitor</div>
<div class="nav-item active" onclick="showTab('dashboard')" id="nav-dashboard"><span class="icon"><svg viewBox="0 0 24 24"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/></svg></span> Dashboard</div>
<div class="nav-item" onclick="showTab('monitoring')" id="nav-monitoring"><span class="icon"><svg viewBox="0 0 24 24"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/></svg></span> Monitoring</div>
<div class="nav-section">Operations</div>
<div class="nav-item" onclick="showTab('testbed')" id="nav-testbed"><span class="icon"><svg viewBox="0 0 24 24"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg></span> Testbed</div>
<div class="nav-item" onclick="showTab('tests')" id="nav-tests"><span class="icon"><svg viewBox="0 0 24 24"><path d="M9 11l3 3L22 4"/><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/></svg></span> Tests<span class="nav-badge info" id="badge-tests" style="display:none"></span></div>
<div class="nav-item" onclick="showTab('jobs')" id="nav-jobs"><span class="icon"><svg viewBox="0 0 24 24"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/></svg></span> Jobs<span class="nav-badge info" id="badge-jobs"></span></div>
<div class="nav-item" onclick="showTab('upload')" id="nav-upload"><span class="icon"><svg viewBox="0 0 24 24"><polyline points="16 16 12 12 8 16"/><line x1="12" y1="12" x2="12" y2="21"/><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"/></svg></span> Upload<span class="nav-badge info" id="badge-upload" style="display:none"></span></div>
<div class="nav-item" onclick="showTab('measurements')" id="nav-measurements"><span class="icon"><svg viewBox="0 0 24 24"><line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/></svg></span> Measurements</div>
<div class="nav-section">Config</div>
<div class="nav-item" onclick="showTab('settings')" id="nav-settings"><span class="icon"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg></span> Settings</div>
<div id="sidebar-footer">
<div id="sf-repo" style="margin-bottom:4px"></div>
<div id="sf-server" style="display:none"><span style="color:var(--c-accent)">●</span> server mode</div>
</div>
</div>
<!-- Main -->
<div id="main">
<!-- ═══════════════════════════ DASHBOARD ════════════════════════════════ -->
<div id="tab-dashboard" class="tab-content active">
<div class="page-title">Dashboard</div>
<div class="page-sub" id="dash-sub">Loading…</div>
<!-- Catalog (collapsed) — repo state + S1 replication lag (moved from Status) -->
<div class="box">
<div class="box-header" style="cursor:pointer" onclick="toggleCollapse('dash-catalog-body','dash-catalog-chevron')">
<span class="box-title">Catalog</span>
<span class="muted" style="font-size:11px;margin-left:8px">Repository state & Stratum-1 replication lag</span>
<span id="dash-catalog-chevron" style="margin-left:auto;font-size:13px;color:var(--c-muted);transition:transform .2s;transform:rotate(-90deg)">▼</span>
</div>
<div id="dash-catalog-body" class="box-pad" style="display:none">
<table style="border-collapse:collapse;font-size:12px;max-width:780px;width:100%">
<thead>
<tr style="color:var(--c-muted);font-size:11px;text-transform:uppercase;letter-spacing:.4px">
<th style="text-align:left;padding:4px 10px 4px 0;font-weight:600">Node</th>
<th style="text-align:left;padding:4px 10px;font-weight:600">Root hash</th>
<th style="text-align:right;padding:4px 10px;font-weight:600">Rev</th>
<th style="text-align:left;padding:4px 10px;font-weight:600">Published at</th>
<th style="text-align:right;padding:4px 0;font-weight:600">Lag vs s0</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding:5px 10px 5px 0;font-weight:700;white-space:nowrap">stratum0</td>
<td style="padding:5px 10px"><div class="mono" id="s0-hash" style="font-size:10px;word-break:break-all;max-width:200px">–</div></td>
<td style="padding:5px 10px;text-align:right;font-weight:600;color:var(--c-info)" id="s0-rev">–</td>
<td style="padding:5px 10px;white-space:nowrap" id="s0-ts">–</td>
<td style="padding:5px 0;text-align:right;color:var(--c-muted);font-size:11px">—</td>
</tr>
<tr style="border-top:1px solid var(--c-border)">
<td style="padding:5px 10px 5px 0;font-weight:700;white-space:nowrap;color:#1a7f37">stratum1-a</td>
<td style="padding:5px 10px"><div id="s1a-hash-icon" style="font-size:11px;color:var(--c-muted)">–</div></td>
<td style="padding:5px 10px;text-align:right;font-weight:600;color:var(--c-info)" id="s1a-rev">–</td>
<td style="padding:5px 10px;white-space:nowrap" id="s1a-ts">–</td>
<td style="padding:5px 0;text-align:right;font-weight:600" id="s1a-lag">–</td>
</tr>
<tr style="border-top:1px solid var(--c-border)">
<td style="padding:5px 10px 5px 0;font-weight:700;white-space:nowrap;color:#1a7f37">stratum1-b</td>
<td style="padding:5px 10px"><div id="s1b-hash-icon" style="font-size:11px;color:var(--c-muted)">–</div></td>
<td style="padding:5px 10px;text-align:right;font-weight:600;color:var(--c-info)" id="s1b-rev">–</td>
<td style="padding:5px 10px;white-space:nowrap" id="s1b-ts">–</td>
<td style="padding:5px 0;text-align:right;font-weight:600" id="s1b-lag">–</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="cards">
<div class="card"><div class="card-label">Services up</div><div class="card-value blue" id="c-svc">–</div></div>
<div class="card"><div class="card-label">Active jobs</div><div class="card-value orange" id="c-active">–</div></div>
<div class="card"><div class="card-label">Jobs today</div><div class="card-value blue" id="c-today">–</div></div>
<div class="card"><div class="card-label">Avg publish</div><div class="card-value green" id="c-avg-pub">–</div><div class="card-sub">seconds</div></div>
<div class="card"><div class="card-label">Last root hash</div><div class="card-value mono" id="c-hash" style="font-size:12px;word-break:break-all">–</div><div class="card-sub" id="c-hash-age"></div></div>
<div class="card"><div class="card-label">S1 peers</div><div class="card-value" id="c-s1">–</div></div>
</div>
<!-- ── Publish-chain diagram ────────────────────────────────────── -->
<div class="box" style="overflow-x:auto">
<div class="box-header">
<span class="box-title">Publish chain</span>
<span id="sd-last-update" style="font-size:11px;color:var(--c-muted);margin-left:auto"></span>
</div>
<div class="box-pad" style="padding:16px 12px">
<svg id="status-diagram" viewBox="0 0 860 305"
style="width:100%;min-width:600px;display:block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:12px">
<defs>
<marker id="sd-ar" markerWidth="8" markerHeight="6" refX="6" refY="3" orient="auto">
<polygon points="0 0,8 3,0 6" fill="#586069"/>
</marker>
</defs>
<!-- ── cvmfs-prepub node ─────────────────────────────────── -->
<rect id="sd-rect-prepub" x="10" y="88" width="152" height="96" rx="6"
fill="#ddf4ff" stroke="#a3c8f5" stroke-width="2"/>
<text x="86" y="109" text-anchor="middle" font-weight="700" font-size="13" fill="#0550ae">cvmfs-prepub</text>
<text x="86" y="125" text-anchor="middle" font-size="10" fill="#6a737d">Publisher · :8080</text>
<text id="sd-health-prepub" x="86" y="147" text-anchor="middle" font-size="12" font-weight="600" fill="#8b949e">● checking…</text>
<text id="sd-ms-prepub" x="86" y="162" text-anchor="middle" font-size="10" fill="#6a737d"></text>
<!-- ── arrow: prepub → gateway ─────────────────────────── -->
<line x1="162" y1="136" x2="208" y2="136" stroke="#586069" stroke-width="1.5" marker-end="url(#sd-ar)"/>
<!-- ── gateway node ─────────────────────────────────────── -->
<rect id="sd-rect-gateway" x="210" y="88" width="152" height="96" rx="6"
fill="#fff" stroke="#e1e4e8" stroke-width="2"/>
<text x="286" y="109" text-anchor="middle" font-weight="700" font-size="13" fill="#24292e">gateway</text>
<text x="286" y="125" text-anchor="middle" font-size="10" fill="#6a737d">Lease manager · :4929</text>
<text id="sd-health-gateway" x="286" y="147" text-anchor="middle" font-size="12" font-weight="600" fill="#8b949e">● checking…</text>
<text id="sd-ms-gateway" x="286" y="162" text-anchor="middle" font-size="10" fill="#6a737d"></text>
<!-- ── arrow: gateway → stratum0 ─────────────────────── -->
<line x1="362" y1="136" x2="408" y2="136" stroke="#586069" stroke-width="1.5" marker-end="url(#sd-ar)"/>
<!-- ── stratum0 node (taller — carries host metrics) ──── -->
<rect id="sd-rect-stratum0" x="410" y="60" width="158" height="190" rx="6"
fill="#fff3cd" stroke="#fcd34d" stroke-width="2"/>
<text x="489" y="82" text-anchor="middle" font-weight="700" font-size="13" fill="#854d0e">stratum0</text>
<text x="489" y="98" text-anchor="middle" font-size="10" fill="#6a737d">Content server · :8090</text>
<text id="sd-health-stratum0" x="489" y="119" text-anchor="middle" font-size="12" font-weight="600" fill="#8b949e">● checking…</text>
<text id="sd-ms-stratum0" x="489" y="134" text-anchor="middle" font-size="10" fill="#6a737d"></text>
<!-- host-metrics sub-section inside node -->
<line x1="422" y1="142" x2="556" y2="142" stroke="#f0d060" stroke-width="1"/>
<text x="425" y="155" font-size="9" fill="#9a7a30" font-weight="600">HOST METRICS</text>
<text id="sd-m-cpu" x="425" y="169" font-size="10" fill="#24292e">CPU: –</text>
<text id="sd-m-temp" x="425" y="182" font-size="10" fill="#24292e">Temp: –</text>
<text id="sd-m-mem" x="425" y="195" font-size="10" fill="#24292e">Mem: –</text>
<text id="sd-m-disk" x="425" y="208" font-size="10" fill="#24292e">Disk: –</text>
<text id="sd-m-dio" x="425" y="221" font-size="10" fill="#24292e">Disk I/O: –</text>
<text id="sd-m-net" x="425" y="234" font-size="10" fill="#24292e">Net: –</text>
<!-- ── arrow: stratum0 → s1a ────────────────────────── -->
<line id="sd-arrow-s1a" x1="568" y1="100" x2="628" y2="68" stroke="#586069" stroke-width="1.5" marker-end="url(#sd-ar)"/>
<!-- net I/O label on replication link s1a -->
<text id="sd-net-link-label" x="596" y="74" text-anchor="middle" font-size="9" fill="#586069"></text>
<!-- ── arrow: stratum0 → s1b ────────────────────────── -->
<line id="sd-arrow-s1b" x1="568" y1="200" x2="628" y2="210" stroke="#586069" stroke-width="1.5" marker-end="url(#sd-ar)"/>
<!-- net I/O label on replication link s1b -->
<text id="sd-net-link-s1b-label" x="596" y="198" text-anchor="middle" font-size="9" fill="#586069"></text>
<!-- ── stratum1-a node ──────────────────────────────── -->
<rect id="sd-rect-s1a" x="630" y="18" width="155" height="114" rx="6"
fill="#dcffe4" stroke="#a3d9a5" stroke-width="2"/>
<text x="707" y="40" text-anchor="middle" font-weight="700" font-size="13" fill="#1a7f37">stratum1-a</text>
<text x="707" y="56" text-anchor="middle" font-size="10" fill="#6a737d">Replica · :9101</text>
<text id="sd-health-s1a" x="707" y="77" text-anchor="middle" font-size="12" font-weight="600" fill="#8b949e">● checking…</text>
<text id="sd-ms-s1a" x="707" y="92" text-anchor="middle" font-size="10" fill="#6a737d"></text>
<text id="sd-disk-s1a" x="707" y="108" text-anchor="middle" font-size="9" fill="#6a737d">Disk: –</text>
<!-- ── stratum1-b node ──────────────────────────────── -->
<rect id="sd-rect-s1b" x="630" y="160" width="155" height="114" rx="6"
fill="#dcffe4" stroke="#a3d9a5" stroke-width="2"/>
<text x="707" y="182" text-anchor="middle" font-weight="700" font-size="13" fill="#1a7f37">stratum1-b</text>
<text x="707" y="198" text-anchor="middle" font-size="10" fill="#6a737d">Replica · :9102</text>
<text id="sd-health-s1b" x="707" y="219" text-anchor="middle" font-size="12" font-weight="600" fill="#8b949e">● checking…</text>
<text id="sd-ms-s1b" x="707" y="234" text-anchor="middle" font-size="10" fill="#6a737d"></text>
<text id="sd-disk-s1b" x="707" y="250" text-anchor="middle" font-size="9" fill="#6a737d">Disk: –</text>
<!-- ── legend ─────────────────────────────────────────── -->
<text x="10" y="292" font-size="10" fill="#6a737d">● green = HTTP OK ● orange = HTTP error ● red = critical · host metrics shown on stratum0 node (all services share the same host)</text>
</svg>
</div>
</div>
<!-- ── S1 Distribution Backlog ────────────────────────────────────────── -->
<div class="box" id="box-s1-backlog">
<div class="box-header">
<span class="box-title">S1 Distribution Backlog</span>
<span class="muted" style="font-size:11px;margin-left:8px">Objects pending push to Stratum 1 replicas</span>
<button class="btn btn-outline btn-sm" onclick="refreshS1Backlog()" style="margin-left:auto">↻</button>
</div>
<div class="box-pad">
<div id="s1-backlog-content">
<div style="color:var(--c-muted);font-size:12px">Loading…</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header" style="cursor:pointer" onclick="toggleCollapse('dash-arch-body','dash-arch-chevron')">
<span class="box-title">Architecture</span>
<span class="page-sub" id="topology-sub" style="margin:0 0 0 8px;font-size:11px">Testbed architecture.</span>
<span id="dash-arch-chevron" style="margin-left:auto;font-size:13px;color:var(--c-muted);transition:transform .2s;transform:rotate(-90deg)">▼</span>
</div>
<div id="dash-arch-body" style="display:none;padding:8px 0 0">
<svg viewBox="0 0 860 540" xmlns="http://www.w3.org/2000/svg"
style="width:100%;max-width:900px;display:block;margin:0 auto;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:12px">
<rect width="860" height="540" fill="#f6f8fa" rx="8"/>
<text x="16" y="26" font-size="13" font-weight="700" fill="#24292e">CVMFS-Prepub Testbed — Architecture</text>
<text x="16" y="44" font-size="11" fill="#6a737d">docker network: cvmfs-net | host ports in parentheses | console proxy: all services reachable via /api/proxy/<svc>/</text>
<defs>
<marker id="ar" markerWidth="8" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,8 3,0 6" fill="#586069"/></marker>
<marker id="ar-g" markerWidth="8" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,8 3,0 6" fill="#2ea44f"/></marker>
<marker id="ar-b" markerWidth="8" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,8 3,0 6" fill="#0075ca"/></marker>
<marker id="ar-o" markerWidth="8" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,8 3,0 6" fill="#e36209"/></marker>
<marker id="ar-p" markerWidth="8" markerHeight="6" refX="6" refY="3" orient="auto"><polygon points="0 0,8 3,0 6" fill="#8957e5"/></marker>
</defs>
<!-- Remote browser -->
<rect x="10" y="60" width="120" height="48" rx="5" fill="#fff" stroke="#e1e4e8" stroke-width="1.5"/>
<text x="70" y="80" text-anchor="middle" font-weight="600" fill="#24292e">Remote browser</text>
<text x="70" y="96" text-anchor="middle" font-size="10" fill="#6a737d">any host</text>
<!-- Console server box -->
<rect x="210" y="52" width="150" height="64" rx="5" fill="#f0f4ff" stroke="#8957e5" stroke-width="1.5"/>
<text x="285" y="74" text-anchor="middle" font-weight="600" fill="#5a3e9e">testbed-server.py</text>
<text x="285" y="89" text-anchor="middle" font-size="10" fill="#5a3e9e">:8888 reverse proxy</text>
<text x="285" y="103" text-anchor="middle" font-size="10" fill="#6a737d">+ SSE command runner</text>
<!-- Arrow: browser → server -->
<line x1="130" y1="84" x2="208" y2="84" stroke="#8957e5" stroke-width="1.5" marker-end="url(#ar-p)"/>
<text x="168" y="78" text-anchor="middle" font-size="10" fill="#8957e5">HTTP :8888</text>
<!-- cvmfs-prepub -->
<rect x="420" y="52" width="148" height="64" rx="5" fill="#ddf4ff" stroke="#a3c8f5" stroke-width="1.5"/>
<text x="494" y="74" text-anchor="middle" font-weight="600" fill="#0550ae">cvmfs-prepub</text>
<text x="494" y="89" text-anchor="middle" font-size="10" fill="#6a737d">:8080 API+SSE+metrics</text>
<text x="494" y="103" text-anchor="middle" font-size="10" fill="#6a737d">proxy: /api/proxy/prepub/</text>
<!-- Arrow: server → prepub -->
<line x1="360" y1="78" x2="418" y2="78" stroke="#8957e5" stroke-width="1.5" stroke-dasharray="4,3" marker-end="url(#ar-p)"/>
<!-- gateway -->
<rect x="420" y="152" width="148" height="48" rx="5" fill="#fff" stroke="#e1e4e8" stroke-width="1.5"/>
<text x="494" y="172" text-anchor="middle" font-weight="600" fill="#24292e">gateway</text>
<text x="494" y="187" text-anchor="middle" font-size="10" fill="#6a737d">:4929 /api/proxy/gateway/</text>
<!-- stratum0 -->
<rect x="420" y="236" width="148" height="48" rx="5" fill="#fff3cd" stroke="#fcd34d" stroke-width="1.5"/>
<text x="494" y="257" text-anchor="middle" font-weight="600" fill="#854d0e">stratum0</text>
<text x="494" y="272" text-anchor="middle" font-size="10" fill="#6a737d">Apache :8090 /api/proxy/stratum0/</text>
<!-- prepub → gateway -->
<line x1="494" y1="116" x2="494" y2="150" stroke="#586069" stroke-width="1.5" marker-end="url(#ar)"/>
<!-- gateway → stratum0 -->
<line x1="494" y1="200" x2="494" y2="234" stroke="#586069" stroke-width="1.5" marker-end="url(#ar)"/>
<!-- stratum1-a -->
<rect x="660" y="120" width="148" height="56" rx="5" fill="#dcffe4" stroke="#a3d9a5" stroke-width="1.5"/>
<text x="734" y="142" text-anchor="middle" font-weight="600" fill="#1a7f37">stratum1-a</text>
<text x="734" y="157" text-anchor="middle" font-size="10" fill="#6a737d">ctrl :9101 data :9111</text>
<text x="734" y="169" text-anchor="middle" font-size="10" fill="#6a737d">/api/proxy/s1a/</text>
<!-- stratum1-b -->
<rect x="660" y="218" width="148" height="56" rx="5" fill="#dcffe4" stroke="#a3d9a5" stroke-width="1.5"/>
<text x="734" y="240" text-anchor="middle" font-weight="600" fill="#1a7f37">stratum1-b</text>
<text x="734" y="255" text-anchor="middle" font-size="10" fill="#6a737d">ctrl :9102 data :9112</text>
<text x="734" y="267" text-anchor="middle" font-size="10" fill="#6a737d">/api/proxy/s1b/</text>
<!-- prepub → S1 (data plane) -->
<line x1="568" y1="72" x2="658" y2="145" stroke="#2ea44f" stroke-width="1.5" marker-end="url(#ar-g)"/>
<line x1="568" y1="96" x2="658" y2="240" stroke="#2ea44f" stroke-width="1.5" marker-end="url(#ar-g)"/>
<text x="618" y="110" text-anchor="middle" font-size="10" fill="#2ea44f">data plane</text>
<!-- MQTT overlay — opacity toggled by applyOverlayState() -->
<g id="mqtt-topology">
<!-- Mosquitto -->
<rect x="660" y="320" width="148" height="48" rx="5" fill="#ffd7d7" stroke="#f5a5a5" stroke-width="1.5"/>
<text x="734" y="342" text-anchor="middle" font-weight="600" fill="#b91c1c">Mosquitto</text>
<text x="734" y="357" text-anchor="middle" font-size="10" fill="#6a737d">:1883 MQTT broker</text>
<!-- MQTT arrows -->
<line x1="568" y1="110" x2="658" y2="333" stroke="#0075ca" stroke-width="1.5" stroke-dasharray="5,4" marker-end="url(#ar-b)"/>
<line x1="734" y1="320" x2="734" y2="276" stroke="#0075ca" stroke-width="1.5" stroke-dasharray="5,4" marker-end="url(#ar-b)"/>
<line x1="734" y1="320" x2="734" y2="178" stroke="#0075ca" stroke-width="1.5" stroke-dasharray="5,4" marker-end="url(#ar-b)"/>
<text x="610" y="235" text-anchor="middle" font-size="10" fill="#0075ca">MQTT notif.</text>
</g>
<!-- Monitoring -->
<rect x="10" y="370" width="210" height="80" rx="5" fill="#fff" stroke="#e1e4e8" stroke-width="1.5"/>
<text x="115" y="392" text-anchor="middle" font-weight="600" fill="#24292e">Monitoring stack</text>
<text x="115" y="408" text-anchor="middle" font-size="10" fill="#6a737d">vmagent + victoriametrics</text>
<text x="115" y="422" text-anchor="middle" font-size="10" fill="#6a737d">cAdvisor + node-exporter</text>
<!-- vmagent scrapes -->
<line x1="220" y1="390" x2="418" y2="95" stroke="#e36209" stroke-width="1" stroke-dasharray="3,3" marker-end="url(#ar-o)"/>
<text x="320" y="280" text-anchor="middle" font-size="10" fill="#e36209">scrape /metrics</text>
<!-- Legend -->
<rect x="10" y="470" width="840" height="60" rx="5" fill="#fff" stroke="#e1e4e8"/>
<text x="24" y="490" font-weight="600" font-size="11" fill="#24292e">Legend:</text>
<line x1="90" y1="487" x2="120" y2="487" stroke="#8957e5" stroke-width="1.5" marker-end="url(#ar-p)"/>
<text x="126" y="491" font-size="10" fill="#8957e5">proxy (browser→server→service)</text>
<line x1="280" y1="487" x2="310" y2="487" stroke="#2ea44f" stroke-width="1.5" marker-end="url(#ar-g)"/>
<text x="316" y="491" font-size="10" fill="#2ea44f">data plane TCP</text>
<g data-mqtt-legend="1">
<line x1="420" y1="487" x2="450" y2="487" stroke="#0075ca" stroke-width="1.5" stroke-dasharray="5,4" marker-end="url(#ar-b)"/>
<text x="456" y="491" font-size="10" fill="#0075ca">MQTT control</text>
</g>
<line x1="550" y1="487" x2="580" y2="487" stroke="#e36209" stroke-width="1" stroke-dasharray="3,3" marker-end="url(#ar-o)"/>
<text x="586" y="491" font-size="10" fill="#e36209">metrics scrape</text>
<line x1="90" y1="507" x2="120" y2="507" stroke="#586069" stroke-width="1.5" marker-end="url(#ar)"/>
<text x="126" y="511" font-size="10" fill="#586069">publish flow</text>
</svg>
</div>
</div>
<div class="box">
<div class="box-header" style="cursor:pointer" onclick="toggleCollapse('dash-services-body','dash-services-chevron')">
<span class="box-title">Services</span>
<button class="btn btn-outline btn-sm" onclick="event.stopPropagation();refreshServices()">↻ Recheck</button>
<span id="dash-services-chevron" style="margin-left:auto;font-size:13px;color:var(--c-muted);transition:transform .2s;transform:rotate(-90deg)">▼</span>
</div>
<div id="dash-services-body" style="display:none">
<table><thead><tr><th>Service</th><th>Role</th><th>Proxy path</th><th>Status</th><th>ms</th><th></th></tr></thead>
<tbody id="svc-tbody"><tr><td colspan="6" class="loading"><span class="spinner"></span></td></tr></tbody></table>
</div>
</div>
<!-- hidden: keep s0-url-label for MQTT polling compatibility -->
<code id="s0-url-label" style="display:none"></code>
<!-- hidden: keep s0-raw for any legacy references -->
<div id="s0-raw" style="display:none"></div>
</div>
<!-- ═══════════════════════════ MONITORING ══════════════════════════════ -->
<div id="tab-monitoring" class="tab-content">
<div class="page-title">Monitoring</div>
<div class="page-sub" style="display:flex;align-items:center;flex-wrap:wrap;gap:8px">
<span>Job timing statistics and Prometheus metrics.</span>
<span style="margin-left:4px;font-size:12px;color:var(--c-muted)">Method:</span>
<select id="mon-method-filter" style="font-size:12px;padding:3px 6px;border:1px solid var(--c-border);border-radius:var(--radius);background:var(--c-bg)" onchange="applyJobsFilter('mon-method-filter');buildMonitoringCharts()">
<option value="all">All</option>
<option value="bits">Bits (prepub)</option>
<option value="ingest">Ingest (native)</option>
</select>
<button class="btn btn-outline btn-sm" onclick="refreshMonitoring()">↻ Refresh</button>
<button class="btn btn-outline btn-sm" id="mon-range-btn" onclick="cycleRange()">Last 20 jobs</button>
<button class="btn btn-sm" style="background:#d73a49;color:#fff;border:none" onclick="resetMonStats()" title="Zero the baseline — only jobs submitted after this moment will appear in the charts and summary cards">⊘ Reset stats</button>
<span id="mon-since-label" style="font-size:11px;color:var(--c-muted);display:none"></span>
<span style="margin-left:auto;font-size:12px;color:var(--c-muted)">Scenario:</span>
<select id="mon-scenario" style="font-size:12px;padding:3px 6px;border:1px solid var(--c-border);border-radius:var(--radius);background:var(--c-bg)" title="Distribution model to (re)start the testbed in">
<option value="push">push (legacy)</option>
<option value="mqtt">mqtt (push + control plane)</option>
<option value="pull">pull (ADR-0001)</option>
<option value="ingest">ingest (native)</option>
</select>
<button class="btn btn-sm" style="background:#0075ca;color:#fff;border:none" onclick="applyScenario()" title="Restart the testbed in the selected scenario (server mode)">▶ Apply</button>
</div>
<!-- Timing cards -->
<div class="cards" id="mon-cards">
<div class="card"><div class="card-label">Avg publish time</div><div class="card-value green" id="m-avg">–</div><div class="card-sub">seconds (end-to-end)</div></div>
<div class="card"><div class="card-label">Median publish</div><div class="card-value blue" id="m-p50">–</div><div class="card-sub">seconds</div></div>
<div class="card"><div class="card-label">p95 publish</div><div class="card-value orange" id="m-p95">–</div><div class="card-sub">seconds</div></div>
<div class="card"><div class="card-label">Throughput</div><div class="card-value" id="m-tput">–</div><div class="card-sub">jobs / hour</div></div>
<div class="card"><div class="card-label">Success rate</div><div class="card-value green" id="m-rate">–</div><div class="card-sub">% published</div></div>
<div class="card"><div class="card-label">Total jobs</div><div class="card-value blue" id="m-total">–</div></div>
</div>
<!-- 2×2 chart grid -->
<div class="metrics-grid">
<!-- Row 1 col 1: Upload Volume -->
<div class="box">
<div class="box-header"><span class="box-title">Upload Volume — Cumulative per Run (MB)</span></div>
<div class="box-pad">
<div id="chart-volume-note" style="display:none;font-size:11px;color:var(--c-muted);margin-bottom:6px;padding:6px 8px;background:#f6f8fa;border-radius:4px;border-left:3px solid var(--c-warn)"></div>
<div class="chart-wrap"><canvas id="chart-volume"></canvas></div>
</div>
</div>
<!-- Row 1 col 2: Job State Distribution -->
<div class="box">
<div class="box-header"><span class="box-title">Job State Distribution</span></div>
<div class="box-pad"><div class="chart-wrap"><canvas id="chart-states"></canvas></div></div>
</div>
</div>
<!-- Stage timing (avg per phase, collapsible) -->
<div class="box" id="box-stages" style="display:none">
<div class="box-header" style="cursor:pointer" onclick="toggleCollapse('stages-body','stages-chevron')">
<span class="box-title">Time per Pipeline Stage (avg, seconds)</span>
<span id="stages-chevron" style="font-size:13px;color:var(--c-muted);transition:transform .2s">▼</span>
</div>
<div id="stages-body" class="box-pad">
<div style="font-size:11px;color:var(--c-muted);margin-bottom:10px;line-height:1.5">
Average wall time per phase for completed bits (prepub) jobs.
<b>Pipeline</b>: compress + dedup + CAS upload.
<b>Lease+Commit</b>: waiting for per-repo commit slot + gateway lease + catalog merge + commit.
<b>S1 Distribution</b>: async S1 pre-warming; ends when all endpoints confirm.
Hover bars for exact values.
</div>
<div class="chart-wrap"><canvas id="chart-stages"></canvas></div>
</div>
</div>
<!-- CAS Storage (moved from Status tab) -->
<div class="box" id="box-cas-stats">
<div class="box-header">
<span class="box-title">CAS Storage</span>
<span style="font-size:11px;color:var(--c-muted);margin-left:8px">Content-addressable object store on cvmfs-prepub</span>
<button class="btn btn-outline btn-sm" onclick="refreshCASStats()" style="margin-left:auto">↻</button>
</div>
<div class="box-pad">
<div style="display:flex;gap:16px;margin-bottom:16px;flex-wrap:wrap">
<div class="card" style="min-width:130px;flex:1">
<div class="card-label">Total size</div>
<div class="card-value blue" id="cas-size-val">–</div>
<div class="card-sub" id="cas-size-sub">GB</div>
</div>
<div class="card" style="min-width:130px;flex:1">
<div class="card-label">Objects (files)</div>
<div class="card-value" id="cas-count-val">–</div>
<div class="card-sub" id="cas-count-sub"></div>
</div>
<div class="card" style="min-width:130px;flex:1">
<div class="card-label">Avg object size</div>
<div class="card-value" id="cas-avg-val">–</div>
<div class="card-sub">KB / object</div>
</div>
</div>
<div style="height:140px;position:relative">
<canvas id="cas-history-chart"></canvas>
</div>
<div id="cas-error" style="display:none;font-size:11px;color:var(--c-warn);margin-top:6px"></div>
<div id="cas-note" style="font-size:10px;color:var(--c-muted);margin-top:4px">Requires server mode · sampled every ~60 s · graph shows last hour from VictoriaMetrics</div>
</div>
</div>
<!-- Run history -->
<div class="box">
<div class="box-header">
<span class="box-title">Run History</span>
<span class="muted" style="font-size:11px" id="run-count-label"></span>
<button class="btn btn-outline btn-sm" onclick="refreshRuns()">↻</button>
<button class="btn btn-outline btn-sm" onclick="clearRunComparison()" id="run-clear-cmp" style="display:none">✕ Clear compare</button>
</div>
<div class="box-pad" id="run-hint" style="color:var(--c-muted);font-size:12px;padding-bottom:8px">
Click any two rows to compare runs side by side.
</div>
<div id="runs-tbody-wrap" style="max-height:300px;overflow-y:auto">
<table>
<thead><tr>
<th></th><th>Run ID</th><th>Method</th><th>Type</th>
<th>Jobs (ok/req)</th><th>Avg</th><th>p50</th><th>p95</th>
<th>Throughput</th><th>Duration</th><th>Started</th>
</tr></thead>
<tbody id="runs-tbody"><tr><td colspan="11" class="loading"><span class="spinner"></span></td></tr></tbody>
</table>
</div>
</div>
<!-- Run comparison panel -->
<div class="box" id="box-run-cmp" style="display:none">
<div class="box-header"><span class="box-title">Run Comparison</span></div>
<div class="box-pad">
<div id="run-cmp-cards" style="display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px"></div>
<div class="chart-wrap" style="height:240px"><canvas id="chart-run-cmp"></canvas></div>
</div>
</div>
<!-- Host metrics -->
<div class="box">
<div class="box-header">
<span class="box-title">Host Metrics</span>
<span class="muted" style="font-size:11px" id="hm-ts"></span>
<button class="btn btn-outline btn-sm" onclick="refreshHostMetrics()">↻</button>
</div>
<div class="box-pad">
<div style="font-size:11px;color:var(--c-muted);margin-bottom:8px">Click any card to view history.</div>
<div class="cards" id="hm-cards" style="margin-bottom:0;grid-template-columns:repeat(auto-fill,minmax(140px,1fr))">
<div class="card" style="cursor:pointer" title="Click for history" onclick="showMetricHistory('cpu_load1','CPU Load 1m','')">
<div class="card-label">CPU load 1m</div><div class="card-value" id="hm-load1">–</div>
<div class="card-sub" id="hm-load-sub">5m: – · 15m: –</div></div>
<div class="card" style="cursor:pointer" title="Click for history" onclick="showMetricHistory('mem_pct','Memory Used','%')">
<div class="card-label">Memory used</div><div class="card-value" id="hm-mem">–</div>
<div class="card-sub" id="hm-mem-sub">of – GB</div></div>
<div class="card" style="cursor:pointer" title="Click for history" onclick="showMetricHistory('disk_pct','Disk Used','%')">
<div class="card-label">Disk used</div><div class="card-value" id="hm-disk">–</div>
<div class="card-sub" id="hm-disk-sub">of – GB</div></div>
<div class="card" style="cursor:pointer" title="Click for history" onclick="showMetricHistory('cpu_temp','CPU Temp','°C')">
<div class="card-label">CPU temp</div><div class="card-value" id="hm-temp">–</div>
<div class="card-sub">°C</div></div>
<div class="card" style="cursor:pointer" title="Click for network I/O history" onclick="showMetricHistory('net_rx_kbs','Network RX','KB/s','net_tx_kbs','TX')">
<div class="card-label">Network I/O</div><div class="card-value blue" id="hm-net-rx">–</div>
<div class="card-sub" id="hm-net-sub">rx KB/s · tx –</div></div>
<div class="card" style="cursor:pointer" title="Click for disk I/O history" onclick="showMetricHistory('disk_read_kbs','Disk I/O Read','KB/s','disk_write_kbs','Write')">
<div class="card-label">Disk I/O</div><div class="card-value blue" id="hm-disk-rd">–</div>
<div class="card-sub" id="hm-diskio-sub">rd KB/s · wr –</div></div>
</div>
</div>
</div>
<!-- History panel (slide-in overlay within monitoring tab) -->
<div id="hm-history-panel" style="display:none;background:var(--c-surface);border:1px solid var(--c-border);border-radius:var(--radius);box-shadow:var(--shadow);margin-bottom:20px">
<div class="box-header">
<span class="box-title" id="hm-history-title">Metric History</span>
<span class="muted" style="font-size:11px" id="hm-history-sub"></span>
<button class="btn btn-outline btn-sm" onclick="closeMetricHistory()">✕ Close</button>
</div>
<div class="box-pad"><div style="position:relative;height:220px"><canvas id="chart-hm-history"></canvas></div></div>
</div>
<!-- Pull distribution (ADR-0001) -->
<div class="box">
<div class="box-header">
<span class="box-title">Pull Distribution <span class="muted" style="font-size:11px">(ADR-0001 · from VictoriaMetrics)</span></span>
<button class="btn btn-outline btn-sm" onclick="buildPullCharts()">↻</button>
</div>
<div class="box-pad">
<div id="pull-mon-note" style="font-size:11px;color:var(--c-muted);margin-bottom:8px"></div>
<div class="metrics-grid">
<div class="box" style="box-shadow:none;border:1px solid var(--c-border)">
<div class="box-header"><span class="box-title" style="font-size:13px">Receiver pull objects /s <span class="muted" style="font-size:10px">(by result)</span></span></div>
<div class="box-pad"><div class="chart-wrap" style="height:200px"><canvas id="pull-chart-objects"></canvas></div></div>
</div>
<div class="box" style="box-shadow:none;border:1px solid var(--c-border)">
<div class="box-header"><span class="box-title" style="font-size:13px">Warm transactions /s <span class="muted" style="font-size:10px">(warmed vs failed)</span></span></div>
<div class="box-pad"><div class="chart-wrap" style="height:200px"><canvas id="pull-chart-warm"></canvas></div></div>
</div>
</div>
<div style="font-size:11px;color:var(--c-muted);margin-top:6px">Requires server mode + the <code>pull</code> scenario. Each publish announces a transaction; receivers pull missing objects and warm. Publisher-side warm-quorum / commit counters appear in the Prometheus Metrics table below (<code>cvmfs_prepub_dist_*</code>).</div>
</div>
</div>
<!-- Prometheus metrics -->
<div class="box">
<div class="box-header" style="cursor:pointer" onclick="toggleCollapse('metrics-body','metrics-chevron')">
<span class="box-title">Prometheus Metrics <span class="muted" style="font-size:11px">(prepub /api/v1/metrics)</span></span>
<button class="btn btn-outline btn-sm" onclick="event.stopPropagation();refreshMetrics()">↻</button>
<span id="metrics-chevron" style="margin-left:8px;font-size:13px;color:var(--c-muted);transition:transform .2s">▼</span>
</div>
<div id="metrics-body" class="box-pad" style="display:none">
<input id="metrics-filter" placeholder="Filter metric names…" style="width:100%;padding:6px 10px;border:1px solid var(--c-border);border-radius:var(--radius);font-size:12px;margin-bottom:12px;font-family:var(--mono)" oninput="renderMetricsTable()">
<div id="metrics-tbody-wrap" style="max-height:340px;overflow-y:auto">
<table><thead><tr><th>Metric</th><th>Labels</th><th style="text-align:right">Value</th></tr></thead>
<tbody id="metrics-tbody"><tr><td colspan="3" class="loading"><span class="spinner"></span></td></tr></tbody></table>
</div>
</div>
</div>
</div>
<!-- ═══════════════════════════ TESTBED ════════════════════════════════ -->
<div id="tab-testbed" class="tab-content">
<div class="page-title">Testbed</div>
<div class="page-sub">Run <code>./testbed.sh</code> commands from the browser. Output streams live via SSE. <span id="cmd-server-warn" class="muted" style="display:none">⚠️ Server mode required — start <code>./testbed.sh server</code> on the testbed host.</span></div>
<!-- Active configuration (read-only) + command parameters -->
<div class="box box-pad" style="margin-bottom:16px">
<div style="display:flex;gap:24px;flex-wrap:wrap;align-items:flex-end">
<div>
<div style="font-size:11px;color:var(--c-muted);margin-bottom:4px">Active configuration <span class="muted" title="Set at start time via testbed.sh / make arguments (e.g. make start METHOD=ingest WSS=0). Read-only here.">ⓘ</span></div>
<div style="display:flex;gap:8px;align-items:center;flex-wrap:wrap" id="tb-config">
<span class="badge" id="tb-cfg-method" style="background:#0075ca;color:#fff;font-size:11px">method: …</span>
<span class="badge" id="tb-cfg-wss" style="background:#57606a;color:#fff;font-size:11px">pull(wss): …</span>
<span class="badge" id="tb-cfg-bits" style="background:#57606a;color:#fff;font-size:11px">bits-console: …</span>
<span class="muted" id="tb-cfg-started" style="font-size:11px"></span>
</div>
</div>
<div style="border-left:1px solid var(--c-border);padding-left:24px;display:flex;gap:20px;flex-wrap:wrap;align-items:flex-end">
<div>
<span style="font-size:12px;color:var(--c-muted);margin-right:6px">n (stresstest jobs)</span>
<input type="number" id="flag-n" value="10" min="1" max="500" style="width:70px;padding:4px 8px;border:1px solid var(--c-border);border-radius:var(--radius);font-size:12px">
</div>
<div>
<span style="font-size:12px;color:var(--c-muted);margin-right:6px">concurrency</span>
<input type="number" id="flag-concurrency" placeholder="default" min="1" max="100" style="width:90px;padding:4px 8px;border:1px solid var(--c-border);border-radius:var(--radius);font-size:12px">
</div>
<div>
<span style="font-size:12px;color:var(--c-muted);margin-right:6px">service (logs)</span>
<input type="text" id="flag-svc" placeholder="e.g. stratum1-a" style="width:130px;padding:4px 8px;border:1px solid var(--c-border);border-radius:var(--radius);font-size:12px">
</div>
</div>
</div>
<div class="muted" style="font-size:11px;margin-top:8px">Publishing method & overlays are chosen at start time (<code>make start METHOD=ingest</code>, <code>make WSS=0 start</code>) — commands here run in the active mode shown above.</div>
</div>
<!-- Command groups -->
<div class="box box-pad" style="margin-bottom:16px">
<div class="cmd-group">
<div class="cmd-group-label">Monitor</div>
<div class="cmd-buttons">
<button class="btn btn-outline" onclick="runCmd('status')">status</button>
<button class="btn btn-outline" onclick="runCmd('info')">info</button>
<button class="btn btn-outline" onclick="runCmd('logs',{svc:true})">logs</button>
</div>
</div>
<hr>
<div class="cmd-group">
<div class="cmd-group-label">Lifecycle</div>
<div class="cmd-buttons">
<button class="btn btn-outline" onclick="runCmd('start')">start</button>
<button class="btn btn-outline" onclick="runCmd('stop')">stop</button>
<button class="btn btn-outline" onclick="runCmd('restart')">restart</button>
<button class="btn btn-outline" onclick="runCmd('bootstrap')">bootstrap</button>
<button class="btn btn-outline" onclick="runCmd('snapshot')">snapshot</button>
<button class="btn btn-outline" onclick="runCmd('restore')">restore</button>
</div>
</div>
<hr>
<div class="cmd-group">
<div class="cmd-group-label">Test</div>
<div class="cmd-buttons">
<button class="btn btn-primary" onclick="runCmd('test')">test</button>
<button class="btn btn-primary" onclick="runCmd('stresstest',{n:true})">stresstest</button>
<button class="btn btn-primary" onclick="runCmd('pulltest',{wss:true})">pulltest</button>
<button class="btn btn-outline" onclick="runCmd('unittest')">unittest</button>
<button class="btn btn-outline" onclick="runCmd('catdump')">catdump</button>
<button class="btn btn-outline" onclick="runCmd('catdiff')">catdiff</button>
</div>
</div>
<hr>
<div class="cmd-group">
<div class="cmd-group-label">Dangerous</div>
<div class="cmd-buttons">
<button class="btn btn-danger btn-sm" onclick="runCmd('clean',{confirm:'Remove all container state? (snapshot preserved)'})">clean</button>
<button class="btn btn-danger btn-sm" onclick="runCmd('reset',{confirm:'Full teardown + reinit? This deletes all state including the snapshot.'})">reset</button>
</div>
</div>
</div>
<!-- Terminal output -->
<div class="box">
<div class="box-header">
<span class="box-title" id="term-title">Output</span>
<span id="term-status" class="muted" style="font-size:12px;margin-left:8px"></span>
<div class="flex" style="margin-left:auto">
<button class="btn btn-danger btn-sm" id="kill-btn" onclick="killCmd()" style="display:none">■ Stop</button>
<button class="btn btn-outline btn-sm" onclick="clearTerm()">🗑 Clear</button>
<button class="btn btn-outline btn-sm" onclick="copyTerm()">📋 Copy</button>
</div>
</div>
<div class="term" id="terminal" style="height:520px;resize:vertical;overflow:auto">
<span class="muted">Select a command above to run it.</span>
</div>
<div style="padding:8px 16px;background:#f6f8fa;border-top:1px solid var(--c-border);border-radius:0 0 var(--radius) var(--radius);display:flex;gap:8px;align-items:center">
<span style="font-size:11px;color:var(--c-muted)">$</span>
<span id="term-cmdline" style="font-family:var(--mono);font-size:12px;color:var(--c-muted)">—</span>
<span style="margin-left:auto;font-size:11px" id="term-exit"></span>
</div>
</div>
<!-- ── Container Console ─────────────────────────────────────────────── -->
<div class="box" id="box-container-console">
<div class="box-header" style="cursor:pointer" onclick="toggleCollapse('container-console-body','container-console-chevron')">
<span class="box-title">Container Console</span>
<span style="font-size:11px;color:var(--c-muted);margin-left:8px">Run commands inside testbed containers</span>
<span id="container-console-chevron" style="font-size:13px;color:var(--c-muted);transition:transform .2s">▼</span>
</div>
<div id="container-console-body" class="box-pad">
<div style="display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap;margin-bottom:10px">
<div>
<label style="font-size:11px;color:var(--c-muted);display:block;margin-bottom:3px">Container</label>
<select id="cc-container" style="padding:5px 8px;border:1px solid var(--c-border);border-radius:var(--radius);font-size:12px;font-family:var(--mono)">
<!-- Populated dynamically from CONTAINER_DEF at boot -->
</select>
</div>
<div style="flex:1;min-width:200px">
<label style="font-size:11px;color:var(--c-muted);display:block;margin-bottom:3px">Command</label>
<input id="cc-cmd" type="text" placeholder="ls /cvmfs/test.cvmfs.io" autocomplete="off" spellcheck="false"
style="width:100%;padding:5px 8px;border:1px solid var(--c-border);border-radius:var(--radius);font-size:12px;font-family:var(--mono)"
onkeydown="if(event.key==='Enter')execContainerCmd()">
</div>
<button class="btn btn-outline btn-sm" onclick="execContainerCmd()" style="white-space:nowrap">▶ Run</button>
<button class="btn btn-outline btn-sm" onclick="clearContainerOutput()" title="Clear output">✕ Clear</button>
</div>
<!-- Quick-access buttons -->
<div style="display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px">
<span style="font-size:11px;color:var(--c-muted);align-self:center">Quick:</span>
<button class="btn btn-sm" style="font-size:11px" onclick="ccQuick('ls /cvmfs/test.cvmfs.io')">ls /cvmfs/…</button>
<button class="btn btn-sm" style="font-size:11px" onclick="ccQuick('ls /cvmfs/test.cvmfs.io/upload 2>/dev/null || ls /cvmfs/test.cvmfs.io/')">ls upload/</button>
<button class="btn btn-sm" style="font-size:11px" onclick="ccQuick('cat /cvmfs/test.cvmfs.io/.cvmfspublished 2>/dev/null || echo not mounted')">manifest</button>
<button class="btn btn-sm" style="font-size:11px" onclick="ccQuick('df -h /cvmfs/test.cvmfs.io 2>/dev/null; cvmfs_config stat test.cvmfs.io 2>/dev/null || echo no cvmfs_config')">stat</button>
<button class="btn btn-sm" style="font-size:11px" onclick="ccQuick('cvmfs_config reload test.cvmfs.io 2>&1 || echo reload failed')">reload</button>
<button class="btn btn-sm" style="font-size:11px" onclick="ccQuick('env | grep -i cvmfs || echo no cvmfs vars')">env</button>
</div>
<div id="cc-output" style="background:#0d1117;color:#c9d1d9;border-radius:var(--radius);padding:12px;font-family:var(--mono);font-size:12px;min-height:120px;max-height:420px;overflow-y:auto;white-space:pre-wrap;display:none"></div>
<div id="cc-placeholder" style="color:var(--c-muted);font-size:12px;padding:8px 0">Run a command to see output here. Requires server mode and Docker access.</div>
</div>
</div>
</div>
<!-- ═══════════════════════════ TESTS ═══════════════════════════════════ -->
<div id="tab-tests" class="tab-content">
<div class="page-title">Tests</div>
<div class="page-sub">Run the selectable test suite and track results over time. <span id="tests-server-warn" class="muted" style="display:none">⚠️ Server mode required — start <code>./testbed.sh server</code> on the testbed host.</span></div>
<!-- Catalog + run controls -->
<div class="box" style="margin-bottom:16px">
<div class="box-header">
<span class="box-title">Test catalog</span>
<div class="flex" style="margin-left:auto;gap:8px">
<button class="btn btn-outline btn-sm" onclick="testsSelectAll(true)">Select all</button>
<button class="btn btn-outline btn-sm" onclick="testsSelectAll(false)">Clear</button>
<button class="btn btn-primary btn-sm" id="tests-run-selected" onclick="runSuite(false)">▶ Run selected</button>
<button class="btn btn-primary btn-sm" id="tests-run-all" onclick="runSuite(true)">▶ Run all</button>
</div>
</div>
<div class="box-pad">
<div id="tests-catalog" style="display:flex;flex-direction:column;gap:8px"></div>
<div id="tests-run-msg" class="muted" style="font-size:12px;margin-top:10px"></div>
</div>
</div>
<!-- Live progress (visible only while a suite is running) -->
<div class="box" id="tests-progress-box" style="margin-bottom:16px;display:none">
<div class="box-header">
<span class="box-title">Live progress</span>
<span id="tests-progress-count" class="muted" style="font-size:12px;margin-left:8px"></span>
<span id="tests-progress-state" class="badge" style="margin-left:auto;font-size:11px"></span>
</div>
<div class="box-pad">
<div id="tests-progress-list" style="display:flex;flex-direction:column;gap:6px"></div>
</div>
</div>
<!-- Timings -->
<div class="box" id="tests-timings-box" style="margin-bottom:16px">
<div class="box-header">
<span class="box-title">Timings</span>
<span id="tests-timings-sub" class="muted" style="font-size:12px;margin-left:8px"></span>
<div class="flex" style="margin-left:auto;gap:8px;align-items:center">
<label class="muted" style="font-size:12px">Runs
<select id="tests-timings-window" onchange="renderTimings()" style="font-size:12px;padding:2px 5px;border:1px solid var(--c-border);border-radius:var(--radius);background:var(--c-bg)">
<option value="20">20</option>
<option value="50" selected>50</option>
<option value="100">100</option>
<option value="0">All</option>
</select>
</label>
<button class="btn btn-outline btn-sm" onclick="refreshTestResults()">↻ Refresh</button>
</div>
</div>
<div class="box-pad">
<div id="tests-timings-chips" style="display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px"></div>
<div class="chart-wrap" style="height:300px"><canvas id="chart-test-timings"></canvas></div>
<div id="tests-timings-empty" class="empty muted" style="display:none;padding:24px 0">No timing data yet — run the suite to populate.</div>
<div id="tests-timings-summary" class="muted" style="font-size:12px;margin-top:10px"></div>
</div>
</div>
<!-- History -->
<div class="box">
<div class="box-header">
<span class="box-title">History</span>
<span id="tests-history-count" class="muted" style="font-size:12px;margin-left:8px"></span>
<button class="btn btn-outline btn-sm" style="margin-left:auto" onclick="refreshTestResults()">↻ Refresh</button>
</div>
<div style="overflow-x:auto;max-height:480px">
<table style="width:100%;font-size:12px">
<thead>
<tr>
<th>Time</th><th>Test</th><th>Method</th><th>Status</th><th>Duration</th><th>Metrics</th>
</tr>
</thead>
<tbody id="tests-history-tbody">
<tr><td colspan="6" class="empty muted">No test results recorded yet — run the suite to see history.</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- ═══════════════════════════ JOBS ════════════════════════════════════ -->
<div id="tab-jobs" class="tab-content">
<div class="page-title">Publish Jobs</div>
<div class="page-sub" style="display:flex;align-items:center;flex-wrap:wrap;gap:8px">
<span>Bits jobs via cvmfs-prepub REST API; ingest jobs via native-publisher log.</span>
<span style="font-size:12px;color:var(--c-muted)">Method:</span>
<select id="jobs-method-filter" style="font-size:12px;padding:3px 6px;border:1px solid var(--c-border);border-radius:var(--radius);background:var(--c-bg)" onchange="applyJobsFilter('jobs-method-filter')">
<option value="all">All</option>
<option value="bits">Bits (prepub)</option>
<option value="ingest">Ingest (native)</option>
</select>
<span id="jobs-url-label" class="mono" style="font-size:11px"></span>
</div>
<div id="jobs-warn" class="alert alert-warn" style="display:none">Cannot reach prepub API — check Settings or start the testbed.</div>
<div class="box box-pad">
<div style="display:grid;grid-template-columns:1fr 1fr 1fr auto;gap:12px;align-items:end">
<div class="form-row" style="margin:0"><label>Repository</label><input id="job-repo" placeholder="test.cvmfs.io"></div>
<div class="form-row" style="margin:0"><label>Package</label><input id="job-pkg" placeholder="mypackage/1.0"></div>
<div class="form-row" style="margin:0"><label>Ingest base</label><input id="job-base" placeholder="usr/local"></div>
<button class="btn btn-primary" onclick="submitJob()">▶ Submit</button>
</div>
<div id="job-result" style="margin-top:10px"></div>
</div>
<div class="box">
<div class="box-header"><span class="box-title">All Jobs</span>
<button class="btn btn-outline btn-sm" onclick="refreshJobs()">↻</button>
</div>
<table><thead><tr><th>ID</th><th>Repo</th><th>State</th><th>Pipeline</th><th>Publish time</th><th>Hash</th><th>Age</th><th>Log</th></tr></thead>
<tbody id="jobs-tbody"><tr><td colspan="8" class="loading"><span class="spinner"></span></td></tr></tbody></table>
</div>
</div>
<!-- ═══════════════════════════ MQTT MONITOR ════════════════════════════ -->
<!-- ═══════════════════════════ UPLOAD ════════════════════════════════ -->
<div id="tab-upload" class="tab-content">
<div class="page-title">Bulk Upload</div>
<div class="page-sub">Scan a directory for <code>*.tar.gz</code> packages and upload them to CVMFS via the bits REST API.</div>
<!-- ── Directory scanner ────────────────────────────────────────── -->
<div class="box" style="margin-bottom:16px">
<div class="box-header"><span class="box-title">Source directory</span></div>
<div class="box-pad">
<div style="display:flex;gap:8px;align-items:center;margin-bottom:12px">
<input id="ul-dir-input" type="text"
style="flex:1;padding:6px 10px;border:1px solid var(--c-border);border-radius:var(--radius);font-size:13px;font-family:var(--mono)"
placeholder="/path/to/directory"
onkeydown="if(event.key==='Enter') scanUploadDir()">
<button class="btn btn-outline" onclick="openDirPicker(document.getElementById('ul-dir-input')?.value?.trim()||'/')" title="Browse server filesystem">📁 Browse</button>
<label style="display:flex;align-items:center;gap:4px;font-size:13px;white-space:nowrap">
<input id="ul-recursive" type="checkbox" checked> recursive
</label>
<label style="display:flex;align-items:center;gap:4px;font-size:13px;white-space:nowrap" title="Clean CAS storage before run — uncheck to measure deduplication impact">
<input id="ul-clean-cas" type="checkbox" checked onchange="try{localStorage.setItem('ul-clean-cas',this.checked?'1':'0')}catch(_){}"> clean CAS
</label>
<button class="btn btn-outline" onclick="scanUploadDir()">🔍 Scan</button>
</div>
<!-- Scan results -->
<div id="ul-scan-msg" class="muted" style="font-size:12px"></div>
<div id="ul-filelist-table-wrap" style="display:none;margin-top:8px">
<table>
<thead><tr><th>#</th><th>File</th><th>Size</th><th>Full path</th></tr></thead>
<tbody id="ul-filelist-tbody"></tbody>
</table>
<div id="ul-scan-summary" style="padding:8px 12px;font-size:12px;color:var(--c-muted);border-top:1px solid var(--c-border)"></div>
</div>
</div>
</div>
<!-- ── Upload options ───────────────────────────────────────────── -->
<div id="ul-options-wrap" class="box" style="display:none;margin-bottom:16px">
<div class="box-header"><span class="box-title">Upload options</span></div>
<div class="box-pad" style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px;align-items:end">
<div class="form-row" style="margin:0">
<label>Concurrency</label>
<div style="display:flex;align-items:center;gap:8px">
<input id="ul-concurrency" type="range" min="1" max="16" value="4"
style="flex:1" oninput="document.getElementById('ul-conc-val').textContent=this.value">
<span id="ul-conc-val" style="min-width:18px;font-weight:600">4</span>
</div>
<div style="font-size:11px;color:var(--c-muted);margin-top:4px">max parallel uploads in flight (1–16; ingest forced to 1)</div>
</div>
<div class="form-row" style="margin:0">
<label>Repository sub-path</label>
<input id="ul-ingest-path" value="upload" placeholder="upload"
style="width:100%;padding:6px 10px;border:1px solid var(--c-border);border-radius:var(--radius);font-size:13px">
<div style="font-size:11px;color:var(--c-muted);margin-top:4px">/cvmfs/<repo>/<sub-path>/<stem></div>
</div>
<div class="form-row" style="margin:0">
<label>Method</label>
<select id="ul-method" style="width:100%;padding:6px 10px;border:1px solid var(--c-border);border-radius:var(--radius);font-size:13px" onchange="onUlMethodChange()">
<option value="bits">bits (REST API)</option>
<option value="ingest">ingest (native)</option>
</select>
<div id="ul-method-hint" style="font-size:11px;color:var(--c-muted);margin-top:4px">cvmfs-prepub at :8080</div>
</div>
</div>
<div style="padding:0 16px 16px;display:flex;gap:10px;align-items:center;flex-wrap:wrap">
<button id="ul-run-btn" class="btn btn-primary" onclick="runUploadFilelist()">▶ Start Upload</button>
<button id="ul-abort-btn" class="btn btn-danger" onclick="abortUpload()" style="display:none">⏹ Stop</button>
<span id="ul-running-badge" style="display:none" class="badge info">⏳ running…</span>
<span id="ul-done-badge" style="display:none"></span>
<button id="ul-retry-btn" class="btn btn-outline" onclick="retryFailedUploads()" style="display:none;border-color:var(--c-danger);color:var(--c-danger)">↺ Retry failed</button>
</div>
</div>
<!-- ── SSE output console ────────────────────────────────────────── -->
<div id="ul-output-wrap" class="box" style="display:none">
<div class="box-header">
<span class="box-title">Output</span>
<button class="btn btn-outline btn-sm" onclick="$('ul-output-wrap').style.display='none'">✕</button>
</div>
<div class="box-pad" style="padding:0">
<div id="ul-output" class="term" style="max-height:400px;border-radius:0 0 var(--radius) var(--radius)"></div>
</div>
</div>
</div>
<!-- ═══════════════════════════ STATUS ════════════════════════════════ -->
<!-- ═══════════════════════════ SETTINGS ════════════════════════════════ -->
<div id="tab-measurements" class="tab-content">
<div class="page-title">Measurements</div>
<div class="page-sub">Recorded bulk-upload runs (bits vs ingest). Tick rows to compare; delete to prune. Recorded by the Upload tab.</div>
<div class="box" style="margin-bottom:16px">
<div class="box-header">
<span class="box-title">Recorded runs</span>
<span style="display:flex;gap:8px">
<button class="btn btn-outline" onclick="refreshMeasurements()">↻ Refresh</button>
<button class="btn btn-danger" onclick="deleteMeasurements()">🗑 Delete selected</button>
</span>
</div>
<div class="box-pad" style="padding:0">
<table>
<thead><tr>
<th style="width:28px"><input type="checkbox" onchange="toggleMeasAll(this)"></th>
<th>When (UTC)</th><th>Method</th><th>Label</th>
<th style="text-align:right">Files</th><th style="text-align:right">Raw</th>
<th style="text-align:right">Stored</th><th style="text-align:right">Total</th><th>Clean</th>
</tr></thead>
<tbody id="meas-tbody"><tr><td colspan="9" class="muted" style="padding:12px">Loading…</td></tr></tbody>
</table>
</div>
</div>
<div class="box">
<div class="box-header"><span class="box-title">Comparison</span></div>
<div class="box-pad">
<div id="meas-plot-hint" class="muted" style="font-size:13px">Select one or more runs above to plot a comparison.</div>
<div style="position:relative;height:320px"><canvas id="chart-meas-cmp"></canvas></div>
</div>
</div>
</div>
<div id="tab-settings" class="tab-content">
<div class="page-title">Settings</div>
<div class="page-sub">Endpoint configuration — persisted in localStorage.</div>
<div id="settings-server-info" class="alert alert-ok" style="display:none">
✓ Running via testbed-server.py — all internal services are proxied automatically.
The settings below override the proxy targets only if you need non-default ports.
</div>
<div id="settings-direct-info" class="alert alert-warn">
Running in direct mode. CORS may block API calls. Start <code>./testbed.sh server</code>
on the testbed host for full functionality, including remote access and command execution.
</div>
<div class="box box-pad">
<div style="display:grid;grid-template-columns:1fr 1fr;gap:16px">
<div class="form-row"><label>cvmfs-prepub API</label><input id="cfg-prepub" placeholder="http://localhost:8080"></div>
<div class="form-row"><label>Gateway</label><input id="cfg-gateway" placeholder="http://localhost:4929"></div>
<div class="form-row"><label>Stratum 0</label><input id="cfg-stratum0" placeholder="http://localhost:8090"></div>
<div class="form-row"><label>Repository name</label><input id="cfg-repo" placeholder="test.cvmfs.io"></div>
<div class="form-row"><label>Stratum 1-A control</label><input id="cfg-s1a" placeholder="http://localhost:9101"></div>
<div class="form-row"><label>Stratum 1-B control</label><input id="cfg-s1b" placeholder="http://localhost:9102"></div>
</div>
<div class="form-row"><label>Bearer token (prepub API)</label><input id="cfg-token" type="password" placeholder="PREPUB_API_TOKEN from .env"></div>
<div class="form-row"><label>Console name / environment label</label><input id="cfg-consoleName" placeholder="e.g. Production · LHCb · Testbed (shown in header)"><div class="form-hint">Leave empty to hide the label. Names containing "prod" show red; "test" green; "dev" orange; others purple.</div></div>
<div style="display:flex;gap:8px;margin-top:4px">
<button class="btn btn-primary" onclick="saveSettings()">💾 Save</button>
<button class="btn btn-outline" onclick="resetSettings()">Reset to defaults</button>
</div>
<div id="cfg-saved" style="color:var(--c-accent);font-size:12px;margin-top:8px;display:none">✓ Saved.</div>
</div>
</div>
</div><!-- #main -->
</div><!-- #layout -->
<!-- ═══════════════════ Directory picker modal ═══════════════ -->
<div id="dir-picker-modal">
<div id="dir-picker-box">
<div id="dir-picker-header">
<button class="btn btn-outline btn-sm" onclick="dpNavUp()" id="dp-up-btn" title="Go up">↑ Up</button>
<span id="dir-picker-path" class="mono">/</span>
<button class="btn btn-outline btn-sm" onclick="closeDirPicker()">✕</button>
</div>
<div id="dir-picker-list"><div class="loading"><span class="spinner"></span></div></div>
<div id="dir-picker-footer">
<span id="dir-picker-current" class="mono">—</span>
<button class="btn btn-primary btn-sm" onclick="dpSelectCurrent()">Select</button>
<button class="btn btn-outline btn-sm" onclick="closeDirPicker()">Cancel</button>
</div>
</div>
</div>
<!-- ═══════════════════ Token auth dialog ═══════════════════ -->
<div id="token-dialog" style="display:none;position:fixed;inset:0;background:rgba(0,0,0,.7);z-index:9999;align-items:center;justify-content:center">
<div style="background:var(--c-surface);border:1px solid var(--c-border);border-radius:10px;padding:32px 36px;max-width:440px;width:90%;box-shadow:0 8px 32px rgba(0,0,0,.5)">
<div style="font-size:18px;font-weight:700;margin-bottom:8px">🔒 Authentication required</div>
<p style="color:var(--c-muted);font-size:13px;margin-bottom:20px">
This testbed console is protected. Paste the secret token printed by
<code style="color:var(--c-info)">./testbed.sh server</code> at startup.
</p>
<input id="token-input" type="password" placeholder="Paste token here…"
style="width:100%;padding:10px 12px;font-family:var(--mono);font-size:13px;border:1px solid var(--c-border);border-radius:6px;background:var(--c-bg);color:var(--c-text);box-sizing:border-box;margin-bottom:16px"
onkeydown="if(event.key==='Enter') applyDialogToken()">
<div style="display:flex;gap:10px;justify-content:flex-end">
<button class="btn btn-outline" onclick="document.getElementById('token-dialog').style.display='none'">Cancel</button>
<button class="btn btn-primary" onclick="applyDialogToken()">Connect</button>
</div>
</div>
</div>
<script type="module">
'use strict';