discourse/app/assets/javascripts/admin/addon/models/backup.js

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

46 lines
970 B
JavaScript
Raw Normal View History

2019-11-09 03:13:35 +08:00
import EmberObject from "@ember/object";
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
export default class Backup extends EmberObject {
static find() {
return ajax("/admin/backups.json");
}
static start(withUploads) {
if (withUploads === undefined) {
withUploads = true;
}
2016-07-01 01:55:44 +08:00
return ajax("/admin/backups", {
type: "POST",
data: {
with_uploads: withUploads,
client_id: MessageBus.clientId,
},
});
}
static cancel() {
return ajax("/admin/backups/cancel.json", {
type: "DELETE",
});
}
static rollback() {
return ajax("/admin/backups/rollback.json", {
type: "POST",
});
}
destroy() {
return ajax("/admin/backups/" + this.filename, { type: "DELETE" });
}
restore() {
return ajax("/admin/backups/" + this.filename + "/restore", {
type: "POST",
data: { client_id: MessageBus.clientId },
});
}
}