Fixed: Validation failures not being shown if adding a series fails

This commit is contained in:
Mark McDowall 2019-01-01 16:13:49 -08:00
parent 36fe4eaa49
commit fc376bfe3f
13 changed files with 64 additions and 62 deletions

View File

@ -70,7 +70,8 @@ class AddNewSeriesModalContent extends Component {
showLanguageProfile,
isSmallScreen,
onModalClose,
onInputChange
onInputChange,
...otherProps
} = this.props;
return (
@ -87,22 +88,27 @@ class AddNewSeriesModalContent extends Component {
<ModalBody>
<div className={styles.container}>
{
!isSmallScreen &&
isSmallScreen ?
<div className={styles.poster}>
<SeriesPoster
className={styles.poster}
images={images}
size={250}
/>
</div>
</div> :
null
}
<div className={styles.info}>
<div className={styles.overview}>
{overview}
</div>
{
overview ?
<div className={styles.overview}>
{overview}
</div> :
null
}
<Form>
<Form {...otherProps}>
<FormGroup>
<FormLabel>Root Folder</FormLabel>

View File

@ -0,0 +1,3 @@
.validationFailures {
margin-bottom: 20px;
}

View File

@ -2,37 +2,42 @@ import PropTypes from 'prop-types';
import React from 'react';
import { kinds } from 'Helpers/Props';
import Alert from 'Components/Alert';
import styles from './Form.css';
function Form({ children, validationErrors, validationWarnings, ...otherProps }) {
return (
<div>
<div>
{
validationErrors.map((error, index) => {
return (
<Alert
key={index}
kind={kinds.DANGER}
>
{error.errorMessage}
</Alert>
);
})
}
{
validationErrors.length || validationWarnings.length ?
<div className={styles.validationFailures}>
{
validationErrors.map((error, index) => {
return (
<Alert
key={index}
kind={kinds.DANGER}
>
{error.errorMessage}
</Alert>
);
})
}
{
validationWarnings.map((warning, index) => {
return (
<Alert
key={index}
kind={kinds.WARNING}
>
{warning.errorMessage}
</Alert>
);
})
}
</div>
{
validationWarnings.map((warning, index) => {
return (
<Alert
key={index}
kind={kinds.WARNING}
>
{warning.errorMessage}
</Alert>
);
})
}
</div> :
null
}
{children}
</div>

View File

@ -84,9 +84,7 @@ class EditSeriesModalContent extends Component {
</ModalHeader>
<ModalBody>
<Form
{...otherProps}
>
<Form {...otherProps}>
<FormGroup>
<FormLabel>Monitored</FormLabel>

View File

@ -67,9 +67,7 @@ class EditDownloadClientModalContent extends Component {
{
!isFetching && !error &&
<Form
{...otherProps}
>
<Form {...otherProps}>
{
!!message &&
<Alert

View File

@ -56,9 +56,7 @@ function EditRemotePathMappingModalContent(props) {
{
!isFetching && !error &&
<Form
{...otherProps}
>
<Form {...otherProps}>
<FormGroup>
<FormLabel>Host</FormLabel>

View File

@ -7,6 +7,11 @@ import FormGroup from 'Components/Form/FormGroup';
import FormLabel from 'Components/Form/FormLabel';
import FormInputGroup from 'Components/Form/FormInputGroup';
const branchValues = [
'master',
'develop'
];
function UpdateSettings(props) {
const {
advancedSettings,
@ -51,13 +56,14 @@ function UpdateSettings(props) {
<FormLabel>Branch</FormLabel>
<FormInputGroup
type={inputTypes.TEXT}
type={inputTypes.AUTO_COMPLETE}
name="branch"
helpText={usingExternalUpdateMechanism ? 'Branch used by external update mechanism' : 'Branch to use to update Sonarr'}
helpLink="https://github.com/Sonarr/Sonarr/wiki/Release-Branches"
{...branch}
values={branchValues}
onChange={onInputChange}
readOnly={usingExternalUpdateMechanism}
{...branch}
/>
</FormGroup>

View File

@ -64,9 +64,7 @@ function EditIndexerModalContent(props) {
{
!isFetching && !error &&
<Form
{...otherProps}
>
<Form {...otherProps}>
<FormGroup>
<FormLabel>Name</FormLabel>

View File

@ -38,9 +38,7 @@ function EditMetadataModalContent(props) {
</ModalHeader>
<ModalBody>
<Form
{...otherProps}
>
<Form {...otherProps}>
<FormGroup>
<FormLabel>Enable</FormLabel>

View File

@ -70,9 +70,7 @@ function EditNotificationModalContent(props) {
{
!isFetching && !error &&
<Form
{...otherProps}
>
<Form {...otherProps}>
{
!!message &&
<Alert

View File

@ -61,9 +61,7 @@ function EditDelayProfileModalContent(props) {
{
!isFetching && !error &&
<Form
{...otherProps}
>
<Form {...otherProps}>
<FormGroup>
<FormLabel>Protocol</FormLabel>

View File

@ -59,9 +59,7 @@ function EditLanguageProfileModalContent(props) {
{
!isFetching && !error &&
<Form
{...otherProps}
>
<Form {...otherProps}>
<FormGroup>
<FormLabel>Name</FormLabel>

View File

@ -41,9 +41,7 @@ function EditReleaseProfileModalContent(props) {
</ModalHeader>
<ModalBody>
<Form
{...otherProps}
>
<Form {...otherProps}>
<FormGroup>
<FormLabel>Must Contain</FormLabel>