From 9dd47ca755b1b6c538421c1c2772561f44adc532 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Wed, 21 Aug 2024 13:23:24 +1000 Subject: [PATCH] UX: Fix restore info link on admin backups page (#28452) Followup 14465960893981e8aba49f2cc0620944f2abea53 The link to inform admins that restore is disabled was not correct. This fixes it and also changes it to go to /admin/backups/settings --- .../admin/addon/controllers/admin-backups-index.js | 5 +++++ .../admin/addon/templates/backups-index.hbs | 11 +++++++---- config/locales/client.en.yml | 8 ++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/admin/addon/controllers/admin-backups-index.js b/app/assets/javascripts/admin/addon/controllers/admin-backups-index.js index a27fd41ffd4..9e75372dd89 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-backups-index.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-backups-index.js @@ -5,6 +5,7 @@ import { service } from "@ember/service"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { i18n, setting } from "discourse/lib/computed"; +import getURL from "discourse-common/lib/get-url"; import discourseComputed from "discourse-common/utils/decorators"; import I18n from "discourse-i18n"; @@ -17,6 +18,10 @@ export default class AdminBackupsIndexController extends Controller { @setting("backup_location") backupLocation; @equal("backupLocation", "local") localBackupStorage; + get restoreSettingsUrl() { + return getURL("/admin/backups/settings?filter=allow_restore"); + } + @discourseComputed("status.allowRestore", "status.isOperationRunning") restoreTitle(allowRestore, isOperationRunning) { if (!allowRestore) { diff --git a/app/assets/javascripts/admin/addon/templates/backups-index.hbs b/app/assets/javascripts/admin/addon/templates/backups-index.hbs index f05dc65a832..2d67b74d325 100644 --- a/app/assets/javascripts/admin/addon/templates/backups-index.hbs +++ b/app/assets/javascripts/admin/addon/templates/backups-index.hbs @@ -13,10 +13,13 @@ {{#if this.status.restoreDisabled}}
- {{d-icon - "info-circle" - }} - {{i18n "admin.backups.operations.restore.is_disabled"}} + {{dIcon "info-circle"}} + {{html-safe + (i18n + "admin.backups.operations.restore.is_disabled" + url=this.restoreSettingsUrl + ) + }}
{{/if}} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 4692c81bb36..fa420eb6950 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -5686,7 +5686,7 @@ en: backups: "Backups" backup_files: "Backup files" logs: "Logs" - none: "No backup available." + none: "No backup available" read_only: enable: title: "Enable read-only mode" @@ -5724,12 +5724,12 @@ en: download: label: "Download" title: "Send email with download link" - alert: "A link to download this backup has been emailed to you." + alert: "A link to download this backup has been emailed to you" destroy: title: "Remove the backup" confirm: "Are you sure you want to destroy this backup?" restore: - is_disabled: "Restore is disabled in the site settings." + is_disabled: "Restore is currently disabled. To enable it, visit the site settings." label: "Restore" title: "Restore the backup" confirm: "Are you sure you want to restore this backup?" @@ -5738,7 +5738,7 @@ en: title: "Rollback the database to previous working state" confirm: "Are you sure you want to rollback the database to the previous working state?" location: - local: "Local Storage" + local: "Local storage" s3: "S3" backup_storage_error: "Failed to access backup storage: %{error_message}"