mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update sync objects
This commit is contained in:
parent
f603085007
commit
ebe849f9b0
37 changed files with 231 additions and 86 deletions
|
@ -1,5 +1,33 @@
|
|||
(function () {
|
||||
|
||||
function cancelJob(page, id) {
|
||||
|
||||
$('.jobMenu', page).on("popupafterclose.deleteuser", function () {
|
||||
|
||||
$(this).off('popupafterclose.deleteuser');
|
||||
|
||||
var msg = Globalize.translate('CancelSyncJobConfirmation');
|
||||
|
||||
Dashboard.confirm(msg, Globalize.translate('HeaderCancelSyncJob'), function (result) {
|
||||
|
||||
if (result) {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.ajax({
|
||||
|
||||
url: ApiClient.getUrl('Sync/Jobs/' + id),
|
||||
type: 'DELETE'
|
||||
|
||||
}).done(function () {
|
||||
|
||||
reloadData(page);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}).popup('close');
|
||||
}
|
||||
|
||||
function getSyncTargetName(targets, id) {
|
||||
|
||||
var target = targets.filter(function (t) {
|
||||
|
@ -14,7 +42,7 @@
|
|||
|
||||
var html = '';
|
||||
|
||||
html += "<div class='card squareCard'>";
|
||||
html += "<div class='card homePageSquareCard' data-id='" + job.Id + "'>";
|
||||
|
||||
html += '<div class="cardBox visualCardBox">';
|
||||
html += '<div class="cardScalable">';
|
||||
|
@ -24,6 +52,7 @@
|
|||
html += '<div class="cardContent">';
|
||||
|
||||
var imgUrl;
|
||||
var style = '';
|
||||
|
||||
if (job.PrimaryImageItemId) {
|
||||
imgUrl = ApiClient.getScaledImageUrl(job.PrimaryImageItemId, {
|
||||
|
@ -31,18 +60,27 @@
|
|||
width: 400,
|
||||
tag: job.PrimaryImageTag
|
||||
});
|
||||
} else {
|
||||
style = "background-color:#38c;background-position:center center;";
|
||||
imgUrl = "css/images/items/detail/video.png";
|
||||
}
|
||||
|
||||
if (imgUrl) {
|
||||
html += '<div class="cardImage coveredCardImage lazy" data-src="' + imgUrl + '">';
|
||||
html += '<div class="cardImage coveredCardImage lazy" data-src="' + imgUrl + '" style="' + style + '">';
|
||||
|
||||
if (job.Progress) {
|
||||
html += '<div class="cardFooter">';
|
||||
html += "<div class='cardText cardProgress'>";
|
||||
html += '<progress class="itemProgressBar" min="0" max="100" value="' + job.Progress + '"></progress>';
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
|
||||
if (job.Status == 'Completed') {
|
||||
html += '<div class="playedIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>';
|
||||
}
|
||||
else if (job.Status == 'Queued') {
|
||||
html += '<div class="playedIndicator" style="background-color:#38c;"><div class="ui-icon-clock ui-btn-icon-notext"></div></div>';
|
||||
}
|
||||
else if (job.Status == 'Transcoding' || job.Status == 'Transferring') {
|
||||
html += '<div class="playedIndicator"><div class="ui-icon-refresh ui-btn-icon-notext"></div></div>';
|
||||
|
@ -51,7 +89,7 @@
|
|||
html += '<div class="playedIndicator" style="background-color:#FF6A00;"><div class="ui-icon-minus ui-btn-icon-notext"></div></div>';
|
||||
}
|
||||
else if (job.Status == 'TranscodingFailed') {
|
||||
html += '<div class="playedIndicator" style="background-color:#cc0000;"><div class="ui-icon-delete ui-btn-icon-notext"></div></div>';
|
||||
html += '<div class="playedIndicator" style="background-color:#cc0000;"><div class="ui-icon-alert ui-btn-icon-notext"></div></div>';
|
||||
}
|
||||
|
||||
// cardContent
|
||||
|
@ -80,37 +118,16 @@
|
|||
textLines.push(' ');
|
||||
}
|
||||
|
||||
html += '<div class="cardText" style="text-align:right; position:absolute; bottom:5px; right: 5px;">';
|
||||
html += '<button class="btnJobMenu" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 0 0 0;"></button>';
|
||||
html += "</div>";
|
||||
|
||||
for (var i = 0, length = textLines.length; i < length; i++) {
|
||||
html += "<div class='cardText'>";
|
||||
html += "<div class='cardText' style='margin-right:30px;'>";
|
||||
html += textLines[i];
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
//if (!plugin.isExternal) {
|
||||
// html += "<div class='cardText packageReviewText'>";
|
||||
// html += plugin.price > 0 ? "$" + plugin.price.toFixed(2) : Globalize.translate('LabelFree');
|
||||
// html += RatingHelpers.getStoreRatingHtml(plugin.avgRating, plugin.id, plugin.name);
|
||||
|
||||
// html += "<span class='storeReviewCount'>";
|
||||
// html += " " + Globalize.translate('LabelNumberReviews').replace("{0}", plugin.totalRatings);
|
||||
// html += "</span>";
|
||||
|
||||
// html += "</div>";
|
||||
//}
|
||||
|
||||
//var installedPlugin = plugin.isApp ? null : installedPlugins.filter(function (ip) {
|
||||
// return ip.Name == plugin.name;
|
||||
//})[0];
|
||||
|
||||
//html += "<div class='cardText'>";
|
||||
|
||||
//if (installedPlugin) {
|
||||
// html += Globalize.translate('LabelVersionInstalled').replace("{0}", installedPlugin.Version);
|
||||
//} else {
|
||||
// html += ' ';
|
||||
//}
|
||||
//html += "</div>";
|
||||
|
||||
// cardFooter
|
||||
html += "</div>";
|
||||
|
||||
|
@ -142,15 +159,49 @@
|
|||
html += getSyncJobHtml(job);
|
||||
}
|
||||
|
||||
$('.syncActivity', page).html(html).trigger('create');
|
||||
var elem = $('.syncActivity', page).html(html).trigger('create');
|
||||
|
||||
$('.btnJobMenu', elem).on('click', function () {
|
||||
showJobMenu(this);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#dashboardSyncPage", function () {
|
||||
function showJobMenu(elem) {
|
||||
|
||||
var card = $(elem).parents('.card');
|
||||
var page = $(elem).parents('.page');
|
||||
var id = card.attr('data-id');
|
||||
|
||||
$('.jobMenu', page).popup("close").remove();
|
||||
|
||||
var html = '<div data-role="popup" class="jobMenu tapHoldMenu" data-theme="a">';
|
||||
|
||||
html += '<ul data-role="listview" style="min-width: 180px;">';
|
||||
html += '<li data-role="list-divider">' + Globalize.translate('HeaderMenu') + '</li>';
|
||||
|
||||
html += '<li data-icon="delete"><a href="#" class="btnCancelJob" data-id="' + id + '">' + Globalize.translate('ButtonCancel') + '</a></li>';
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
page.append(html);
|
||||
|
||||
var flyout = $('.jobMenu', page).popup({ positionTo: elem || "window" }).trigger('create').popup("open").on("popupafterclose", function () {
|
||||
|
||||
$(this).off("popupafterclose").remove();
|
||||
|
||||
});
|
||||
|
||||
$('.btnCancelJob', flyout).on('click', function () {
|
||||
cancelJob(page, this.getAttribute('data-id'));
|
||||
});
|
||||
}
|
||||
|
||||
function reloadData(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var page = this;
|
||||
|
||||
var promise1 = ApiClient.getJSON(ApiClient.getUrl('Sync/Jobs'));
|
||||
|
||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl('Sync/Targets'));
|
||||
|
@ -162,6 +213,13 @@
|
|||
Dashboard.hideLoadingMsg();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#dashboardSyncPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
reloadData(page);
|
||||
|
||||
}).on('pageinit', "#dashboardSyncPage", function () {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue