From c2018da2e8e9c003657738d3534d005b7c4b38e0 Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Thu, 9 May 2019 16:50:36 +0530 Subject: [PATCH] Fix issue: Publisher not opening modal for second time --- .../src/components/apps/release/LifeCycle.js | 7 +++---- .../components/apps/release/LifecycleModal.js | 19 ++++++++++++++----- .../react-app/src/js/actions/index.js | 7 ++++++- .../react-app/src/js/constants/ActionTypes.js | 3 ++- .../react-app/src/js/reducers/index.js | 7 +++++++ 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifeCycle.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifeCycle.js index 4896801b57..0447bd0213 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifeCycle.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifeCycle.js @@ -12,7 +12,8 @@ const mapDispatchToProps = dispatch => ({ const mapStateToProps = state => { return { - lifecycle: state.lifecycle + lifecycle: state.lifecycle, + currentStatus : state.release.currentStatus.toUpperCase() }; }; @@ -29,17 +30,15 @@ class ConnectedLifeCycle extends React.Component { } openModal() { - console.log(this.props); this.props.openLifecycleModal("IN_REVIEW"); } render() { - console.log(); const lifecycle = this.props.lifecycle; if (lifecycle != null) { return (
- +
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifecycleModal.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifecycleModal.js index 2bef078f8f..fa1e719450 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifecycleModal.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/LifecycleModal.js @@ -1,16 +1,23 @@ import React from "react"; -import {Modal, Typography,List, Avatar} from 'antd'; +import {Modal, Typography,Icon,Input} from 'antd'; import {connect} from 'react-redux'; +import {closeLifecycleModal} from "../../../js/actions"; + +const { TextArea } = Input; +const { Title } = Typography; // connecting state.releaseView with the component const mapStateToProps = state => { - console.log(state); return { nextState: state.lifecycleModal.nextState, visible: state.lifecycleModal.visible } }; +const mapDispatchToProps = dispatch => ({ + closeLifecycleModal : () => dispatch(closeLifecycleModal()) +}); + const Text = Typography; class ConnectedLifecycleModal extends React.Component { @@ -23,7 +30,6 @@ class ConnectedLifecycleModal extends React.Component { componentWillReceiveProps(nextProps) { if (nextProps !== this.props) { - console.log(nextProps); this.setState({ visible: nextProps.visible }) @@ -46,6 +52,7 @@ class ConnectedLifecycleModal extends React.Component { this.setState({ visible: false, }); + this.props.closeLifecycleModal(); }; render() { @@ -59,7 +66,9 @@ class ConnectedLifecycleModal extends React.Component { onOk={this.handleOk} onCancel={this.handleCancel} > -

Some contents...

+ {this.props.currentStatus} <Icon type="arrow-right" /> {nextState} +

Reason:

+