From 70e56f02c2c0cfc1240d91434c4b7c55d8d54135 Mon Sep 17 00:00:00 2001 From: Jayasanka Weerasinghe Date: Fri, 1 Nov 2019 12:50:42 +0000 Subject: [PATCH] Add minor UI fixes to APPM UI The following changes are with this commit - Display wrong credentials error in Login form - Display tags and categories in APPM store release view --- .../react-app/src/pages/Login.js | 28 +++++++++------- .../react-app/package.json | 2 +- .../components/apps/release/ReleaseView.js | 32 ++++++++++++++++++- .../react-app/src/pages/Login.js | 19 ++++++++--- 4 files changed, 62 insertions(+), 19 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js index 55c8643ffa..1282f0b6ce 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js @@ -107,10 +107,22 @@ class NormalLoginForm extends React.Component { window.location = redirectUrl; } }).catch(function (error) { - handleApiError(error, "Error occurred while trying to login."); - thisForm.setState({ - loading: false - }); + if (error.hasOwnProperty("response") && error.response.status === 401) { + thisForm.setState({ + loading: false, + inValid: true + }); + } else { + notification["error"]({ + message: "There was a problem", + duration: 10, + description: message, + }); + thisForm.setState({ + loading: false, + inValid: false + }); + } }); } @@ -149,14 +161,6 @@ class NormalLoginForm extends React.Component { {loading} {errorMsg} - {getFieldDecorator('remember', { - valuePropName: 'checked', - initialValue: true, - })( - Remember me - )} -
- Forgot password diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/package.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/package.json index 50a86492f4..b140135682 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/package.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/package.json @@ -31,7 +31,7 @@ "react-twemoji": "^0.2.3", "react-virtualized": "^9.21.1", "reqwest": "^2.0.5", - "storm-react-diagrams": "^5.2.1" + "shade-blend-color": "^1.0.0" }, "devDependencies": { "@babel/core": "^7.5.4", diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js index d024f5903c..92b1f1f3c4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js @@ -17,11 +17,12 @@ */ import React from "react"; -import {Divider, Row, Col, Typography, Button, Dropdown, notification, Menu, Icon, Spin, Tabs} from "antd"; +import {Divider, Row, Col, Typography, Button, Dropdown, notification, Menu, Icon, Spin, Tabs, Tag} from "antd"; import "../../../App.css"; import ImgViewer from "../../apps/release/images/ImgViewer"; import StarRatings from "react-star-ratings"; import axios from "axios"; +import pSBC from "shade-blend-color"; import AppInstallModal from "./install/AppInstallModal"; import AppUninstallModal from "./install/AppUninstallModal"; import {withConfigContext} from "../../../context/ConfigContext"; @@ -122,6 +123,7 @@ class ReleaseView extends React.Component { render() { const {app, deviceType} = this.props; + const config = this.props.context; const release = app.applicationReleases[0]; let metaData = []; @@ -199,7 +201,35 @@ class ReleaseView extends React.Component { {release.description} + CATEGORIES +
+ { + app.categories.map(category => { + return ( + + {category} + + ); + }) + } +
+ + TAGS +
+ { + app.tags.map(tag => { + return ( + + {tag} + + ); + }) + } +
+ META DATA + { metaData.map((data, index) => { 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 05b3a7305c..bb5e3ec739 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 @@ -17,7 +17,7 @@ */ import React from "react"; -import {Typography, Row, Col, Form, Icon, Input, Button, Checkbox} from 'antd'; +import {Typography, Row, Col, Form, Icon, Input, Button, Checkbox, notification} from 'antd'; import './Login.css'; import axios from 'axios'; import {withConfigContext} from "../context/ConfigContext"; @@ -109,11 +109,20 @@ class NormalLoginForm extends React.Component { window.location = redirectUrl; } }).catch(function (error) { - handleApiError(error, "Error occurred while trying to load groups."); - if (error.hasOwnProperty("response") && error.response.status === 400) { + if (error.hasOwnProperty("response") && error.response.status === 401) { thisForm.setState({ - inValid: true, - loading: false + loading: false, + inValid: true + }); + } else { + notification["error"]({ + message: "There was a problem", + duration: 10, + description: message, + }); + thisForm.setState({ + loading: false, + inValid: false }); } });