loaded releases in modal (basic view)

feature/appm-store/pbac
Jayasanka 6 years ago
parent 9843e6f0e2
commit 9dc007c1da

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import {Modal, Typography} from 'antd'; import {Modal, Typography,List, Avatar} from 'antd';
import { connect } from 'react-redux'; import {connect} from 'react-redux';
// connecting state.releaseView with the component // connecting state.releaseView with the component
const mapStateToProps = state => { const mapStateToProps = state => {
@ -17,10 +17,11 @@ class ConnectedReleaseModal extends React.Component {
app: null app: null
}; };
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (nextProps !== this.props) { if (nextProps !== this.props) {
this.setState({ this.setState({
visible: nextProps.releaseView.visible, visible: nextProps.releaseView.visible,
app: nextProps.releaseView.app app: nextProps.releaseView.app
}) })
} }
@ -45,29 +46,39 @@ class ConnectedReleaseModal extends React.Component {
}; };
render() { render() {
if(this.props.releaseView.app != null){ if (this.props.releaseView.app != null) {
const app = this.props.app; const app = this.props.releaseView.app;
return ( return (
<div> <div>
<Modal <Modal
title={app.title} title={app.name}
visible={this.state.visible} visible={this.state.visible}
onOk={this.handleOk} onOk={this.handleOk}
onCancel={this.handleCancel} onCancel={this.handleCancel}
> >
<p>Some contents...</p> <p>Some contents...</p>
<p>Some contents...</p> <List
<p>Some contents...</p> itemLayout="horizontal"
dataSource={app.applicationReleases}
renderItem={item => (
<List.Item>
<List.Item.Meta
avatar={<Avatar src={item.iconPath} />}
title={<a href="https://ant.design">Title</a>}
description={item.description}
/>
</List.Item>
)}
/>
</Modal> </Modal>
</div> </div>
); );
}else { } else {
return null; return null;
} }
} }
} }
const ReleaseModal = connect(mapStateToProps,null)(ConnectedReleaseModal); const ReleaseModal = connect(mapStateToProps, null)(ConnectedReleaseModal);
export default ReleaseModal; export default ReleaseModal;
Loading…
Cancel
Save