atagen

matrix-rust-sdk

public
Star0
Watch0
ssh://brewery@pls.lobotomise.me:33/atagen/matrix-rust-sdk.git
xtask/src/log/sync.template.htmlHtml366 lines8.7 KB
1
<!doctype html>
2
<html lang="en">
3
<head>
4
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
  <meta http-equiv="content-security-policy" content="default-src 'self'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:">
6
  <meta name="viewport" content="width=device-width, minimum-scale=1">
7
8
  <style>
9
  /* Reset */
10
11
  *, *::before, *::after {
12
    box-sizing: border-box;
13
  }
14
15
  * { margin: 0 }
16
17
  input, button, textarea, select {
18
    font: inherit;
19
    color: currentColor;
20
  }
21
22
  :root {
23
    --space-very-small: .25rem;
24
    --space-small: .5rem;
25
    --space: 1rem;
26
    --space-large: 2rem;
27
    --space-very-large: 4rem;
28
29
    --border-radius: 3px;
30
31
    --color-accent: oklch(59.1% .236 10.25);
32
    --color-text: oklch(.84 0 0);
33
    --color-canvas: oklch(0.258 0.007 285.867);
34
    --color-canvas-lighter: oklch(0.303 0.007 285.966);
35
    --color-canvas-lighter-2: oklch(0.343 0.009 285.935);
36
    --color-canvas-lighter-3: oklch(0.6 0 0);
37
38
    --color-green: oklch(.524 .164 145);
39
    --color-red: oklch(.503 .172 25);
40
    --color-orange: oklch(.793 .171 70.67);
41
    --color-yellow: oklch(.968 .211 109.769);
42
    --color-violet: oklch(.39 .193 328.363);
43
  }
44
45
  .content-grid {
46
    --padding-inline: 1rem;
47
    --content-max-width: 70ch;
48
    --breakout-max-width: 85ch;
49
50
    --breakout-size: calc((var(--breakout-max-width) - var(--content-max-width)) / 2);
51
52
    display: grid;
53
    grid-template-columns:
54
      [full-width-start]
55
        minmax(var(--padding-inline), 1fr)
56
        [breakout-start]
57
          minmax(0, var(--breakout-size))
58
          [content-start]
59
            min(
60
              100% - (var(--padding-inline) * 2),
61
              var(--content-max-width)
62
            )
63
          [content-end]
64
          minmax(0, var(--breakout-size))
65
        [breakout-end]
66
        minmax(var(--padding-inline), 1fr)
67
      [full-width-end];
68
69
    > * {
70
      grid-column: content;
71
    }
72
73
    > .breakout {
74
      grid-column: breakout;
75
    }
76
77
    > .full-width {
78
      grid-column: full-width;
79
    }
80
  }
81
82
  html {
83
    scroll-padding-top: var(--space-very-large);
84
  }
85
86
  body {
87
    font-size: .95rem;
88
    /* Thanks modernfontstacks.com */
89
    font-family: Inter, Roboto, 'Helvetica Neue', 'Arial Nova', 'Nimbus Sans', Arial, sans-serif;
90
    font-weight: normal;
91
    font-variant-numeric: proportional-nums slashed-zero;
92
    color: var(--color-text);
93
    background: var(--color-canvas);
94
    scroll-behaviour: smooth;
95
  }
96
97
  header {
98
    text-align: center;
99
    text-wrap: balanced;
100
    margin-block: var(--space) var(--space-large);
101
  }
102
103
  ul {
104
    margin: 0;
105
    padding: 0;
106
    list-style-position: inside;
107
    list-style-type: "− ";
108
  }
109
110
  main > table {
111
    width: 100%;
112
    min-width: 1400px;
113
    border-spacing: 0;
114
115
    th, td {
116
      white-space: nowrap;
117
      padding: .15rem var(--space-small);
118
    }
119
120
    thead {
121
      position: sticky;
122
      top: 0;
123
      z-index: 100;
124
      background: oklch(from var(--color-canvas) l c h / .8);
125
      backdrop-filter: blur(5px);
126
127
      tr {
128
        font-weight: bold;
129
        height: 3em;
130
      }
131
    }
132
133
    tbody > tr {
134
      position: relative;
135
136
      &:nth-child(even) {
137
        background: var(--color-canvas-lighter);
138
      }
139
140
      &:hover {
141
        z-index: 2;
142
        outline: 1px var(--color-canvas-lighter-3) dashed;
143
        outline-offset: var(--space-very-small);
144
        border-radius: var(--border-radius);
145
      }
146
147
      &:target {
148
        z-index: 2;
149
        outline: 3px var(--color-yellow) solid;
150
        outline-offset: .1rem;
151
        border-radius: var(--border-radius);
152
      }
153
154
      /* request ID */
155
      > :nth-child(2) {
156
        text-align: end;
157
158
        a {
159
          color: inherit;
160
        }
161
      }
162
163
      /* status */
164
      > :nth-child(3) {
165
        &[data-status-family] {
166
          --_background: var(--color-red);
167
168
          > span {
169
            width: 3em;
170
            display: inline-block;
171
            text-align: center;
172
            border-radius: var(--border-radius);
173
            padding-inline: var(--space-very-small);
174
            background-color: var(--_background, transparent);
175
          }
176
        }
177
178
        &[data-status-family="cancelled"] {
179
          color: var(--color-canvas);
180
          font-weight: bold;
181
          --_background: var(--color-orange);
182
        }
183
        &[data-status-family="2"] { --_background: var(--color-green) }
184
      }
185
186
      /* domain and path */
187
      > :nth-child(5) { --_column-width: 15ch; --_dir: ltr }
188
      > :nth-child(6) { --_column-width: 18ch; --_dir: rtl }
189
      > :nth-child(5),
190
      > :nth-child(6) {
191
        direction: var(--_dir);
192
        text-overflow: ellipsis;
193
        max-width: var(--_column-width);
194
        overflow: hidden;
195
      }
196
197
      /* request timeout, request size and response size */
198
      > :nth-child(7),
199
      > :nth-child(8),
200
      > :nth-child(9) {
201
        text-align: end;
202
      }
203
204
      /* time */
205
      > :nth-child(10) {
206
        font-size: small;
207
        font-variant-numeric: slashed-zero tabular-nums;
208
      }
209
210
      > :last-child {
211
        --_end-at: var(--end-at, 100);
212
213
        width: 100%;
214
215
        --_grid-step: 15%;
216
        --_grid-width: 2px;
217
        background: linear-gradient(
218
          90deg,
219
          var(--color-canvas-lighter-2) var(--_grid-width),
220
          transparent var(--_grid-width)
221
        );
222
        background-size: var(--_grid-step);
223
224
        position: relative;
225
226
        .span {
227
          --_start-at: var(--start-at, 0);
228
          --_timeout: var(--timeout, 0);
229
          --_duration: var(--duration, 0);
230
          --_end-gutter: 10ch; /* spaces for the labels */
231
232
          display: block;
233
          position: absolute;
234
          top: .15rem;
235
          left: calc((var(--_start-at) * (100% - var(--_end-gutter))) / var(--_end-at));
236
          width: max(1px, calc((var(--_duration) * (100% - var(--_end-gutter))) / var(--_end-at)));
237
          height: 1.2rem;
238
          background: var(--_background);
239
240
          --_duration-color: var(--color-accent);
241
          --_timeout-color: var(--color-violet);
242
          --_timeout-stop: calc((var(--_timeout) * 100%) / var(--_duration));
243
244
          background: linear-gradient(
245
            90deg,
246
            var(--_timeout-color) var(--_timeout-stop),
247
            var(--_duration-color) var(--_timeout-stop)
248
          );
249
          border-radius: var(--border-radius);
250
251
          tr:has(> td[data-status-family="cancelled"]) & {
252
            width: 3px; /* to be sure it is seen */
253
            --_duration-color: var(--color-orange);
254
          }
255
256
          > span {
257
            position: absolute;
258
            font-size: .855em;
259
            top: .1em;
260
            left: calc(100% + var(--space-very-small));
261
          }
262
        }
263
264
        details {
265
          text-align: end;
266
267
          summary {
268
            pointer: cursor;
269
            height: 1em;
270
            width: 100%;
271
272
            list-style: none;
273
            &::marker,
274
            &::-webkit-details-marker {
275
              content: none; /* all browsers */
276
              display: none; /* WebKit */
277
            }
278
279
            &::after {
280
              position: absolute;
281
              top: 0;
282
              right: var(--space-small);
283
284
              content: '+';
285
              font-weight: bold;
286
            }
287
          }
288
289
          &[open] {
290
            margin-bottom: var(--space-small);
291
292
            summary {
293
              margin-bottom: var(--space-small);
294
295
              &::after {
296
                content: '−' !important;
297
              }
298
            }
299
          }
300
301
          summary ~ * {
302
            text-align: start;
303
            font-size: small;
304
          }
305
        }
306
      }
307
    }
308
  }
309
310
  code {
311
    /* Thanks modernfontstacks.com */
312
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
313
    font-weight: normal;
314
    font-size: .9em;
315
  }
316
317
  .text-overflow {
318
    display: inline-block;
319
    max-width: 25ch;
320
    text-overflow: ellipsis ellipsis;
321
    overflow-x: auto;
322
    vertical-align: text-bottom;
323
  }
324
325
  .hidden {
326
    display: none;
327
  }
328
  </style>
329
330
  <title>Network viewer</title>
331
</head>
332
333
<body class="content-grid">
334
335
<header>
336
  <h1>Analyse of <code>{log_file}</code></h1>
337
</header>
338
339
<main class="full-width">
340
341
<table>
342
  <thead>
343
    <tr>
344
      <th scope="col"><abbr title="Connection">Conn.</abbr> ID</th>
345
      <th scope="col"><abbr title="Request">Req.</abbr> ID</th>
346
      <th scope="col">Status</th>
347
      <th scope="col"><abbr title="Method">Meth.</abbr></th>
348
      <th scope="col">Domain</th>
349
      <th scope="col">Path</th>
350
      <th scope="col"><abbr title="Request">Req.</abbr> timeout</th>
351
      <th scope="col"><abbr title="Request">Req.</abbr> size</th>
352
      <th scope="col"><abbr title="Response">Resp.</abbr> size</th>
353
      <th scope="col">Time</th>
354
      <th scope="col">Timeline</th>
355
    </tr>
356
  </thead>
357
358
  <tbody style="--end-at: {end_at}">
359
    {rows}
360
  </tbody>
361
</table>
362
363
</main>
364
365
</body>
366
</html>