From 36da57f87bbcba43f26ea9fdb4ee346828028c87 Mon Sep 17 00:00:00 2001 From: Zack Eckersley Pallett <40175773+ZackaryH8@users.noreply.github.com> Date: Mon, 21 Feb 2022 20:11:12 +0000 Subject: [PATCH] New: Add backup size information Closes #4830 (cherry picked from commit 78aeda1a2cc217c367c5c3c6fd281c101b28413c) --- frontend/src/System/Backup/BackupRow.js | 7 +++++++ frontend/src/System/Backup/Backups.js | 7 +++++++ src/NzbDrone.Core/Backup/Backup.cs | 1 + src/NzbDrone.Core/Backup/BackupService.cs | 1 + src/Radarr.Api.V3/System/Backup/BackupController.cs | 1 + src/Radarr.Api.V3/System/Backup/BackupResource.cs | 1 + 6 files changed, 18 insertions(+) diff --git a/frontend/src/System/Backup/BackupRow.js b/frontend/src/System/Backup/BackupRow.js index 2f454a4b3..63a38f459 100644 --- a/frontend/src/System/Backup/BackupRow.js +++ b/frontend/src/System/Backup/BackupRow.js @@ -8,6 +8,7 @@ import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellCo import TableRowCell from 'Components/Table/Cells/TableRowCell'; import TableRow from 'Components/Table/TableRow'; import { icons, kinds } from 'Helpers/Props'; +import formatBytes from 'Utilities/Number/formatBytes'; import translate from 'Utilities/String/translate'; import RestoreBackupModalConnector from './RestoreBackupModalConnector'; import styles from './BackupRow.css'; @@ -65,6 +66,7 @@ class BackupRow extends Component { type, name, path, + size, time } = this.props; @@ -104,6 +106,10 @@ class BackupRow extends Component { + + {formatBytes(size)} + + @@ -147,6 +153,7 @@ BackupRow.propTypes = { type: PropTypes.string.isRequired, name: PropTypes.string.isRequired, path: PropTypes.string.isRequired, + size: PropTypes.number.isRequired, time: PropTypes.string.isRequired, onDeleteBackupPress: PropTypes.func.isRequired }; diff --git a/frontend/src/System/Backup/Backups.js b/frontend/src/System/Backup/Backups.js index f65010875..83d961e71 100644 --- a/frontend/src/System/Backup/Backups.js +++ b/frontend/src/System/Backup/Backups.js @@ -23,6 +23,11 @@ const columns = [ label: translate('Name'), isVisible: true }, + { + name: 'size', + label: 'Size', + isVisible: true + }, { name: 'time', label: translate('Time'), @@ -127,6 +132,7 @@ class Backups extends Component { type, name, path, + size, time } = item; @@ -137,6 +143,7 @@ class Backups extends Component { type={type} name={name} path={path} + size={size} time={time} onDeleteBackupPress={onDeleteBackupPress} /> diff --git a/src/NzbDrone.Core/Backup/Backup.cs b/src/NzbDrone.Core/Backup/Backup.cs index 5d148648e..4c6200436 100644 --- a/src/NzbDrone.Core/Backup/Backup.cs +++ b/src/NzbDrone.Core/Backup/Backup.cs @@ -6,6 +6,7 @@ namespace NzbDrone.Core.Backup { public string Name { get; set; } public BackupType Type { get; set; } + public long Size { get; set; } public DateTime Time { get; set; } } } diff --git a/src/NzbDrone.Core/Backup/BackupService.cs b/src/NzbDrone.Core/Backup/BackupService.cs index f19d83d33..a8ce6d6ed 100644 --- a/src/NzbDrone.Core/Backup/BackupService.cs +++ b/src/NzbDrone.Core/Backup/BackupService.cs @@ -107,6 +107,7 @@ namespace NzbDrone.Core.Backup { Name = Path.GetFileName(b), Type = backupType, + Size = _diskProvider.GetFileSize(b), Time = _diskProvider.FileGetLastWrite(b) })); } diff --git a/src/Radarr.Api.V3/System/Backup/BackupController.cs b/src/Radarr.Api.V3/System/Backup/BackupController.cs index d972c8847..0cd95ab22 100644 --- a/src/Radarr.Api.V3/System/Backup/BackupController.cs +++ b/src/Radarr.Api.V3/System/Backup/BackupController.cs @@ -42,6 +42,7 @@ namespace Radarr.Api.V3.System.Backup Name = b.Name, Path = $"/backup/{b.Type.ToString().ToLower()}/{b.Name}", Type = b.Type, + Size = b.Size, Time = b.Time }) .OrderByDescending(b => b.Time) diff --git a/src/Radarr.Api.V3/System/Backup/BackupResource.cs b/src/Radarr.Api.V3/System/Backup/BackupResource.cs index 605e5fb98..45b64d7b4 100644 --- a/src/Radarr.Api.V3/System/Backup/BackupResource.cs +++ b/src/Radarr.Api.V3/System/Backup/BackupResource.cs @@ -9,6 +9,7 @@ namespace Radarr.Api.V3.System.Backup public string Name { get; set; } public string Path { get; set; } public BackupType Type { get; set; } + public long Size { get; set; } public DateTime Time { get; set; } } }