2013-03-30 03:48:26 +08: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-15 06:26:12 +08:00
|
|
|
Discourse.AdminDashboard = Discourse.Model.extend({});
|
|
|
|
|
|
|
|
Discourse.AdminDashboard.reopenClass({
|
2013-03-30 03:48:26 +08: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-15 06:26:12 +08:00
|
|
|
find: function() {
|
2014-02-11 01:43:17 +08:00
|
|
|
return Discourse.ajax("/admin/dashboard.json").then(function(json) {
|
2013-04-04 04:06:55 +08:00
|
|
|
var model = Discourse.AdminDashboard.create(json);
|
|
|
|
model.set('loaded', true);
|
|
|
|
return model;
|
2013-03-15 06:26:12 +08:00
|
|
|
});
|
2013-03-30 03:48:26 +08: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() {
|
2014-02-11 01:43:17 +08:00
|
|
|
return Discourse.ajax("/admin/dashboard/problems.json", {
|
2013-03-30 03:48:26 +08:00
|
|
|
type: 'GET',
|
2013-04-04 04:06:55 +08:00
|
|
|
dataType: 'json'
|
|
|
|
}).then(function(json) {
|
|
|
|
var model = Discourse.AdminDashboard.create(json);
|
|
|
|
model.set('loaded', true);
|
|
|
|
return model;
|
2013-03-30 03:48:26 +08:00
|
|
|
});
|
2013-03-15 06:26:12 +08:00
|
|
|
}
|
2013-03-21 23:24:05 +08:00
|
|
|
});
|