diff --git a/res/app/components/stf/screen/fast-image-render/index.js b/res/app/components/stf/screen/fast-image-render/index.js index 9e46d4cd..f6f9d4b8 100644 --- a/res/app/components/stf/screen/fast-image-render/index.js +++ b/res/app/components/stf/screen/fast-image-render/index.js @@ -412,6 +412,7 @@ function FastImageRender(canvasElement, options) { var that = this this.options = options || {} this.canvasElement = canvasElement + this.timeoutId = null if (that.options.raf) { that.animLoop = function() { @@ -425,11 +426,17 @@ function FastImageRender(canvasElement, options) { if (true) { this.loader = new Image() this.loader.onload = function () { + if (that.options.timeout) { + clearTimeout(that.timeoutId) + } if (typeof(that.onLoad) === 'function') { that.onLoad(this) } } this.loader.onerror = function () { + if (that.options.timeout) { + clearTimeout(that.timeoutId) + } if (typeof(that.onError) === 'function') { that.onError(this) } @@ -455,6 +462,14 @@ FastImageRender.prototype.destroy = function () { FastImageRender.prototype.load = function (url, type) { var that = this + if (that.options.timeout) { + that.timeoutId = setTimeout(function () { + if (typeof(that.onError) === 'function') { + that.onError('timeout') + } + }, that.options.timeout) + } + if (this.options.textureLoader) { if (!this.textureLoader) { this.textureLoader = new TextureUtil.TextureLoader(this.render.ctx) diff --git a/res/app/components/stf/screen/screen-directive.js b/res/app/components/stf/screen/screen-directive.js index adead1e4..8477e0ed 100644 --- a/res/app/components/stf/screen/screen-directive.js +++ b/res/app/components/stf/screen/screen-directive.js @@ -6,7 +6,7 @@ module.exports = function DeviceScreenDirective($document, ScalingService, Vendo template: require('./screen.jade'), link: function (scope, element) { var canvas = element.find('canvas')[0] - , imageRender = new FastImageRender(canvas, {render: 'canvas'}) + , imageRender = new FastImageRender(canvas, {render: 'canvas', timeout: 1000}) , guestDisplayDensity = BrowserInfo.retina ? 2 : 1 , guestDisplayRotation = 0 , finger = element.find('span') @@ -116,7 +116,9 @@ module.exports = function DeviceScreenDirective($document, ScalingService, Vendo } scope.retryLoadingScreen = function () { - scope.control.home() + if (scope.displayError === 'secure') { + scope.control.home() + } $timeout(maybeLoadScreen, 1000) } @@ -204,11 +206,15 @@ module.exports = function DeviceScreenDirective($document, ScalingService, Vendo } } - imageRender.onError = function () { + imageRender.onError = function (type) { loading = false scope.$apply(function () { - scope.displayError = true + if (type === 'timeout') { + scope.displayError = 'timeout' + } else { + scope.displayError = 'secure' + } }) } diff --git a/res/app/components/stf/screen/screen.jade b/res/app/components/stf/screen/screen.jade index 79d92b51..73588cce 100644 --- a/res/app/components/stf/screen/screen.jade +++ b/res/app/components/stf/screen/screen.jade @@ -5,7 +5,8 @@ div(ng-if='displayError').screen-error // TODO: PING here to check for connectivity http://172.19.9.107:7401/api/v1/displays/0 .well - .screen-error-alert(translate) This might be caused by a network error, or you might be trying to access a secure view. + .screen-error-alert(ng-show='displayError === "secure"', translate) This might be caused by a network error, or you might be trying to access a secure view. + .screen-error-alert(ng-show='displayError === "timeout"', translate) Retrieving the device screen has timed out. .well button(ng-click='retryLoadingScreen()', style='text-align: center;').btn.btn-primary.btn-block diff --git a/res/app/control-panes/logs/logs.jade b/res/app/control-panes/logs/logs.jade index ba36a9ca..f9dbe335 100644 --- a/res/app/control-panes/logs/logs.jade +++ b/res/app/control-panes/logs/logs.jade @@ -32,12 +32,12 @@ th(width='16%') Tag th(width='46%') Text tr - td(width='0') + td(width='1%') button(ng-model='started', btn-checkbox, title='{{"Start/Stop Logging"|translate}}').btn.btn-xs.btn-primary-outline i.fa.fa-list-alt span(ng-if='started') {{"Stop"|translate}} span(ng-if='!started') {{"Get"|translate}} - td(width='10%') + //td(width='10%') select(ng-model='filtering.deviceName', ng-options='d for d in filtering.devicesList') option(value='') {{"Device"|translate}} td(width='6%')