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

View File

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

View File

@ -6,6 +6,7 @@ namespace NzbDrone.Core.Backup
{ {
public string Name { get; set; } public string Name { get; set; }
public BackupType Type { get; set; } public BackupType Type { get; set; }
public long Size { get; set; }
public DateTime Time { get; set; } public DateTime Time { get; set; }
} }
} }

View File

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

View File

@ -44,6 +44,7 @@ namespace Sonarr.Api.V3.System.Backup
Name = b.Name, Name = b.Name,
Path = $"/backup/{b.Type.ToString().ToLower()}/{b.Name}", Path = $"/backup/{b.Type.ToString().ToLower()}/{b.Name}",
Type = b.Type, Type = b.Type,
Size = b.Size,
Time = b.Time Time = b.Time
}) })
.OrderByDescending(b => 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 Name { get; set; }
public string Path { get; set; } public string Path { get; set; }
public BackupType Type { get; set; } public BackupType Type { get; set; }
public long Size { get; set; }
public DateTime Time { get; set; } public DateTime Time { get; set; }
} }
} }