+ {loading && hasMore && (
+
)}
- {!this.state.loadMore && (this.state.data.length >= limit) && (
+ {!loadMore && (data.length >= limit) && (
)}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/SingleReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/SingleReview.js
deleted file mode 100644
index d76bb00ed26..00000000000
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/SingleReview.js
+++ /dev/null
@@ -1,52 +0,0 @@
-import React from "react";
-import {Avatar} from "antd";
-import {List, Typography} from "antd";
-import StarRatings from "react-star-ratings";
-import Twemoji from "react-twemoji";
-import "./Reviews.css";
-
-const {Text, Paragraph} = Typography;
-const colorList = ['#f0932b', '#badc58', '#6ab04c', '#eb4d4b', '#0abde3', '#9b59b6', '#3498db', '#22a6b3'];
-
-class SingleReview extends React.Component {
-
- render() {
- const review = this.props.review;
- const randomColor = colorList[Math.floor(Math.random() * (colorList.length))];
- const avatarLetter = review.username.charAt(0).toUpperCase();
- const content = (
-
-
-
{review.createdAt}
-
-
- {review.content}
-
-
-
- );
-
- return (
-
-
- {avatarLetter}
-
- }
- title={review.username}
- description={content}
- />
-
- );
- }
-}
-
-export default SingleReview;
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.css
new file mode 100644
index 00000000000..7bdb6e5d2cb
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.css
@@ -0,0 +1,26 @@
+img.twemoji {
+ height: 1em;
+ width: 1em;
+ margin: 0 .05em 0 .1em;
+ vertical-align: -0.1em;
+}
+
+.edit-button {
+ color: #1890ff;
+ text-decoration: none;
+ outline: none;
+ cursor: pointer;
+ font-weight: normal;
+ font-size: 0.8em;
+ padding-left: 5px;
+}
+
+.delete-button {
+ color: #e74c3c;
+ text-decoration: none;
+ outline: none;
+ cursor: pointer;
+ font-weight: normal;
+ font-size: 0.8em;
+ padding-left: 5px;
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js
new file mode 100644
index 00000000000..8ca58208588
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js
@@ -0,0 +1,90 @@
+import React from "react";
+import {Avatar} from "antd";
+import {List, Typography} from "antd";
+import StarRatings from "react-star-ratings";
+import Twemoji from "react-twemoji";
+import "./SingleReview.css";
+import EditReview from "./editReview/EditReview";
+
+const {Text, Paragraph} = Typography;
+const colorList = ['#f0932b', '#badc58', '#6ab04c', '#eb4d4b', '#0abde3', '#9b59b6', '#3498db', '#22a6b3','#e84393','#f9ca24'];
+
+class SingleReview extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ content: '',
+ rating: 0,
+ color: '#f0932b'
+ }
+ }
+
+ componentDidMount() {
+ const {content, rating, username} = this.props.review;
+ const color = colorList[username.length%10];
+ this.setState({
+ content,
+ rating,
+ color
+ });
+ }
+
+
+ updateCallback = (response) =>{
+ console.log(response);
+ const {rating, content} = response;
+ this.setState({
+ rating,
+ content
+ });
+ };
+
+ render() {
+ const {review, isEditable, isDeletable, uuid} = this.props;
+ const {content, rating, color} = this.state;
+ const {username} = review;
+ const avatarLetter = username.charAt(0).toUpperCase();
+ const body = (
+
+
+
{review.createdAt}
+
+
+ {content}
+
+
+
+ );
+
+ const title = (
+
+ {review.username}
+ {isEditable && ()}
+ {isDeletable && (delete)}
+
+ );
+
+ return (
+
+
+ {avatarLetter}
+
+ }
+ title={title}
+ description={body}
+ />
+
+ );
+ }
+}
+
+export default SingleReview;
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.css
new file mode 100644
index 00000000000..d4d0955a757
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.css
@@ -0,0 +1,9 @@
+.edit-button {
+ color: #1890ff;
+ text-decoration: none;
+ outline: none;
+ cursor: pointer;
+ font-weight: normal;
+ font-size: 0.8em;
+ padding-left: 5px;
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js
new file mode 100644
index 00000000000..3a2af32e915
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js
@@ -0,0 +1,170 @@
+import React from "react";
+import {Drawer, Button, Icon, Row, Col, Typography, Divider, Input, Spin, notification} from 'antd';
+import StarRatings from "react-star-ratings";
+import axios from "axios";
+import config from "../../../../../../../public/conf/config.json";
+import "./EditReview.css";
+
+const {Title} = Typography;
+const {TextArea} = Input;
+
+class EditReview extends React.Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ visible: false,
+ content: '',
+ rating: 0,
+ loading: false
+ };
+ }
+
+ componentDidMount() {
+ const {content,rating,id} = this.props.review;
+ console.log(this.props.review);
+ this.setState({
+ content,
+ rating
+ });
+ }
+
+ showDrawer = () => {
+ this.setState({
+ visible: true,
+ loading: false
+ });
+ };
+
+ onClose = () => {
+ this.setState({
+ visible: false,
+
+ });
+ };
+
+ changeRating = (newRating, name) => {
+ this.setState({
+ rating: newRating
+ });
+ };
+
+ onChange = (e) => {
+ this.setState({content: e.target.value})
+ };
+
+ onSubmit = () => {
+ const {content, rating} = this.state;
+ const {id} = this.props.review;
+ const {uuid} = this.props;
+ this.setState({
+ loading: true
+ });
+
+ const payload = {
+ content: content,
+ rating: rating
+ };
+
+ axios.put(
+ config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/reviews/" + uuid+"/"+id,
+ payload,
+ ).then(res => {
+ if (res.status === 200) {
+ this.setState({
+ loading: false,
+ visible: false
+ });
+ notification["success"]({
+ message: 'Done!',
+ description:
+ 'Your review has been update successfully.',
+ });
+
+ this.props.updateCallback(res.data.data);
+ } else {
+ this.setState({
+ loading: false,
+ visible: false
+ });
+ notification["error"]({
+ message: 'Something went wrong',
+ description:
+ "We are unable to update your review right now.",
+ });
+ }
+
+ }).catch((error) => {
+ console.log(error);
+ if (error.hasOwnProperty("response") && error.response.status === 401) {
+ window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login';
+ } else {
+ this.setState({
+ loading: false,
+ visible: false
+ });
+ notification["error"]({
+ message: 'Something went wrong',
+ description:
+ "We are unable to add your review right now.",
+ });
+ }
+ });
+
+
+ };
+
+ render() {
+ return (
+
+ edit
+
+
+
+
+
+ Edit review
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default EditReview;
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js
index 71bae0e7927..fbdb202364d 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js
@@ -68,7 +68,7 @@ class NormalLoginForm extends React.Component {
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname+':'+config.serverConfig.httpsPort+config.serverConfig.loginUri, request
).then(res => {
if (res.status === 200) {
- window.location = res.data.url;
+ window.location = config.serverConfig.protocol + "://"+config.serverConfig.hostname+':'+config.serverConfig.httpsPort+"/store";
}
}).catch(function (error) {
if (error.response.status === 400) {
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js
index 2a2a1dd0ff4..55c99248581 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js
@@ -48,7 +48,6 @@ class Dashboard extends React.Component {
-
{this.state.routes.map((route) => (
))}