2013-03-29 15:48:26 -04:00
|
|
|
/**
|
|
|
|
A model that stores all or some data that is displayed on the dashboard.
|
|
|
|
|
|
|
|
@class AdminDashboard
|
|
|
|
@extends Discourse.Model
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
|
|
|
**/
|
|
|
|
|
2013-03-14 18:26:12 -04:00
|
|
|
Discourse.AdminDashboard = Discourse.Model.extend({});
|
|
|
|
|
|
|
|
Discourse.AdminDashboard.reopenClass({
|
2013-03-29 15:48:26 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Fetch all dashboard data. This can be an expensive request when the cached data
|
|
|
|
has expired and the server must collect the data again.
|
|
|
|
|
|
|
|
@method find
|
|
|
|
@return {jqXHR} a jQuery Promise object
|
|
|
|
**/
|
2013-03-14 18:26:12 -04:00
|
|
|
find: function() {
|
2013-05-07 13:30:12 -04:00
|
|
|
return Discourse.ajax("/admin/dashboard").then(function(json) {
|
2013-04-03 16:06:55 -04:00
|
|
|
var model = Discourse.AdminDashboard.create(json);
|
|
|
|
model.set('loaded', true);
|
|
|
|
return model;
|
2013-03-14 18:26:12 -04:00
|
|
|
});
|
2013-03-29 15:48:26 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Only fetch the list of problems that should be rendered on the dashboard.
|
|
|
|
The model will only have its "problems" attribute set.
|
|
|
|
|
|
|
|
@method fetchProblems
|
|
|
|
@return {jqXHR} a jQuery Promise object
|
|
|
|
**/
|
|
|
|
fetchProblems: function() {
|
2013-05-07 13:30:12 -04:00
|
|
|
return Discourse.ajax("/admin/dashboard/problems", {
|
2013-03-29 15:48:26 -04:00
|
|
|
type: 'GET',
|
2013-04-03 16:06:55 -04:00
|
|
|
dataType: 'json'
|
|
|
|
}).then(function(json) {
|
|
|
|
var model = Discourse.AdminDashboard.create(json);
|
|
|
|
model.set('loaded', true);
|
|
|
|
return model;
|
2013-03-29 15:48:26 -04:00
|
|
|
});
|
2013-03-14 18:26:12 -04:00
|
|
|
}
|
2013-03-21 11:24:05 -04:00
|
|
|
});
|