2018-10-20 03:03:56 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React, { Component, Fragment } from 'react';
|
2018-02-06 23:08:36 +00:00
|
|
|
import PageContent from 'Components/Page/PageContent';
|
2020-06-30 01:35:29 +00:00
|
|
|
import PageContentBody from 'Components/Page/PageContentBody';
|
2018-10-20 03:03:56 +00:00
|
|
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
|
|
|
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
2020-09-07 01:33:10 +00:00
|
|
|
import { icons } from 'Helpers/Props';
|
2018-02-06 23:08:36 +00:00
|
|
|
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
2021-10-03 15:01:09 +00:00
|
|
|
import translate from 'Utilities/String/translate';
|
2019-03-01 22:26:36 +00:00
|
|
|
import ImportListsExclusionsConnector from './ImportListExclusions/ImportListExclusionsConnector';
|
2020-09-07 01:33:10 +00:00
|
|
|
import ImportListsConnector from './ImportLists/ImportListsConnector';
|
2023-07-10 21:42:51 +00:00
|
|
|
import ManageImportListsModal from './ImportLists/Manage/ManageImportListsModal';
|
2018-02-06 23:08:36 +00:00
|
|
|
|
|
|
|
class ImportListSettings extends Component {
|
|
|
|
|
|
|
|
//
|
|
|
|
// Lifecycle
|
|
|
|
|
|
|
|
constructor(props, context) {
|
|
|
|
super(props, context);
|
|
|
|
|
|
|
|
this.state = {
|
2023-07-10 21:42:51 +00:00
|
|
|
hasPendingChanges: false,
|
|
|
|
isManageImportListsOpen: false
|
2018-02-06 23:08:36 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Listeners
|
|
|
|
|
|
|
|
setListOptionsRef = (ref) => {
|
|
|
|
this._listOptions = ref;
|
2021-12-24 18:18:14 +00:00
|
|
|
};
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2023-07-10 21:42:51 +00:00
|
|
|
onManageImportListsPress = () => {
|
|
|
|
this.setState({ isManageImportListsOpen: true });
|
|
|
|
};
|
|
|
|
|
|
|
|
onManageImportListsModalClose = () => {
|
|
|
|
this.setState({ isManageImportListsOpen: false });
|
|
|
|
};
|
|
|
|
|
2018-02-06 23:08:36 +00:00
|
|
|
onHasPendingChange = (hasPendingChanges) => {
|
|
|
|
this.setState({
|
|
|
|
hasPendingChanges
|
|
|
|
});
|
2021-12-24 18:18:14 +00:00
|
|
|
};
|
2018-02-06 23:08:36 +00:00
|
|
|
|
|
|
|
onSavePress = () => {
|
|
|
|
this._listOptions.getWrappedInstance().save();
|
2021-12-24 18:18:14 +00:00
|
|
|
};
|
2018-02-06 23:08:36 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Render
|
|
|
|
|
|
|
|
render() {
|
2018-10-20 03:03:56 +00:00
|
|
|
const {
|
|
|
|
isTestingAll,
|
|
|
|
dispatchTestAllImportLists
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
isSaving,
|
2023-07-10 21:42:51 +00:00
|
|
|
hasPendingChanges,
|
|
|
|
isManageImportListsOpen
|
2018-10-20 03:03:56 +00:00
|
|
|
} = this.state;
|
|
|
|
|
2018-02-06 23:08:36 +00:00
|
|
|
return (
|
2021-10-03 15:01:09 +00:00
|
|
|
<PageContent title={translate('ImportListSettings')}>
|
2018-02-06 23:08:36 +00:00
|
|
|
<SettingsToolbarConnector
|
2018-10-20 03:03:56 +00:00
|
|
|
isSaving={isSaving}
|
|
|
|
hasPendingChanges={hasPendingChanges}
|
|
|
|
additionalButtons={
|
|
|
|
<Fragment>
|
|
|
|
<PageToolbarSeparator />
|
|
|
|
|
|
|
|
<PageToolbarButton
|
2021-10-03 15:01:09 +00:00
|
|
|
label={translate('TestAllLists')}
|
2018-10-20 03:03:56 +00:00
|
|
|
iconName={icons.TEST}
|
|
|
|
isSpinning={isTestingAll}
|
|
|
|
onPress={dispatchTestAllImportLists}
|
|
|
|
/>
|
2023-07-10 21:42:51 +00:00
|
|
|
|
|
|
|
<PageToolbarButton
|
|
|
|
label={translate('ManageLists')}
|
|
|
|
iconName={icons.MANAGE}
|
|
|
|
onPress={this.onManageImportListsPress}
|
|
|
|
/>
|
2018-10-20 03:03:56 +00:00
|
|
|
</Fragment>
|
|
|
|
}
|
2018-02-06 23:08:36 +00:00
|
|
|
onSavePress={this.onSavePress}
|
|
|
|
/>
|
|
|
|
|
2020-06-30 01:35:29 +00:00
|
|
|
<PageContentBody>
|
2018-02-06 23:08:36 +00:00
|
|
|
<ImportListsConnector />
|
2019-03-01 22:26:36 +00:00
|
|
|
<ImportListsExclusionsConnector />
|
2023-07-10 21:42:51 +00:00
|
|
|
<ManageImportListsModal
|
|
|
|
isOpen={isManageImportListsOpen}
|
|
|
|
onModalClose={this.onManageImportListsModalClose}
|
|
|
|
/>
|
2020-06-30 01:35:29 +00:00
|
|
|
</PageContentBody>
|
2018-02-06 23:08:36 +00:00
|
|
|
</PageContent>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-20 03:03:56 +00:00
|
|
|
ImportListSettings.propTypes = {
|
|
|
|
isTestingAll: PropTypes.bool.isRequired,
|
|
|
|
dispatchTestAllImportLists: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
2018-02-06 23:08:36 +00:00
|
|
|
export default ImportListSettings;
|