From 1a3e5fd7387fc8bbe4a67756bbbeb7678e8030e6 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 5 Jul 2021 13:12:06 -0400 Subject: [PATCH] New: Advanced settings toggle in indexer edit/add modal (cherry picked from commit 94a8ef63044f47b615facbb6e04200bdd3797189) Fixes #2506 --- .../src/Settings/AdvancedSettingsButton.js | 26 +++++++++++++------ .../Indexers/EditIndexerModalContent.js | 9 +++++++ .../EditIndexerModalContentConnector.js | 11 ++++++-- src/NzbDrone.Core/Localization/Core/en.json | 6 +++-- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/frontend/src/Settings/AdvancedSettingsButton.js b/frontend/src/Settings/AdvancedSettingsButton.js index cc7be45a5..6ba40f6d7 100644 --- a/frontend/src/Settings/AdvancedSettingsButton.js +++ b/frontend/src/Settings/AdvancedSettingsButton.js @@ -10,13 +10,14 @@ import styles from './AdvancedSettingsButton.css'; function AdvancedSettingsButton(props) { const { advancedSettings, - onAdvancedSettingsPress + onAdvancedSettingsPress, + showLabel } = props; return ( -
-
- {advancedSettings ? 'Hide Advanced' : 'Show Advanced'} -
-
+ { + showLabel ? +
+
+ {advancedSettings ? translate('HideAdvanced') : translate('ShowAdvanced')} +
+
: + null + } ); } AdvancedSettingsButton.propTypes = { advancedSettings: PropTypes.bool.isRequired, - onAdvancedSettingsPress: PropTypes.func.isRequired + onAdvancedSettingsPress: PropTypes.func.isRequired, + showLabel: PropTypes.bool.isRequired +}; + +AdvancedSettingsButton.defaultProps = { + showLabel: true }; export default AdvancedSettingsButton; diff --git a/frontend/src/Settings/Indexers/Indexers/EditIndexerModalContent.js b/frontend/src/Settings/Indexers/Indexers/EditIndexerModalContent.js index ab968c005..516e7c48b 100644 --- a/frontend/src/Settings/Indexers/Indexers/EditIndexerModalContent.js +++ b/frontend/src/Settings/Indexers/Indexers/EditIndexerModalContent.js @@ -13,6 +13,7 @@ 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'; @@ -31,6 +32,7 @@ function EditIndexerModalContent(props) { onSavePress, onTestPress, onDeleteIndexerPress, + onAdvancedSettingsPress, ...otherProps } = props; @@ -212,6 +214,12 @@ function EditIndexerModalContent(props) { } + + { + this.props.toggleAdvancedSettings(); + }; + // // Render @@ -65,6 +70,7 @@ class EditIndexerModalContentConnector extends Component { {...this.props} onSavePress={this.onSavePress} onTestPress={this.onTestPress} + onAdvancedSettingsPress={this.onAdvancedSettingsPress} onInputChange={this.onInputChange} onFieldChange={this.onFieldChange} /> @@ -80,6 +86,7 @@ EditIndexerModalContentConnector.propTypes = { item: PropTypes.object.isRequired, setIndexerValue: PropTypes.func.isRequired, setIndexerFieldValue: PropTypes.func.isRequired, + toggleAdvancedSettings: PropTypes.func.isRequired, saveIndexer: PropTypes.func.isRequired, testIndexer: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 222b9b1f2..216b0b0aa 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -13,8 +13,6 @@ "AddNewItem": "Add New Item", "AddedAuthorSettings": "Added Author Settings", "AddingTag": "Adding tag", - "AdvancedSettingsHiddenClickToShow": "Hidden, click to show", - "AdvancedSettingsShownClickToHide": "Shown, click to hide", "AgeWhenGrabbed": "Age (when grabbed)", "All": "All", "AllAuthorBooks": "All Author Books", @@ -325,6 +323,8 @@ "HasPendingChangesNoChanges": "No Changes", "HasPendingChangesSaveChanges": "Save Changes", "HealthNoIssues": "No issues with your configuration", + "HiddenClickToShow": "Hidden, click to show", + "HideAdvanced": "Hide Advanced", "HideBooks": "Hide books", "History": "History", "Host": "Host", @@ -731,6 +731,7 @@ "ShouldMonitorExistingHelpText": "Automatically monitor books on this list which are already in Readarr", "ShouldMonitorHelpText": "Monitor new authors and books added from this list", "ShouldSearchHelpText": "Search indexers for newly added items. Use with caution for large lists.", + "ShowAdvanced": "Show Advanced", "ShowBanners": "Show Banners", "ShowBannersHelpText": "Show banners instead of names", "ShowBookCount": "Show Book Count", @@ -754,6 +755,7 @@ "ShowTitleHelpText": "Show author name under poster", "ShowUnknownAuthorItems": "Show Unknown Author Items", "ShownAboveEachColumnWhenWeekIsTheActiveView": "Shown above each column when week is the active view", + "ShownClickToHide": "Shown, click to hide", "Size": " Size", "SizeLimit": "Size Limit", "SkipBooksWithMissingReleaseDate": "Skip books with missing release date",