mirror of https://github.com/hashicorp/consul
Ensure startup/load image is removed if you hit an error on first load
parent
71cef8b8cd
commit
11ec24fe48
|
@ -4,6 +4,9 @@ import { hash } from 'rsvp';
|
||||||
import { get } from '@ember/object';
|
import { get } from '@ember/object';
|
||||||
import { next } from '@ember/runloop';
|
import { next } from '@ember/runloop';
|
||||||
const $html = document.documentElement;
|
const $html = document.documentElement;
|
||||||
|
const removeLoading = function() {
|
||||||
|
return $html.classList.remove('ember-loading');
|
||||||
|
};
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
@ -24,7 +27,7 @@ export default Route.extend({
|
||||||
const controller = this.controllerFor('application');
|
const controller = this.controllerFor('application');
|
||||||
controller.setProperties(model);
|
controller.setProperties(model);
|
||||||
transition.promise.finally(function() {
|
transition.promise.finally(function() {
|
||||||
$html.classList.remove('ember-loading');
|
removeLoading();
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
loading: false,
|
loading: false,
|
||||||
dc: model.dc,
|
dc: model.dc,
|
||||||
|
@ -51,11 +54,13 @@ export default Route.extend({
|
||||||
dc: error.status.toString().indexOf('5') !== 0 ? get(this, 'repo').getActive() : null,
|
dc: error.status.toString().indexOf('5') !== 0 ? get(this, 'repo').getActive() : null,
|
||||||
})
|
})
|
||||||
.then(model => {
|
.then(model => {
|
||||||
|
removeLoading();
|
||||||
next(() => {
|
next(() => {
|
||||||
this.controllerFor('error').setProperties(model);
|
this.controllerFor('error').setProperties(model);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
removeLoading();
|
||||||
next(() => {
|
next(() => {
|
||||||
this.controllerFor('error').setProperties({ error: error });
|
this.controllerFor('error').setProperties({ error: error });
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue