New: Add backup size information

Closes #4830

(cherry picked from commit 78aeda1a2cc217c367c5c3c6fd281c101b28413c)
This commit is contained in:
Zack Eckersley Pallett 2022-02-21 20:11:12 +00:00 committed by Robin Dadswell
parent 07bb5e416b
commit 36da57f87b
6 changed files with 18 additions and 0 deletions

View File

@ -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 {
</Link>
</TableRowCell>
<TableRowCell>
{formatBytes(size)}
</TableRowCell>
<RelativeDateCellConnector
date={time}
/>
@ -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
};

View File

@ -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}
/>

View File

@ -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; }
}
}

View File

@ -107,6 +107,7 @@ namespace NzbDrone.Core.Backup
{
Name = Path.GetFileName(b),
Type = backupType,
Size = _diskProvider.GetFileSize(b),
Time = _diskProvider.FileGetLastWrite(b)
}));
}

View File

@ -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)

View File

@ -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; }
}
}