diff --git a/assets/bootstrap.js b/assets/bootstrap.js index 7aacd6f..26a3bfa 100644 --- a/assets/bootstrap.js +++ b/assets/bootstrap.js @@ -3,6 +3,7 @@ import PreviewContentDialog from "./components/preview-content-dialog.js"; import EpisodeContainer from './components/episode-container.js'; import DownloadOptionTr from './components/download-option-tr.js'; import DownloadListRow from './components/download-list-row.js'; +import MonitorListRow from './components/monitor-list-row.js'; import MovieContainer from "./components/movie-container.js"; import { startStimulusApp } from '@symfony/stimulus-bundle'; @@ -22,3 +23,4 @@ customElements.define('episode-container', EpisodeContainer); customElements.define('movie-container', MovieContainer); customElements.define('dl-tr', DownloadOptionTr, {extends: 'tr'}); customElements.define('download-list-row', DownloadListRow, {extends: 'tr'}); +customElements.define('monitor-list-row', MonitorListRow, {extends: 'tr'}); diff --git a/assets/components/monitor-list-row.js b/assets/components/monitor-list-row.js new file mode 100644 index 0000000..e7e20eb --- /dev/null +++ b/assets/components/monitor-list-row.js @@ -0,0 +1,115 @@ +export default class MonitorListRow extends HTMLTableRowElement { + constructor() { + super(); + this.downloadId = this.getAttribute('monitor-id'); + this.imdbId = this.getAttribute('imdb-id'); + this.mediaTitle = this.getAttribute('media-title'); + this.url = this.getAttribute('url'); + this.filename = this.getAttribute('filename'); + this.status = this.getAttribute('status'); + this.progress = this.getAttribute('progress'); + this.mediaType = this.getAttribute('media-type'); + this.episodeId = this.getAttribute('episode-id'); + this.createdAt = this.getAttribute('created-at'); + this.updatedAt = this.getAttribute('updated-at'); + } + + static get observedAttributes() { + return ['download-id', 'imdb-id', 'media-title', 'url', 'filename', 'status', 'progress', 'media-type', 'episode-id', 'created-at', 'updated-at']; + } + + attributeChangedCallback(name, oldValue, newValue) { + if (oldValue !== newValue) { + this[name] = newValue; + this.setAttribute(name, newValue); + this.setPreviewContent(); + } + } + + setPreviewContent() { + this.previewContent = ` +
|
+ ID
+ |
+
+ IMDB ID
+ |
+
+ Title
+ |
+
+ Season
+ |
+
+ Episode
+ |
+
+ Status
+ |
+
+ Search Count
+ |
+
+ Media Type
+ |
+
+ Episode ID
+ |
+
+ Created At
+ |
+
+ Updated At
+ |
+
+ Downloaded At
+ |
+
|---|---|---|---|---|---|---|---|---|---|---|---|
|
+ ${this.getAttribute('monitor-id') ?? "-"}
+ |
+
+ ${this.getAttribute('imdb-id') ?? "-"}
+ |
+
+ ${this.getAttribute('media-title') ?? "-"}
+ |
+
+ ${this.getAttribute('season') ?? "-"}
+ |
+
+ ${this.getAttribute('episode') ?? "-"}
+ |
+
+ ${this.getAttribute('status') ?? "-"}
+ |
+
+ ${this.getAttribute('search-count') ?? "-"}
+ |
+
+ ${this.getAttribute('media-type') ?? "-"}
+ |
+
+ ${this.getAttribute('episode-id') ?? "-"}
+ |
+
+ ${this.getAttribute('created-at') ?? "-"}
+ |
+
+ ${this.getAttribute('last-search') ?? "-"}
+ |
+
+ ${this.getAttribute('downloaded-at') ?? "-"}
+ |
+