New: Advanced settings toggle in indexer edit/add modal

pull/300/head
Qstick 4 years ago
parent 5cffb10e08
commit a570fd2a8f

@ -13,6 +13,7 @@ import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter'; import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader'; import ModalHeader from 'Components/Modal/ModalHeader';
import { inputTypes, kinds } from 'Helpers/Props'; import { inputTypes, kinds } from 'Helpers/Props';
import AdvancedSettingsButton from 'Settings/AdvancedSettingsButton';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import styles from './EditIndexerModalContent.css'; import styles from './EditIndexerModalContent.css';
@ -31,6 +32,7 @@ function EditIndexerModalContent(props) {
onSavePress, onSavePress,
onTestPress, onTestPress,
onDeleteIndexerPress, onDeleteIndexerPress,
onAdvancedSettingsPress,
...otherProps ...otherProps
} = props; } = props;
@ -165,6 +167,12 @@ function EditIndexerModalContent(props) {
</Button> </Button>
} }
<AdvancedSettingsButton
advancedSettings={advancedSettings}
onAdvancedSettingsPress={onAdvancedSettingsPress}
showLabel={false}
/>
<SpinnerErrorButton <SpinnerErrorButton
isSpinning={isTesting} isSpinning={isTesting}
error={saveError} error={saveError}
@ -204,6 +212,7 @@ EditIndexerModalContent.propTypes = {
onModalClose: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired,
onSavePress: PropTypes.func.isRequired, onSavePress: PropTypes.func.isRequired,
onTestPress: PropTypes.func.isRequired, onTestPress: PropTypes.func.isRequired,
onAdvancedSettingsPress: PropTypes.func.isRequired,
onDeleteIndexerPress: PropTypes.func onDeleteIndexerPress: PropTypes.func
}; };

@ -3,6 +3,7 @@ import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { saveIndexer, setIndexerFieldValue, setIndexerValue, testIndexer } from 'Store/Actions/indexerActions'; import { saveIndexer, setIndexerFieldValue, setIndexerValue, testIndexer } from 'Store/Actions/indexerActions';
import { toggleAdvancedSettings } from 'Store/Actions/settingsActions';
import createIndexerSchemaSelector from 'Store/Selectors/createIndexerSchemaSelector'; import createIndexerSchemaSelector from 'Store/Selectors/createIndexerSchemaSelector';
import EditIndexerModalContent from './EditIndexerModalContent'; import EditIndexerModalContent from './EditIndexerModalContent';
@ -23,7 +24,8 @@ const mapDispatchToProps = {
setIndexerValue, setIndexerValue,
setIndexerFieldValue, setIndexerFieldValue,
saveIndexer, saveIndexer,
testIndexer testIndexer,
toggleAdvancedSettings
}; };
class EditIndexerModalContentConnector extends Component { class EditIndexerModalContentConnector extends Component {
@ -56,6 +58,11 @@ class EditIndexerModalContentConnector extends Component {
this.props.testIndexer({ id: this.props.id }); this.props.testIndexer({ id: this.props.id });
} }
onAdvancedSettingsPress = () => {
console.log('settings');
this.props.toggleAdvancedSettings();
}
// //
// Render // Render
@ -65,6 +72,7 @@ class EditIndexerModalContentConnector extends Component {
{...this.props} {...this.props}
onSavePress={this.onSavePress} onSavePress={this.onSavePress}
onTestPress={this.onTestPress} onTestPress={this.onTestPress}
onAdvancedSettingsPress={this.onAdvancedSettingsPress}
onInputChange={this.onInputChange} onInputChange={this.onInputChange}
onFieldChange={this.onFieldChange} onFieldChange={this.onFieldChange}
/> />
@ -80,6 +88,7 @@ EditIndexerModalContentConnector.propTypes = {
item: PropTypes.object.isRequired, item: PropTypes.object.isRequired,
setIndexerValue: PropTypes.func.isRequired, setIndexerValue: PropTypes.func.isRequired,
setIndexerFieldValue: PropTypes.func.isRequired, setIndexerFieldValue: PropTypes.func.isRequired,
toggleAdvancedSettings: PropTypes.func.isRequired,
saveIndexer: PropTypes.func.isRequired, saveIndexer: PropTypes.func.isRequired,
testIndexer: PropTypes.func.isRequired, testIndexer: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired onModalClose: PropTypes.func.isRequired

@ -10,7 +10,8 @@ import styles from './AdvancedSettingsButton.css';
function AdvancedSettingsButton(props) { function AdvancedSettingsButton(props) {
const { const {
advancedSettings, advancedSettings,
onAdvancedSettingsPress onAdvancedSettingsPress,
showLabel
} = props; } = props;
return ( return (
@ -43,18 +44,27 @@ function AdvancedSettingsButton(props) {
/> />
</span> </span>
<div className={styles.labelContainer}> {
<div className={styles.label}> showLabel &&
{advancedSettings ? translate('HideAdvanced') : translate('ShowAdvanced')} <div className={styles.labelContainer}>
</div> <div className={styles.label}>
</div> {advancedSettings ? translate('HideAdvanced') : translate('ShowAdvanced')}
</div>
</div>
}
</Link> </Link>
); );
} }
AdvancedSettingsButton.propTypes = { AdvancedSettingsButton.propTypes = {
advancedSettings: PropTypes.bool.isRequired, advancedSettings: PropTypes.bool.isRequired,
onAdvancedSettingsPress: PropTypes.func.isRequired onAdvancedSettingsPress: PropTypes.func.isRequired,
showLabel: PropTypes.bool.isRequired
};
AdvancedSettingsButton.defaultProps = {
showLabel: true
}; };
export default AdvancedSettingsButton; export default AdvancedSettingsButton;

Loading…
Cancel
Save