From 9807a360989102f43d3480bb10128f5bc93f7216 Mon Sep 17 00:00:00 2001 From: Jayasanka Weerasinghe Date: Thu, 24 Oct 2019 15:37:29 +0000 Subject: [PATCH] Add ui improvements to APPM Publisher UI The following changes are with this commit - View subscription status of devices in release view - Display server error response in add new app form --- .../AppDetailsDrawer/AppDetailsDrawer.js | 55 +++++++++++++++---- .../apps/list-apps/appsTable/AppsTable.js | 32 +++++++++-- .../apps/release/InstalledDevicesTable.js | 20 +------ .../components/apps/release/ReleaseView.js | 5 +- 4 files changed, 76 insertions(+), 36 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js index 335e1c46dd..fc54ab399b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js @@ -30,7 +30,7 @@ import { Spin, message, Icon, - Card + Card, Badge } from 'antd'; import DetailedRating from "../../detailed-rating/DetailedRating"; import {Link} from "react-router-dom"; @@ -487,18 +487,14 @@ class AppDetailsDrawer extends React.Component { )} Releases - {/*display add new release only if app type is enterprise*/} -
- - {(app.type === "ENTERPRISE") && ( - )} (
@@ -507,7 +503,27 @@ class AppDetailsDrawer extends React.Component { +
+ {(release.currentStatus === "PUBLISHED") ? ( + + }> + + + ) : ( + + )} +
} title={release.version} description={ @@ -529,10 +545,27 @@ class AppDetailsDrawer extends React.Component {
)} /> -
+ {/*display add new release only if app type is enterprise*/} + {(app.type === "ENTERPRISE") && ( +
+
+ + Add new release for the application + +
+ + + +
)} + Description {!isDescriptionEditEnabled && ( diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.js index 24e43a89c6..d008cf5609 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/appsTable/AppsTable.js @@ -17,7 +17,7 @@ */ import React from "react"; -import {Avatar, Table, Tag, Icon, message, notification, Col} from "antd"; +import {Avatar, Table, Tag, Icon, message, notification, Col, Badge} from "antd"; import axios from "axios"; import pSBC from 'shade-blend-color'; import "./AppsTable.css"; @@ -47,7 +47,31 @@ const columns = [ ); } else { - avatar = ( + const {applicationReleases} = row; + let hasPublishedRelease = false; + for (let i = 0; i < applicationReleases.length; i++) { + if (applicationReleases[i].currentStatus === "PUBLISHED") { + hasPublishedRelease = true; + break; + } + } + avatar = (hasPublishedRelease) ? ( + + }> + + + ) : ( - ) + ); } return (
{avatar} - {name} + {name}
); } }, diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/InstalledDevicesTable.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/InstalledDevicesTable.js index 1b6642f3d4..39fd3ef27c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/InstalledDevicesTable.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/InstalledDevicesTable.js @@ -24,6 +24,7 @@ import TimeAgo from 'javascript-time-ago' // Load locale-specific relative date/time formatting rules. import en from 'javascript-time-ago/locale/en' import {withConfigContext} from "../../../context/ConfigContext"; +import {handleApiError} from "../../../js/Utils"; const {Text} = Typography; @@ -180,19 +181,7 @@ class InstalledDevicesTable extends React.Component { } }).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 = window.location.origin + '/entgra/login'; - } else { - notification["error"]({ - message: "There was a problem", - duration: 0, - description: - "Error occurred while trying to load devices.", - }); - } - + handleApiError(error, "Something went wrong when trying to load subscription data."); this.setState({loading: false}); }); }; @@ -203,10 +192,7 @@ class InstalledDevicesTable extends React.Component {
- Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque - laudantium, - totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae - dicta sunt explicabo. + The following are the subscription details of the application in each respective device.
- +