diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 9c3eb5e753..0f5a5bafbd 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -14,12 +14,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.4.169", - "_release": "1.4.169", + "version": "1.4.170", + "_release": "1.4.170", "_resolution": { "type": "version", - "tag": "1.4.169", - "commit": "af6acc90c4ff89041c8f0be115ec132389e7805b" + "tag": "1.4.170", + "commit": "61f0b1c9783d19db9b76882badbf575500dea6e9" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.1", diff --git a/dashboard-ui/bower_components/emby-webcomponents/formdialog.css b/dashboard-ui/bower_components/emby-webcomponents/formdialog.css index 0a23e5e03e..bc437f595c 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/formdialog.css +++ b/dashboard-ui/bower_components/emby-webcomponents/formdialog.css @@ -12,7 +12,7 @@ } .formDialogHeaderTitle { - margin-left: .75em; + margin-left: .5em; } .formDialogContent { diff --git a/dashboard-ui/bower_components/emby-webcomponents/notifications/notifications.js b/dashboard-ui/bower_components/emby-webcomponents/notifications/notifications.js index b2aedee634..92378815e5 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/notifications/notifications.js +++ b/dashboard-ui/bower_components/emby-webcomponents/notifications/notifications.js @@ -59,14 +59,20 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir } catch (err) { if (options.actions) { options.actions = []; - show(title, options, timeoutMs); + showNonPersistentNotification(title, options, timeoutMs); } else { throw err; } } } - function show(title, options, timeoutMs) { + function showNotification(options, timeoutMs, apiClient) { + + var title = options.title; + + options.data = options.data || {}; + options.data.serverId = apiClient.serverInfo().Id; + options.icon = options.icon || getIconUrl(); resetRegistration(); @@ -103,7 +109,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir }); } - show(notification.title, notification, 15000); + showNotification(notification, 15000, apiClient); } function onLibraryChanged(data, apiClient) { @@ -140,6 +146,9 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir } function getIconUrl(name) { + + name = name || 'notificationicon.png'; + return require.toUrl('.').split('?')[0] + '/' + name; } @@ -153,8 +162,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir var notification = { tag: "install" + installation.Id, - data: {}, - icon: getIconUrl('/notificationicon.png') + data: {} }; if (status == 'completed') { @@ -173,8 +181,14 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir notification.actions = [ - { action: 'cancel-install-' + installation.Id, title: globalize.translate('sharedcomponents#ButtonCancel')/*, icon: 'https://example/like.png'*/ } + { + action: 'cancel-install', + title: globalize.translate('sharedcomponents#ButtonCancel'), + icon: getIconUrl() + } ]; + + notification.data.id = installation.id; } if (status == 'progress') { @@ -186,7 +200,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir var timeout = status == 'cancelled' ? 5000 : 0; - show(notification.title, notification, timeout); + showNotification(notification, timeout, apiClient); }); } @@ -210,4 +224,41 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir showPackageInstallNotification(apiClient, data, "progress"); }); + events.on(serverNotifications, 'ServerShuttingDown', function (e, apiClient, data) { + var serverId = apiClient.serverInfo().Id; + var notification = { + tag: "restart" + serverId, + title: globalize.translate('sharedcomponents#ServerNameIsShuttingDown', apiClient.serverInfo().Name) + }; + showNotification(notification, 0, apiClient); + }); + + events.on(serverNotifications, 'ServerRestarting', function (e, apiClient, data) { + var serverId = apiClient.serverInfo().Id; + var notification = { + tag: "restart" + serverId, + title: globalize.translate('sharedcomponents#ServerNameIsRestarting', apiClient.serverInfo().Name) + }; + showNotification(notification, 0, apiClient); + }); + + events.on(serverNotifications, 'RestartRequired', function (e, apiClient, data) { + + var serverId = apiClient.serverInfo().Id; + var notification = { + tag: "restart" + serverId, + title: globalize.translate('sharedcomponents#PleaseRestartServerName', apiClient.serverInfo().Name) + }; + + notification.actions = + [ + { + action: 'restart', + title: globalize.translate('sharedcomponents#ButtonRestart'), + icon: getIconUrl() + } + ]; + + showNotification(notification, 0, apiClient); + }); }); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json b/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json index 18daf90681..9f8b3a795a 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json +++ b/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json @@ -24,6 +24,7 @@ "ButtonOk": "Ok", "ButtonCancel": "Cancel", "ButtonGotIt": "Got It", + "ButtonRestart": "Restart", "RecordingCancelled": "Recording cancelled.", "RecordingScheduled": "Recording scheduled.", "SeriesRecordingScheduled": "Series recording scheduled.", @@ -248,5 +249,8 @@ "MessageItemSaved": "Item saved.", "SearchResults": "Search Results", "SyncToOtherDevice": "Sync to other device", - "MakeAvailableOffline": "Make available offline" + "MakeAvailableOffline": "Make available offline", + "ServerNameIsRestarting": "Emby Server - {0} is restarting.", + "ServerNameIsShuttingDown": "Emby Server - {0} is shutting down.", + "PleaseRestartServerName": "Please restart Emby Server - {0}." } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-meta/.bower.json b/dashboard-ui/bower_components/iron-meta/.bower.json index f4bfef4a7c..e1304d174b 100644 --- a/dashboard-ui/bower_components/iron-meta/.bower.json +++ b/dashboard-ui/bower_components/iron-meta/.bower.json @@ -26,14 +26,14 @@ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, "main": "iron-meta.html", - "homepage": "https://github.com/polymerelements/iron-meta", + "homepage": "https://github.com/PolymerElements/iron-meta", "_release": "1.1.1", "_resolution": { "type": "version", "tag": "v1.1.1", "commit": "e171ee234b482219c9514e6f9551df48ef48bd9f" }, - "_source": "git://github.com/polymerelements/iron-meta.git", + "_source": "git://github.com/PolymerElements/iron-meta.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-meta" + "_originalSource": "PolymerElements/iron-meta" } \ No newline at end of file diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index c5f1201a53..2bd7fd67b7 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -387,26 +387,6 @@ textarea { } } -/* Footer */ -#footer { - position: fixed; - bottom: 0; - left: 0; - right: 0; - /* Above everything, except for the video player and popup overlays */ - z-index: 1097; - color: #fff; - border: 0 !important; - background-color: rgba(26,26,26,.94); -} - -.footerNotification { - padding: .75em 1em; - margin: 0; - font-weight: normal; - border-top: 1px solid #555; -} - /* * Gradient Shadow */ diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 30799f0dd8..7a6d07bd07 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -154,17 +154,8 @@ var Dashboard = { if (info.HasPendingRestart) { - Dashboard.getCurrentUser().then(function (currentUser) { - - if (currentUser.Policy.IsAdministrator) { - Dashboard.showServerRestartWarning(info); - } - }); - } else { - Dashboard.hideServerRestartWarning(); - if (Dashboard.initialServerVersion != info.Version && !AppInfo.isNativeApp) { window.location.reload(true); @@ -172,98 +163,6 @@ var Dashboard = { } }, - showServerRestartWarning: function (systemInfo) { - - if (AppInfo.isNativeApp) { - return; - } - - var html = '' + Globalize.translate('MessagePleaseRestart') + ''; - - if (systemInfo.CanSelfRestart) { - html += ''; - } - - Dashboard.showFooterNotification({ id: "serverRestartWarning", html: html, forceShow: true, allowHide: false }); - }, - - hideServerRestartWarning: function () { - - var elem = document.getElementById('serverRestartWarning'); - if (elem) { - elem.parentNode.removeChild(elem); - } - }, - - showFooterNotification: function (options) { - - var removeOnHide = !options.id; - - options.id = options.id || "notification" + new Date().getTime() + parseInt(Math.random()); - - if (!document.querySelector(".footer")) { - - var footerHtml = ''; - - document.body.insertAdjacentHTML('beforeend', footerHtml); - } - - var footer = document.querySelector('.footer'); - footer.style.top = 'initial'; - footer.classList.remove('hide'); - - var parentElem = footer.querySelector('#footerNotifications'); - - var notificationElementId = 'notification' + options.id; - - var elem = parentElem.querySelector('#' + notificationElementId); - - if (!elem) { - parentElem.insertAdjacentHTML('beforeend', '

'); - elem = parentElem.querySelector('#' + notificationElementId); - } - - var onclick = removeOnHide ? "jQuery('#" + notificationElementId + "').trigger('notification.remove').remove();" : "jQuery('#" + notificationElementId + "').trigger('notification.hide').hide();"; - - if (options.allowHide !== false) { - options.html += '"; - } - - if (options.forceShow) { - elem.classList.remove('hide'); - } - - elem.innerHTML = options.html; - - if (options.timeout) { - - setTimeout(function () { - - if (removeOnHide) { - $(elem).trigger("notification.remove").remove(); - } else { - $(elem).trigger("notification.hide").hide(); - } - - }, options.timeout); - } - - $(footer).on("notification.remove notification.hide", function (e) { - - setTimeout(function () { // give the DOM time to catch up - - if (!parentElem.innerHTML) { - footer.classList.add('hide'); - } - - }, 50); - - }); - }, - getConfigurationPageUrl: function (name) { return "configurationpage?name=" + encodeURIComponent(name); }, @@ -370,20 +269,6 @@ var Dashboard = { }); }, - refreshSystemInfoFromServer: function () { - - var apiClient = ApiClient; - - if (apiClient && apiClient.accessToken()) { - if (AppInfo.enableFooterNotifications) { - apiClient.getSystemInfo().then(function (info) { - - Dashboard.updateSystemInfo(info); - }); - } - } - }, - restartServer: function () { var apiClient = window.ApiClient; @@ -698,13 +583,7 @@ var Dashboard = { var msg = data; - if (msg.MessageType === "ServerShuttingDown") { - Dashboard.hideServerRestartWarning(); - } - else if (msg.MessageType === "ServerRestarting") { - Dashboard.hideServerRestartWarning(); - } - else if (msg.MessageType === "SystemInfo") { + if (msg.MessageType === "SystemInfo") { Dashboard.updateSystemInfo(msg.Data); } else if (msg.MessageType === "RestartRequired") { diff --git a/dashboard-ui/serviceworker.js b/dashboard-ui/serviceworker.js index 12229506f9..2176aae4ca 100644 --- a/dashboard-ui/serviceworker.js +++ b/dashboard-ui/serviceworker.js @@ -100,14 +100,28 @@ self.addEventListener('activate', function (event) { }); self.addEventListener('notificationclick', function (event) { - event.notification.close(); + var notification = event.notification; + notification.close(); + + var data = notification.data; + var serverId = data.serverId; var action = event.action; + var promise; - if (action.indexOf('cancel-install') == 0) { - var id = action.split('-')[2]; - console.log('cancel: ' + id); - } else { - clients.openWindow("/index.html"); + switch (action) { + case 'cancel-install': + var id = data.id; + console.log('cancel: ' + id); + break; + case 'restart': + break; + default: + clients.openWindow("/"); + break; } + + promise = promise || Promise.resolve(); + event.waitUntil(promise); + }, false); \ No newline at end of file