discourse/app/assets/javascripts/admin/models/admin-dashboard.js.es6

41 lines
1.0 KiB
Plaintext
Raw Normal View History

2016-04-01 05:33:25 +08:00
const AdminDashboard = Discourse.Model.extend({});
2016-04-01 05:33:25 +08:00
AdminDashboard.reopenClass({
/**
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
**/
find: function() {
return Discourse.ajax("/admin/dashboard.json").then(function(json) {
2016-04-01 05:33:25 +08:00
var model = AdminDashboard.create(json);
model.set('loaded', true);
return model;
});
},
/**
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() {
return Discourse.ajax("/admin/dashboard/problems.json", {
type: 'GET',
dataType: 'json'
}).then(function(json) {
2016-04-01 05:33:25 +08:00
var model = AdminDashboard.create(json);
model.set('loaded', true);
return model;
});
}
});
2016-04-01 05:33:25 +08:00
export default AdminDashboard;