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