From 7f7325e05ef3f67d30df00a436e1bbc2a18200a8 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Wed, 13 Jun 2018 14:15:08 +0100 Subject: [PATCH] Ensure startup/load image is removed if you hit an error on first load --- ui-v2/app/routes/application.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui-v2/app/routes/application.js b/ui-v2/app/routes/application.js index 0fd78fb06..d37941247 100644 --- a/ui-v2/app/routes/application.js +++ b/ui-v2/app/routes/application.js @@ -4,6 +4,9 @@ import { hash } from 'rsvp'; import { get } from '@ember/object'; import { next } from '@ember/runloop'; const $html = document.documentElement; +const removeLoading = function() { + return $html.classList.remove('ember-loading'); +}; export default Route.extend({ init: function() { this._super(...arguments); @@ -24,7 +27,7 @@ export default Route.extend({ const controller = this.controllerFor('application'); controller.setProperties(model); transition.promise.finally(function() { - $html.classList.remove('ember-loading'); + removeLoading(); controller.setProperties({ loading: false, dc: model.dc, @@ -51,11 +54,13 @@ export default Route.extend({ dc: error.status.toString().indexOf('5') !== 0 ? get(this, 'repo').getActive() : null, }) .then(model => { + removeLoading(); next(() => { this.controllerFor('error').setProperties(model); }); }) .catch(e => { + removeLoading(); next(() => { this.controllerFor('error').setProperties({ error: error }); });