mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
5772a26964
commit
51d44957c3
7 changed files with 67 additions and 56 deletions
|
@ -53,14 +53,14 @@
|
|||
|
||||
html += '<div class="listItemBody three-line">';
|
||||
|
||||
html += '<div>';
|
||||
html += '<h3 class="listItemBodyText">';
|
||||
html += jobItem.ItemName;
|
||||
html += '</div>';
|
||||
html += '</h3>';
|
||||
|
||||
if (jobItem.Status === 'Failed') {
|
||||
html += '<div class="secondary" style="color:red;">';
|
||||
html += '<div class="secondary listItemBodyText" style="color:red;">';
|
||||
} else {
|
||||
html += '<div class="secondary">';
|
||||
html += '<div class="secondary listItemBodyText">';
|
||||
}
|
||||
html += globalize.translate('sharedcomponents#SyncJobItemStatus' + jobItem.Status);
|
||||
if (jobItem.Status === 'Synced' && jobItem.IsMarkedForRemoval) {
|
||||
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="secondary" style="padding-top:5px;">';
|
||||
html += '<div class="secondary listItemBodyText" style="padding-top:5px;">';
|
||||
html += '<div style="background:#e0e0e0;height:4px;"><div style="background:#52B54B;width:' + (jobItem.Progress || 0) + '%;height:100%;"></div></div>';
|
||||
html += '</div>';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
function onSyncJobsUpdated(e, apiClient, data) {
|
||||
|
||||
var listInstance = this;
|
||||
renderList(listInstance, data);
|
||||
renderList(listInstance, data, apiClient);
|
||||
}
|
||||
|
||||
function refreshList(listInstance, jobs) {
|
||||
|
@ -54,28 +54,28 @@ globalize.translate('sharedcomponents#CancelSyncJobConfirmation');
|
|||
return;
|
||||
}
|
||||
|
||||
var progress = job.Progress || 0;
|
||||
var statusIcon = listItem.querySelector('.statusIcon');
|
||||
|
||||
if (progress === 0) {
|
||||
statusIcon.innerHTML = 'file_download';
|
||||
statusIcon.classList.add('md-icon');
|
||||
statusIcon.classList.remove('status-text-icon');
|
||||
statusIcon.classList.add('zeroProgressStatus');
|
||||
} else if (progress >= 100) {
|
||||
statusIcon.innerHTML = 'check';
|
||||
statusIcon.classList.add('md-icon');
|
||||
statusIcon.classList.remove('status-text-icon');
|
||||
statusIcon.classList.remove('zeroProgressStatus');
|
||||
} else {
|
||||
statusIcon.classList.remove('md-icon');
|
||||
statusIcon.classList.remove('zeroProgressStatus');
|
||||
statusIcon.classList.add('status-text-icon');
|
||||
statusIcon.innerHTML = (Math.round(progress)) + '%';
|
||||
}
|
||||
listItem.querySelector('.jobStatus').innerHTML = getProgressText(job);
|
||||
}
|
||||
|
||||
function getSyncJobHtml(listInstance, job) {
|
||||
function getProgressText(job) {
|
||||
|
||||
var status = job.Status;
|
||||
|
||||
if (status === 'Completed') {
|
||||
status = 'Synced';
|
||||
}
|
||||
|
||||
var html = globalize.translate('sharedcomponents#SyncJobItemStatus' + status);
|
||||
|
||||
if (job.Status === 'Transferring' || job.Status === 'Converting' || job.Status === 'Completed') {
|
||||
html += ' ';
|
||||
html += (job.Progress || 0) + '%';
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function getSyncJobHtml(listInstance, job, apiClient) {
|
||||
|
||||
var html = '';
|
||||
|
||||
|
@ -90,14 +90,24 @@ globalize.translate('sharedcomponents#CancelSyncJobConfirmation');
|
|||
|
||||
html += '<' + tagName + typeAttribute + ' class="' + listItemClass + '" data-id="' + job.Id + '" data-status="' + job.Status + '">';
|
||||
|
||||
var progress = job.Progress || 0;
|
||||
var imgUrl;
|
||||
|
||||
if (progress === 0) {
|
||||
html += '<i class="md-icon listItemIcon statusIcon zeroProgressStatus">file_download</i>';
|
||||
} else if (progress >= 100) {
|
||||
html += '<i class="md-icon listItemIcon statusIcon">check</i>';
|
||||
} else {
|
||||
html += '<i class="listItemIcon statusIcon status-text-icon">' + (Math.round(progress)) + '%</i>';
|
||||
if (job.PrimaryImageItemId) {
|
||||
|
||||
imgUrl = apiClient.getImageUrl(job.PrimaryImageItemId, {
|
||||
type: "Primary",
|
||||
width: 80,
|
||||
tag: job.PrimaryImageTag,
|
||||
minScale: 1.5
|
||||
});
|
||||
}
|
||||
|
||||
if (imgUrl) {
|
||||
html += '<div class="listItemImage lazy" data-src="' + imgUrl + '" item-icon>';
|
||||
html += '</div>';
|
||||
}
|
||||
else {
|
||||
html += '<i class="md-icon listItemIcon">file_download</i>';
|
||||
}
|
||||
|
||||
var textLines = [];
|
||||
|
@ -114,11 +124,7 @@ globalize.translate('sharedcomponents#CancelSyncJobConfirmation');
|
|||
textLines.push(globalize.translate('sharedcomponents#ItemCount', job.ItemCount));
|
||||
}
|
||||
|
||||
if (textLines >= 3) {
|
||||
html += '<div class="listItemBody three-line">';
|
||||
} else {
|
||||
html += '<div class="listItemBody two-line">';
|
||||
}
|
||||
html += '<div class="listItemBody three-line">';
|
||||
|
||||
for (var i = 0, length = textLines.length; i < length; i++) {
|
||||
|
||||
|
@ -133,6 +139,10 @@ globalize.translate('sharedcomponents#CancelSyncJobConfirmation');
|
|||
}
|
||||
}
|
||||
|
||||
html += '<div class="secondary listItemBodyText jobStatus" style="color:green;">';
|
||||
html += getProgressText(job);
|
||||
html += '</div>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
if (!layoutManager.tv) {
|
||||
|
@ -144,7 +154,7 @@ globalize.translate('sharedcomponents#CancelSyncJobConfirmation');
|
|||
return html;
|
||||
}
|
||||
|
||||
function renderList(listInstance, jobs) {
|
||||
function renderList(listInstance, jobs, apiClient) {
|
||||
|
||||
if ((new Date().getTime() - listInstance.lastDataLoad) < 60000) {
|
||||
refreshList(listInstance, jobs);
|
||||
|
@ -187,7 +197,7 @@ globalize.translate('sharedcomponents#CancelSyncJobConfirmation');
|
|||
}
|
||||
}
|
||||
|
||||
html += getSyncJobHtml(listInstance, job);
|
||||
html += getSyncJobHtml(listInstance, job, apiClient);
|
||||
}
|
||||
|
||||
if (hasOpenSection) {
|
||||
|
@ -229,7 +239,7 @@ globalize.translate('sharedcomponents#CancelSyncJobConfirmation');
|
|||
|
||||
return apiClient.getJSON(apiClient.getUrl('Sync/Jobs', options)).then(function (response) {
|
||||
|
||||
renderList(listInstance, response.Items);
|
||||
renderList(listInstance, response.Items, apiClient);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue