mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
push updates to backups list to client
This commit is contained in:
parent
38b6c1d67f
commit
d233ecbe34
4 changed files with 32 additions and 27 deletions
|
@ -1,7 +1,15 @@
|
|||
import Backup from 'admin/models/backup';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
activate() {
|
||||
this.messageBus.subscribe("/admin/backups", backups => this.controller.set("model", backups));
|
||||
},
|
||||
|
||||
model() {
|
||||
return Backup.find();
|
||||
},
|
||||
|
||||
deactivate() {
|
||||
this.messageBus.unsubscribe("/admin/backups");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,10 +9,7 @@ const LOG_CHANNEL = "/admin/backups/logs";
|
|||
export default Discourse.Route.extend({
|
||||
|
||||
activate() {
|
||||
this.messageBus.subscribe(LOG_CHANNEL, this._processLogMessage.bind(this));
|
||||
},
|
||||
|
||||
_processLogMessage(log) {
|
||||
this.messageBus.subscribe(LOG_CHANNEL, (log) => {
|
||||
if (log.message === "[STARTED]") {
|
||||
this.controllerFor("adminBackups").set("model.isOperationRunning", true);
|
||||
this.controllerFor("adminBackupsLogs").get('logs').clear();
|
||||
|
@ -29,6 +26,7 @@ export default Discourse.Route.extend({
|
|||
} else {
|
||||
this.controllerFor("adminBackupsLogs").get('logs').pushObject(Em.Object.create(log));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
model() {
|
||||
|
@ -122,12 +120,7 @@ export default Discourse.Route.extend({
|
|||
},
|
||||
|
||||
uploadSuccess(filename) {
|
||||
const self = this;
|
||||
bootbox.alert(I18n.t("admin.backups.upload.success", { filename: filename }), function() {
|
||||
Backup.find().then(function (backups) {
|
||||
self.controllerFor("adminBackupsIndex").set("model", backups);
|
||||
});
|
||||
});
|
||||
bootbox.alert(I18n.t("admin.backups.upload.success", { filename: filename }));
|
||||
},
|
||||
|
||||
uploadError(filename, message) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Jobs
|
||||
|
||||
class BackupChunksMerger < Jobs::Base
|
||||
sidekiq_options retry: false
|
||||
sidekiq_options queue: 'critical', retry: false
|
||||
|
||||
def execute(args)
|
||||
filename = args[:filename]
|
||||
|
@ -19,6 +19,10 @@ module Jobs
|
|||
|
||||
# merge all chunks
|
||||
HandleChunkUpload.merge_chunks(chunks, upload_path: backup_path, tmp_upload_path: tmp_backup_path, model: Backup, identifier: identifier, filename: filename, tmp_directory: tmp_directory)
|
||||
|
||||
# push an updated list to the clients
|
||||
data = ActiveModel::ArraySerializer.new(Backup.all, each_serializer: BackupSerializer).as_json
|
||||
MessageBus.publish("/admin/backups", data, user_ids: User.staff.pluck(:id))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -2894,7 +2894,7 @@ en:
|
|||
label: "Upload"
|
||||
title: "Upload a backup to this instance"
|
||||
uploading: "Uploading..."
|
||||
success: "'{{filename}}' has successfully been uploaded."
|
||||
success: "'{{filename}}' has successfully been uploaded. The file is now being processed and will take up to a minute to show up in the list."
|
||||
error: "There has been an error while uploading '{{filename}}': {{message}}"
|
||||
operations:
|
||||
is_running: "An operation is currently running..."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue