display release

merge-requests/84/head
Jayasanka 6 years ago
parent 795acbe219
commit 1712792d87

@ -0,0 +1,33 @@
import React from "react";
import {Avatar, Row, Col, Typography} from "antd";
const {Title, Text} = Typography;
class ReleaseView extends React.Component {
render() {
const release = this.props.release;
return (
<div>
<Row>
<Col span={4}>
<Avatar size={128} shape="square"
src={release.iconPath}/>
</Col>
<Col span={18}>
<Title level={2}>App Name</Title>
<Text>{release.version}</Text><br/>
<Text type="secondary">{release.description}</Text>
</Col>
</Row>
<br/>
<Row>
<Col span={6}>
<img style={{width:"100%"}} src={release.screenshotPath1}/>
</Col>
</Row>
</div>
);
}
}
export default ReleaseView;

@ -4,7 +4,6 @@ import config from "../../../public/conf/config.json";
export const getApps = () => dispatch => {
const request = "method=post&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications";
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
@ -26,6 +25,28 @@ export const getApps = () => dispatch => {
});
};
export const getRelease = (uuid) => dispatch => {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/release/"+uuid;
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
let release = res.data.data;
console.log(res.data);
dispatch({type: ActionTypes.GET_RELEASE, payload: release});
}
}).catch(function (error) {
if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login';
}
});
};
export const openReleasesModal = (app) => dispatch => {

@ -9,7 +9,8 @@ const ActionTypes = keyMirror({
LOGIN: null,
GET_APPS: null,
OPEN_RELEASES_MODAL: null,
CLOSE_RELEASES_MODAL: null
CLOSE_RELEASES_MODAL: null,
GET_RELEASE: null
});

@ -5,7 +5,8 @@ const initialState = {
releaseView: {
visible: false,
app: null
}
},
release: null
};
function rootReducer(state = initialState, action) {
@ -20,6 +21,11 @@ function rootReducer(state = initialState, action) {
app: action.payload.app
}
});
}else if(action.type === ActionTypes.GET_RELEASE){
return Object.assign({}, state, {
release: action.payload
});
}
return state;
}

@ -1,9 +1,11 @@
import React from "react";
import "antd/dist/antd.css";
import {PageHeader, Typography, Input, Button, Row, Col} from "antd";
import {PageHeader, Typography, Input, Button, Row, Col, Avatar, Card} from "antd";
import {connect} from "react-redux";
import ReleaseView from "../../../../components/apps/release/ReleaseView";
import {getRelease} from "../../../../js/actions";
const Search = Input.Search;
const {Title} = Typography;
const routes = [
{
@ -20,8 +22,15 @@ const routes = [
},
];
const mapStateToProps = state => {
return {release: state.release}
};
const mapDispatchToProps = dispatch => ({
getRelease: (uuid) => dispatch(getRelease(uuid))
});
class Release extends React.Component {
class ConnectedRelease extends React.Component {
routes;
constructor(props) {
@ -31,11 +40,20 @@ class Release extends React.Component {
}
componentDidMount() {
const {uuid} = this.props.match.params;
this.props.getRelease(uuid);
}
render() {
const {uuid} = this.props.match.params;
const release = this.props.release;
if (release == null) {
return (
<div style={{background: '#f0f2f5', padding: 24, minHeight: 780}}>
<Title level={3}>No Releases Found</Title>
</div>
);
}
return (
<div>
<PageHeader
@ -43,13 +61,10 @@ class Release extends React.Component {
/>
<div style={{background: '#f0f2f5', padding: 24, minHeight: 780}}>
<Row style={{padding: 10}}>
<Col span={6} offset={18}>
<Search
placeholder="search"
onSearch={value => console.log(value)}
style={{width: 200}}
/>
<Button style={{margin: 5}}>Advanced Search</Button>
<Col span={18}>
<Card>
<ReleaseView release={release}/>
</Card>
</Col>
</Row>
</div>
@ -60,4 +75,6 @@ class Release extends React.Component {
}
}
const Release = connect(mapStateToProps,mapDispatchToProps)(ConnectedRelease);
export default Release;

Loading…
Cancel
Save