New: Add backup size information

Closes #4830
This commit is contained in:
Zack Eckersley Pallett 2022-02-21 20:11:12 +00:00 committed by GitHub
parent c7427f8df8
commit 78aeda1a2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import formatBytes from 'Utilities/Number/formatBytes';
import { icons, kinds } from 'Helpers/Props';
import Icon from 'Components/Icon';
import IconButton from 'Components/Link/IconButton';
@ -64,6 +65,7 @@ class BackupRow extends Component {
type,
name,
path,
size,
time
} = this.props;
@ -103,6 +105,10 @@ class BackupRow extends Component {
</Link>
</TableRowCell>
<TableRowCell>
{formatBytes(size)}
</TableRowCell>
<RelativeDateCellConnector
date={time}
/>
@ -146,8 +152,9 @@ 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
};
export default BackupRow;
export default BackupRow;

View File

@ -22,6 +22,11 @@ const columns = [
label: 'Name',
isVisible: true
},
{
name: 'size',
label: 'Size',
isVisible: true
},
{
name: 'time',
label: 'Time',
@ -122,6 +127,7 @@ class Backups extends Component {
type,
name,
path,
size,
time
} = item;
@ -132,6 +138,7 @@ class Backups extends Component {
type={type}
name={name}
path={path}
size={size}
time={time}
onDeleteBackupPress={onDeleteBackupPress}
/>
@ -163,4 +170,4 @@ Backups.propTypes = {
onDeleteBackupPress: PropTypes.func.isRequired
};
export default Backups;
export default Backups;

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

@ -44,6 +44,7 @@ namespace Sonarr.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 Sonarr.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; }
}
}