|
|
@ -1,61 +1,80 @@
|
|
|
|
import React from "react";
|
|
|
|
import React from "react";
|
|
|
|
import '../../../../App.css';
|
|
|
|
import '../../../../App.css';
|
|
|
|
import {Skeleton, Typography, Row, Col, Card} from "antd";
|
|
|
|
import {Skeleton, Typography, Row, Col, Card, message} from "antd";
|
|
|
|
import {connect} from "react-redux";
|
|
|
|
|
|
|
|
import ReleaseView from "../../../../components/apps/release/ReleaseView";
|
|
|
|
import ReleaseView from "../../../../components/apps/release/ReleaseView";
|
|
|
|
import {getRelease, setLoading} from "../../../../js/actions";
|
|
|
|
import axios from "axios";
|
|
|
|
|
|
|
|
import config from "../../../../../public/conf/config.json";
|
|
|
|
|
|
|
|
|
|
|
|
const {Title} = Typography;
|
|
|
|
const {Title} = Typography;
|
|
|
|
|
|
|
|
|
|
|
|
const routes = [
|
|
|
|
class Release extends React.Component {
|
|
|
|
{
|
|
|
|
|
|
|
|
path: 'index',
|
|
|
|
|
|
|
|
breadcrumbName: 'store',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
path: 'first',
|
|
|
|
|
|
|
|
breadcrumbName: 'Dashboard',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
path: 'second',
|
|
|
|
|
|
|
|
breadcrumbName: 'Apps',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = state => {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
release: state.release,
|
|
|
|
|
|
|
|
releaseLoading: state.loadingState.release
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => ({
|
|
|
|
|
|
|
|
getRelease: (uuid) => dispatch(getRelease(uuid)),
|
|
|
|
|
|
|
|
setLoading: (stateToLoad) => dispatch(setLoading(stateToLoad))
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConnectedRelease extends React.Component {
|
|
|
|
|
|
|
|
routes;
|
|
|
|
routes;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
super(props);
|
|
|
|
this.routes = props.routes;
|
|
|
|
this.routes = props.routes;
|
|
|
|
|
|
|
|
this.state={
|
|
|
|
|
|
|
|
loading: true,
|
|
|
|
|
|
|
|
app: null
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
componentDidMount() {
|
|
|
|
const {uuid} = this.props.match.params;
|
|
|
|
const {uuid} = this.props.match.params;
|
|
|
|
this.props.setLoading("release");
|
|
|
|
this.fetchData(uuid);
|
|
|
|
this.props.getRelease(uuid);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
|
|
|
|
|
|
if (prevProps !== this.props) {
|
|
|
|
|
|
|
|
this.fetchData(uuid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fetchData = (uuid)=>{
|
|
|
|
|
|
|
|
const parameters = {
|
|
|
|
|
|
|
|
method: "get",
|
|
|
|
|
|
|
|
'content-type': "application/json",
|
|
|
|
|
|
|
|
payload: "{}",
|
|
|
|
|
|
|
|
'api-endpoint': "/application-mgt-store/v1.0/applications/" + uuid
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//url-encode parameters
|
|
|
|
|
|
|
|
const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//send request to the invoker
|
|
|
|
|
|
|
|
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
|
|
|
|
|
|
|
|
).then(res => {
|
|
|
|
|
|
|
|
if (res.status === 200) {
|
|
|
|
|
|
|
|
let app = res.data.data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
app: app,
|
|
|
|
|
|
|
|
loading: false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
if (error.hasOwnProperty("response") && error.response.status === 401) {
|
|
|
|
|
|
|
|
//todo display a popop with error
|
|
|
|
|
|
|
|
message.error('You are not logged in');
|
|
|
|
|
|
|
|
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
message.error('Something went wrong... :(');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({loading: false});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const release = this.props.release;
|
|
|
|
render() {
|
|
|
|
|
|
|
|
const {app, loading} = this.state;
|
|
|
|
let content = <Title level={3}>No Releases Found</Title>;
|
|
|
|
let content = <Title level={3}>No Releases Found</Title>;
|
|
|
|
|
|
|
|
|
|
|
|
if (release != null) {
|
|
|
|
if (app != null && app.applicationReleases.length!==0) {
|
|
|
|
content = <ReleaseView release={release}/>;
|
|
|
|
content = <ReleaseView app={app}/>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -67,7 +86,7 @@ class ConnectedRelease extends React.Component {
|
|
|
|
</Col>
|
|
|
|
</Col>
|
|
|
|
<Col lg={16} md={24} style={{padding: 3}}>
|
|
|
|
<Col lg={16} md={24} style={{padding: 3}}>
|
|
|
|
<Card>
|
|
|
|
<Card>
|
|
|
|
<Skeleton loading={this.props.releaseLoading} avatar={{size: 'large'}} active paragraph={{rows: 8}}>
|
|
|
|
<Skeleton loading={loading} avatar={{size: 'large'}} active paragraph={{rows: 8}}>
|
|
|
|
{content}
|
|
|
|
{content}
|
|
|
|
</Skeleton>
|
|
|
|
</Skeleton>
|
|
|
|
</Card>
|
|
|
|
</Card>
|
|
|
@ -76,29 +95,8 @@ class ConnectedRelease extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //todo remove uppercase
|
|
|
|
|
|
|
|
// return (
|
|
|
|
|
|
|
|
// <div>
|
|
|
|
|
|
|
|
// <div className="main-container">
|
|
|
|
|
|
|
|
// <Row style={{padding: 10}}>
|
|
|
|
|
|
|
|
// <Col lg={4}>
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// </Col>
|
|
|
|
|
|
|
|
// <Col lg={16} md={24} style={{padding: 3}}>
|
|
|
|
|
|
|
|
// <Card>
|
|
|
|
|
|
|
|
// <ReleaseView release={release}/>
|
|
|
|
|
|
|
|
// </Card>
|
|
|
|
|
|
|
|
// </Col>
|
|
|
|
|
|
|
|
// </Row>
|
|
|
|
|
|
|
|
// </div>
|
|
|
|
|
|
|
|
// </div>
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const Release = connect(mapStateToProps, mapDispatchToProps)(ConnectedRelease);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default Release;
|
|
|
|
export default Release;
|
|
|
|