mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-28 08:58:41 +02:00
Fixed: Formatting empty size on disk values
This commit is contained in:
parent
363f8fc347
commit
cc03ce04f1
@ -21,7 +21,7 @@ interface RootFolderRowProps {
|
||||
}
|
||||
|
||||
function RootFolderRow(props: RootFolderRowProps) {
|
||||
const { id, path, accessible, freeSpace, unmappedFolders = [] } = props;
|
||||
const { id, path, accessible, freeSpace = 0, unmappedFolders = [] } = props;
|
||||
|
||||
const isUnavailable = !accessible;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import DescriptionList from 'Components/DescriptionList/DescriptionList';
|
||||
import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem';
|
||||
@ -6,14 +5,19 @@ import formatBytes from 'Utilities/Number/formatBytes';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import styles from './SeasonInfo.css';
|
||||
|
||||
function SeasonInfo(props) {
|
||||
const {
|
||||
totalEpisodeCount,
|
||||
monitoredEpisodeCount,
|
||||
episodeFileCount,
|
||||
sizeOnDisk
|
||||
} = props;
|
||||
interface SeasonInfoProps {
|
||||
totalEpisodeCount: number;
|
||||
monitoredEpisodeCount: number;
|
||||
episodeFileCount: number;
|
||||
sizeOnDisk: number;
|
||||
}
|
||||
|
||||
function SeasonInfo({
|
||||
totalEpisodeCount,
|
||||
monitoredEpisodeCount,
|
||||
episodeFileCount,
|
||||
sizeOnDisk,
|
||||
}: SeasonInfoProps) {
|
||||
return (
|
||||
<DescriptionList>
|
||||
<DescriptionListItem
|
||||
@ -47,11 +51,4 @@ function SeasonInfo(props) {
|
||||
);
|
||||
}
|
||||
|
||||
SeasonInfo.propTypes = {
|
||||
totalEpisodeCount: PropTypes.number.isRequired,
|
||||
monitoredEpisodeCount: PropTypes.number.isRequired,
|
||||
episodeFileCount: PropTypes.number.isRequired,
|
||||
sizeOnDisk: PropTypes.number.isRequired
|
||||
};
|
||||
|
||||
export default SeasonInfo;
|
@ -212,8 +212,8 @@ class SeriesDetails extends Component {
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
episodeFileCount,
|
||||
sizeOnDisk
|
||||
episodeFileCount = 0,
|
||||
sizeOnDisk = 0
|
||||
} = statistics;
|
||||
|
||||
const {
|
||||
@ -454,10 +454,9 @@ class SeriesDetails extends Component {
|
||||
name={icons.DRIVE}
|
||||
size={17}
|
||||
/>
|
||||
|
||||
<span className={styles.sizeOnDisk}>
|
||||
{
|
||||
formatBytes(sizeOnDisk || 0)
|
||||
}
|
||||
{formatBytes(sizeOnDisk)}
|
||||
</span>
|
||||
</div>
|
||||
</Label>
|
||||
|
@ -194,10 +194,12 @@ function getInfoRowProps(
|
||||
}
|
||||
|
||||
if (name === 'sizeOnDisk') {
|
||||
const { sizeOnDisk = 0 } = props;
|
||||
|
||||
return {
|
||||
title: translate('SizeOnDisk'),
|
||||
iconName: icons.DRIVE,
|
||||
label: formatBytes(props.sizeOnDisk),
|
||||
label: formatBytes(sizeOnDisk),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ function SeriesIndexPosterInfo(props: SeriesIndexPosterInfoProps) {
|
||||
added,
|
||||
seasonCount,
|
||||
path,
|
||||
sizeOnDisk,
|
||||
sizeOnDisk = 0,
|
||||
tags,
|
||||
sortKey,
|
||||
showRelativeDates,
|
||||
|
@ -1,10 +1,6 @@
|
||||
import { filesize } from 'filesize';
|
||||
|
||||
function formatBytes(input?: string | number) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
function formatBytes(input: string | number) {
|
||||
const size = Number(input);
|
||||
|
||||
if (isNaN(size)) {
|
||||
|
Loading…
Reference in New Issue
Block a user