Skip to content

Commit

Permalink
Merge pull request #1589 from boaz0/cost_282
Browse files Browse the repository at this point in the history
fix(costmodels): show close dialog on wizard close if >20% is filled
  • Loading branch information
boaz0 committed Jun 30, 2020
2 parents 66c63b8 + ca2bb4b commit 87656cb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/pages/costModels/createCostModelWizard/index.tsx
Expand Up @@ -185,7 +185,8 @@ class CostModelWizardBase extends React.Component<Props, State> {
public state = defaultState;
public render() {
const { metricsHash, t } = this.props;

/*
*/
const closeConfirmDialog = () => {
this.setState({ isDialogOpen: false }, this.props.openWizard);
};
Expand Down Expand Up @@ -317,7 +318,16 @@ class CostModelWizardBase extends React.Component<Props, State> {
isProcess={this.state.createProcess}
isSuccess={this.state.createSuccess}
closeFnc={() => {
this.setState({ isDialogOpen: true }, this.props.closeWizard);
if (
(this.state.type === 'OCP' &&
this.state.step > 1 &&
this.state.tiers.length > 0) ||
(this.state.type !== 'OCP' && this.state.step > 2)
) {
this.setState({ isDialogOpen: true }, this.props.closeWizard);
} else {
this.setState({ ...defaultState }, this.props.closeWizard);
}
}}
isOpen={this.props.isOpen}
onMove={curr => this.setState({ step: Number(curr.id) })}
Expand Down

0 comments on commit 87656cb

Please sign in to comment.