diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js new file mode 100644 index 00000000000..8e0953c9c35 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js @@ -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 ( +
+ + + + + + App Name + {release.version}
+ {release.description} + +
+
+ + + + + +
+ ); + } +} + +export default ReleaseView; \ No newline at end of file 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 ba225caf320..de94675a262 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 @@ -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 => { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/constants/ActionTypes.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/constants/ActionTypes.js index 036e0e595f9..211bd739a4f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/constants/ActionTypes.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/constants/ActionTypes.js @@ -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 }); 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 51db6d4e50a..5a9b3796574 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 @@ -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; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/release/Release.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/release/Release.js index d497aed19d3..aad15ec595c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/release/Release.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/release/Release.js @@ -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 ( +
+ No Releases Found +
+ ); + } return (
- - console.log(value)} - style={{width: 200}} - /> - + + + +
@@ -60,4 +75,6 @@ class Release extends React.Component { } } +const Release = connect(mapStateToProps,mapDispatchToProps)(ConnectedRelease); + export default Release;