import PropTypes from 'prop-types'; import React from 'react'; 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 ProviderFieldFormGroup from 'Components/Form/ProviderFieldFormGroup'; import Button from 'Components/Link/Button'; import SpinnerErrorButton from 'Components/Link/SpinnerErrorButton'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import ModalBody from 'Components/Modal/ModalBody'; import ModalContent from 'Components/Modal/ModalContent'; import ModalFooter from 'Components/Modal/ModalFooter'; import ModalHeader from 'Components/Modal/ModalHeader'; import { inputTypes, kinds } from 'Helpers/Props'; import AdvancedSettingsButton from 'Settings/AdvancedSettingsButton'; import translate from 'Utilities/String/translate'; import styles from './EditIndexerModalContent.css'; function EditIndexerModalContent(props) { const { advancedSettings, isFetching, error, isSaving, isTesting, saveError, item, hasUsenetDownloadClients, hasTorrentDownloadClients, onInputChange, onFieldChange, onModalClose, onSavePress, onTestPress, onDeleteIndexerPress, onAdvancedSettingsPress, ...otherProps } = props; const { id, implementationName, definitionName, name, enable, redirect, supportsRss, supportsRedirect, appProfileId, tags, fields, priority, protocol, downloadClientId } = item; const indexerDisplayName = implementationName === definitionName ? implementationName : `${implementationName} (${definitionName})`; const showDownloadClientInput = downloadClientId.value > 0 || protocol.value === 'usenet' && hasUsenetDownloadClients || protocol.value === 'torrent' && hasTorrentDownloadClients; return ( {id ? translate('EditIndexerImplementation', { implementationName: indexerDisplayName }) : translate('AddIndexerImplementation', { implementationName: indexerDisplayName })} { isFetching && } { !isFetching && !!error &&
{translate('UnableToAddANewIndexerPleaseTryAgain')}
} { !isFetching && !error &&
{translate('Name')} {translate('Enable')} {translate('Redirect')} {translate('SyncProfile')} { fields ? fields.map((field) => { return ( ); }) : null } {translate('IndexerPriority')} {showDownloadClientInput ? {translate('DownloadClient')} : null } {translate('Tags')} }
{ id && } {translate('Test')} {translate('Save')}
); } EditIndexerModalContent.propTypes = { advancedSettings: PropTypes.bool.isRequired, isFetching: PropTypes.bool.isRequired, error: PropTypes.object, isSaving: PropTypes.bool.isRequired, isTesting: PropTypes.bool.isRequired, saveError: PropTypes.object, item: PropTypes.object.isRequired, hasUsenetDownloadClients: PropTypes.bool.isRequired, hasTorrentDownloadClients: PropTypes.bool.isRequired, onInputChange: PropTypes.func.isRequired, onFieldChange: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired, onSavePress: PropTypes.func.isRequired, onTestPress: PropTypes.func.isRequired, onAdvancedSettingsPress: PropTypes.func.isRequired, onDeleteIndexerPress: PropTypes.func }; export default EditIndexerModalContent;