discourse/app/assets/javascripts/admin/addon/routes/admin-backups-index.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
634 B
JavaScript
Raw Normal View History

import Route from "@ember/routing/route";
import { bind } from "discourse-common/utils/decorators";
import Backup from "admin/models/backup";
export default class AdminBackupsIndexRoute extends Route {
2018-01-31 19:05:06 +08:00
activate() {
this.messageBus.subscribe("/admin/backups", this.onMessage);
}
deactivate() {
this.messageBus.unsubscribe("/admin/backups", this.onMessage);
}
2018-01-31 19:05:06 +08:00
model() {
return Backup.find().then((backups) =>
backups.map((backup) => Backup.create(backup))
);
}
2018-01-31 19:05:06 +08:00
@bind
onMessage(backups) {
this.controller.set(
"model",
backups.map((backup) => Backup.create(backup))
);
}
}