110 lines
5.5 KiB
JavaScript
110 lines
5.5 KiB
JavaScript
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="dark:text-orange-500 text-right whitespace-nowrap ">ID</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">IMDB ID</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Title</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">URL</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Filename</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Status</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Progress</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Media Type</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Episode ID</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Created At</div>
|
|
</th>
|
|
<th class="px-4 py-2">
|
|
<div class="dark:text-orange-500 text-right whitespace-nowrap ">Updated At</div>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr class="flex flex-col">
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('download-id') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('imdb-id') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('media-title') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('url') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('filename') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('status') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('progress') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('media-type') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('episode-id') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('created-at') ?? "-"}</div>
|
|
</td>
|
|
<td class="px-4 py-2">
|
|
<div class="text-left dark:text-white whitespace-nowrap font-normal">${this.getAttribute('updated-at') ?? "-"}</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
`;
|
|
}
|
|
} |