mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Fixed: Medium track status on AlbumDetails page.
This commit is contained in:
parent
750ecacb9b
commit
ef6a84c136
5 changed files with 17 additions and 5 deletions
|
@ -369,6 +369,7 @@ class AlbumDetails extends Component {
|
|||
<AlbumDetailsMediumConnector
|
||||
key={medium.mediumNumber}
|
||||
albumId={id}
|
||||
albumMonitored={monitored}
|
||||
{...medium}
|
||||
isExpanded={expandedState[medium.mediumNumber]}
|
||||
onExpandPress={this.onExpandPress}
|
||||
|
|
|
@ -22,6 +22,8 @@ function getMediumStatistics(tracks) {
|
|||
if (track.trackFileId) {
|
||||
trackCount++;
|
||||
trackFileCount++;
|
||||
} else if (track.monitored) {
|
||||
trackCount++;
|
||||
}
|
||||
|
||||
totalTrackCount++;
|
||||
|
@ -34,11 +36,15 @@ function getMediumStatistics(tracks) {
|
|||
};
|
||||
}
|
||||
|
||||
function getTrackCountKind(trackFileCount, trackCount) {
|
||||
function getTrackCountKind(monitored, trackFileCount, trackCount) {
|
||||
if (trackFileCount === trackCount && trackCount > 0) {
|
||||
return kinds.SUCCESS;
|
||||
}
|
||||
|
||||
if (!monitored) {
|
||||
return kinds.WARNING;
|
||||
}
|
||||
|
||||
return kinds.DANGER;
|
||||
}
|
||||
|
||||
|
@ -94,6 +100,7 @@ class AlbumDetailsMedium extends Component {
|
|||
const {
|
||||
mediumNumber,
|
||||
mediumFormat,
|
||||
albumMonitored,
|
||||
items,
|
||||
columns,
|
||||
onTableOptionChange,
|
||||
|
@ -123,11 +130,11 @@ class AlbumDetailsMedium extends Component {
|
|||
|
||||
<Label
|
||||
title={`${totalTrackCount} tracks total. ${trackFileCount} tracks with files.`}
|
||||
kind={getTrackCountKind(trackFileCount, trackCount)}
|
||||
kind={getTrackCountKind(albumMonitored, trackFileCount, trackCount)}
|
||||
size={sizes.LARGE}
|
||||
>
|
||||
{
|
||||
<span>{totalTrackCount} / {trackCount}</span>
|
||||
<span>{trackFileCount} / {trackCount}</span>
|
||||
}
|
||||
</Label>
|
||||
</div>
|
||||
|
@ -197,6 +204,7 @@ class AlbumDetailsMedium extends Component {
|
|||
|
||||
AlbumDetailsMedium.propTypes = {
|
||||
albumId: PropTypes.number.isRequired,
|
||||
albumMonitored: PropTypes.bool.isRequired,
|
||||
mediumNumber: PropTypes.number.isRequired,
|
||||
mediumFormat: PropTypes.string.isRequired,
|
||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
|
|
|
@ -56,6 +56,7 @@ class AlbumDetailsMediumConnector extends Component {
|
|||
|
||||
AlbumDetailsMediumConnector.propTypes = {
|
||||
albumId: PropTypes.number.isRequired,
|
||||
albumMonitored: PropTypes.bool.isRequired,
|
||||
mediumNumber: PropTypes.number.isRequired,
|
||||
setTracksTableOption: PropTypes.func.isRequired,
|
||||
executeCommand: PropTypes.func.isRequired
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
||||
import selectAll from 'Utilities/Table/selectAll';
|
||||
import toggleSelected from 'Utilities/Table/toggleSelected';
|
||||
|
@ -195,7 +196,7 @@ class InteractiveImportModalContent extends Component {
|
|||
|
||||
const selectedIds = this.getSelectedIds();
|
||||
const selectedItem = selectedIds.length ? _.find(items, { id: selectedIds[0] }) : null;
|
||||
const errorMessage = error && error.message || 'Unable to load manual import items';
|
||||
const errorMessage = getErrorMessage(error, 'Unable to load manual import items');
|
||||
|
||||
const importModeOptions = [
|
||||
{ key: 'move', value: 'Move Files' },
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
||||
import selectAll from 'Utilities/Table/selectAll';
|
||||
import toggleSelected from 'Utilities/Table/toggleSelected';
|
||||
|
@ -95,7 +96,7 @@ class SelectTrackModalContent extends Component {
|
|||
selectedState
|
||||
} = this.state;
|
||||
|
||||
const errorMessage = error && error.message || 'Unable to load tracks';
|
||||
const errorMessage = getErrorMessage(error, 'Unable to load tracks');
|
||||
|
||||
return (
|
||||
<ModalContent onModalClose={onModalClose}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue