Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ frappe.ui.form.on("S3 Backup Settings", {
frm.add_custom_button(__("Take Backup Now"), function () {
frm.dashboard.set_headline_alert("S3 Backup Started!");
frappe.call({
method: "offsite_backups.offsite_backups.doctype.s3_backup_settings.s3_backup_settings.take_backups_s3",
method: "offsite_backups.offsite_backups.doctype.s3_backup_settings.s3_backup_settings.take_backup",
callback: function (r) {
if (!r.exc) {
frappe.msgprint(__("S3 Backup complete!"));
if (!r.exc && r.message) {
const job_id = r.message;
frappe.msgprint({
message: __(
"S3 Backup has been queued. You can track the progress <a href='/app/rq-job/{0}' target='_blank'>here</a>.",
[job_id]
),
});
frm.dashboard.clear_headline();
}
},
});
}).addClass("btn-primary");
});
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def validate(self):
@frappe.whitelist()
def take_backup():
"""Enqueue longjob for taking backup to s3"""
enqueue(
job = enqueue(
"offsite_backups.offsite_backups.doctype.s3_backup_settings.s3_backup_settings.take_backups_s3",
queue="long",
timeout=1500,
)
frappe.msgprint(_("Queued for backup. It may take a few minutes to an hour."))
return job.id


def take_backups_daily():
Expand Down
Loading