feat: download data preview modal
This commit is contained in:
110
assets/components/download-list-row.js
Normal file
110
assets/components/download-list-row.js
Normal file
@@ -0,0 +1,110 @@
|
||||
export default class DownloadListRow extends HTMLTableRowElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.downloadId = this.getAttribute('download-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');
|
||||
|
||||
// this.previewContent = this.previewContent.bind(this);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
previewContent() {
|
||||
return `
|
||||
<table class="table-auto flex flex-row">
|
||||
<thead>
|
||||
<tr class="flex flex-col">
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">ID</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">IMDB ID</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">Title</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">URL</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">Filename</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">Status</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">Progress</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">Media Type</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">Episode ID</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">Created At</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-right whitespace-nowrap ">Updated At</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="flex flex-col">
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('download-id') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('imdb-id') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('media-title') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('url') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('filename') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('status') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('progress') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('media-type') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('episode-id') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('created-at') ?? "-"}</div>
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
<div class="text-left whitespace-nowrap font-normal">${this.getAttribute('updated-at') ?? "-"}</div>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user