Commit 7d330734 authored by Oleksii Savran's avatar Oleksii Savran Committed by Viacheslav Pavlov

Send request button is disabled on request stepper after user refreshes page

parent fa46f89b
...@@ -3,6 +3,8 @@ import { bindActionCreators } from 'redux'; ...@@ -3,6 +3,8 @@ import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { WithTranslation, withTranslation } from 'react-i18next'; import { WithTranslation, withTranslation } from 'react-i18next';
import { loadAccessionsByUUIDs } from 'list/actions/public';
// ui // ui
import StepperTemplate from 'ui/common/stepper/StepperTemplate'; import StepperTemplate from 'ui/common/stepper/StepperTemplate';
import Markdown from 'ui/common/markdown'; import Markdown from 'ui/common/markdown';
...@@ -11,14 +13,19 @@ import { Button } from '@material-ui/core'; ...@@ -11,14 +13,19 @@ import { Button } from '@material-ui/core';
interface IAccessionsListStep extends React.ClassAttributes<any>, WithTranslation { interface IAccessionsListStep extends React.ClassAttributes<any>, WithTranslation {
myList: any; myList: any;
requestInfo: any; requestInfo: any;
loadAccessionsByUUIDs: () => void;
} }
class ConfirmStep extends StepperTemplate<IAccessionsListStep> { class ConfirmStep extends StepperTemplate<IAccessionsListStep> {
public componentWillMount() { public componentWillMount() {
const { myList: { accessionUuids }, requestInfo } = this.props; const { myList: { accessionUuids, loaded }, requestInfo, loadAccessionsByUUIDs } = this.props;
this.setDisabledActions(!requestInfo || !accessionUuids || accessionUuids.length === 0 || (!requestInfo.internalRequest && requestInfo.preacceptSMTA !== 'true')); this.setDisabledActions(!requestInfo || !accessionUuids || accessionUuids.length === 0 || (!requestInfo.internalRequest && requestInfo.preacceptSMTA !== 'true'));
if (accessionUuids.length !== 0 && loaded.length === 0) {
loadAccessionsByUUIDs();
}
} }
public componentWillReceiveProps(nextProps) { public componentWillReceiveProps(nextProps) {
...@@ -62,7 +69,7 @@ const mapStateToProps = (state, ownProps) => ({ ...@@ -62,7 +69,7 @@ const mapStateToProps = (state, ownProps) => ({
}); });
const mapDispatchToProps = (dispatch) => bindActionCreators({ const mapDispatchToProps = (dispatch) => bindActionCreators({
// nope loadAccessionsByUUIDs,
}, dispatch); }, dispatch);
export default connect( export default connect(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment