UX: display warning message when uploads are not included in backup. (#23253)
Also, this PR will introduce a new checkbox in the modal window to manage whether the uploads should be included in the backup or not.
This commit is contained in:
parent
8ef569cda4
commit
5a810fd6cc
|
@ -1,23 +1,27 @@
|
||||||
<DModal
|
<DModal
|
||||||
@title={{i18n "admin.backups.operations.backup.confirm"}}
|
@title={{i18n "admin.backups.operations.backup.confirm"}}
|
||||||
@closeModal={{@closeModal}}
|
@closeModal={{@closeModal}}
|
||||||
|
class="start-backup-modal"
|
||||||
>
|
>
|
||||||
<:body>
|
<:body>
|
||||||
{{#if this.warningMessage}}
|
{{#if this.warningMessage}}
|
||||||
<div class="alert alert-warning">{{html-safe this.warningMessage}}</div>
|
<div class={{this.warningCssClasses}}>{{html-safe
|
||||||
|
this.warningMessage
|
||||||
|
}}</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#if this.canManageUploadsInBackup}}
|
||||||
|
<label>
|
||||||
|
<Input @type="checkbox" @checked={{this.includeUploads}} />
|
||||||
|
{{i18n "admin.backups.operations.backup.include_uploads"}}
|
||||||
|
</label>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</:body>
|
</:body>
|
||||||
<:footer>
|
<:footer>
|
||||||
<DButton
|
<DButton
|
||||||
class="btn-primary backup-with-uploads"
|
class="btn-primary"
|
||||||
@action={{this.startBackupWithUploads}}
|
@action={{this.startBackup}}
|
||||||
@label={{or this.yesLabel "yes_value"}}
|
@label="yes_value"
|
||||||
/>
|
/>
|
||||||
<DButton
|
<DButton class="btn-flat" @action={{@closeModal}} @label="cancel" />
|
||||||
class="backup-no-uploads"
|
|
||||||
@action={{this.startBackupWithoutUploads}}
|
|
||||||
@label="admin.backups.operations.backup.without_uploads"
|
|
||||||
/>
|
|
||||||
<DButton class="btn-default" @action={{@closeModal}} @label="no_value" />
|
|
||||||
</:footer>
|
</:footer>
|
||||||
</DModal>
|
</DModal>
|
|
@ -1,16 +1,37 @@
|
||||||
import Component from "@glimmer/component";
|
import Component from "@glimmer/component";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { tracked } from "@glimmer/tracking";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
import I18n from "I18n";
|
||||||
|
|
||||||
export default class StartBackup extends Component {
|
export default class StartBackup extends Component {
|
||||||
@action
|
@service siteSettings;
|
||||||
startBackupWithUploads() {
|
@tracked includeUploads = true;
|
||||||
this.args.model.startBackup(true);
|
|
||||||
this.args.closeModal();
|
get canManageUploadsInBackup() {
|
||||||
|
return (
|
||||||
|
!this.siteSettings.enable_s3_uploads ||
|
||||||
|
this.siteSettings.include_s3_uploads_in_backups
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
get warningCssClasses() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
get warningMessage() {
|
||||||
|
if (
|
||||||
|
this.siteSettings.enable_s3_uploads &&
|
||||||
|
!this.siteSettings.include_s3_uploads_in_backups
|
||||||
|
) {
|
||||||
|
return I18n.t("admin.backups.operations.backup.s3_upload_warning");
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
startBackupWithoutUploads() {
|
startBackup() {
|
||||||
this.args.model.startBackup(false);
|
this.args.model.startBackup(this.includeUploads);
|
||||||
this.args.closeModal();
|
this.args.closeModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,11 +89,8 @@ button.ru {
|
||||||
}
|
}
|
||||||
|
|
||||||
.start-backup-modal {
|
.start-backup-modal {
|
||||||
.btn {
|
.alert {
|
||||||
margin: 10px 0 10px 5px;
|
margin-bottom: 0;
|
||||||
}
|
|
||||||
.btn:first-of-type {
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5043,7 +5043,8 @@ en:
|
||||||
label: "Backup"
|
label: "Backup"
|
||||||
title: "Create a backup"
|
title: "Create a backup"
|
||||||
confirm: "Do you want to start a new backup?"
|
confirm: "Do you want to start a new backup?"
|
||||||
without_uploads: "Yes (do not include uploads)"
|
include_uploads: "include all uploads"
|
||||||
|
s3_upload_warning: 'This is for database backups only. Uploads will not be included, meaning all images and other file uploads can be missing if the backup is restored to another hosting setup. <b>To enable a full backup including your S3 uploads please see <a href="https://meta.discourse.org/t/-/276535" target="_blank">this guide</a>.</b>'
|
||||||
download:
|
download:
|
||||||
label: "Download"
|
label: "Download"
|
||||||
title: "Send email with download link"
|
title: "Send email with download link"
|
||||||
|
|
Loading…
Reference in New Issue