1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update metadataeditor

This commit is contained in:
Luke Pulverenti 2016-08-15 01:22:40 -04:00
parent 775db5c5e8
commit 818ee2bcc3
3 changed files with 48 additions and 37 deletions

View file

@ -99,6 +99,27 @@ self.addEventListener('activate', function (event) {
);
});
function getApiClient(serverId) {
return Promise.reject();
}
function executeAction(action, data, serverId) {
return getApiClient(serverId).then(function (apiClient) {
switch (action) {
case 'cancel-install':
var id = data.id;
return apiClient.cancelPackageInstallation(id);
case 'restart':
return apiClient.restartServer();
default:
clients.openWindow("/");
return Promise.resolve();
}
});
}
self.addEventListener('notificationclick', function (event) {
var notification = event.notification;
@ -107,21 +128,13 @@ self.addEventListener('notificationclick', function (event) {
var data = notification.data;
var serverId = data.serverId;
var action = event.action;
var promise;
switch (action) {
case 'cancel-install':
var id = data.id;
console.log('cancel: ' + id);
break;
case 'restart':
break;
default:
clients.openWindow("/");
break;
if (!action) {
clients.openWindow("/");
event.waitUntil(Promise.resolve());
return;
}
promise = promise || Promise.resolve();
event.waitUntil(promise);
event.waitUntil(executeAction(action, data, serverId));
}, false);