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