mirror of https://github.com/Sonarr/Sonarr
Fixed: Prevent loss of restrictions when attempting to edit multiple restrictions at once
Closes #4917
This commit is contained in:
parent
bd228e88c3
commit
b16094a9e3
|
@ -76,9 +76,15 @@ class TagInput extends Component {
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onTagEdit = ({ value, ...otherProps }) => {
|
onTagEdit = ({ value, ...otherProps }) => {
|
||||||
this.setState({ value });
|
const currentValue = this.state.value;
|
||||||
|
|
||||||
this.props.onTagDelete(otherProps);
|
if (currentValue && this.props.onTagReplace) {
|
||||||
|
this.props.onTagReplace(otherProps, { name: currentValue });
|
||||||
|
} else {
|
||||||
|
this.props.onTagDelete(otherProps);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({ value });
|
||||||
};
|
};
|
||||||
|
|
||||||
onInputContainerPress = () => {
|
onInputContainerPress = () => {
|
||||||
|
@ -234,7 +240,7 @@ class TagInput extends Component {
|
||||||
<AutoSuggestInput
|
<AutoSuggestInput
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
forwardedRef={this._setAutosuggestRef}
|
forwardedRef={this._setAutosuggestRef}
|
||||||
className={styles.internalInput}
|
className={className}
|
||||||
inputContainerClassName={classNames(
|
inputContainerClassName={classNames(
|
||||||
inputContainerClassName,
|
inputContainerClassName,
|
||||||
isFocused && styles.isFocused,
|
isFocused && styles.isFocused,
|
||||||
|
@ -276,7 +282,8 @@ TagInput.propTypes = {
|
||||||
hasWarning: PropTypes.bool,
|
hasWarning: PropTypes.bool,
|
||||||
tagComponent: PropTypes.elementType.isRequired,
|
tagComponent: PropTypes.elementType.isRequired,
|
||||||
onTagAdd: PropTypes.func.isRequired,
|
onTagAdd: PropTypes.func.isRequired,
|
||||||
onTagDelete: PropTypes.func.isRequired
|
onTagDelete: PropTypes.func.isRequired,
|
||||||
|
onTagReplace: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
TagInput.defaultProps = {
|
TagInput.defaultProps = {
|
||||||
|
|
|
@ -138,6 +138,7 @@ class TagInputConnector extends Component {
|
||||||
<TagInput
|
<TagInput
|
||||||
onTagAdd={this.onTagAdd}
|
onTagAdd={this.onTagAdd}
|
||||||
onTagDelete={this.onTagDelete}
|
onTagDelete={this.onTagDelete}
|
||||||
|
onTagReplace={this.onTagReplace}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -71,6 +71,20 @@ class TextTagInputConnector extends Component {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onTagReplace = (tagToReplace, newTag) => {
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
valueArray,
|
||||||
|
onChange
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
const newValue = [...valueArray];
|
||||||
|
newValue.splice(tagToReplace.index, 1);
|
||||||
|
newValue.push(newTag.name.trim());
|
||||||
|
|
||||||
|
onChange({ name, value: newValue });
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render
|
// Render
|
||||||
|
|
||||||
|
@ -80,6 +94,7 @@ class TextTagInputConnector extends Component {
|
||||||
tagList={[]}
|
tagList={[]}
|
||||||
onTagAdd={this.onTagAdd}
|
onTagAdd={this.onTagAdd}
|
||||||
onTagDelete={this.onTagDelete}
|
onTagDelete={this.onTagDelete}
|
||||||
|
onTagReplace={this.onTagReplace}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,3 +3,9 @@
|
||||||
|
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tagInternalInput {
|
||||||
|
composes: internalInput from '~Components/Form/TagInput.css';
|
||||||
|
|
||||||
|
flex: 0 0 100%;
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Please do not change this file!
|
// Please do not change this file!
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
'deleteButton': string;
|
'deleteButton': string;
|
||||||
|
'tagInternalInput': string;
|
||||||
}
|
}
|
||||||
export const cssExports: CssExports;
|
export const cssExports: CssExports;
|
||||||
export default cssExports;
|
export default cssExports;
|
||||||
|
|
|
@ -76,6 +76,7 @@ function EditReleaseProfileModalContent(props) {
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
{...required}
|
{...required}
|
||||||
|
inputClassName={styles.tagInternalInput}
|
||||||
type={inputTypes.TEXT_TAG}
|
type={inputTypes.TEXT_TAG}
|
||||||
name="required"
|
name="required"
|
||||||
helpText="The release must contain at least one of these terms (case insensitive)"
|
helpText="The release must contain at least one of these terms (case insensitive)"
|
||||||
|
@ -92,6 +93,7 @@ function EditReleaseProfileModalContent(props) {
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
{...ignored}
|
{...ignored}
|
||||||
|
inputClassName={styles.tagInternalInput}
|
||||||
type={inputTypes.TEXT_TAG}
|
type={inputTypes.TEXT_TAG}
|
||||||
name="ignored"
|
name="ignored"
|
||||||
helpText="The release will be rejected if it contains one or more of terms (case insensitive)"
|
helpText="The release will be rejected if it contains one or more of terms (case insensitive)"
|
||||||
|
|
Loading…
Reference in New Issue