|
|
@ -1,12 +1,13 @@
|
|
|
|
import React from "react";
|
|
|
|
import React from "react";
|
|
|
|
import {Row, Typography, Icon} from "antd";
|
|
|
|
import {Row, Typography, Icon} from "antd";
|
|
|
|
import StarRatings from "react-star-ratings";
|
|
|
|
import StarRatings from "react-star-ratings";
|
|
|
|
import axios from "axios";
|
|
|
|
|
|
|
|
import "./DetailedRating.css";
|
|
|
|
import "./DetailedRating.css";
|
|
|
|
import config from "../../../../public/conf/config.json";
|
|
|
|
import config from "../../../../public/conf/config.json";
|
|
|
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
|
|
|
|
|
|
|
const { Text } = Typography;
|
|
|
|
const { Text } = Typography;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DetailedRating extends React.Component{
|
|
|
|
class DetailedRating extends React.Component{
|
|
|
|
|
|
|
|
|
|
|
|
constructor(props){
|
|
|
|
constructor(props){
|
|
|
@ -17,20 +18,24 @@ class DetailedRating extends React.Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
componentDidMount() {
|
|
|
|
this.getData(this.props.uuid);
|
|
|
|
const {type,uuid} = this.props;
|
|
|
|
|
|
|
|
this.getData(type,uuid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps, prevState) {
|
|
|
|
componentDidUpdate(prevProps, prevState) {
|
|
|
|
if (prevProps.uuid !== this.props.uuid) {
|
|
|
|
if (prevProps.uuid !== this.props.uuid) {
|
|
|
|
this.getData(this.props.uuid);
|
|
|
|
const {type,uuid} = this.props;
|
|
|
|
|
|
|
|
this.getData(type,uuid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getData = (uuid)=>{
|
|
|
|
getData = (type, uuid)=>{
|
|
|
|
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/reviews/"+uuid+"/rating";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
|
|
|
|
return axios.get(
|
|
|
|
).then(res => {
|
|
|
|
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+uuid+"/"+type+"-rating",
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
headers: { 'X-Platform': config.serverConfig.platform }
|
|
|
|
|
|
|
|
}).then(res => {
|
|
|
|
if (res.status === 200) {
|
|
|
|
if (res.status === 200) {
|
|
|
|
let detailedRating = res.data.data;
|
|
|
|
let detailedRating = res.data.data;
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
@ -48,8 +53,6 @@ class DetailedRating extends React.Component{
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const detailedRating = this.state.detailedRating;
|
|
|
|
const detailedRating = this.state.detailedRating;
|
|
|
|
|
|
|
|
|
|
|
|
console.log(detailedRating);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(detailedRating ==null){
|
|
|
|
if(detailedRating ==null){
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -73,8 +76,6 @@ class DetailedRating extends React.Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log(ratingBarPercentages);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Row className="d-rating">
|
|
|
|
<Row className="d-rating">
|
|
|
|
<div className="numeric-data">
|
|
|
|
<div className="numeric-data">
|
|
|
|