summaryrefslogtreecommitdiffstats
path: root/.github/scripts/tests/templates/summary.html
blob: 8d5b57aa139997719a486efb05f31a15555f418b (plain) (blame)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
<html>
<head>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism-themes/1.9.0/prism-vs.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-c.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-cpp.min.js"></script>
    <style>
        body {
            font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            width: 100%;
        }
        h1 { 
            font-size: 20px; 
        }
        .report-header {
            background-color: #f6f8fa;
            border: 1px solid #d0d7de;
            border-radius: 6px;
            padding: 16px;
            margin: 16px 0;
        }
        .report-header h2 {
            margin: 0 0 8px 0;
            font-size: 16px;
            font-weight: 600;
        }
        .report-header p {
            margin: 4px 0;
            font-size: 14px;
        }
        .report-header a {
            color: #0969da;
            text-decoration: none;
        }
        .report-header a:hover {
            text-decoration: underline;
        }
        th {
            text-transform: uppercase;
        }

        th, td {
            padding: 5px;
            word-break: break-word; /* Allow breaking long words */
            font-size: 14px;
            min-width: 80px;
        }
        td.test_name{
            min-width: 72.5vw;
            max-width: 72.5vw;
        }
        td.test_name.with_history{
            min-width: 62vw;
            max-width: 62vw;
        }

        table {
            border-collapse: collapse;
            width: 100%;
            left: 5;
        }

        span.test_status {
            font-weight: bold;
        }

        span.test_fail {
            color: red;
        }

        span.test_pass {
            color: green;
        }

        span.test_mute {
            color: blue;
        }
        
        span.test_fail_sanitizer {
            color: #ff4500;  /* Dark orange to distinguish from regular red */
            background-color: #fff5ee;  /* Light orange background */
            padding: 2px 4px;
            border-radius: 3px;
            border-left: 3px solid #ff4500;
        }
        
        span.test_error_sanitizer {
            color: #ff4500;  /* Dark orange to distinguish from regular red */
            background-color: #fff5ee;  /* Light orange background */
            padding: 2px 4px;
            border-radius: 3px;
            border-left: 3px solid #ff4500;
        }
        .issue-button {
            display: inline-block;
            background-color: #f6f8fa;
            border: 1px solid #d0d7de;
            border-radius: 6px;
            color: #0969da;
            padding: 2px 6px;
            font-size: 11px;
            font-weight: 500;
            text-decoration: none;
            margin-left: 8px;
            cursor: pointer;
            transition: background-color 0.2s, border-color 0.2s;
        }

        .issue-button:hover {
            background-color: #f3f4f6;
            border-color: #d0d7de;
            text-decoration: none;
        }

        .success-rate-button {
            background-color: #0366d6;
            color: white;
            border: none;
            padding: 4px 8px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 11px;
            font-weight: 500;
            white-space: nowrap;
            min-width: 0;
        }
        .success-rate-button:hover {
            background-color: #0256cc;
        }
        .emoji {
            font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
            font-style: normal;
            font-variant: normal;
            font-weight: normal;
            line-height: 1;
            display: inline-block;
            vertical-align: middle;
        }

        .button {
            display: inline-flex;
            align-items: center;
            justify-content: left;
            padding: 4px;
            border: none;
            background: none;
            cursor: pointer;
            position: relative;
        }

        .button svg {
            fill: #4b535c;
            fill-rule: evenodd;
        }

        .button svg:hover {
            fill: #0366d6;
            fill-rule: evenodd;
        }

        .button-group {
            display: inline-flex;
            float: right;
            align-items: center;
            position: relative; /* Added for positioning the dropdown */
            white-space: nowrap;
        }

        .button-group > button {
            margin-left: 5px;
            padding: 4px 8px;
            border: none;
            background: none;
            cursor: pointer;
            white-space: nowrap;
        }

        .button-group > button svg {
            fill: #4b535c;
            fill-rule: evenodd;
        }

        .button-group > button svg:hover {
            fill: #0366d6;
            fill-rule: evenodd;
        }

        .button-group  .icon-container .show_history_svg {
            fill: #ffffff;
            stroke: #000;
            stroke-width: 2.5;
            fill-rule: evenodd;
         }

        .button-group  .icon-container .show_history_svg:hover {
            stroke: #0366d6;
         }

        .button-group .button-text {
            color: #4b535c;
        }
        .button-group .button-text:hover {
            color: #0366d6;
        }

        .button-group .dropdown {
            display: none; /* Hide the dropdown by default */
            position: absolute;
            top: 100%;
            right: 0;
            background-color: white;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            padding: 8px;
            z-index: 10; /* Ensure the dropdown is above other content */
            width: 160;
        }

        .button-group .dropdown.show {
            display: block; /* Show the dropdown when active */
        }

        .button-group .dropdown > button {
            display: table; /* Make each button in the dropdown take up full width */
            margin-bottom: 3px; /* Add spacing between dropdown buttons */
        }
        .button-group button .icon-container {
            display: inline-block; /* Align SVG with text */
            vertical-align: middle; /* Center SVG vertically */
            margin-right: 3px; /* Add spacing between SVG and text */
        }

        .button-group button .button-text {
            margin-left: 5px; /* Add spacing between icon and text */
            cursor: pointer; /* Make text clickable */
            
        }
        .button-group button::after { /* Target the "Copy" button specifically */
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            background-color: #7d7d92; /* Same as your tooltip background */
            color: white;
            padding: 2px 5px;
            border-radius: 3px;
            visibility: hidden; /* Hide by default */
            opacity: 0;
            transition: visibility 0.2s, opacity 0.2s;
        }

        .button-group button:hover::after {
            visibility: visible;
            opacity: 1;
        }

        .tooltip {
            visibility: hidden;
            max-width: 340px;
            min-width: 260px;
            word-break: break-word;
            background-color: #7d7d92;
            color: #fff;
            text-align: left;
            border-radius: 5px;
            padding: 5px;
            position: absolute;
            z-index: 3;
            bottom: 100%; /* Positioned above the svg icon */
            left: 50%; /* Center the tooltip */
            margin-left: -95px; /* Use negative margin to actually center the tooltip */
            opacity: 0;
            transition: opacity 0.3s;
            overflow: hidden;
            white-space: nowrap; /* Don't forget this one */
            text-overflow: ellipsis;
        }

        .tooltip::after {
            content: "";
            position: absolute;
            top: 100%; /* Arrow will be positioned at the bottom of the tooltip */
            left: 50%;
            margin-left: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: #7d7d92 transparent transparent transparent; /* Arrow color */
        }

        .tooltip.visible {
            visibility: visible;
            opacity: 1;
        }
  
        table > tbody > tr > td:nth-child(2),
        table > tbody > tr > td:nth-child(3),
        table > tbody > tr > td:nth-child(4) {
            text-align: left;
        }
        
        /* Status column styling */
        th.status-column,
        td.status-column {
            width: 60px;
            min-width: 50px;
            max-width: 60px;
            text-align: center;
        }
        
        /* Ensure status text is centered */
        td.status-column span.test_status {
            display: inline-block;
            width: 100%;
            text-align: center;
        }
    
        .collapsible-content {
            display: table-row-group;
            position: absolute;
            top: -9999px;
            left: -9999px;
            height: 0;
            overflow: hidden;
        }
    
        .collapsible-content.active {
            position: relative;
            top: 0;
            left: 5;
            height: auto;
        }

        .collapsible-header {
            cursor: pointer;
            background-color: #f2f2f2;
            padding: 10px;
            border: 1px solid #ddd;
            margin-bottom: 5px;
        }

        .toggle-visibility-buttons {
            margin-bottom: 10px;
            overflow:hidden;
            float: right;
        }

        .error-button {
            border: none;
            cursor: pointer;
            background: url("data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjM0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIzNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOC41OSAxNi4zNGw0LjU4LTQuNTktNC41OC00LjU5TDEwIDUuNzVsNiA2LTYgNnoiLz48L3N2Zz4=") no-repeat 50% 50% / 1em 1em;
            width: 1em;
            height: 1em;  
            content: "";
            transition: transform .5s;
        }

        pre>code[class*=language-] {
            font-size: x-small;
        }

        .console-frame {
            font-size: x-small;
            display: grid;
            border-radius: 4px;
            overscroll-behavior: none;
            background: #ddd;
            padding: 5px;
            color: #f1f2f3;
            overflow-y: auto;
            font-family: monospace;
            word-break: keep-all;
            font-size: x-small;
        }

        .console-frame::-webkit-scrollbar {
            width: 10px;
        }

        .console-frame::-webkit-scrollbar-track {
            background: #c5c6c8;
        }

        .console-frame::-webkit-scrollbar-thumb {
            background: #838485;
            border-radius: 4px;
        }
        pre[class*=language-] {
            padding: 1em;
            margin: 0;
            overflow: auto;
        }

        /* Modal window styles */
        #errorModal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0,0,0,0.5);
        }
    
        .modal-content {
            background-color: #fefefe;
            margin: 5% auto;
            padding: 20px;
            border: 1px solid #888;
            width: 80%;
            border-radius: 5px;
            max-height: 80vh;
            overflow-y: auto;
            position: relative;
        }
    
        .close-modal {
            color: #aaa;
            font-size: 28px;
            font-weight: bold;
            cursor: pointer;
            position: absolute;
            top: 15px;
            right: 20px;
            line-height: 1;
            padding: 0;
            z-index: 1;
        }
        .close-modal:hover {
            color: #000;
        }
        
        .modal-header {
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
            font-size: smaller;
        }
        
        .modal-info {
            font-size: small;
            margin-bottom: 15px;
            line-height: 1.5;
        }
        
        .modal-info-item {
            margin-bottom: 5px;
        }
        
        .modal-info-label {
            font-weight: bold;
            display: inline-block;
            width: 80px;
        }
        
        /* Success rate modal styles */
        #successRateModal {
            display: none;
            position: fixed;
            z-index: 1000;
            inset: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            background-color: rgba(0,0,0,0.5);
            padding: 16px;
            box-sizing: border-box;
        }
        #successRateModal .modal-content {
            width: min(1200px, 90vw);
            max-width: 90vw;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            margin: 2% auto;
            position: relative;
        }
        #successRateModal .modal-header {
            flex-shrink: 0;
        }
        #successRateModalTitle {
            font-size: 14px;
            word-break: break-word;
        }
        #successRateModalContent {
            overflow-y: auto;
            overflow-x: hidden;
            flex: 1 1 auto;
            min-height: 0;
            padding-right: 10px;
        }
        #successRateModalContent::-webkit-scrollbar {
            width: 8px;
        }
        #successRateModalContent::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 4px;
        }
        #successRateModalContent::-webkit-scrollbar-thumb {
            background: #888;
            border-radius: 4px;
        }
        #successRateModalContent::-webkit-scrollbar-thumb:hover {
            background: #555;
        }
        .sr-runs {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
        }
        .sr-runs span[data-tooltip] {
            position: relative;
        }
        .sr-runs span[data-tooltip]:hover::after {
            content: attr(data-tooltip);
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            background-color: #333;
            color: white;
            padding: 6px 10px;
            border-radius: 4px;
            font-size: 12px;
            white-space: nowrap;
            z-index: 1000;
            margin-bottom: 5px;
            pointer-events: none;
            opacity: 1;
            transition: opacity 0.1s;
            box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        }
        .sr-runs span[data-tooltip]:hover::before {
            content: '';
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            border: 5px solid transparent;
            border-top-color: #333;
            z-index: 1001;
            margin-bottom: -5px;
            pointer-events: none;
        }
        .sr-table-wrap {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            max-width: 100%;
            margin: 0 -4px;
            padding: 0 4px;
        }
        .sr-table-wrap table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 15px;
        }
        .sr-table-wrap thead th {
            background-color: #f6f8fa;
            border-bottom: 2px solid #d0d7de;
            padding: 10px;
            text-align: left;
        }
        .sr-table-wrap tbody td {
            padding: 10px;
            border-bottom: 1px solid #d0d7de;
        }
        .sr-table-wrap tbody tr:last-child td {
            border-bottom: none;
        }
</style>
<script>
    function findParentBySelector(elm, selector) {
        var all = document.querySelectorAll(selector);
        var cur = elm.parentNode;
        while(cur && !collectionHas(all, cur)) { //keep going up until you find a match
            cur = cur.parentNode; //go up
        }
        return cur; //will return null if not found
    }

    function collectionHas(a, b) { //helper function (see below)
        for(var i = 0, len = a.length; i < len; i ++) {
            if(a[i] == b) return true;
        }
        return false;
    }

    function copyTestNameToClipboard(text) {
        const cmdArg = getTestRunCommand(text);
        if (!cmdArg) return;

        console.log(cmdArg);

        navigator.clipboard.writeText(cmdArg).then(
            () => {
                console.log("Copied!");
                showCopiedTooltip();
            },
            () => {
                console.error("Unable to copy %o to clipboard", cmdArg);
            }
        );
    }
    function copyTestNameForMuteToClipboard(text) {
        const parsed = parseTestName(text);
        if (!parsed) return;
        
        const [path, testName] = parsed;
        const cmdArg = `${path} ${testName}`;

        console.log(cmdArg);

        navigator.clipboard.writeText(cmdArg).then(
            () => {
                console.log("Copied!");
                showCopiedTooltip();
            },
            () => {
                console.error("Unable to copy %o to clipboard", cmdArg);
            }
        );
    }

    // Configuration constants
    const MAX_URL_LENGTH = 8000; // GitHub URL limit is 8201, stay under 8000 to be safe
    const GITHUB_ISSUE_BASE_URL = "https://github.com/ydb-platform/ydb/issues/new"; // Base URL for GitHub issues

    // Utility functions
    function buildGitHubIssueUrl(title, body, labels) {
        // Body is already partially encoded (contains %0A for newlines, etc.)
        // Title and labels need to be encoded, but body is already encoded
        return GITHUB_ISSUE_BASE_URL + "?title=" + encodeURIComponent(title) + "&body=" + body + "&labels=" + encodeURIComponent(labels) + "&type=Bug";
    }

    // Show tooltip stub to avoid runtime errors (visual feedback provided by icon swap)
    function showCopiedTooltip() {}

    // Safe percent-encoded truncation helpers
    function isDecodable(s) {
        try { decodeURIComponent(s); return true; } catch (e) { return false; }
    }

    function safeTruncateEncoded(encoded, maxLen) {
        if (encoded.length <= maxLen) return encoded;
        let cut = encoded.slice(0, maxLen);
        // Remove incomplete % sequence at the tail
        cut = cut.replace(/%(?:[0-9A-Fa-f]{0,2})$/, '');
        while (cut && !isDecodable(cut)) {
            if (/%[0-9A-Fa-f]{2}$/.test(cut)) cut = cut.slice(0, -3);
            else cut = cut.slice(0, -1);
        }
        return cut;
    }

    function parseTestName(full_name) {
        const trimmed = full_name.trim();
        let pieces;
        
        if (trimmed.includes('.py.')) {
            pieces = /(.+)\/(.*py.*[^\/]+)$/.exec(trimmed);
        } else {
            pieces = /(.+)\/([^$]+)$/.exec(trimmed);
        }

        if (!pieces) {
            console.error("Unable to split path/test name from %o", trimmed);
            return null;
        }
        
        return [pieces[1], pieces[2]];
    }

    // Bash/zsh: wrap in single quotes; embedded ' becomes '\'' (close quote, escaped quote, reopen).
    function bashSingleQuote(s) {
        return "'" + s.replace(/'/g, "'\\''") + "'";
    }

    function formatTestCommand(path, testName) {
        const namePieces = testName.split('.');
        let filterName = testName;
        if (namePieces.length === 2) {
            filterName = namePieces[0] + '::' + namePieces[1];
        } else if (namePieces.length > 2) {
            filterName = namePieces[0] + '.' + namePieces[1] + '::' + namePieces.slice(2).join('::');
        }

        return `./ya make -ttt {{ build_preset_params }} -F ${bashSingleQuote(filterName)} ${path}`;
    }

    function getTestRunCommand(test) {
        const parsed = parseTestName(test);
        if (!parsed) return "";
        
        const [path, testName] = parsed;
        return formatTestCommand(path, testName);
    }

    function getOwnerAreaLabel(owner) {
        const ownerMapping = {{ owner_area_mapping | tojson }};
        return ownerMapping[owner] || "";
    }

    function buildLabels(issueType, buildPreset, ownerAreaLabel) {
        let labels = [];
        
        if (issueType === 'mute') {
            labels.push('mute');
        } else {
            labels.push('bug');
            
            if (issueType === 'sanitizer') {
                labels.push('sanitizer');
                
                if (buildPreset.includes("asan")) {
                    labels.push("asan");
                } else if (buildPreset.includes("msan")) {
                    labels.push("msan");
                } else if (buildPreset.includes("tsan")) {
                    labels.push("tsan");
                }
            }
        }
        
        if (ownerAreaLabel) {
            labels.push(ownerAreaLabel);
        }
        
        return labels.join(',');
    }

    // Encode each '/'-separated segment with encodeURIComponent; '/' stays a separator
    // (so '+' in a test name becomes %2B, not a space).
    function encodePathSegmentsForUrl(path) {
        return path.split('/').map(function(part) {
            return encodeURIComponent(part);
        }).join('/');
    }

    // Same as encodePathSegmentsForUrl, then double '%' for values embedded in the
    // GitHub issue-creation URL body=... (GitHub decodes once; %252B → %2B in markdown).
    function encodePathForBodyUrl(path) {
        return encodePathSegmentsForUrl(path).replace(/%/g, '%25');
    }

    function buildIssueBody(issueType, path, testName, buildPreset, branch, commitSha, testRunCommand, owner, successRates, logUrls, errorText, reportUrl) {
        let body = encodeURIComponent(path) + "/" + encodeURIComponent(testName) + "%0A%0A";
        
        // Add type-specific header
        if (issueType === 'sanitizer') {
            // No header for sanitizer issues as requested
        } else if (issueType === 'mute') {
            body += "**Test mute request**%0A%0A";
        } else {
            body += "**Test Failure**%0A%0A";
        }
        
        // Build information
        body += "**Build Information:**%0A";
        if (commitSha && commitSha !== "") {
            body += "- Version: " + encodeURIComponent(commitSha) + "%0A";
        }
        body += "- Build Preset: " + encodeURIComponent(buildPreset) + "%0A";
        body += "- Branch: " + encodeURIComponent(branch) + "%0A%0A";
        
        // Report link (if available)
        // Always include report link if reportUrl is provided, even if it's a local file:// URL
        if (reportUrl && reportUrl.trim() !== "") {
            // Encode the URL part of the markdown link to prevent special characters (like #) from breaking the link
            // when the body is used as a URL parameter. This matches the pattern used for other URLs in the body.
            body += "**Test Report:** [View report](" + encodeURIComponent(reportUrl) + ")%0A%0A";
        } else {
            // Log warning if reportUrl is missing
            console.warn('reportUrl is empty or undefined in buildIssueBody, Test Report link will not be included');
        }
        
        // Run command
        body += "**Run Command:**%0A```%0A" + encodeURIComponent(testRunCommand) + "%0A```%0A%0A";
        
        // Owner
        body += "**Owner:** [TEAM:@ydb-platform/" + owner + "](https://github.com/orgs/ydb-platform/teams/" + owner + ")%0A%0A";
        
        // Success rate (for all issue types)
        if (successRates) {
            body += "**Success rate (last 4 days):**%0A";
            const parts = [];
            if (successRates.other) {
                parts.push(branch.toUpperCase() + ": " + successRates.other.rate + "%25 (" + successRates.other.passed + "/" + successRates.other.total + ")");
            }
            if (successRates.pr_check) {
                parts.push("PR-Check: " + successRates.pr_check.rate + "%25 (" + successRates.pr_check.passed + "/" + successRates.pr_check.total + ")");
            }
            if (parts.length > 0) {
                body += parts.join(" | ") + "%0A%0A";
            } else {
                body += "No history data available%0A%0A";
            }
        }
        
        // Always include test run history link
        body += "**Test run history:** [link](https://datalens.yandex/34xnbsom67hcq?branch=" + encodeURIComponent(branch) + "%26full_name=" + encodePathForBodyUrl(path + "/" + testName) + "%26build_type=" + encodeURIComponent(buildPreset) + ")%0A%0A";
        
        // Always include report link
        body += "More info in [dashboard](https://datalens.yandex/4un3zdm0zcnyr)%0A%0A";
        
        return body;
    }

    function buildBodyWithLengthLimit(baseBody, logUrls, errorText, title, labels, maxUrlLength) {
        let body = baseBody;
        
        // Add logs first
        if (logUrls && Object.keys(logUrls).length > 0) {
            let logsSection = "**Logs:**%0A";
            for (const [logName, logUrl] of Object.entries(logUrls)) {
                logsSection += "- [" + encodeURIComponent(logName) + "](" + encodeURIComponent(logUrl) + ")%0A";
            }
            logsSection += "%0A";
            body += logsSection;
        }
        
        // Try to add error text, checking actual URL length
        if (errorText && errorText.trim() !== "") {
            const errorPrefix = "**Error Summary:**%0A```%0A";
            const errorSuffix = "%0A```%0A%0A";
            const tooLongMsg = "**Error Summary:**%0A```%0A_Error text is too long to include automatically. Please copy the error text from the test report and paste it here manually._%0A```%0A%0A";
            
            const fullErrorText = errorText.trim();
            const encodedFullError = encodeURIComponent(fullErrorText);

            // Compute minimal overhead URL length (without error content)
            const minimalSection = errorPrefix + errorSuffix;
            const minimalUrl = buildGitHubIssueUrl(title, body + minimalSection, labels);
            
            // Check if we can add the full error text
            if (minimalUrl.length <= maxUrlLength) {
                const allowedDelta = maxUrlLength - minimalUrl.length;
                if (encodedFullError.length <= allowedDelta) {
                    // Error text fits, include it fully
                    body += errorPrefix + encodedFullError + errorSuffix;
                    return body;
                }
            }
            
            // Error text doesn't fit or minimal section doesn't fit - try to add message instead
            const urlWithMsg = buildGitHubIssueUrl(title, body + tooLongMsg, labels);
            if (urlWithMsg.length <= maxUrlLength) {
                body += tooLongMsg;
            }
            // If even the message doesn't fit, we skip it entirely
        }
        
        return body;
    }

    function createIssueGeneric(issueType, test, owner, successRates, is_sanitizer, errorText, logUrls = {}) {
        const parsed = parseTestName(test);
        if (!parsed) return;
        
        const [path, testName] = parsed;
        
        // Get build preset and other contextual information
        const buildPreset = "{{ build_preset }}";
        const branch = "{{ branch }}";
        const commitSha = "{{ commit_sha }}";
        const testRunCommand = getTestRunCommand(test);
        const ownerAreaLabel = getOwnerAreaLabel(owner);
        
        // Get report URL - use current page URL (the report page itself)
        const reportUrl = window.location.href;
        
        // Log warning if reportUrl is empty (shouldn't happen in normal browser context)
        if (!reportUrl || reportUrl.trim() === "") {
            console.warn('Warning: reportUrl is empty, Test Report link will not be included');
        }
        
        // Determine issue type based on parameters
        let actualIssueType = issueType;
        if (is_sanitizer && issueType === 'bug') {
            actualIssueType = 'sanitizer';
        }
        
        // Create title based on issue type
        // Don't encode here - encoding will be done in buildGitHubIssueUrl
        let title;
        if (actualIssueType === 'sanitizer') {
            title = "Sanitizer error in " + path + "/" + testName;
        } else if (actualIssueType === 'mute') {
            title = "Mute test " + path + "/" + testName;
        } else {
            title = "Test failure in " + path + "/" + testName;
        }
        
        // Build body
        const body = buildIssueBody(actualIssueType, path, testName, buildPreset, branch, commitSha, testRunCommand, owner, successRates, logUrls, errorText, reportUrl);
        
        // Build labels
        const labels = buildLabels(actualIssueType, buildPreset, ownerAreaLabel);
        
        // Build body with exact length limit checking
        const finalBody = buildBodyWithLengthLimit(body, logUrls, errorText, title, labels, MAX_URL_LENGTH);
        
        // Create final URL and open
        const finalUrl = buildGitHubIssueUrl(title, finalBody, labels);
        window.open(finalUrl, '_blank');
    }

    function createIssue(test, owner, successRates, is_sanitizer, errorText, logUrls = {}) {
        createIssueGeneric('bug', test, owner, successRates, is_sanitizer, errorText, logUrls);
    }

    function createMuteIssue(test, owner, successRates, errorText = '', logUrls = {}) {
        createIssueGeneric('mute', test, owner, successRates, false, errorText, logUrls);
    }

    function openHistory(test) {
        const full_name = test.trim();
        const buildPreset = "{{ build_preset }}";
        const branch = "{{ branch }}";
        let url = "https://datalens.yandex/34xnbsom67hcq?branch=" + encodeURIComponent(branch) + "&full_name=" + encodePathSegmentsForUrl(full_name) + "&build_type=" + encodeURIComponent(buildPreset);
        window.open(url, '_blank');
    }

    // Function to display test information in a modal window
    function showTestInfo(testInfo) {
        const modal = document.getElementById('errorModal');
        const modalTitle = document.getElementById('modalTitle');
        const modalStatus = document.getElementById('modalStatus');
        const modalDate = document.getElementById('modalDate');
        const modalSha = document.getElementById('modalSha');
        const modalJob = document.getElementById('modalJob');
        const modalErrorContent = document.getElementById('modalErrorContent');

        // Fill in the information
        modalTitle.textContent = 'Test details: ' + testInfo.testName;
        modalStatus.textContent = testInfo.status;
        modalDate.textContent = testInfo.date;
        
        // Update the job run link
        const jobLink = document.getElementById('modalJobLink');
        jobLink.href = `https://github.com/ydb-platform/ydb/actions/runs/${testInfo.job_id}`;
        jobLink.textContent = testInfo.job_name;
        // Update the commit link
        const shaLink = document.getElementById('modalShaLink');
        shaLink.href = `https://github.com/ydb-platform/ydb//commit/${testInfo.commit}`;
        shaLink.textContent = testInfo.commit.substring(0, 8);
        
        // Status class
        modalStatus.className = '';
        if (testInfo.status === 'passed') {
            modalStatus.classList.add('test_pass');
        } else if (testInfo.status === 'failure') {
            modalStatus.classList.add('test_fail');
        } else if (testInfo.status === 'mute') {
            modalStatus.classList.add('test_mute');
        }
        
        // Error text handling
        if (testInfo.errorText && testInfo.errorText.trim() !== "") {
            document.getElementById('modalErrorSection').style.display = 'block';
            modalErrorContent.textContent = testInfo.errorText;
            
            // Determine language for syntax highlighting
            modalErrorContent.className = 'language-' + (testInfo.testName.includes('.py') ? 'python' : 'cpp');
            
            // Activate syntax highlighting
            if (typeof Prism !== 'undefined') {
                Prism.highlightElement(modalErrorContent);
            }
        } else {
            document.getElementById('modalErrorSection').style.display = 'none';
        }
        
        // Show the modal window
        modal.style.display = 'block';
    }
    
    function toggleAllTables(action) {
        const contents = document.querySelectorAll('.collapsible-content');
        if (action === 'expand') {
            contents.forEach(content => content.classList.add('active'));
        } else if (action === 'collapse') {
            contents.forEach(content => content.classList.remove('active'));
        }
    }
    function ButtonIconsClick(button){
        button.addEventListener('click', function() {
                const iconContainer = button.querySelector('.icon-container');
                const initialIcon = iconContainer.querySelector('svg:first-child');
                const doneIcon = iconContainer.querySelector('svg:last-child');

                // Swap icon visibility
                initialIcon.style.display = 'none'; 
                doneIcon.style.display = 'block';

                // You can add any additional actions here, like:
                // - Disabling the button
                // - Changing the button's title
                // - Triggering other effects
            });
         
    }
    
    document.addEventListener("DOMContentLoaded", function() {
        let openDropdown = null; // Track the currently open dropdown

        const buttonGroups = document.querySelectorAll(".button-group");
        buttonGroups.forEach(buttonGroup => {
            const dropdown = buttonGroup.querySelector('.dropdown');
            const toggleButton = buttonGroup.querySelector('button:first-child'); // The "..." button

            toggleButton.addEventListener('click', function() {
                // Close any previously open dropdown
                if (openDropdown && openDropdown !== dropdown) {
                    openDropdown.classList.remove('show');
                }
                dropdown.classList.toggle('show');
                openDropdown = dropdown.classList.contains('show') ? dropdown : null;
                const iconContainer = dropdown.querySelectorAll('.icon-container');
                iconContainer.forEach(element=>{
                    const initialIcon = element.querySelector('svg:first-child');
                    const doneIcon = element.querySelector('svg:last-child');

                // Swap icon visibility
                initialIcon.style.display = 'block'; 
                doneIcon.style.display = 'none';
                });
            });
            
            // Close the dropdown when clicking outside of it
            document.addEventListener('click', function(event) {
                if (!event.target.closest('.button-group')) {
                    dropdown.classList.remove('show');
                    openDropdown = null;
                }
            });
            buttonGroup.querySelectorAll('.button-group .dropdown  .button').forEach(button => {
                ButtonIconsClick(button)
            });
        });

        document.addEventListener('keydown', function(event) {
            if ((event.ctrlKey && event.keyCode == 70) || (event.metaKey && event.keyCode == 70)) { 
                toggleAllTables('expand');
            }    
        });

        // SVG icons are no longer used - replaced with success rate button
        // History entries are now shown in success rate modal
        
        const copyButtons = document.querySelectorAll(".copy");
        copyButtons.forEach(button => {
            button.addEventListener('click', function(event) {
                event.preventDefault();
                copyTestNameToClipboard(findParentBySelector(event.target,'tr').querySelector('.test_name').querySelector('span').innerText);
            });
        });
        const muteButtons = document.querySelectorAll(".mute");
        muteButtons.forEach(button => {
            button.addEventListener('click', function(event) {
                event.preventDefault();
                copyTestNameForMuteToClipboard(findParentBySelector(event.target,'tr').querySelector('.test_name').querySelector('span').innerText);
            });
        });
        const historyButton = document.querySelectorAll(".open_history");
        historyButton.forEach(button => {
            button.addEventListener('click', function(event) {
                event.preventDefault();
                openHistory(findParentBySelector(event.target,'tr').querySelector('.test_name').querySelector('span').innerText);
            });
        });
        const createIssueButton = document.querySelectorAll(".create_issue");
        createIssueButton.forEach(button => {
            button.addEventListener('click', async function(event) {
                event.preventDefault();
                const testRow = findParentBySelector(event.target,'tr');
                const testName = testRow.querySelector('.test_name').querySelector('span').innerText;
                const owner = testRow.querySelector('.test_owner').innerText;
                
                // Get success rates from testSuccessRates (same data used for the button)
                let successRates = null;
                try {
                    if (Object.keys(testSuccessRates).length === 0) {
                        await getTestSuccessRates().catch((e) => {
                            console.warn('Failed to load success rates for issue creation:', e);
                        });
                    }
                    successRates = testSuccessRates[testName] || null;
                } catch (e) {
                    console.warn('Failed to load success rates for issue creation:', e);
                }
                
                // Check if this is a sanitizer issue by looking for the SANITIZER badge
                const is_sanitizer = testRow.querySelector('.test_name span[style*="background-color: #ff4500"]') !== null;
                
                // Get error text from the test description if available
                let errorText = '';
                const errorButton = testRow.querySelector('.error-button');
                if (errorButton && errorButton.nextElementSibling) {
                    const errorContent = errorButton.nextElementSibling.querySelector('pre code');
                    if (errorContent) {
                        errorText = errorContent.textContent;
                    }
                }
                
                // Extract log URLs from the test row
                let logUrls = {};
                const logCell = testRow.querySelector('td.log-column');
                if (logCell) {
                    const logLinks = logCell.querySelectorAll('a');
                    logLinks.forEach(link => {
                        const logName = link.textContent.trim();
                        const logUrl = link.href;
                        if (logName && logUrl) {
                            logUrls[logName] = logUrl;
                        }
                    });
                }

                createIssue(testName, owner, successRates, is_sanitizer, errorText, logUrls);
            });
        });
        
        const createMuteIssueButton = document.querySelectorAll(".create_mute_issue");
        createMuteIssueButton.forEach(button => {
            button.addEventListener('click', async function(event) {
                event.preventDefault();
                const testRow = findParentBySelector(event.target,'tr');
                const testName = testRow.querySelector('.test_name').querySelector('span').innerText;
                const owner = testRow.querySelector('.test_owner').innerText;
                
                // Get success rates from testSuccessRates (same data used for the button)
                let successRates = null;
                try {
                    if (Object.keys(testSuccessRates).length === 0) {
                        await getTestSuccessRates().catch((e) => {
                            console.warn('Failed to load success rates for issue creation:', e);
                        });
                    }
                    successRates = testSuccessRates[testName] || null;
                } catch (e) {
                    console.warn('Failed to load success rates for issue creation:', e);
                }
                
                // Get error text from the test description if available
                let errorText = '';
                const errorButton = testRow.querySelector('.error-button');
                if (errorButton && errorButton.nextElementSibling) {
                    const errorContent = errorButton.nextElementSibling.querySelector('pre code');
                    if (errorContent) {
                        errorText = errorContent.textContent;
                    }
                }
                
                // Extract log URLs from the test row
                let logUrls = {};
                const logCell = testRow.querySelector('td.log-column');
                if (logCell) {
                    const logLinks = logCell.querySelectorAll('a');
                    logLinks.forEach(link => {
                        const logName = link.textContent.trim();
                        const logUrl = link.href;
                        if (logName && logUrl) {
                            logUrls[logName] = logUrl;
                        }
                    });
                }

                createMuteIssue(testName, owner, successRates, errorText, logUrls);
            });
        });


        const headers = document.querySelectorAll(".collapsible-header");
        headers.forEach(header => {
            header.addEventListener('click', function() {
                const content = this.nextElementSibling;
                if (content.classList.contains('active')) {
                    content.classList.remove('active');
                } else {
                    content.classList.add('active');
                }
            });
        });

        document.getElementById('expand-all').addEventListener('click', function(event) {
             toggleAllTables('expand');
        });
        document.getElementById('collapse-all').addEventListener('click',  function(event) {
            toggleAllTables('collapse');
        });
        
        // Handler for closing modal windows
        document.querySelectorAll('.close-modal').forEach(closeBtn => {
            closeBtn.onclick = function(event) {
                event.stopPropagation();
                // Find parent modal
                let modal = this.closest('.modal');
                if (!modal) {
                    // Try to find by id
                    modal = document.getElementById('errorModal');
                    if (!modal) {
                        modal = document.getElementById('successRateModal');
                    }
                }
                if (modal) {
                    modal.style.display = 'none';
                }
            };
        });
        
        // Close on click outside the modal window
        window.onclick = function(event) {
            const errorModal = document.getElementById('errorModal');
            const successRateModal = document.getElementById('successRateModal');
            if (event.target == errorModal) {
                errorModal.style.display = 'none';
            }
            if (event.target == successRateModal) {
                successRateModal.style.display = 'none';
            }
        }
        
        // Close modals on Escape key - close only the topmost (last opened) modal
        document.addEventListener('keydown', function(event) {
            if (event.key === 'Escape' || event.keyCode === 27) {
                const errorModal = document.getElementById('errorModal');
                const successRateModal = document.getElementById('successRateModal');
                
                // Check which modal is currently visible (has display: block)
                // Close only the one that is visible, prioritizing errorModal (test details) if both are visible
                // errorModal (test details) is typically opened on top of successRateModal
                if (errorModal && errorModal.style.display === 'block') {
                    errorModal.style.display = 'none';
                } else if (successRateModal && successRateModal.style.display === 'block') {
                    successRateModal.style.display = 'none';
                }
            }
        });
        
        // Add click handlers for success rate buttons
        document.addEventListener('click', function(e) {
            const button = e.target.closest('.success-rate-button');
            if (!button) return;
            
            const testFullName = button.getAttribute('data-test-full-name');
            if (!testFullName) return;
            
            showSuccessRateModal(testFullName);
        });
    });
    
    // Data loading and success rate modal functions
    const dataFileUrl = "{{ data_file_url }}";
    let testData = null;
    let dataLoadPromise = null;
    
    // Lazy load test data from JSON file
    async function loadTestData() {
        if (testData) {
            return testData;
        }
        if (dataLoadPromise) {
            return dataLoadPromise;
        }
        
        // Check if we're in a local file:// context (CORS will fail)
        const isLocalFile = window.location.protocol === 'file:';
        
        // For local file:// protocol, fetch won't work due to CORS
        // Return empty data structure immediately to avoid errors
        if (isLocalFile) {
            console.warn('Local file mode detected (file://). JSON data cannot be loaded via fetch due to CORS restrictions.');
            console.warn('For local testing, use a local web server: python3 -m http.server 8000');
            testData = {
                history_for_js: {},
                history_descriptions: {},
                test_descriptions: {},
                test_success_rates: {}
            };
            return Promise.resolve(testData);
        }
        
        dataLoadPromise = fetch(dataFileUrl)
            .then(response => {
                if (!response.ok) {
                    throw new Error(`Failed to load data: ${response.status}`);
                }
                return response.json();
            })
            .then(data => {
                console.log('Test data loaded successfully. Keys:', Object.keys(data));
                testData = data;
                return testData;
            })
            .catch(error => {
                console.error('Error loading test data from JSON file:', error);
                console.error('Data file URL:', dataFileUrl);
                // Return empty data structure on error
                testData = {
                    history_for_js: {},
                    history_descriptions: {},
                    test_descriptions: {},
                    test_success_rates: {}
                };
                return testData;
            });
        
        return dataLoadPromise;
    }
    
    // Initialize with empty data structures (will be populated when needed)
    let testHistory = {};
    let historyDescriptions = {};
    let testDescriptions = {};
    let testSuccessRates = {};
    
    // Helper functions to get data (with lazy loading)
    async function getTestHistory() {
        if (Object.keys(testHistory).length === 0) {
            const data = await loadTestData();
            testHistory = data.history_for_js || {};
        }
        return testHistory;
    }
    
    async function getHistoryDescriptions() {
        if (Object.keys(historyDescriptions).length === 0) {
            const data = await loadTestData();
            historyDescriptions = data.history_descriptions || {};
        }
        return historyDescriptions;
    }
    
    async function getTestDescriptions() {
        if (Object.keys(testDescriptions).length === 0) {
            const data = await loadTestData();
            testDescriptions = data.test_descriptions || {};
        }
        return testDescriptions;
    }
    
    async function getTestSuccessRates() {
        if (Object.keys(testSuccessRates).length === 0) {
            const data = await loadTestData();
            testSuccessRates = data.test_success_rates || {};
        }
        return testSuccessRates;
    }
    
    // Flag to prevent multiple simultaneous updates
    let isUpdatingButtons = false;
    
    // Update success rate buttons with loaded data
    async function updateSuccessRateButtons() {
        // Prevent multiple simultaneous calls
        if (isUpdatingButtons) {
            return;
        }
        
        isUpdatingButtons = true;
        try {
            const branch = "{{ branch }}";
            const buttons = document.querySelectorAll('.success-rate-button');
            
            // If no buttons, nothing to update
            if (buttons.length === 0) {
                return;
            }
            
            // If no data yet, load it once and then proceed
            if (Object.keys(testSuccessRates).length === 0) {
                await getTestSuccessRates().catch((e) => {
                    console.warn('Failed to load success rates:', e);
                });
            }
        
            let updatedCount = 0;
            buttons.forEach(button => {
                const testFullName = button.getAttribute('data-test-full-name');
                if (!testFullName) {
                    console.warn('Button missing data-test-full-name attribute');
                    return;
                }
                
                const rates = testSuccessRates[testFullName];
                if (!rates) {
                    // Don't log every missing test to avoid spam
                    return;
                }
                
                const rateText = button.querySelector('.success-rate-text');
                if (!rateText) {
                    console.warn('Button missing .success-rate-text element for test:', testFullName);
                    return;
                }
                
                let text = '';
                if (rates.other) {
                    text += branch.toUpperCase() + ':' + rates.other.rate + '%';
                }
                if (rates.other && rates.pr_check) {
                    text += ' | ';
                }
                if (rates.pr_check) {
                    text += 'PR:' + rates.pr_check.rate + '%';
                }
                
                if (text) {
                    rateText.textContent = text;
                    updatedCount++;
                }
            });
            // Only log if we actually updated something
            if (updatedCount > 0) {
                console.log('Updated', updatedCount, 'success rate buttons');
            }
        } finally {
            isUpdatingButtons = false;
        }
    }
    
    async function showSuccessRateModal(testFullName) {
        const modal = document.getElementById('successRateModal');
        const modalTitle = document.getElementById('successRateModalTitle');
        const modalContent = document.getElementById('successRateModalContent');
        
        // Load data asynchronously
        const [history, rates] = await Promise.all([
            getTestHistory(),
            getTestSuccessRates()
        ]);

        // After data is loaded, also refresh buttons so the clicked one updates
        updateSuccessRateButtons();
        
        if (!history || !history[testFullName] || !rates || !rates[testFullName]) {
            modalTitle.textContent = `Success Rate: ${testFullName}`;
            modalContent.innerHTML = '<div style="padding: 20px;"><p>No history data available for this test.</p><p>History is collected for the last 4 days for failed, error, and muted tests.</p></div>';
            modal.style.display = 'block';
            return;
        }
        
        const testRates = rates[testFullName];
        const historyEntries = history[testFullName];
        
        // Build modal content
        let html = '<div style="margin-bottom: 20px;">';
        html += '<h3>Overall Success Rate (Last 4 Days)</h3>';
        html += '<div style="display: flex; gap: 30px; margin: 15px 0;">';
        if (testRates.other) {
            html += `<div><strong>Branch Runs:</strong> ${testRates.other.rate}% (${testRates.other.passed}/${testRates.other.total})</div>`;
        }
        if (testRates.pr_check) {
            html += `<div><strong>PR-Check:</strong> ${testRates.pr_check.rate}% (${testRates.pr_check.passed}/${testRates.pr_check.total})</div>`;
        }
        html += '</div></div>';
        
        // Group history by date and calculate daily success rates
        const historyByDate = {};
        for (const timestamp in historyEntries) {
            const entry = historyEntries[timestamp];
            if (!entry) continue;
            
            // Safely get date - handle both 'date' and 'datetime' fields
            const dateStr = entry.date || entry.datetime || '';
            if (!dateStr) continue;
            
            const date = dateStr.split(' ')[0]; // Get date part only
            if (!date) continue;
            
            if (!historyByDate[date]) {
                historyByDate[date] = {
                    pr_check: { passed: 0, total: 0 },
                    other: { passed: 0, total: 0 },
                    entries: []
                };
            }
            const isPrCheck = entry.job_name && (
                entry.job_name.toLowerCase().includes('pr-check') ||
                entry.job_name.toLowerCase().includes('pr_check') ||
                entry.job_name.toLowerCase().includes('pr/check')
            );
            const group = isPrCheck ? 'pr_check' : 'other';
            historyByDate[date][group].total++;
            if (entry.status === 'passed') {
                historyByDate[date][group].passed++;
            }
            historyByDate[date].entries.push({
                timestamp: timestamp,
                entry: entry
            });
        }
        
        // Sort dates (newest first)
        const sortedDates = Object.keys(historyByDate).sort((a, b) => new Date(b) - new Date(a));
        
        html += '<h3>Daily History</h3>';
        html += '<div class="sr-table-wrap"><table class="sr-table" style="width: 100%; border-collapse: collapse; margin-top: 15px;">';
        html += '<thead><tr style="background-color: #f6f8fa; border-bottom: 2px solid #d0d7de;">';
        html += '<th style="padding: 10px; text-align: left;">Date</th>';
        const branch = "{{ branch }}";
        html += `<th style="padding: 10px; text-align: center;">Success Rate Branch (${branch})</th>`;
        html += `<th style="padding: 10px; text-align: left;">Runs in Branch (${branch})</th>`;
        html += '<th style="padding: 10px; text-align: center;">Success Rate PR-Check</th>';
        html += '<th style="padding: 10px; text-align: left;">Runs in PR-Check</th>';
        html += '</tr></thead><tbody>';
        
        for (const date of sortedDates) {
            const dayData = historyByDate[date];
            const prRate = dayData.pr_check.total > 0 
                ? ((dayData.pr_check.passed / dayData.pr_check.total) * 100).toFixed(1)
                : '-';
            const otherRate = dayData.other.total > 0
                ? ((dayData.other.passed / dayData.other.total) * 100).toFixed(1)
                : '-';
            
            // Sort entries by timestamp (newest first) and separate by type
            dayData.entries.sort((a, b) => parseInt(b.timestamp) - parseInt(a.timestamp));
            
            // Separate entries by type
            const prCheckEntries = dayData.entries.filter(({ entry }) => {
                const jobName = entry.job_name || '';
                return jobName.toLowerCase().includes('pr-check') ||
                       jobName.toLowerCase().includes('pr_check') ||
                       jobName.toLowerCase().includes('pr/check');
            });
            const otherEntries = dayData.entries.filter(({ entry }) => {
                const jobName = entry.job_name || '';
                return !jobName.toLowerCase().includes('pr-check') &&
                       !jobName.toLowerCase().includes('pr_check') &&
                       !jobName.toLowerCase().includes('pr/check');
            });
            
            html += `<tr style="border-bottom: 1px solid #d0d7de;">`;
            html += `<td style="padding: 10px;"><strong>${date}</strong></td>`;
            
            // Column 1: Success Rate Branch (main)
            html += `<td style="padding: 10px; text-align: center;">${dayData.other.total > 0 ? `${otherRate}% (${dayData.other.passed}/${dayData.other.total})` : '-'}</td>`;
            
            // Column 2: Runs in Branch (main)
            html += `<td style="padding: 10px;"><div class="sr-runs">`;
            for (const { timestamp, entry } of otherEntries) {
                if (!entry) continue;
                const status = entry.status || 'unknown';
                const date = entry.date || entry.datetime || '';
                const jobName = entry.job_name || '';
                const statusColor = status === 'passed' ? '#28a745' : 
                                   status === 'failure' ? '#dc3545' : '#007bff';
                const statusSymbol = status === 'passed' ? '\u2713' : 
                                    status === 'failure' ? '\u2717' : '\u2298';
                const tooltipText = `${status} - ${date} - ${jobName}`;
                html += `<span style="cursor: pointer; padding: 4px 8px; border-radius: 3px; background-color: ${statusColor}; color: white; font-size: 11px;" `;
                html += `onclick="showHistoryEntry('${testFullName}', '${timestamp}')" `;
                html += `data-tooltip="${tooltipText.replace(/"/g, '&quot;')}" title="${tooltipText.replace(/"/g, '&quot;')}">`;
                html += `${statusSymbol}</span>`;
            }
            html += '</div></td>';
            
            // Column 3: Success Rate PR-Check
            html += `<td style="padding: 10px; text-align: center;">${dayData.pr_check.total > 0 ? `${prRate}% (${dayData.pr_check.passed}/${dayData.pr_check.total})` : '-'}</td>`;
            
            // Column 4: Runs in PR-Check
            html += `<td style="padding: 10px;"><div class="sr-runs">`;
            for (const { timestamp, entry } of prCheckEntries) {
                if (!entry) continue;
                const status = entry.status || 'unknown';
                const date = entry.date || entry.datetime || '';
                const jobName = entry.job_name || '';
                const statusColor = status === 'passed' ? '#28a745' : 
                                   status === 'failure' ? '#dc3545' : '#007bff';
                const statusSymbol = status === 'passed' ? '\u2713' : 
                                    status === 'failure' ? '\u2717' : '\u2298';
                const tooltipText = `${status} - ${date} - ${jobName}`;
                html += `<span style="cursor: pointer; padding: 4px 8px; border-radius: 3px; background-color: ${statusColor}; color: white; font-size: 11px;" `;
                html += `onclick="showHistoryEntry('${testFullName}', '${timestamp}')" `;
                html += `data-tooltip="${tooltipText.replace(/"/g, '&quot;')}" title="${tooltipText.replace(/"/g, '&quot;')}">`;
                html += `${statusSymbol}</span>`;
            }
            html += '</div></td></tr>';
        }
        html += '</tbody></table>';
        html += '</div>'; // sr-table-wrap
        
        modalTitle.textContent = `Success Rate: ${testFullName}`;
        modalContent.innerHTML = html;
        modal.style.display = 'block';
    }
    
    async function showHistoryEntry(testName, timestamp) {
        const history = await getTestHistory();
        if (!history || !history[testName] || !history[testName][timestamp]) return;
        
        const entry = history[testName][timestamp];
        const timestampStr = String(timestamp);
        // Get error text from separate historyDescriptions object
        const descs = await getHistoryDescriptions();
        const errorText = descs[testName] && descs[testName][timestampStr] ? descs[testName][timestampStr] : '';
        
        // Find the test row to get log URLs
        // Search for test name in all rows
        const allRows = document.querySelectorAll('tbody tr');
        let testRow = null;
        for (const row of allRows) {
            const testNameCell = row.querySelector('.test_name span');
            if (testNameCell && testNameCell.textContent.trim() === testName) {
                testRow = row;
                break;
            }
        }
        const logUrls = {};
        if (testRow) {
            const logCell = testRow.querySelector('td.log-column');
            if (logCell) {
                const logLinks = logCell.querySelectorAll('a');
                logLinks.forEach(link => {
                    logUrls[link.textContent.trim()] = link.href;
                });
            }
        }
        
        showTestInfo({
            testName: testName,
            status: entry.status || '',
            date: entry.date || entry.datetime || '',
            errorText: errorText,
            commit: entry.commit || '',
            job_name: entry.job_name || '',
            job_id: entry.job_id || '',
            logUrls: logUrls
        });
    }
    
    function closeSuccessRateModal() {
        const modal = document.getElementById('successRateModal');
        if (modal) {
            modal.style.display = 'none';
        }
    }
    
    // Initialize success rate buttons on page load
    document.addEventListener('DOMContentLoaded', function() {
        updateSuccessRateButtons();
    });
    function toggleError(button) {
    const errorContent = button.nextElementSibling;
    const consoleFrame = errorContent.querySelector('.console-frame');
    if (errorContent.style.display === 'none') {
        errorContent.style.display = 'block';
        consoleFrame.style.display = 'block';
        button.style.transform = "rotate(90deg)"
    } else {
        errorContent.style.display = 'none';
        consoleFrame.style.display = 'none';
        button.style.transform = "rotate(0deg)"
    }
  }
</script>
</head>
<body>
    {% if pr_url or workflow_url %}
    <div class="report-header">
        <h2>Test Report Information</h2>
        {% if pr_url %}
        <p><strong>Pull Request:</strong> <a href="{{ pr_url }}" target="_blank">PR #{{ pr_number }}</a></p>
        {% endif %}
        {% if workflow_url %}
        <p><strong>Workflow Run:</strong> <a href="{{ workflow_url }}" target="_blank">{{ workflow_run_id }}</a></p>
        {% endif %}
        <p><strong>Build Preset:</strong> {{ build_preset }}</p>
        <p><strong>Branch:</strong> {{ branch }}</p>
    </div>
    {% endif %}
    <div class="toggle-visibility-buttons">
        <button id="expand-all">Expand All</button>
        <button id="collapse-all">Collapse All</button>
    </div>
{% for status in status_order %}
{% set sanitizer_count = tests[status] | selectattr('is_sanitizer_issue') | list | length %}
{% set timeout_count = tests[status] | selectattr('is_timeout_issue') | list | length %}
{% set xfailed_count = tests[status] | selectattr('is_xfailed_issue') | list | length %}
{% set verify_count = tests[status] | selectattr('is_verify_issue') | list | length %}
{% set oom_count = tests[status] | selectattr('is_possible_oom') | list | length %}
{% set not_launched_count = tests[status] | selectattr('is_not_launched') | list | length %}
<h1 id="{{ status.name}}" class="collapsible-header">
    {{ status.name }} ({{ tests[status] | length }})
    {% if sanitizer_count > 0 %}
        <span style="color: #ff4500; font-weight: bold;">- {{ sanitizer_count }} SANITIZER ISSUE{{ 's' if sanitizer_count != 1 else '' }}</span>
    {% endif %}
    {% if timeout_count > 0 %}
        <span style="color: #ff8c00; font-weight: bold;">- {{ timeout_count }} TIMEOUT ISSUE{{ 's' if timeout_count != 1 else '' }}</span>
    {% endif %}
    {% if xfailed_count > 0 %}
        <span style="color: #6f42c1; font-weight: bold;">- {{ xfailed_count }} XFAILED ISSUE{{ 's' if xfailed_count != 1 else '' }}</span>
    {% endif %}
    {% if verify_count > 0 %}
        <span style="color: #b22222; font-weight: bold;">- {{ verify_count }} VERIFY ISSUE{{ 's' if verify_count != 1 else '' }}</span>
    {% endif %}
    {% if oom_count > 0 %}
        <span style="color: #d63384; font-weight: bold;">- {{ oom_count }} POSSIBLE OOM{{ 's' if oom_count != 1 else '' }}</span>
    {% endif %}
    {% if not_launched_count > 0 %}
        <span style="color: #6c757d; font-weight: bold;">- {{ not_launched_count }} NOT LAUNCHED ISSUE{{ 's' if not_launched_count != 1 else '' }}</span>
    {% endif %}
</h1>
<table class="collapsible-content active" border="1">
    <thead>
    <tr>
        <th>test owner</th>
        <th>test name</th>
    {% if status.is_error  and history%}
        <th>Success rate</th>
    {% endif %}
        <th>elapsed</th>
        <th class="status-column">status</th>
    {% if status in has_any_log %}
        <th>LOG</th>
    {% endif %}
    </tr>
    </thead>
    <tbody>
    {% for t in tests[status] %}
    <tr>
        <td class="test_owner">
            <a href="https://github.com/orgs/ydb-platform/teams/{{ t.owners.replace('TEAM:@ydb-platform/','')}}" target="_blank">{{ t.owners.replace('TEAM:@ydb-platform/','')}}</a>
        </td>
        {% if status.is_error %} 
        <td class="test_name with_history">
        {% else %} 
        <td class="test_name">
        {% endif %}
            <span>{{ t.full_name }}</span>
            {% if status.is_error %}
                <button class="issue-button create_issue" title="Create issue">+ ISSUE</button>
            {% endif %}
            {% if t.is_sanitizer_issue %}
                <span style="background-color: #ff4500; color: white; padding: 2px 6px; border-radius: 12px; font-size: 11px; margin-left: 8px; font-weight: bold;">SANITIZER</span>
            {% endif %}
            {% if t.is_timeout_issue %}
                <span style="background-color: #ff8c00; color: white; padding: 2px 6px; border-radius: 12px; font-size: 11px; margin-left: 8px; font-weight: bold;">TIMEOUT</span>
            {% endif %}
            {% if t.is_xfailed_issue %}
                <span style="background-color: #6f42c1; color: white; padding: 2px 6px; border-radius: 12px; font-size: 11px; margin-left: 8px; font-weight: bold;">XFAILED</span>
            {% endif %}
            {% if t.is_verify_issue %}
                <span style="background-color: #b22222; color: white; padding: 2px 6px; border-radius: 12px; font-size: 11px; margin-left: 8px; font-weight: bold;">VERIFY</span>
            {% endif %}
            {% if t.is_possible_oom %}
                <span style="background-color: #d63384; color: white; padding: 2px 6px; border-radius: 12px; font-size: 11px; margin-left: 8px; font-weight: bold;">possible OOM</span>
            {% endif %}
            {% if t.is_not_launched %}
                <span style="background-color: #6c757d; color: white; padding: 2px 6px; border-radius: 12px; font-size: 11px; margin-left: 8px; font-weight: bold;">NOT LAUNCHED</span>
            {% endif %}
            {% if status.is_error %}
            <div class="button-group">
                <button class="button" title="Show options">
                    <svg  class="more"  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14" height="14" stroke="none" aria-hidden="true" viewBox="0 0 448 512">
                        <path  d="M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z" clip-rule="evenodd"></path>
                    </svg>
                </button>
                <div class="dropdown">
                    <button class="button copy" title="Copy test filter to clipboard" >
                        <div class="icon-container"> 
                            <svg  class="copy_svg"  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14" height="14" stroke="none" aria-hidden="true" viewBox="0 0 16 16">
                                <path  d="M12 2.5H8A1.5 1.5 0 0 0 6.5 4v1H8a3 3 0 0 1 3 3v1.5h1A1.5 1.5 0 0 0 13.5 8V4A1.5 1.5 0 0 0 12 2.5M11 11h1a3 3 0 0 0 3-3V4a3 3 0 0 0-3-3H8a3 3 0 0 0-3 3v1H4a3 3 0 0 0-3 3v4a3 3 0 0 0 3 3h4a3 3 0 0 0 3-3zM4 6.5h4A1.5 1.5 0 0 1 9.5 8v4A1.5 1.5 0 0 1 8 13.5H4A1.5 1.5 0 0 1 2.5 12V8A1.5 1.5 0 0 1 4 6.5" clip-rule="evenodd"></path>
                            </svg>
                            <svg class="done-icon" width="16" height="16" viewBox="0 0 26 26" fill="green" display="none">
                                <path class="cls-2" d="M12,2A10,10,0,1,0,22,12,10,10,0,0,0,12,2Zm0,18a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"/>
                                <path class="cls-2" d="M14.7,8.39l-3.78,5L9.29,11.28a1,1,0,0,0-1.58,1.23l2.43,3.11a1,1,0,0,0,.79.38h0a1,1,0,0,0,.79-.39l4.57-6a1,1,0,1,0-1.6-1.22Z"/>
                            </svg>
                        </div>
                        <span class="button-text">Copy run command</span>
                    </button>
                    {% if status.is_error %} 
                    <button class="button mute" title="Copy mute string to clipboard" >
                        <div class="icon-container"> 
                            <svg  class="mute_svg"  xmlns="http://www.w3.org/2000/svg" width="32" height="14" position="left" stroke="none" viewBox="2 0 30 17">
                                <!-- First icon: copied squares -->
                                <path transform="translate(20, 0)" d="M12 2.5H8A1.5 1.5 0 0 0 6.5 4v1H8a3 3 0 0 1 3 3v1.5h1A1.5 1.5 0 0 0 13.5 8V4A1.5 1.5 0 0 0 12 2.5M11 11h1a3 3 0 0 0 3-3V4a3 3 0 0 0-3-3H8a3 3 0 0 0-3 3v1H4a3 3 0 0 0-3 3v4a3 3 0 0 0 3 3h4a3 3 0 0 0 3-3zM4 6.5h4A1.5 1.5 0 0 1 9.5 8v4A1.5 1.5 0 0 1 8 13.5H4A1.5 1.5 0 0 1 2.5 12V8A1.5 1.5 0 0 1 4 6.5"  />
                                <!-- Second icon: microphone -->
                                <path transform="translate(0, 0)" d="M5.06 9.94A1.5 1.5 0 0 0 4 9.5H2a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h2a1.5 1.5 0 0 0 1.06-.44l2.483-2.482a.268.268 0 0 1 .457.19v8.464a.268.268 0 0 1-.457.19zM2 5h2l2.482-2.482A1.768 1.768 0 0 1 9.5 3.768v8.464a1.768 1.768 0 0 1-3.018 1.25L4 11H2a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2m10.28.72a.75.75 0 1 0-1.06 1.06L12.44 8l-1.22 1.22a.75.75 0 1 0 1.06 1.06l1.22-1.22 1.22 1.22a.75.75 0 1 0 1.06-1.06L14.56 8l1.22-1.22a.75.75 0 0 0-1.06-1.06L13.5 6.94z"  />
                            </svg>
                            <svg class="done-icon" width="16" height="16" viewBox="0 0 26 26" fill="green" display="none">
                                <path class="cls-2" d="M12,2A10,10,0,1,0,22,12,10,10,0,0,0,12,2Zm0,18a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"/>
                                <path class="cls-2" d="M14.7,8.39l-3.78,5L9.29,11.28a1,1,0,0,0-1.58,1.23l2.43,3.11a1,1,0,0,0,.79.38h0a1,1,0,0,0,.79-.39l4.57-6a1,1,0,1,0-1.6-1.22Z"/>
                            </svg>
                        </div>
                        <span class="button-text">Copy mute string</span>
                    </button>
                    <button class="button create_mute_issue" title="Create mute issue">
                        <div class="icon-container"> 
                            <svg class="issue_svg" xmlns="http://www.w3.org/2000/svg" width="32" height="14" position="left"  stroke="none" viewBox="2 0 30 17">
                                <!-- First icon: plus -->
                                <path transform="translate(20, 0)" d="M13.5 8a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0M8.75 5.5a.75.75 0 0 0-1.5 0v1.75H5.5a.75.75 0 0 0 0 1.5h1.75v1.75a.75.75 0 0 0 1.5 0V8.75h1.75a.75.75 0 0 0 0-1.5H8.75z"  />
                                <!-- Second icon: microphone -->
                                <path transform="translate(0, 0)" d="M5.06 9.94A1.5 1.5 0 0 0 4 9.5H2a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h2a1.5 1.5 0 0 0 1.06-.44l2.483-2.482a.268.268 0 0 1 .457.19v8.464a.268.268 0 0 1-.457.19zM2 5h2l2.482-2.482A1.768 1.768 0 0 1 9.5 3.768v8.464a1.768 1.768 0 0 1-3.018 1.25L4 11H2a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2m10.28.72a.75.75 0 1 0-1.06 1.06L12.44 8l-1.22 1.22a.75.75 0 1 0 1.06 1.06l1.22-1.22 1.22 1.22a.75.75 0 1 0 1.06-1.06L14.56 8l1.22-1.22a.75.75 0 0 0-1.06-1.06L13.5 6.94z"  />
                            </svg>
                            <svg class="done-icon" width="16" height="16" viewBox="0 0 26 26" fill="green" display="none">
                                <path class="cls-2" d="M12,2A10,10,0,1,0,22,12,10,10,0,0,0,12,2Zm0,18a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"/>
                                <path class="cls-2" d="M14.7,8.39l-3.78,5L9.29,11.28a1,1,0,0,0-1.58,1.23l2.43,3.11a1,1,0,0,0,.79.38h0a1,1,0,0,0,.79-.39l4.57-6a1,1,0,1,0-1.6-1.22Z"/>
                            </svg>
                        </div>
                        <span class="button-text">Create mute issue</span>
                    </button>

                     {% endif %}
                    <button class="button open_history" title="Show history">
                        <div class="icon-container"> 
                            <svg class="show_history_svg" width="18" height="18" viewBox="0 0 48 48" fill="none"  xmlns="http://www.w3.org/2000/svg">
                                <path d="M42 24V9C42 7.34315 40.6569 6 39 6H9C7.34315 6 6 7.34315 6 9V39C6 40.6569 7.34315 42 9 42H24"  stroke-linecap="round" stroke-linejoin="round"/>
                                <circle cx="32" cy="32" r="6" />
                                <path d="M37 36L42 40"  stroke-linecap="round" stroke-linejoin="round"/>
                                <path d="M14 16H34"  stroke-linecap="round" stroke-linejoin="round"/>
                                <path d="M14 24L22 24"   stroke-linecap="round" stroke-linejoin="round"/>
                            </svg>
                            <svg class="done-icon" width="16" height="16" viewBox="0 0 26 26" fill="green" display="none">
                                <path class="cls-2" d="M12,2A10,10,0,1,0,22,12,10,10,0,0,0,12,2Zm0,18a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"/>
                                <path class="cls-2" d="M14.7,8.39l-3.78,5L9.29,11.28a1,1,0,0,0-1.58,1.23l2.43,3.11a1,1,0,0,0,.79.38h0a1,1,0,0,0,.79-.39l4.57-6a1,1,0,1,0-1.6-1.22Z"/>
                            </svg>
                        </div>
                        <span class="button-text">Open test history</span>
                    </button>
           
                    </div>
                </div>
            {% endif %}
            {% if t.status_description %}
            <button class="error-button" onclick="toggleError(this)"></button>
            <div style="display: none;" class="error-content">
                <div class="console-frame" style="display: none;">
                    <pre><code class="language-{{ 'python' if '.py' in t.full_name else 'cpp'}}">{{ t.status_description | default("Status description missed") | e }}</code></pre>
                </div>
            </div>
            {% endif %}
        </td>
        {% if status.is_error and history %}
        <td>
            {% if t.full_name in history %}
            <button class="success-rate-button" data-test-full-name="{{ t.full_name|e }}" data-action="show-success-rate" title="View success rate and history">
                <span class="success-rate-text">No history</span>
            </button>
                    {% endif %}
        </td> 
        {% endif %}
        <td><span title="{{ t.elapsed }}s">{{ t.elapsed_display }}</span></td>
        <td class="status-column">
            <span class="test_status test_{{ t.status_display }}">{{ t.status_display }}</span>
        </td>
        {% if status in has_any_log %}
        <td class="log-column">
            {% if t.log_urls %}
                {% for log_name, log_url in t.log_urls.items() %}
                <a href="{{ log_url }}">{{ log_name }}</a>{% if not loop.last %} | {% endif %}

                {% endfor %}
            {% else %}
                &nbsp;
            {% endif %}
        </td>
        {% endif %}
    </tr>
    {% endfor %}
    </tbody>
</table>
{% endfor %}

<!-- Modal window for success rate and detailed history -->
<div id="successRateModal" class="modal">
    <div class="modal-content">
        <span class="close-modal">&times;</span>
        <div class="modal-header">
            <h2 id="successRateModalTitle">Test Success Rate</h2>
        </div>
        <div id="successRateModalContent"></div>
    </div>
</div>

<!-- Modal window for detailed error display -->
<div id="errorModal" class="modal">
    <div class="modal-content">
        <span class="close-modal">&times;</span>
        <div class="modal-header">
            <h3 id="modalTitle">Test Details</h3>
        </div>
        <div class="modal-info">
            <div class="modal-info-item">
                <span class="modal-info-label">Run:</span>
                <a id="modalJobLink" href="#" target="_blank"></a>
            </div>
            <div class="modal-info-item">
                <span class="modal-info-label">Status:</span>
                <span id="modalStatus"></span>
            </div>
            <div class="modal-info-item">
                <span class="modal-info-label">Date:</span>
                <span id="modalDate"></span>
            </div>
            <div class="modal-info-item">
                <span class="modal-info-label">Commit:</span>
                <a id="modalShaLink" href="#" target="_blank"></a>
            </div>
        </div>
        <div id="modalErrorSection">
            <div class="console-frame">
                <pre><code id="modalErrorContent"></code></pre>
            </div>
        </div>
    </div>
</div>

</body>
</html>