discourse/app/assets/javascripts/admin/addon/models/admin-dashboard.js
Martin Brennan 3e5976f843
FEATURE: Always show full page "New Features" to admins (#28383)
We used to show New Features in a tab on the dashboard,
but this could get pushed down the page especially on
our hosting. In 043117ca13
we made a separate What's New page, so this commit removes
the dashboard tab and changes the admin notification to
send the admin to /admin/whats-new instead of the dashboard
tab.
2024-08-16 09:12:24 +10:00

47 lines
1.0 KiB
JavaScript

import EmberObject from "@ember/object";
import { ajax } from "discourse/lib/ajax";
const GENERAL_ATTRIBUTES = [
"updated_at",
"discourse_updated_at",
"release_notes_link",
];
export default class AdminDashboard extends EmberObject {
static fetch() {
return ajax("/admin/dashboard.json").then((json) => {
const model = AdminDashboard.create();
model.setProperties({
version_check: json.version_check,
});
return model;
});
}
static 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;
});
}
static fetchProblems() {
return ajax("/admin/dashboard/problems.json").then((json) => {
const model = AdminDashboard.create(json);
model.set("loaded", true);
return model;
});
}
}