diff --git a/dashboard-ui/bower_components/emby-webcomponents/router.js b/dashboard-ui/bower_components/emby-webcomponents/router.js index fa9560b73b..e0349789d7 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/router.js +++ b/dashboard-ui/bower_components/emby-webcomponents/router.js @@ -203,7 +203,7 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b return; //} } - viewManager.tryRestoreView(currentRequest).then(function () { + viewManager.tryRestoreView(currentRequest, function () { // done currentRouteInfo = { @@ -211,7 +211,12 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b path: ctx.path }; - }, onNewViewNeeded); + }).catch(function (result) { + + if (!result || !result.cancelled) { + onNewViewNeeded(); + } + }); } var firstConnectionResult; diff --git a/dashboard-ui/bower_components/emby-webcomponents/viewmanager/viewmanager.js b/dashboard-ui/bower_components/emby-webcomponents/viewmanager/viewmanager.js index c47efcc62d..ae7666acb6 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/viewmanager/viewmanager.js +++ b/dashboard-ui/bower_components/emby-webcomponents/viewmanager/viewmanager.js @@ -35,8 +35,6 @@ define(['viewcontainer', 'focusManager', 'queryString', 'layoutManager'], functi function onViewChange(view, options, isRestore) { - var viewType = options.type; - var lastView = currentView; if (lastView) { dispatchViewEvent(lastView, 'viewhide'); @@ -123,67 +121,54 @@ define(['viewcontainer', 'focusManager', 'queryString', 'layoutManager'], functi //events.on(connectionManager, 'localusersignedin', resetCachedViews); //events.on(connectionManager, 'localusersignedout', resetCachedViews); - function tryRestoreInternal(viewcontainer, options, resolve, reject) { + function ViewManager() { + } + + ViewManager.prototype.loadView = function (options) { + + var lastView = currentView; + + // Record the element that has focus + if (lastView) { + lastView.activeElement = document.activeElement; + } if (options.cancel) { return; } - viewcontainer.tryRestoreView(options).then(function (view) { + viewcontainer.loadView(options).then(function (view) { + onViewChange(view, options); + }); + }; + + ViewManager.prototype.tryRestoreView = function (options, onViewChanging) { + + if (options.cancel) { + return Promise.reject({ cancelled: true }); + } + + // Record the element that has focus + if (currentView) { + currentView.activeElement = document.activeElement; + } + + return viewcontainer.tryRestoreView(options).then(function (view) { + + onViewChanging(); onViewChange(view, options, true); - resolve(); - }, reject); - } + }); + }; - function ViewManager() { + ViewManager.prototype.currentView = function () { + return currentView; + }; - var self = this; - - self.loadView = function (options) { - - var lastView = currentView; - - // Record the element that has focus - if (lastView) { - lastView.activeElement = document.activeElement; - } - - if (options.cancel) { - return; - } - - viewcontainer.loadView(options).then(function (view) { - - onViewChange(view, options); - }); - }; - - self.tryRestoreView = function (options) { - return new Promise(function (resolve, reject) { - - if (options.cancel) { - return; - } - - // Record the element that has focus - if (currentView) { - currentView.activeElement = document.activeElement; - } - - tryRestoreInternal(viewcontainer, options, resolve, reject); - }); - }; - - self.currentView = function () { - return currentView; - }; - - self.dispatchPageEvents = function (value) { - dispatchPageEvents = value; - }; - } + ViewManager.prototype.dispatchPageEvents = function (value) { + dispatchPageEvents = value; + }; return new ViewManager(); }); diff --git a/dashboard-ui/camerauploadsettings.html b/dashboard-ui/camerauploadsettings.html index be983af99d..23db249355 100644 --- a/dashboard-ui/camerauploadsettings.html +++ b/dashboard-ui/camerauploadsettings.html @@ -1,4 +1,4 @@ -