Mercurial > code > home > repos > video
diff 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 |
line wrap: on
line diff
--- a/src/ingest/IngestStatus.ts Sun Apr 16 03:17:48 2023 -0700 +++ b/src/ingest/IngestStatus.ts Sun Apr 16 03:19:33 2023 -0700 @@ -1,21 +1,49 @@ import { LitElement, html, css } from "lit"; import { customElement, property } from "lit/decorators.js"; +interface Row { + url: string; + t: string; + progress: string; +} + @customElement("ingest-status") export class IngestStatus extends LitElement { - + @property() queue: Row[] = []; static styles = [ css` + table { + background: #ccc; + } `, ]; + connectedCallback(): void { + super.connectedCallback(); + const es = new EventSource("../api/ingest/queue"); + es.onmessage = (ev) => { + this.queue = JSON.parse(ev.data); + }; + } render() { return html` - -<table> - <thead><th>Source</th><th>Status</th></thead> - <tbody id="processing"> - </tbody> - </table> + <table> + <thead> + <th>Queued at</th> + <th>Progress</th> + <th>Source</th> + </thead> + <tbody id="processing"> + ${this.queue.map( + (row) => html` + <tr> + <td>${row.t}</td> + <td>${row.progress}</td> + <td>${row.url}</td> + </tr> + ` + )} + </tbody> + </table> `; } }