mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 02:48:19 -07:00
update buttons immediately when starting/stopping tasks
This commit is contained in:
parent
3544f24448
commit
4ced71186b
@ -135,21 +135,25 @@
|
|||||||
|
|
||||||
var btnTask = $('#btnTask' + task.Id, page);
|
var btnTask = $('#btnTask' + task.Id, page);
|
||||||
|
|
||||||
if (task.State == "Idle") {
|
updateTaskButton(btnTask, task.State);
|
||||||
|
|
||||||
btnTask.addClass('btnStartTask').removeClass('btnStopTask').show().data('icon', 'play').buttonMarkup("refresh");
|
|
||||||
}
|
|
||||||
else if (task.State == "Running") {
|
|
||||||
|
|
||||||
btnTask.addClass('btnStopTask').removeClass('btnStartTask').show().data('icon', 'stop').buttonMarkup("refresh");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
btnTask.addClass('btnStartTask').removeClass('btnStopTask').hide().data('icon', 'play').buttonMarkup("refresh");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateTaskButton(btnTask, state) {
|
||||||
|
if (state == "Idle") {
|
||||||
|
|
||||||
|
btnTask.addClass('btnStartTask').removeClass('btnStopTask').show().data('icon', 'play').buttonMarkup("refresh");
|
||||||
|
}
|
||||||
|
else if (state == "Running") {
|
||||||
|
|
||||||
|
btnTask.addClass('btnStopTask').removeClass('btnStartTask').show().data('icon', 'stop').buttonMarkup("refresh");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
btnTask.addClass('btnStartTask').removeClass('btnStopTask').hide().data('icon', 'play').buttonMarkup("refresh");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onWebSocketConnectionChange() {
|
function onWebSocketConnectionChange() {
|
||||||
reloadList($.mobile.activePage, true);
|
reloadList($.mobile.activePage, true);
|
||||||
@ -179,17 +183,21 @@
|
|||||||
|
|
||||||
$('#divScheduledTasks', page).on('click', '.btnStartTask', function () {
|
$('#divScheduledTasks', page).on('click', '.btnStartTask', function () {
|
||||||
|
|
||||||
var id = this.getAttribute('data-taskid');
|
var button = this;
|
||||||
|
var id = button.getAttribute('data-taskid');
|
||||||
ApiClient.startScheduledTask(id).done(function () {
|
ApiClient.startScheduledTask(id).done(function () {
|
||||||
|
|
||||||
|
updateTaskButton($(button), "Running");
|
||||||
reloadList(page);
|
reloadList(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
}).on('click', '.btnStopTask', function () {
|
}).on('click', '.btnStopTask', function () {
|
||||||
|
|
||||||
var id = this.getAttribute('data-taskid');
|
var button = this;
|
||||||
|
var id = button.getAttribute('data-taskid');
|
||||||
ApiClient.stopScheduledTask(id).done(function () {
|
ApiClient.stopScheduledTask(id).done(function () {
|
||||||
|
|
||||||
|
updateTaskButton($(button), "");
|
||||||
reloadList(page);
|
reloadList(page);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user