mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-21 13:37:19 +00:00
Fixed: Ensure the default monitoring type in Album Studio is not all
This commit is contained in:
parent
950dcd30f0
commit
7b01c85c76
7 changed files with 40 additions and 25 deletions
|
@ -1,11 +1,11 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||
import MonitorAlbumsSelectInput from 'Components/Form/MonitorAlbumsSelectInput';
|
||||
import MonitorNewItemsSelectInput from 'Components/Form/MonitorNewItemsSelectInput';
|
||||
import SelectInput from 'Components/Form/SelectInput';
|
||||
import SpinnerButton from 'Components/Link/SpinnerButton';
|
||||
import PageContentFooter from 'Components/Page/PageContentFooter';
|
||||
import { kinds } from 'Helpers/Props';
|
||||
import { inputTypes, kinds } from 'Helpers/Props';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import styles from './AlbumStudioFooter.css';
|
||||
|
||||
|
@ -30,7 +30,7 @@ class AlbumStudioFooter extends Component {
|
|||
const {
|
||||
isSaving,
|
||||
saveError
|
||||
} = prevProps;
|
||||
} = this.props;
|
||||
|
||||
if (prevProps.isSaving && !isSaving && !saveError) {
|
||||
this.setState({
|
||||
|
@ -89,8 +89,8 @@ class AlbumStudioFooter extends Component {
|
|||
|
||||
const monitoredOptions = [
|
||||
{ key: NO_CHANGE, value: translate('NoChange'), disabled: true },
|
||||
{ key: 'monitored', value: 'Monitored' },
|
||||
{ key: 'unmonitored', value: 'Unmonitored' }
|
||||
{ key: 'monitored', value: translate('Monitored') },
|
||||
{ key: 'unmonitored', value: translate('Unmonitored') }
|
||||
];
|
||||
|
||||
const noChanges = monitored === NO_CHANGE &&
|
||||
|
@ -101,10 +101,11 @@ class AlbumStudioFooter extends Component {
|
|||
<PageContentFooter>
|
||||
<div className={styles.inputContainer}>
|
||||
<div className={styles.label}>
|
||||
Monitor Artist
|
||||
{translate('MonitorArtist')}
|
||||
</div>
|
||||
|
||||
<SelectInput
|
||||
<FormInputGroup
|
||||
type={inputTypes.SELECT}
|
||||
name="monitored"
|
||||
value={monitored}
|
||||
values={monitoredOptions}
|
||||
|
@ -115,13 +116,14 @@ class AlbumStudioFooter extends Component {
|
|||
|
||||
<div className={styles.inputContainer}>
|
||||
<div className={styles.label}>
|
||||
Monitor Existing Albums
|
||||
{translate('MonitorExistingAlbums')}
|
||||
</div>
|
||||
|
||||
<MonitorAlbumsSelectInput
|
||||
name="monitor"
|
||||
value={monitor}
|
||||
includeNoChange={true}
|
||||
includeNoChangeDisabled={false}
|
||||
isDisabled={!selectedCount}
|
||||
onChange={this.onInputChange}
|
||||
/>
|
||||
|
@ -129,13 +131,14 @@ class AlbumStudioFooter extends Component {
|
|||
|
||||
<div className={styles.inputContainer}>
|
||||
<div className={styles.label}>
|
||||
Monitor New Albums
|
||||
{translate('MonitorNewAlbums')}
|
||||
</div>
|
||||
|
||||
<MonitorNewItemsSelectInput
|
||||
name="monitorNewItems"
|
||||
value={monitorNewItems}
|
||||
includeNoChange={true}
|
||||
includeNoChangeDisabled={false}
|
||||
isDisabled={!selectedCount}
|
||||
onChange={this.onInputChange}
|
||||
/>
|
||||
|
@ -143,7 +146,7 @@ class AlbumStudioFooter extends Component {
|
|||
|
||||
<div>
|
||||
<div className={styles.label}>
|
||||
{selectedCount} Artist(s) Selected
|
||||
{translate('CountArtistsSelected', [selectedCount])}
|
||||
</div>
|
||||
|
||||
<SpinnerButton
|
||||
|
@ -153,7 +156,7 @@ class AlbumStudioFooter extends Component {
|
|||
isDisabled={!selectedCount || noChanges}
|
||||
onPress={this.onUpdateSelectedPress}
|
||||
>
|
||||
Update Selected
|
||||
{translate('UpdateSelected')}
|
||||
</SpinnerButton>
|
||||
</div>
|
||||
</PageContentFooter>
|
||||
|
|
|
@ -7,6 +7,7 @@ import SelectInput from './SelectInput';
|
|||
function MonitorAlbumsSelectInput(props) {
|
||||
const {
|
||||
includeNoChange,
|
||||
includeNoChangeDisabled = true,
|
||||
includeMixed,
|
||||
...otherProps
|
||||
} = props;
|
||||
|
@ -17,7 +18,7 @@ function MonitorAlbumsSelectInput(props) {
|
|||
values.unshift({
|
||||
key: 'noChange',
|
||||
value: translate('NoChange'),
|
||||
disabled: true
|
||||
disabled: includeNoChangeDisabled
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -39,6 +40,7 @@ function MonitorAlbumsSelectInput(props) {
|
|||
|
||||
MonitorAlbumsSelectInput.propTypes = {
|
||||
includeNoChange: PropTypes.bool.isRequired,
|
||||
includeNoChangeDisabled: PropTypes.bool,
|
||||
includeMixed: PropTypes.bool.isRequired,
|
||||
onChange: PropTypes.func.isRequired
|
||||
};
|
||||
|
|
|
@ -7,6 +7,7 @@ import SelectInput from './SelectInput';
|
|||
function MonitorNewItemsSelectInput(props) {
|
||||
const {
|
||||
includeNoChange,
|
||||
includeNoChangeDisabled = true,
|
||||
includeMixed,
|
||||
...otherProps
|
||||
} = props;
|
||||
|
@ -17,7 +18,7 @@ function MonitorNewItemsSelectInput(props) {
|
|||
values.unshift({
|
||||
key: 'noChange',
|
||||
value: translate('NoChange'),
|
||||
disabled: true
|
||||
disabled: includeNoChangeDisabled
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -39,6 +40,7 @@ function MonitorNewItemsSelectInput(props) {
|
|||
|
||||
MonitorNewItemsSelectInput.propTypes = {
|
||||
includeNoChange: PropTypes.bool.isRequired,
|
||||
includeNoChangeDisabled: PropTypes.bool,
|
||||
includeMixed: PropTypes.bool.isRequired,
|
||||
onChange: PropTypes.func.isRequired
|
||||
};
|
||||
|
|
|
@ -18,11 +18,13 @@ public AlbumStudioController(IArtistService artistService, IAlbumMonitoredServic
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult UpdateAll([FromBody] AlbumStudioResource request)
|
||||
[Consumes("application/json")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult UpdateAll([FromBody] AlbumStudioResource resource)
|
||||
{
|
||||
var artistToUpdate = _artistService.GetArtists(request.Artist.Select(s => s.Id));
|
||||
var artistToUpdate = _artistService.GetArtists(resource.Artist.Select(s => s.Id));
|
||||
|
||||
foreach (var s in request.Artist)
|
||||
foreach (var s in resource.Artist)
|
||||
{
|
||||
var artist = artistToUpdate.Single(c => c.Id == s.Id);
|
||||
|
||||
|
@ -31,20 +33,20 @@ public IActionResult UpdateAll([FromBody] AlbumStudioResource request)
|
|||
artist.Monitored = s.Monitored.Value;
|
||||
}
|
||||
|
||||
if (request.MonitoringOptions != null && request.MonitoringOptions.Monitor == MonitorTypes.None)
|
||||
if (resource.MonitoringOptions is { Monitor: MonitorTypes.None })
|
||||
{
|
||||
artist.Monitored = false;
|
||||
}
|
||||
|
||||
if (request.MonitorNewItems.HasValue)
|
||||
if (resource.MonitorNewItems.HasValue)
|
||||
{
|
||||
artist.MonitorNewItems = request.MonitorNewItems.Value;
|
||||
artist.MonitorNewItems = resource.MonitorNewItems.Value;
|
||||
}
|
||||
|
||||
_albumMonitoredService.SetAlbumMonitoredStatus(artist, request.MonitoringOptions);
|
||||
_albumMonitoredService.SetAlbumMonitoredStatus(artist, resource.MonitoringOptions);
|
||||
}
|
||||
|
||||
return Accepted(request);
|
||||
return Accepted(resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,6 +165,7 @@
|
|||
"CopyUsingHardlinksHelpTextWarning": "Occasionally, file locks may prevent renaming files that are being seeded. You may temporarily disable seeding and use Lidarr's rename function as a work around.",
|
||||
"CouldntFindAnyResultsForTerm": "Couldn't find any results for '{0}'",
|
||||
"CountAlbums": "{0} albums",
|
||||
"CountArtistsSelected": "{0} artist(s) selected",
|
||||
"CountDownloadClientsSelected": "{0} download client(s) selected",
|
||||
"CountImportListsSelected": "{0} import list(s) selected",
|
||||
"CountIndexersSelected": "{0} indexer(s) selected",
|
||||
|
@ -549,6 +550,8 @@
|
|||
"MonitorAlbum": "Monitor Album",
|
||||
"MonitorAlbumExistingOnlyWarning": "This is a one off adjustment of the monitored setting for each album. Use the option under Artist/Edit to control what happens for newly added albums",
|
||||
"MonitorArtist": "Monitor Artist",
|
||||
"MonitorExistingAlbums": "Monitor Existing Albums",
|
||||
"MonitorNewAlbums": "Monitor New Albums",
|
||||
"MonitorNewItems": "Monitor New Albums",
|
||||
"MonitorNewItemsHelpText": "Which new albums should be monitored",
|
||||
"Monitored": "Monitored",
|
||||
|
@ -1017,6 +1020,7 @@
|
|||
"UpdateCheckUINotWritableMessage": "Cannot install update because UI folder '{0}' is not writable by the user '{1}'.",
|
||||
"UpdateMechanismHelpText": "Use Lidarr's built-in updater or a script",
|
||||
"UpdateScriptPathHelpText": "Path to a custom script that takes an extracted update package and handle the remainder of the update process",
|
||||
"UpdateSelected": "Update Selected",
|
||||
"Updates": "Updates",
|
||||
"UpdatingIsDisabledInsideADockerContainerUpdateTheContainerImageInstead": "Updating is disabled inside a docker container. Update the container image instead.",
|
||||
"UpgradeAllowedHelpText": "If disabled qualities will not be upgraded",
|
||||
|
|
|
@ -7,6 +7,7 @@ public class MonitoringOptions : IEmbeddedDocument
|
|||
{
|
||||
public MonitoringOptions()
|
||||
{
|
||||
Monitor = MonitorTypes.Unknown;
|
||||
AlbumsToMonitor = new List<string>();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,8 @@ public void SetAlbumMonitoredStatus(Artist artist, MonitoringOptions monitoringO
|
|||
// If specific albums are passed use those instead of the monitoring options.
|
||||
if (monitoredAlbums.Any())
|
||||
{
|
||||
ToggleAlbumsMonitoredState(
|
||||
albums.Where(s => monitoredAlbums.Contains(s.ForeignAlbumId)), true);
|
||||
ToggleAlbumsMonitoredState(
|
||||
albums.Where(s => !monitoredAlbums.Contains(s.ForeignAlbumId)), false);
|
||||
ToggleAlbumsMonitoredState(albums.Where(s => monitoredAlbums.Contains(s.ForeignAlbumId)), true);
|
||||
ToggleAlbumsMonitoredState(albums.Where(s => !monitoredAlbums.Contains(s.ForeignAlbumId)), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -81,6 +79,9 @@ public void SetAlbumMonitoredStatus(Artist artist, MonitoringOptions monitoringO
|
|||
ToggleAlbumsMonitoredState(albums, false);
|
||||
ToggleAlbumsMonitoredState(albums.OrderBy(e => e.ReleaseDate).Take(1), true);
|
||||
break;
|
||||
case MonitorTypes.Unknown:
|
||||
// Ignoring, it's the default value
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue