diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppCard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppCard.js index ac1f66f2da..8fa60bffcc 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppCard.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppCard.js @@ -3,14 +3,25 @@ import { } from 'antd'; import React from "react"; import config from "../../../public/conf/config.json"; +import {openReleasesModal} from "../../js/actions"; +import {connect} from "react-redux"; const { Meta } = Card; const { Text } = Typography; -class AppCard extends React.Component { +const mapDispatchToProps = dispatch => ({ + openReleasesModal: (app) => dispatch(openReleasesModal(app)) +}); + +class ConnectedAppCard extends React.Component { constructor(props){ super(props); + this.handleReleasesClick = this.handleReleasesClick.bind(this); + } + + handleReleasesClick(){ + this.props.openReleasesModal(this.props.app); } @@ -33,7 +44,7 @@ class AppCard extends React.Component { ); return ( - , , ]}> + , , ]}> } title={this.props.name} @@ -44,4 +55,6 @@ class AppCard extends React.Component { } } +const AppCard = connect(null,mapDispatchToProps)(ConnectedAppCard); + export default AppCard; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppList.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppList.js index 599e6be2d0..00f715825f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppList.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppList.js @@ -24,6 +24,7 @@ class ConnectedAppList extends React.Component { {this.props.apps.map(app => ( { return {releaseView: state.releaseView} }; +const Text = Typography; + class ConnectedReleaseModal extends React.Component { constructor(props) { super(props); this.state = { - visible: false + visible: false, + app: null }; } componentWillReceiveProps(nextProps) { if (nextProps !== this.props) { this.setState({ - visible: nextProps.releaseView.visible + visible: nextProps.releaseView.visible, + app: nextProps.releaseView.app }) } } @@ -29,37 +33,38 @@ class ConnectedReleaseModal extends React.Component { }; handleOk = (e) => { - console.log(e); this.setState({ visible: false, }); }; handleCancel = (e) => { - console.log(e); this.setState({ visible: false, }); }; render() { - return ( -
- - -

Some contents...

-

Some contents...

-

Some contents...

-
-
- ); + if(this.props.releaseView.app != null){ + const app = this.props.app; + + return ( +
+ +

Some contents...

+

Some contents...

+

Some contents...

+
+
+ ); + }else { + return null; + } } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/actions/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/actions/index.js index cd9fc1adc6..ba225caf32 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/actions/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/actions/index.js @@ -28,11 +28,12 @@ export const getApps = () => dispatch => { }; -export const openReleasesModal = () => dispatch => { +export const openReleasesModal = (app) => dispatch => { + console.log(app); dispatch({ type: ActionTypes.OPEN_RELEASES_MODAL, payload: { - title :"hi" + app:app } }); }; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js index c2e5074064..51db6d4e50 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js @@ -4,7 +4,7 @@ const initialState = { apps: [], releaseView: { visible: false, - title: "hi" + app: null } }; @@ -17,7 +17,7 @@ function rootReducer(state = initialState, action) { return Object.assign({}, state, { releaseView: { visible: true, - title: action.title + app: action.payload.app } }); }