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.

50 lines
985 B
JavaScript
Raw Normal View History

2019-11-08 14:13:35 -05:00
import EmberObject from "@ember/object";
import MessageBus from "message-bus-client";
2016-06-30 13:55:44 -04:00
import { ajax } from "discourse/lib/ajax";
2016-07-04 14:15:51 -04:00
2019-11-08 14:13:35 -05:00
const Backup = EmberObject.extend({
destroy() {
return ajax("/admin/backups/" + this.filename, { type: "DELETE" });
},
restore() {
return ajax("/admin/backups/" + this.filename + "/restore", {
type: "POST",
data: { client_id: MessageBus.clientId },
});
},
});
Backup.reopenClass({
find() {
return ajax("/admin/backups.json");
},
start(withUploads) {
if (withUploads === undefined) {
withUploads = true;
}
2016-06-30 13:55:44 -04:00
return ajax("/admin/backups", {
type: "POST",
data: {
with_uploads: withUploads,
client_id: MessageBus.clientId,
},
});
},
cancel() {
return ajax("/admin/backups/cancel.json", {
type: "DELETE",
});
},
rollback() {
return ajax("/admin/backups/rollback.json", {
type: "POST",
});
},
});
export default Backup;