2019-10-24 00:39:32 +08:00
|
|
|
import Route from "@ember/routing/route";
|
2022-12-12 23:32:25 +08:00
|
|
|
import { bind } from "discourse-common/utils/decorators";
|
2023-10-11 02:38:59 +08:00
|
|
|
import Backup from "admin/models/backup";
|
2015-11-21 09:27:06 +08:00
|
|
|
|
2023-03-15 21:17:51 +08:00
|
|
|
export default class AdminBackupsIndexRoute extends Route {
|
2018-01-31 19:05:06 +08:00
|
|
|
activate() {
|
2022-12-12 23:32:25 +08:00
|
|
|
this.messageBus.subscribe("/admin/backups", this.onMessage);
|
2023-03-15 21:17:51 +08:00
|
|
|
}
|
2022-12-12 23:32:25 +08:00
|
|
|
|
|
|
|
deactivate() {
|
|
|
|
this.messageBus.unsubscribe("/admin/backups", this.onMessage);
|
2023-03-15 21:17:51 +08:00
|
|
|
}
|
2018-01-31 19:05:06 +08:00
|
|
|
|
2015-08-07 00:14:59 +08:00
|
|
|
model() {
|
2021-01-20 13:04:21 +08:00
|
|
|
return Backup.find().then((backups) =>
|
|
|
|
backups.map((backup) => Backup.create(backup))
|
|
|
|
);
|
2023-03-15 21:17:51 +08:00
|
|
|
}
|
2018-01-31 19:05:06 +08:00
|
|
|
|
2022-12-12 23:32:25 +08:00
|
|
|
@bind
|
|
|
|
onMessage(backups) {
|
|
|
|
this.controller.set(
|
|
|
|
"model",
|
|
|
|
backups.map((backup) => Backup.create(backup))
|
|
|
|
);
|
2023-03-15 21:17:51 +08:00
|
|
|
}
|
|
|
|
}
|