2013-02-23 04:41:12 +08:00
|
|
|
/**
|
|
|
|
This controller supports the default interface when you enter the admin section.
|
2013-02-21 02:15:50 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
@class AdminDashboardController
|
|
|
|
@extends Ember.Controller
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
|
|
|
**/
|
|
|
|
Discourse.AdminDashboardController = Ember.Controller.extend({
|
|
|
|
loading: true,
|
2013-03-20 11:18:00 +08:00
|
|
|
versionCheck: null,
|
2013-04-17 00:09:37 +08:00
|
|
|
problemsCheckInterval: '1 minute ago',
|
2013-03-20 11:18:00 +08:00
|
|
|
|
|
|
|
foundProblems: function() {
|
|
|
|
return(this.get('problems') && this.get('problems').length > 0);
|
2013-04-17 00:09:37 +08:00
|
|
|
}.property('problems'),
|
|
|
|
|
|
|
|
thereWereProblems: function() {
|
|
|
|
if( this.get('foundProblems') ) {
|
|
|
|
this.set('hadProblems', true);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return this.get('hadProblems') || false;
|
|
|
|
}
|
|
|
|
}.property('foundProblems'),
|
|
|
|
|
|
|
|
loadProblems: function() {
|
|
|
|
this.set('loadingProblems', true);
|
|
|
|
this.set('problemsFetchedAt', new Date());
|
|
|
|
var c = this;
|
|
|
|
Discourse.AdminDashboard.fetchProblems().then(function(d) {
|
|
|
|
c.set('problems', d.problems);
|
|
|
|
c.set('loadingProblems', false);
|
|
|
|
if( d.problems && d.problems.length > 0 ) {
|
|
|
|
c.problemsCheckInterval = '1 minute ago';
|
|
|
|
} else {
|
|
|
|
c.problemsCheckInterval = '10 minutes ago';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
problemsTimestamp: function() {
|
|
|
|
return this.get('problemsFetchedAt').long();
|
|
|
|
}.property('problemsFetchedAt')
|
2013-02-23 04:41:12 +08:00
|
|
|
});
|