New: Specials monitoring options

This commit is contained in:
Stevie Robinson 2023-03-27 08:40:11 +02:00 committed by GitHub
parent 033936dce7
commit 11905b99d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 129 additions and 4 deletions

View File

@ -35,6 +35,16 @@ function SeriesMonitoringOptionsPopoverContent() {
data="Monitor all episodes of the latest season and future seasons"
/>
<DescriptionListItem
title="Monitor Specials"
data="Monitor all special episodes without changing the monitored status of other episodes"
/>
<DescriptionListItem
title="Unmonitor Specials"
data="Unmonitor all special episodes without changing the monitored status of other episodes"
/>
<DescriptionListItem
title="None"
data="No episodes will be monitored"

View File

@ -8,6 +8,10 @@
font-weight: bold;
}
.labelIcon {
margin-left: 8px;
}
@media only screen and (max-width: $breakpointExtraSmall) {
.modalFooter {
flex-direction: column;

View File

@ -1,6 +1,7 @@
// This file is automatically generated.
// Please do not change this file!
interface CssExports {
'labelIcon': string;
'modalFooter': string;
'selected': string;
}

View File

@ -1,14 +1,17 @@
import React, { useCallback, useState } from 'react';
import SeriesMonitoringOptionsPopoverContent from 'AddSeries/SeriesMonitoringOptionsPopoverContent';
import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import Icon from 'Components/Icon';
import Button from 'Components/Link/Button';
import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import { inputTypes } from 'Helpers/Props';
import Popover from 'Components/Tooltip/Popover';
import { icons, inputTypes, tooltipPositions } from 'Helpers/Props';
import translate from 'Utilities/String/translate';
import styles from './ChangeMonitoringModalContent.css';
@ -48,7 +51,16 @@ function ChangeMonitoringModalContent(
<ModalBody>
<Form {...otherProps}>
<FormGroup>
<FormLabel>{translate('Monitoring')}</FormLabel>
<FormLabel>
{translate('Monitoring')}
<Popover
anchor={<Icon className={styles.labelIcon} name={icons.INFO} />}
title={translate('Monitoring Options')}
body={<SeriesMonitoringOptionsPopoverContent />}
position={tooltipPositions.RIGHT}
/>
</FormLabel>
<FormInputGroup
type={inputTypes.MONITOR_EPISODES_SELECT}

View File

@ -0,0 +1,3 @@
.labelIcon {
margin-left: 8px;
}

View File

@ -0,0 +1,7 @@
// This file is automatically generated.
// Please do not change this file!
interface CssExports {
'labelIcon': string;
}
export const cssExports: CssExports;
export default cssExports;

View File

@ -1,16 +1,20 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import SeriesMonitoringOptionsPopoverContent from 'AddSeries/SeriesMonitoringOptionsPopoverContent';
import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import Icon from 'Components/Icon';
import Button from 'Components/Link/Button';
import SpinnerButton from 'Components/Link/SpinnerButton';
import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import { inputTypes } from 'Helpers/Props';
import Popover from 'Components/Tooltip/Popover';
import { icons, inputTypes, tooltipPositions } from 'Helpers/Props';
import styles from './MonitoringOptionsModalContent.css';
const NO_CHANGE = 'noChange';
@ -84,7 +88,21 @@ class MonitoringOptionsModalContent extends Component {
<ModalBody>
<Form {...otherProps}>
<FormGroup>
<FormLabel>Monitoring</FormLabel>
<FormLabel>
Monitoring
<Popover
anchor={
<Icon
className={styles.labelIcon}
name={icons.INFO}
/>
}
title="Monitoring Options"
body={<SeriesMonitoringOptionsPopoverContent />}
position={tooltipPositions.RIGHT}
/>
</FormLabel>
<FormInputGroup
type={inputTypes.MONITOR_EPISODES_SELECT}

View File

@ -6,6 +6,8 @@ const monitorOptions = [
{ key: 'pilot', value: 'Pilot Episode' },
{ key: 'firstSeason', value: 'Only First Season' },
{ key: 'latestSeason', value: 'Only Latest Season' },
{ key: 'monitorSpecials', value: 'Monitor Specials' },
{ key: 'unmonitorSpecials', value: 'Unmonitor Specials' },
{ key: 'none', value: 'None' }
];

View File

@ -149,6 +149,58 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeMonitoredServiceTests
VerifyNotMonitored(e => e.SeasonNumber == 0);
}
[Test]
public void should_monitor_specials()
{
GivenSpecials();
var monitoringOptions = new MonitoringOptions
{
Monitor = MonitorTypes.MonitorSpecials
};
Subject.SetEpisodeMonitoredStatus(_series, monitoringOptions);
VerifyMonitored(e => e.SeasonNumber == 0);
}
[Test]
public void should_unmonitor_specials()
{
GivenSpecials();
var monitoringOptions = new MonitoringOptions
{
Monitor = MonitorTypes.UnmonitorSpecials
};
Subject.SetEpisodeMonitoredStatus(_series, monitoringOptions);
VerifyNotMonitored(e => e.SeasonNumber == 0);
}
[Test]
public void should_unmonitor_specials_after_monitoring()
{
GivenSpecials();
var monitoringOptions = new MonitoringOptions
{
Monitor = MonitorTypes.MonitorSpecials
};
Subject.SetEpisodeMonitoredStatus(_series, monitoringOptions);
monitoringOptions = new MonitoringOptions
{
Monitor = MonitorTypes.UnmonitorSpecials
};
Subject.SetEpisodeMonitoredStatus(_series, monitoringOptions);
VerifyNotMonitored(e => e.SeasonNumber == 0);
}
[Test]
public void should_not_monitor_season_when_all_episodes_are_monitored_except_latest_season()
{

View File

@ -100,6 +100,18 @@ namespace NzbDrone.Core.Tv
break;
case MonitorTypes.MonitorSpecials:
_logger.Debug("[{0}] Monitoring special episodes", series.Title);
ToggleEpisodesMonitoredState(episodes.Where(e => e.SeasonNumber == 0), true);
break;
case MonitorTypes.UnmonitorSpecials:
_logger.Debug("[{0}] Unmonitoring special episodes", series.Title);
ToggleEpisodesMonitoredState(episodes.Where(e => e.SeasonNumber == 0), false);
break;
case MonitorTypes.None:
_logger.Debug("[{0}] Unmonitoring all episodes", series.Title);
ToggleEpisodesMonitoredState(episodes, e => false);

View File

@ -19,6 +19,8 @@ namespace NzbDrone.Core.Tv
FirstSeason,
LatestSeason,
Pilot,
MonitorSpecials,
UnmonitorSpecials,
None
}
}

View File

@ -9150,6 +9150,8 @@
"firstSeason",
"latestSeason",
"pilot",
"monitorSpecials",
"UnmonitorSpecials",
"none"
],
"type": "string"