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, showLanguageProfile,
isSmallScreen, isSmallScreen,
onModalClose, onModalClose,
onInputChange onInputChange,
...otherProps
} = this.props; } = this.props;
return ( return (
@ -87,22 +88,27 @@ class AddNewSeriesModalContent extends Component {
<ModalBody> <ModalBody>
<div className={styles.container}> <div className={styles.container}>
{ {
!isSmallScreen && isSmallScreen ?
<div className={styles.poster}> <div className={styles.poster}>
<SeriesPoster <SeriesPoster
className={styles.poster} className={styles.poster}
images={images} images={images}
size={250} size={250}
/> />
</div> </div> :
null
} }
<div className={styles.info}> <div className={styles.info}>
<div className={styles.overview}> {
{overview} overview ?
</div> <div className={styles.overview}>
{overview}
</div> :
null
}
<Form> <Form {...otherProps}>
<FormGroup> <FormGroup>
<FormLabel>Root Folder</FormLabel> <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 React from 'react';
import { kinds } from 'Helpers/Props'; import { kinds } from 'Helpers/Props';
import Alert from 'Components/Alert'; import Alert from 'Components/Alert';
import styles from './Form.css';
function Form({ children, validationErrors, validationWarnings, ...otherProps }) { function Form({ children, validationErrors, validationWarnings, ...otherProps }) {
return ( return (
<div> <div>
<div> {
{ validationErrors.length || validationWarnings.length ?
validationErrors.map((error, index) => { <div className={styles.validationFailures}>
return ( {
<Alert validationErrors.map((error, index) => {
key={index} return (
kind={kinds.DANGER} <Alert
> key={index}
{error.errorMessage} kind={kinds.DANGER}
</Alert> >
); {error.errorMessage}
}) </Alert>
} );
})
}
{ {
validationWarnings.map((warning, index) => { validationWarnings.map((warning, index) => {
return ( return (
<Alert <Alert
key={index} key={index}
kind={kinds.WARNING} kind={kinds.WARNING}
> >
{warning.errorMessage} {warning.errorMessage}
</Alert> </Alert>
); );
}) })
} }
</div> </div> :
null
}
{children} {children}
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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