Mercurial > code > home > repos > video
annotate src/ingest/IngestStatus.ts @ 17:071943adf000
dnd a file or a url which we'll queue and fetch
author | drewp@bigasterisk.com |
---|---|
date | Sun, 16 Apr 2023 03:19:33 -0700 |
parents | b73941c4dc0a |
children | 111a41817968 |
rev | line source |
---|---|
13 | 1 import { LitElement, html, css } from "lit"; |
2 import { customElement, property } from "lit/decorators.js"; | |
3 | |
17
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
4 interface Row { |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
5 url: string; |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
6 t: string; |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
7 progress: string; |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
8 } |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
9 |
13 | 10 @customElement("ingest-status") |
11 export class IngestStatus extends LitElement { | |
17
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
12 @property() queue: Row[] = []; |
13 | 13 static styles = [ |
14 css` | |
17
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
15 table { |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
16 background: #ccc; |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
17 } |
13 | 18 `, |
19 ]; | |
17
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
20 connectedCallback(): void { |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
21 super.connectedCallback(); |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
22 const es = new EventSource("../api/ingest/queue"); |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
23 es.onmessage = (ev) => { |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
24 this.queue = JSON.parse(ev.data); |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
25 }; |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
26 } |
13 | 27 render() { |
28 return html` | |
17
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
29 <table> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
30 <thead> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
31 <th>Queued at</th> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
32 <th>Progress</th> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
33 <th>Source</th> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
34 </thead> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
35 <tbody id="processing"> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
36 ${this.queue.map( |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
37 (row) => html` |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
38 <tr> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
39 <td>${row.t}</td> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
40 <td>${row.progress}</td> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
41 <td>${row.url}</td> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
42 </tr> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
43 ` |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
44 )} |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
45 </tbody> |
071943adf000
dnd a file or a url which we'll queue and fetch
drewp@bigasterisk.com
parents:
13
diff
changeset
|
46 </table> |
13 | 47 `; |
48 } | |
49 } |