import PropTypes from 'prop-types' ;
import React from 'react' ;
import { inputTypes } from 'Helpers/Props' ;
import LoadingIndicator from 'Components/Loading/LoadingIndicator' ;
import FieldSet from 'Components/FieldSet' ;
import Form from 'Components/Form/Form' ;
import FormGroup from 'Components/Form/FormGroup' ;
import FormLabel from 'Components/Form/FormLabel' ;
import FormInputGroup from 'Components/Form/FormInputGroup' ;
function IndexerOptions ( props ) {
const {
advancedSettings ,
isFetching ,
error ,
settings ,
hasSettings ,
onInputChange
} = props ;
return (
< FieldSet legend = "Options" >
{
isFetching &&
< LoadingIndicator / >
}
{
! isFetching && error &&
< div > Unable to load indexer options < / d i v >
}
{
hasSettings && ! isFetching && ! error &&
< Form >
< FormGroup >
< FormLabel > Minimum Age < / F o r m L a b e l >
< FormInputGroup
type = { inputTypes . NUMBER }
name = "minimumAge"
min = { 0 }
unit = "minutes"
helpText = "Usenet only: Minimum age in minutes of NZBs before they are grabbed. Use this to give new releases time to propagate to your usenet provider."
onChange = { onInputChange }
{ ... settings . minimumAge }
/ >
< / F o r m G r o u p >
< FormGroup >
< FormLabel > Maximum Size < / F o r m L a b e l >
< FormInputGroup
type = { inputTypes . NUMBER }
name = "maximumSize"
min = { 0 }
unit = "MB"
helpText = "Maximum size for a release to be grabbed in MB. Set to zero to set to unlimited."
onChange = { onInputChange }
{ ... settings . maximumSize }
/ >
< / F o r m G r o u p >
< FormGroup >
< FormLabel > Retention < / F o r m L a b e l >
< FormInputGroup
type = { inputTypes . NUMBER }
name = "retention"
min = { 0 }
unit = "days"
helpText = "Usenet only: Set to zero to set for unlimited retention"
onChange = { onInputChange }
{ ... settings . retention }
/ >
< / F o r m G r o u p >
< FormGroup
advancedSettings = { advancedSettings }
isAdvanced = { true }
>
< FormLabel > RSS Sync Interval < / F o r m L a b e l >
< FormInputGroup
type = { inputTypes . NUMBER }
name = "rssSyncInterval"
min = { 0 }
unit = "minutes"
helpText = "Interval in minutes. Set to zero to disable (this will stop all automatic release grabbing)"
helpTextWarning = "This will apply to all indexers, please follow the rules set forth by them"
helpLink = "https://github.com/Readarr/Readarr/wiki/RSS-Sync"
onChange = { onInputChange }
{ ... settings . rssSyncInterval }
/ >
< / F o r m G r o u p >
< / F o r m >
}
< / F i e l d S e t >
) ;
}
IndexerOptions . propTypes = {
advancedSettings : PropTypes . bool . isRequired ,
isFetching : PropTypes . bool . isRequired ,
error : PropTypes . object ,
settings : PropTypes . object . isRequired ,
hasSettings : PropTypes . bool . isRequired ,
onInputChange : PropTypes . func . isRequired
} ;
export default IndexerOptions ;