2019-11-08 14:13:35 -05:00
|
|
|
import EmberObject from "@ember/object";
|
2016-06-30 13:55:44 -04:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
2013-03-29 15:48:26 -04:00
|
|
|
|
2019-05-17 01:42:45 -04:00
|
|
|
const GENERAL_ATTRIBUTES = [
|
|
|
|
"updated_at",
|
|
|
|
"discourse_updated_at",
|
|
|
|
"release_notes_link",
|
|
|
|
];
|
2019-04-01 06:39:49 -04:00
|
|
|
|
2019-11-08 14:13:35 -05:00
|
|
|
const AdminDashboard = EmberObject.extend({});
|
2013-03-29 15:48:26 -04:00
|
|
|
|
2015-11-20 20:27:06 -05:00
|
|
|
AdminDashboard.reopenClass({
|
2019-04-01 06:39:49 -04:00
|
|
|
fetch() {
|
|
|
|
return ajax("/admin/dashboard.json").then((json) => {
|
|
|
|
const model = AdminDashboard.create();
|
|
|
|
model.set("version_check", json.version_check);
|
2021-01-22 10:09:02 -05:00
|
|
|
|
2019-04-01 06:39:49 -04:00
|
|
|
return model;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
fetchGeneral() {
|
|
|
|
return ajax("/admin/dashboard/general.json").then((json) => {
|
|
|
|
const model = AdminDashboard.create();
|
|
|
|
|
|
|
|
const attributes = {};
|
|
|
|
GENERAL_ATTRIBUTES.forEach((a) => (attributes[a] = json[a]));
|
|
|
|
|
|
|
|
model.setProperties({
|
|
|
|
reports: json.reports,
|
|
|
|
attributes,
|
|
|
|
loaded: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
return model;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
fetchProblems() {
|
|
|
|
return ajax("/admin/dashboard/problems.json").then((json) => {
|
|
|
|
const model = AdminDashboard.create(json);
|
2013-04-03 16:06:55 -04:00
|
|
|
model.set("loaded", true);
|
|
|
|
return model;
|
2013-03-14 18:26:12 -04:00
|
|
|
});
|
2013-03-29 15:48:26 -04:00
|
|
|
},
|
2013-03-21 11:24:05 -04:00
|
|
|
});
|
2015-11-20 20:27:06 -05:00
|
|
|
|
|
|
|
export default AdminDashboard;
|