diff --git a/frontend/src/Indexer/Add/AddIndexerModalContent.js b/frontend/src/Indexer/Add/AddIndexerModalContent.js index 5255a4e7c..253703d5d 100644 --- a/frontend/src/Indexer/Add/AddIndexerModalContent.js +++ b/frontend/src/Indexer/Add/AddIndexerModalContent.js @@ -15,7 +15,7 @@ import TableBody from 'Components/Table/TableBody'; import { kinds, scrollDirections } from 'Helpers/Props'; import getErrorMessage from 'Utilities/Object/getErrorMessage'; import translate from 'Utilities/String/translate'; -import SelectIndexerRow from './SelectIndexerRow'; +import SelectIndexerRowConnector from './SelectIndexerRowConnector'; import styles from './AddIndexerModalContent.css'; const columns = [ @@ -219,7 +219,7 @@ class AddIndexerModalContent extends Component { { filteredIndexers.map((indexer) => ( - {name} + { + isExistingIndexer ? + : + null + } @@ -62,7 +75,8 @@ SelectIndexerRow.propTypes = { privacy: PropTypes.string.isRequired, language: PropTypes.string.isRequired, implementation: PropTypes.string.isRequired, - onIndexerSelect: PropTypes.func.isRequired + onIndexerSelect: PropTypes.func.isRequired, + isExistingIndexer: PropTypes.bool.isRequired }; export default SelectIndexerRow; diff --git a/frontend/src/Indexer/Add/SelectIndexerRowConnector.js b/frontend/src/Indexer/Add/SelectIndexerRowConnector.js new file mode 100644 index 000000000..f507689c8 --- /dev/null +++ b/frontend/src/Indexer/Add/SelectIndexerRowConnector.js @@ -0,0 +1,18 @@ + +import { connect } from 'react-redux'; +import { createSelector } from 'reselect'; +import createExistingIndexerSelector from 'Store/Selectors/createExistingIndexerSelector'; +import SelectIndexerRow from './SelectIndexerRow'; + +function createMapStateToProps() { + return createSelector( + createExistingIndexerSelector(), + (isExistingIndexer, dimensions) => { + return { + isExistingIndexer + }; + } + ); +} + +export default connect(createMapStateToProps)(SelectIndexerRow); diff --git a/frontend/src/Store/Selectors/createExclusionMovieSelector.js b/frontend/src/Store/Selectors/createExclusionMovieSelector.js deleted file mode 100644 index 20365e9b5..000000000 --- a/frontend/src/Store/Selectors/createExclusionMovieSelector.js +++ /dev/null @@ -1,14 +0,0 @@ -import _ from 'lodash'; -import { createSelector } from 'reselect'; - -function createExclusionMovieSelector() { - return createSelector( - (state, { tmdbId }) => tmdbId, - (state) => state.settings.importExclusions, - (tmdbId, importExclusions) => { - return _.some(importExclusions.items, { tmdbId }); - } - ); -} - -export default createExclusionMovieSelector; diff --git a/frontend/src/Store/Selectors/createExistingIndexerSelector.js b/frontend/src/Store/Selectors/createExistingIndexerSelector.js new file mode 100644 index 000000000..af16973b7 --- /dev/null +++ b/frontend/src/Store/Selectors/createExistingIndexerSelector.js @@ -0,0 +1,15 @@ +import _ from 'lodash'; +import { createSelector } from 'reselect'; +import createAllIndexersSelector from './createAllIndexersSelector'; + +function createExistingIndexerSelector() { + return createSelector( + (state, { definitionName }) => definitionName, + createAllIndexersSelector(), + (definitionName, indexers) => { + return _.some(indexers, { definitionName }); + } + ); +} + +export default createExistingIndexerSelector; diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 3e09bea17..2360e55a5 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -169,6 +169,7 @@ "IllRestartLater": "I'll restart later", "IncludeHealthWarningsHelpText": "Include Health Warnings", "Indexer": "Indexer", + "IndexerAlreadySetup": "At least one instace of indexer is already setup", "IndexerAuth": "Indexer Auth", "IndexerFlags": "Indexer Flags", "IndexerHealthCheckNoIndexers": "No indexers enabled, Prowlarr will not return search results",