mirror of https://github.com/lidarr/Lidarr
Set fallback values for statistics
This commit is contained in:
parent
2ee4a3346e
commit
f0eb626324
|
@ -58,8 +58,8 @@ class DeleteAlbumModalContent extends Component {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
trackFileCount,
|
trackFileCount = 0,
|
||||||
sizeOnDisk
|
sizeOnDisk = 0
|
||||||
} = statistics;
|
} = statistics;
|
||||||
|
|
||||||
const deleteFiles = this.state.deleteFiles;
|
const deleteFiles = this.state.deleteFiles;
|
||||||
|
@ -133,14 +133,14 @@ class DeleteAlbumModalContent extends Component {
|
||||||
|
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button onPress={onModalClose}>
|
<Button onPress={onModalClose}>
|
||||||
Close
|
{translate('Close')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
onPress={this.onDeleteAlbumConfirmed}
|
onPress={this.onDeleteAlbumConfirmed}
|
||||||
>
|
>
|
||||||
Delete
|
{translate('Delete')}
|
||||||
</Button>
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
|
@ -216,8 +216,8 @@ class AlbumDetails extends Component {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
trackFileCount,
|
trackFileCount = 0,
|
||||||
sizeOnDisk
|
sizeOnDisk = 0
|
||||||
} = statistics;
|
} = statistics;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -43,6 +43,10 @@ class EditAlbumModalContent extends Component {
|
||||||
...otherProps
|
...otherProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const {
|
||||||
|
trackFileCount = 0
|
||||||
|
} = statistics;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
monitored,
|
monitored,
|
||||||
anyReleaseOk,
|
anyReleaseOk,
|
||||||
|
@ -96,7 +100,7 @@ class EditAlbumModalContent extends Component {
|
||||||
type={inputTypes.ALBUM_RELEASE_SELECT}
|
type={inputTypes.ALBUM_RELEASE_SELECT}
|
||||||
name="releases"
|
name="releases"
|
||||||
helpText={translate('ReleasesHelpText')}
|
helpText={translate('ReleasesHelpText')}
|
||||||
isDisabled={anyReleaseOk.value && statistics.trackFileCount > 0}
|
isDisabled={anyReleaseOk.value && trackFileCount > 0}
|
||||||
albumReleases={releases}
|
albumReleases={releases}
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -56,8 +56,8 @@ class DeleteArtistModalContent extends Component {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
trackFileCount,
|
trackFileCount = 0,
|
||||||
sizeOnDisk
|
sizeOnDisk = 0
|
||||||
} = statistics;
|
} = statistics;
|
||||||
|
|
||||||
const deleteFiles = this.state.deleteFiles;
|
const deleteFiles = this.state.deleteFiles;
|
||||||
|
|
|
@ -85,9 +85,9 @@ class AlbumRow extends Component {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
trackCount,
|
trackCount = 0,
|
||||||
trackFileCount,
|
trackFileCount = 0,
|
||||||
totalTrackCount
|
totalTrackCount = 0
|
||||||
} = statistics;
|
} = statistics;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -257,7 +257,8 @@ AlbumRow.propTypes = {
|
||||||
AlbumRow.defaultProps = {
|
AlbumRow.defaultProps = {
|
||||||
statistics: {
|
statistics: {
|
||||||
trackCount: 0,
|
trackCount: 0,
|
||||||
trackFileCount: 0
|
trackFileCount: 0,
|
||||||
|
totalTrackCount: 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -222,8 +222,8 @@ class ArtistDetails extends Component {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
trackFileCount,
|
trackFileCount = 0,
|
||||||
sizeOnDisk
|
sizeOnDisk = 0
|
||||||
} = statistics;
|
} = statistics;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -33,7 +33,11 @@ function AlbumStudioAlbum(props: AlbumStudioAlbumProps) {
|
||||||
isSaving = false,
|
isSaving = false,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { trackFileCount, totalTrackCount, percentOfTracks } = statistics;
|
const {
|
||||||
|
trackFileCount = 0,
|
||||||
|
totalTrackCount = 0,
|
||||||
|
percentOfTracks = 0,
|
||||||
|
} = statistics;
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const onAlbumMonitoredPress = useCallback(() => {
|
const onAlbumMonitoredPress = useCallback(() => {
|
||||||
|
|
|
@ -44,9 +44,9 @@ class SelectAlbumRow extends Component {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
trackCount,
|
trackCount = 0,
|
||||||
trackFileCount,
|
trackFileCount = 0,
|
||||||
totalTrackCount
|
totalTrackCount = 0
|
||||||
} = statistics;
|
} = statistics;
|
||||||
|
|
||||||
const extendedTitle = disambiguation ? `${title} (${disambiguation})` : title;
|
const extendedTitle = disambiguation ? `${title} (${disambiguation})` : title;
|
||||||
|
@ -134,7 +134,8 @@ SelectAlbumRow.propTypes = {
|
||||||
SelectAlbumRow.defaultProps = {
|
SelectAlbumRow.defaultProps = {
|
||||||
statistics: {
|
statistics: {
|
||||||
trackCount: 0,
|
trackCount: 0,
|
||||||
trackFileCount: 0
|
trackFileCount: 0,
|
||||||
|
totalTrackCount: 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ export const defaultState = {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
trackCount = 0,
|
trackCount = 0,
|
||||||
trackFileCount
|
trackFileCount = 0
|
||||||
} = statistics;
|
} = statistics;
|
||||||
|
|
||||||
const progress = trackCount ? trackFileCount / trackCount * 100 : 100;
|
const progress = trackCount ? trackFileCount / trackCount * 100 : 100;
|
||||||
|
@ -201,7 +201,7 @@ export const defaultState = {
|
||||||
albumCount: function(item) {
|
albumCount: function(item) {
|
||||||
const { statistics = {} } = item;
|
const { statistics = {} } = item;
|
||||||
|
|
||||||
return statistics.albumCount;
|
return statistics.albumCount || 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
trackCount: function(item) {
|
trackCount: function(item) {
|
||||||
|
@ -229,7 +229,7 @@ export const defaultState = {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
trackCount = 0,
|
trackCount = 0,
|
||||||
trackFileCount
|
trackFileCount = 0
|
||||||
} = statistics;
|
} = statistics;
|
||||||
|
|
||||||
const progress = trackCount ?
|
const progress = trackCount ?
|
||||||
|
|
Loading…
Reference in New Issue