mirror of https://github.com/Sonarr/Sonarr
117 lines
3.3 KiB
JavaScript
117 lines
3.3 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import Alert from 'Components/Alert';
|
|
import FieldSet from 'Components/FieldSet';
|
|
import Form from 'Components/Form/Form';
|
|
import FormGroup from 'Components/Form/FormGroup';
|
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
|
import FormLabel from 'Components/Form/FormLabel';
|
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
import { inputTypes, kinds } from 'Helpers/Props';
|
|
import translate from 'Utilities/String/translate';
|
|
|
|
function IndexerOptions(props) {
|
|
const {
|
|
advancedSettings,
|
|
isFetching,
|
|
error,
|
|
settings,
|
|
hasSettings,
|
|
onInputChange
|
|
} = props;
|
|
|
|
return (
|
|
<FieldSet legend={translate('Options')}>
|
|
{
|
|
isFetching &&
|
|
<LoadingIndicator />
|
|
}
|
|
|
|
{
|
|
!isFetching && error &&
|
|
<Alert kind={kinds.DANGER}>
|
|
{translate('IndexerOptionsLoadError')}
|
|
</Alert>
|
|
}
|
|
|
|
{
|
|
hasSettings && !isFetching && !error &&
|
|
<Form>
|
|
<FormGroup>
|
|
<FormLabel>{translate('MinimumAge')}</FormLabel>
|
|
|
|
<FormInputGroup
|
|
type={inputTypes.NUMBER}
|
|
name="minimumAge"
|
|
min={0}
|
|
unit="minutes"
|
|
helpText={translate('MinimumAgeHelpText')}
|
|
onChange={onInputChange}
|
|
{...settings.minimumAge}
|
|
/>
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
<FormLabel>{translate('Retention')}</FormLabel>
|
|
|
|
<FormInputGroup
|
|
type={inputTypes.NUMBER}
|
|
name="retention"
|
|
min={0}
|
|
unit="days"
|
|
helpText={translate('RetentionHelpText')}
|
|
onChange={onInputChange}
|
|
{...settings.retention}
|
|
/>
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
<FormLabel>{translate('MaximumSize')}</FormLabel>
|
|
|
|
<FormInputGroup
|
|
type={inputTypes.NUMBER}
|
|
name="maximumSize"
|
|
min={0}
|
|
unit="MB"
|
|
helpText={translate('MaximumSizeHelpText')}
|
|
onChange={onInputChange}
|
|
{...settings.maximumSize}
|
|
/>
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
advancedSettings={advancedSettings}
|
|
isAdvanced={true}
|
|
>
|
|
<FormLabel>{translate('RssSyncInterval')}</FormLabel>
|
|
|
|
<FormInputGroup
|
|
type={inputTypes.NUMBER}
|
|
name="rssSyncInterval"
|
|
min={0}
|
|
max={120}
|
|
unit="minutes"
|
|
helpText={translate('RssSyncIntervalHelpText')}
|
|
helpTextWarning={translate('RssSyncIntervalHelpTextWarning')}
|
|
helpLink="https://wiki.servarr.com/sonarr/faq#how-does-sonarr-find-episodes"
|
|
onChange={onInputChange}
|
|
{...settings.rssSyncInterval}
|
|
/>
|
|
</FormGroup>
|
|
</Form>
|
|
}
|
|
</FieldSet>
|
|
);
|
|
}
|
|
|
|
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;
|