2019-11-09 03:13:35 +08:00
|
|
|
import EmberObject from "@ember/object";
|
2020-05-28 20:42:36 +08:00
|
|
|
import MessageBus from "message-bus-client";
|
2016-07-01 01:55:44 +08:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
2016-07-05 02:15:51 +08:00
|
|
|
|
2019-11-09 03:13:35 +08:00
|
|
|
const Backup = EmberObject.extend({
|
2015-08-28 02:02:13 +08:00
|
|
|
destroy() {
|
2019-05-27 16:15:39 +08:00
|
|
|
return ajax("/admin/backups/" + this.filename, { type: "DELETE" });
|
2015-08-28 02:02:13 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
restore() {
|
2019-05-27 16:15:39 +08:00
|
|
|
return ajax("/admin/backups/" + this.filename + "/restore", {
|
2015-08-28 02:02:13 +08:00
|
|
|
type: "POST",
|
2020-05-28 20:42:36 +08:00
|
|
|
data: { client_id: MessageBus.clientId },
|
2015-08-28 02:02:13 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
Backup.reopenClass({
|
|
|
|
find() {
|
2021-01-20 13:04:21 +08:00
|
|
|
return ajax("/admin/backups.json");
|
2015-08-28 02:02:13 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
start(withUploads) {
|
|
|
|
if (withUploads === undefined) {
|
|
|
|
withUploads = true;
|
|
|
|
}
|
2016-07-01 01:55:44 +08:00
|
|
|
return ajax("/admin/backups", {
|
2015-08-28 02:02:13 +08:00
|
|
|
type: "POST",
|
|
|
|
data: {
|
|
|
|
with_uploads: withUploads,
|
2020-05-28 20:42:36 +08:00
|
|
|
client_id: MessageBus.clientId,
|
2015-08-28 02:02:13 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
cancel() {
|
2017-03-23 10:29:35 +08:00
|
|
|
return ajax("/admin/backups/cancel.json", {
|
|
|
|
type: "DELETE",
|
|
|
|
});
|
2015-08-28 02:02:13 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
rollback() {
|
2017-03-23 10:29:35 +08:00
|
|
|
return ajax("/admin/backups/rollback.json", {
|
|
|
|
type: "POST",
|
2015-08-28 02:02:13 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Backup;
|