mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 09:25:49 +08:00
45afed8720
MIME type, then leave and hit the back button, you'll get the last MIME type requested instead of HTML. This fixes it.
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
/**
|
|
A model that stores all or some data that is displayed on the dashboard.
|
|
|
|
@class AdminDashboard
|
|
@extends Discourse.Model
|
|
@namespace Discourse
|
|
@module Discourse
|
|
**/
|
|
|
|
Discourse.AdminDashboard = Discourse.Model.extend({});
|
|
|
|
Discourse.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) {
|
|
var model = Discourse.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) {
|
|
var model = Discourse.AdminDashboard.create(json);
|
|
model.set('loaded', true);
|
|
return model;
|
|
});
|
|
}
|
|
});
|