FIX: Show error if dashboard can't load
This commit is contained in:
parent
e4a5b0c39a
commit
ec6bbe2af0
|
@ -19,6 +19,7 @@ export default Ember.Controller.extend({
|
||||||
versionCheck: null,
|
versionCheck: null,
|
||||||
dashboardFetchedAt: null,
|
dashboardFetchedAt: null,
|
||||||
showVersionChecks: setting('version_checks'),
|
showVersionChecks: setting('version_checks'),
|
||||||
|
exceptionController: Ember.inject.controller('exception'),
|
||||||
|
|
||||||
@computed('problems.length')
|
@computed('problems.length')
|
||||||
foundProblems(problemsLength) {
|
foundProblems(problemsLength) {
|
||||||
|
@ -39,10 +40,10 @@ export default Ember.Controller.extend({
|
||||||
|
|
||||||
fetchDashboard() {
|
fetchDashboard() {
|
||||||
if (!this.get('dashboardFetchedAt') || moment().subtract(30, 'minutes').toDate() > this.get('dashboardFetchedAt')) {
|
if (!this.get('dashboardFetchedAt') || moment().subtract(30, 'minutes').toDate() > this.get('dashboardFetchedAt')) {
|
||||||
this.set('dashboardFetchedAt', new Date());
|
|
||||||
this.set('loading', true);
|
this.set('loading', true);
|
||||||
const versionChecks = this.siteSettings.version_checks;
|
const versionChecks = this.siteSettings.version_checks;
|
||||||
AdminDashboard.find().then(d => {
|
AdminDashboard.find().then(d => {
|
||||||
|
this.set('dashboardFetchedAt', new Date());
|
||||||
if (versionChecks) {
|
if (versionChecks) {
|
||||||
this.set('versionCheck', VersionCheck.create(d.version_check));
|
this.set('versionCheck', VersionCheck.create(d.version_check));
|
||||||
}
|
}
|
||||||
|
@ -56,6 +57,10 @@ export default Ember.Controller.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
ATTRIBUTES.forEach(a => this.set(a, d[a]));
|
ATTRIBUTES.forEach(a => this.set(a, d[a]));
|
||||||
|
}).catch(e => {
|
||||||
|
this.get('exceptionController').set('thrown', e.jqXHR);
|
||||||
|
this.replaceRoute('exception');
|
||||||
|
}).finally(() => {
|
||||||
this.set('loading', false);
|
this.set('loading', false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue