Fixed: Changes to Profiles, Languages, Manual Import

This commit is contained in:
Qstick
2019-06-18 22:50:17 -04:00
parent c76364a891
commit 9350f6a04c
97 changed files with 1217 additions and 428 deletions

View File

@@ -92,10 +92,12 @@ class EditQualityProfileModalContent extends Component {
isSaving,
saveError,
qualities,
languages,
item,
isInUse,
onInputChange,
onCutoffChange,
onLanguageChange,
onSavePress,
onModalClose,
onDeleteQualityProfilePress,
@@ -105,10 +107,14 @@ class EditQualityProfileModalContent extends Component {
const {
id,
name,
upgradeAllowed,
cutoff,
language,
items
} = item;
const languageId = language.value.id;
return (
<ModalContent onModalClose={onModalClose}>
<Measure
@@ -159,16 +165,48 @@ class EditQualityProfileModalContent extends Component {
<FormGroup size={sizes.EXTRA_SMALL}>
<FormLabel size={sizes.SMALL}>
Cutoff
Upgrades Allowed
</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="upgradeAllowed"
{...upgradeAllowed}
helpText="If disabled qualities will not be upgraded"
onChange={onInputChange}
/>
</FormGroup>
{
upgradeAllowed.value &&
<FormGroup size={sizes.EXTRA_SMALL}>
<FormLabel size={sizes.SMALL}>
Upgrade Until
</FormLabel>
<FormInputGroup
type={inputTypes.SELECT}
name="cutoff"
{...cutoff}
values={qualities}
helpText="Once this quality is reached Radarr will no longer download movies"
onChange={onCutoffChange}
/>
</FormGroup>
}
<FormGroup size={sizes.EXTRA_SMALL}>
<FormLabel size={sizes.SMALL}>
Language
</FormLabel>
<FormInputGroup
type={inputTypes.SELECT}
name="cutoff"
{...cutoff}
values={qualities}
helpText="Once this quality is reached Radarr will no longer download movies"
onChange={onCutoffChange}
name="language"
values={languages}
value={languageId}
helpText="Language for Releases"
onChange={onLanguageChange}
/>
</FormGroup>
</div>
@@ -197,10 +235,10 @@ class EditQualityProfileModalContent extends Component {
>
<ModalFooter>
{
id &&
id ?
<div
className={styles.deleteButtonContainer}
title={isInUse && 'Can\'t delete a quality profile that is attached to a series'}
title={isInUse ? 'Can\'t delete a quality profile that is attached to a movie' : undefined}
>
<Button
kind={kinds.DANGER}
@@ -209,7 +247,8 @@ class EditQualityProfileModalContent extends Component {
>
Delete
</Button>
</div>
</div> :
null
}
<Button
@@ -239,10 +278,12 @@ EditQualityProfileModalContent.propTypes = {
isSaving: PropTypes.bool.isRequired,
saveError: PropTypes.object,
qualities: PropTypes.arrayOf(PropTypes.object).isRequired,
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
item: PropTypes.object.isRequired,
isInUse: PropTypes.bool.isRequired,
onInputChange: PropTypes.func.isRequired,
onCutoffChange: PropTypes.func.isRequired,
onLanguageChange: PropTypes.func.isRequired,
onSavePress: PropTypes.func.isRequired,
onContentHeightChange: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired,

View File

@@ -61,14 +61,38 @@ function createQualitiesSelector() {
);
}
function createLanguagesSelector() {
return createSelector(
(state) => state.settings.languages,
(languages) => {
const items = languages.items;
if (!items) {
return [];
}
const newItems = items.map((item) => {
return {
key: item.id,
value: item.name
};
});
return newItems;
}
);
}
function createMapStateToProps() {
return createSelector(
createProviderSettingsSelector('qualityProfiles'),
createQualitiesSelector(),
createLanguagesSelector(),
createProfileInUseSelector('qualityProfileId'),
(qualityProfile, qualities, isInUse) => {
(qualityProfile, qualities, languages, isInUse) => {
return {
qualities,
languages,
...qualityProfile,
isInUse
};
@@ -159,6 +183,15 @@ class EditQualityProfileModalContentConnector extends Component {
this.props.setQualityProfileValue({ name, value: cutoffId });
}
onLanguageChange = ({ name, value }) => {
const id = parseInt(value);
const language = _.find(this.props.languages, (item) => item.key === id);
this.props.setQualityProfileValue({ name, value: { id: language.key, Name: language.value } });
}
onSavePress = () => {
this.props.saveQualityProfile({ id: this.props.id });
}
@@ -413,6 +446,7 @@ class EditQualityProfileModalContentConnector extends Component {
onSavePress={this.onSavePress}
onInputChange={this.onInputChange}
onCutoffChange={this.onCutoffChange}
onLanguageChange={this.onLanguageChange}
onCreateGroupPress={this.onCreateGroupPress}
onDeleteGroupPress={this.onDeleteGroupPress}
onQualityProfileItemAllowedChange={this.onQualityProfileItemAllowedChange}
@@ -433,6 +467,7 @@ EditQualityProfileModalContentConnector.propTypes = {
isSaving: PropTypes.bool.isRequired,
saveError: PropTypes.object,
item: PropTypes.object.isRequired,
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
setQualityProfileValue: PropTypes.func.isRequired,
fetchQualityProfileSchema: PropTypes.func.isRequired,
saveQualityProfile: PropTypes.func.isRequired,

View File

@@ -65,6 +65,7 @@ class QualityProfile extends Component {
const {
id,
name,
upgradeAllowed,
cutoff,
items,
isDeleting
@@ -97,7 +98,7 @@ class QualityProfile extends Component {
}
if (item.quality) {
const isCutoff = item.quality.id === cutoff;
const isCutoff = upgradeAllowed && item.quality.id === cutoff;
return (
<Label
@@ -110,7 +111,7 @@ class QualityProfile extends Component {
);
}
const isCutoff = item.id === cutoff;
const isCutoff = upgradeAllowed && item.id === cutoff;
return (
<Tooltip
@@ -174,6 +175,7 @@ class QualityProfile extends Component {
QualityProfile.propTypes = {
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
upgradeAllowed: PropTypes.bool.isRequired,
cutoff: PropTypes.number.isRequired,
items: PropTypes.arrayOf(PropTypes.object).isRequired,
isDeleting: PropTypes.bool.isRequired,