From 76b34b3229d24ae9f8af9396d78f938b1fa46360 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 6 Jun 2019 22:11:34 +0530 Subject: [PATCH 1/4] Add gson dependency to commons --- .../device-mgt/org.wso2.carbon.device.mgt.common/pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index eb7b99a2a4..0782c24070 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -51,7 +51,8 @@ javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", com.fasterxml.jackson.annotation;version="${jackson-annotations.version}", org.wso2.carbon.analytics.datasource.commons;version="${carbon.analytics.version.range}", - io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional + io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional, + com.google.gson @@ -103,6 +104,10 @@ org.wso2.carbon.analytics org.wso2.carbon.analytics.datasource.commons + + com.google.code.gson + gson + From c9c4d7a64b0df4ea1ecd52a75a66f8b414cf2da8 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 6 Jun 2019 22:12:06 +0530 Subject: [PATCH 2/4] Android enterpise app install payload creation --- .../src/main/webapp/WEB-INF/web.xml | 19 ++++++++++--------- .../core/impl/SubscriptionManagerImpl.java | 3 +++ .../core/util/MDMAndroidOperationUtil.java | 4 +++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml index 63d4e111fc..15677f5277 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -47,15 +47,16 @@ - - - ApplicationMgt-Admin - /* - - - CONFIDENTIAL - - + + + + + + + + + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index 13a7b2336c..8d0b07e007 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -50,6 +50,7 @@ import org.wso2.carbon.device.application.mgt.core.util.HelperUtil; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.app.mgt.MobileApp; +import org.wso2.carbon.device.mgt.common.app.mgt.MobileAppTypes; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.exceptions.UnknownApplicationTypeException; @@ -460,6 +461,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { MobileApp mobileApp = new MobileApp(); if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { + mobileApp.setType(MobileAppTypes.ENTERPRISE); + mobileApp.setLocation(application.getApplicationReleases().get(0).getInstallerPath()); return MDMAndroidOperationUtil.createInstallAppOperation(mobileApp); } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { return MDMAndroidOperationUtil.createAppUninstallOperation(mobileApp); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java index 85d3cb573d..2f73db6357 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java @@ -51,7 +51,9 @@ public class MDMAndroidOperationUtil { EnterpriseApplication enterpriseApplication = new EnterpriseApplication(); enterpriseApplication.setType(application.getType().toString()); - enterpriseApplication.setUrl(application.getLocation()); + //TODO: replace needs to be removed after doing the proper config update in application-mgt.xml + enterpriseApplication.setUrl(application.getLocation().replace("https://localhost:9443", + "http://192.168.8.6:9763")); operation.setPayLoad(enterpriseApplication.toJSON()); break; case PUBLIC: From 857f9057d328be60a2ed13e5c0ef669205486d90 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Fri, 7 Jun 2019 11:18:07 +0530 Subject: [PATCH 3/4] Modify setting app type --- .../application/mgt/core/impl/SubscriptionManagerImpl.java | 3 ++- .../device/mgt/core/util/MDMAndroidOperationUtil.java | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index 8d0b07e007..479d809d36 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -459,9 +459,10 @@ public class SubscriptionManagerImpl implements SubscriptionManager { //todo rethink and modify the {@link MobileApp} usage MobileApp mobileApp = new MobileApp(); + MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType()); if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { - mobileApp.setType(MobileAppTypes.ENTERPRISE); + mobileApp.setType(mobileAppType); mobileApp.setLocation(application.getApplicationReleases().get(0).getInstallerPath()); return MDMAndroidOperationUtil.createInstallAppOperation(mobileApp); } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java index 2f73db6357..cce871d009 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java @@ -48,12 +48,9 @@ public class MDMAndroidOperationUtil { switch (application.getType()) { case ENTERPRISE: - EnterpriseApplication enterpriseApplication = - new EnterpriseApplication(); + EnterpriseApplication enterpriseApplication = new EnterpriseApplication(); enterpriseApplication.setType(application.getType().toString()); - //TODO: replace needs to be removed after doing the proper config update in application-mgt.xml - enterpriseApplication.setUrl(application.getLocation().replace("https://localhost:9443", - "http://192.168.8.6:9763")); + enterpriseApplication.setUrl(application.getLocation()); operation.setPayLoad(enterpriseApplication.toJSON()); break; case PUBLIC: From a5694371ea5882126ebf7a7a9397ef7bab390bf6 Mon Sep 17 00:00:00 2001 From: Jayasanka Weerasinghe Date: Fri, 7 Jun 2019 06:45:01 +0000 Subject: [PATCH 4/4] Improve app subscription functionality Further integrate app management component with device mgt --- .../react-app/package.json | 3 +- .../react-app/public/conf/config.json | 17 +- .../apps/detailed-rating/DetailedRating.css | 72 +++++++ .../apps/detailed-rating/DetailedRating.js | 122 ++++++++++++ .../apps/list-apps/AppDetailsDrawer.js | 95 +++++++++ .../components/apps/list-apps/AppsTable.js | 180 ++++++++++++++++++ .../src/components/apps/list-apps/Filters.js | 74 +++++++ .../src/components/apps/list-apps/ListApps.js | 76 ++++++++ .../src/pages/dashboard/Dashboard.js | 2 +- .../src/pages/dashboard/apps/Apps-old.js | 60 ++++++ .../src/pages/dashboard/apps/Apps.js | 14 +- .../apps/release/review/AddReview.js | 2 +- 12 files changed, 698 insertions(+), 19 deletions(-) create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.css create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.js create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer.js create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppsTable.js create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/Filters.js create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json index 89be809f26..92328d98bb 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json @@ -26,7 +26,8 @@ "react-router-dom": "latest", "react-scripts": "2.1.8", "redux-thunk": "^2.3.0", - "storm-react-diagrams": "^5.2.1" + "storm-react-diagrams": "^5.2.1", + "react-star-ratings": "^2.3.0" }, "devDependencies": { "@babel/core": "^7.0.0", diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/public/conf/config.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/public/conf/config.json index c2e66dda14..47b11b05c1 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/public/conf/config.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/public/conf/config.json @@ -9,10 +9,19 @@ "invokerUri": "/api/application-mgt-handler/v1.0/invoke", "loginUri": "/api/application-mgt-handler/v1.0/login" }, - "serverUrl" : "https://localhost:9443", + "serverUrl": "https://localhost:9443", "defaultPlatformIcons": { - "default": "http://www.newdesignfile.com/postpic/2015/08/square-app-icon-blue_77131.png", - "android": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAZlBMVEX///+m2GSt23Gk11+i1lug1le+4pLb7sTu9+Tl89X5/PSk12Ge1VOo2Wef1Vb2+/Dr9t6334TM6Kr8/vrR6rO234Oy3Xq84Y7Y7b+r2m3g8czK56bs9uC94pCx3Xnz+uzU7LjF5Z+YGtzqAAAHSUlEQVR4nO2da5uiIBSAM8BK1Cy7WbMz0///k1s5FeJBcUQOz+55v3aW5R0QuQmzmQPO+2i+K12k9KLczaPN2WmSI7jmMop4lThMMsl4FMn86jDJEZzT6A7L1s6SXEfykWYaRil+1rm5ZcqV4lMwkgdHKY4jeuJK8SV4w0mCY6mkW0VFUFYO0hvPhSulOL65UUuQXxzkbzxlxRxWVFWQVW5fQb8myZh9KfbkOVEFM5cvoFE0FCVQiuvVaRvvK5HWiGofb08rKFCqJRiMoF6KzZwXu00mBOdMybyUjHMhquN30Yhdh1mCd5JMQorJ4niTe9vrsJvm8fwyCViw+fw8FVdH3mH3tuTH1SNeFZShCbZLsdxJ0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jZrUdwAvYQiXzk3lz75ZG7VTx62tVn1ArlvwzG7nh4IQLoxVuvbtqbzp68yjyv8y58fbdH220y54Xu38UyDCVVl9nVb13bhjUi1KsuWoTNOuruKddKv+ANf/kjfiNBjwAAAAAElFTkSuQmCC" + "default": { + "icon": "mobile", + "color": "#535c68" + }, + "android": { + "icon": "android", + "color": "#7db343" + }, + "ios": { + "icon": "apple", + "color": "#535c68" + } } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.css new file mode 100644 index 0000000000..9e7f3bc579 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.css @@ -0,0 +1,72 @@ +.d-rating .numeric-data{ + box-sizing: border-box; + display: inline-block; + padding: 20px 0 20px 0; + vertical-align: top; + text-align: center; + width: 30%; +} + +.d-rating .bar-containers{ + box-sizing: border-box; + display: inline-block; + padding: 20px 20px 20px 30px; + vertical-align: top; + width: 70%; +} + +.d-rating .bar-containers .bar-container{ + color: #737373; + font-weight: 400; + height: 20px; + margin-bottom: 4px; + position: relative; + width: 100%; +} + +.d-rating .bar-containers .bar-container .number{ + font-size: 11px; + left: -16px; + letter-spacing: 1px; + position: absolute; +} + +.d-rating .bar-containers .bar-container .bar{ + transition: width .25s ease; + display: inline-block; + height: 100%; + opacity: .8; + border-radius: 5px; +} + +.bar-container .rate-5{ + background: #57bb8a; +} + +.bar-container .rate-4{ + background: #9ace6a; +} + +.bar-container .rate-3{ + background: #ffcf02; +} + +.bar-container .rate-2{ + background: #ff9f02; +} + +.bar-container .rate-1{ + background: #ff6f31; +} + +.d-rating .numeric-data .rate{ + color: #333; + font-size: 64px; + font-weight: 100; + line-height: 64px; + padding-bottom: 6px; +} + +.d-rating .numeric-data .people-count{ + padding-top: 6px; +} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.js new file mode 100644 index 0000000000..5d764c99ea --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/detailed-rating/DetailedRating.js @@ -0,0 +1,122 @@ +import React from "react"; +import {Row, Typography, Icon} from "antd"; +import StarRatings from "react-star-ratings"; +import "./DetailedRating.css"; +import config from "../../../../public/conf/config.json"; +import axios from "axios"; + +const { Text } = Typography; + + +class DetailedRating extends React.Component{ + + constructor(props){ + super(props); + this.state={ + detailedRating: null + } + } + + componentDidMount() { + this.getData(this.props.uuid); + } + + componentDidUpdate(nextProps) { + if (nextProps !== this.props) { + this.getData(this.props.uuid); + } + } + + getData = (uuid)=>{ + const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/reviews/"+uuid+"/rating"; + + return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request + ).then(res => { + if (res.status === 200) { + let detailedRating = res.data.data; + this.setState({ + detailedRating + }) + } + + }).catch(function (error) { + if (error.response.status === 401) { + window.location.href = 'https://localhost:9443/store/login'; + } + }); + }; + + render() { + const detailedRating = this.state.detailedRating; + + console.log(detailedRating); + + if(detailedRating ==null){ + return null; + } + + const totalCount = detailedRating.noOfUsers; + const ratingVariety = detailedRating.ratingVariety; + + const ratingArray = []; + + for (let [key, value] of Object.entries(ratingVariety)) { + ratingArray.push(value); + } + + const maximumRating = Math.max(...ratingArray); + + const ratingBarPercentages = [0,0,0,0,0]; + + if(maximumRating>0){ + for(let i = 0; i<5; i++){ + ratingBarPercentages[i] = (ratingVariety[(i+1).toString()])/maximumRating*100; + } + } + + console.log(ratingBarPercentages); + + return ( + +
+
{detailedRating.ratingValue.toFixed(1)}
+ +
+ {totalCount} total +
+
+
+ 5 + +
+
+ 4 + +
+
+ 3 + +
+
+ 2 + +
+
+ 1 + +
+
+
+ ); + } +} + + +export default DetailedRating; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer.js new file mode 100644 index 0000000000..c25164f7a0 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer.js @@ -0,0 +1,95 @@ +import React from 'react'; +import {Drawer, Row, Col, Typography, Divider, Tag, Avatar, List} from 'antd'; +import "../../../App.css"; +import DetailedRating from "../detailed-rating/DetailedRating"; + +const {Text, Title, Paragraph} = Typography; + +class AppDetailsDrawer extends React.Component { + + render() { + const {app, visible, onClose} = this.props; + if (app == null) { + return null; + } + console.log(app); + return ( +
+ + +
+ + {app.name} +
+ + {app.description} + + Categories +
+
+ + {app.appCategories.map(category => { + return ( + + {category} + + ); + })} + + + + Tags +
+
+ + {app.tags.map(category => { + return ( + + {category} + + ); + })} + + + Releases +
+ ( + + {release.version}} + description={ +
+ Status : {release.currentStatus} Release Type {release.releaseType} +
+ } + /> +
+ )} + /> + + + +
+
+ ); + } +} + +export default AppDetailsDrawer; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppsTable.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppsTable.js new file mode 100644 index 0000000000..9095b68b15 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppsTable.js @@ -0,0 +1,180 @@ +import React from "react"; +import {Avatar, Card, Col, Row, Table, Typography, Tag, Icon, message} from "antd"; +import {connect} from "react-redux"; +import {getApps} from "../../../js/actions"; +import axios from "axios"; +import config from "../../../../public/conf/config.json"; + +const {Title} = Typography; + +// connecting state.apps with the component +const mapStateToProps = state => { + return {apps: state.apps} +}; + +const columns = [ + { + title: '', + dataIndex: 'name', + render: (name, row) => { + return ( +
+ + {name} +
); + } + }, + { + title: 'Categories', + dataIndex: 'appCategories', + render: appCategories => ( + + {appCategories.map(category => { + return ( + + {category} + + ); + })} + + ) + }, + { + title: 'Platform', + dataIndex: 'deviceType', + render: platform => { + const defaultPlatformIcons = config.defaultPlatformIcons; + let icon = defaultPlatformIcons.default.icon; + let color = defaultPlatformIcons.default.color; + if (defaultPlatformIcons.hasOwnProperty(platform)) { + icon = defaultPlatformIcons[platform].icon; + color = defaultPlatformIcons[platform].color; + } + return () + } + }, + { + title: 'Type', + dataIndex: 'type' + }, + { + title: 'Subscription', + dataIndex: 'subType' + }, +]; + +class ConnectedAppsTable extends React.Component { + constructor(props) { + super(props); + this.state = { + pagination: { + total: 100 + }, + apps: [] + }; + } + + componentDidMount() { + this.fetch(); + } + + handleTableChange = (pagination, filters, sorter) => { + const pager = {...this.state.pagination}; + pager.current = pagination.current; + + this.setState({ + pagination: pager, + }); + this.fetch({ + results: pagination.pageSize, + page: pagination.current, + sortField: sorter.field, + sortOrder: sorter.order, + ...filters, + }); + }; + + fetch = (params = {}) => { + this.setState({loading: true}); + + const extraParams = { + offset: 10 * (params.page - 1), + limit: 10 + }; + // note: encode with '%26' not '&' + const encodedExtraParams = Object.keys(extraParams).map(key => key + '=' + extraParams[key]).join('%26'); + const parameters = { + method: "post", + 'content-type': "application/json", + payload: JSON.stringify({}), + 'api-endpoint': "/application-mgt-publisher/v1.0/applications?" + encodedExtraParams + }; + + const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&'); + console.log(request); + axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request + ).then(res => { + if (res.status === 200) { + let apps = []; + + if (res.data.data.hasOwnProperty("applications")) { + apps = res.data.data.applications; + } + const pagination = {...this.state.pagination}; + // Read total count from server + // pagination.total = data.totalCount; + pagination.total = 200; + this.setState({ + loading: false, + apps: apps, + pagination, + }); + + } + + }).catch((error) => { + if (error.response.status === 401) { + message.error('You are not logged in'); + window.location.href = 'https://localhost:9443/publisher/login'; + } else { + message.error('Something went wrong... :('); + } + + this.setState({loading: false}); + }); + }; + + render() { + console.log("rendered"); + return ( + + record.id} + dataSource={this.state.apps} + columns={columns} + pagination={this.state.pagination} + onChange={this.handleTableChange} + onRow={(record, rowIndex) => { + return { + onClick: event => { + this.props.showDrawer(record); + }, + }; + }} + /> + + ); + } +} + +const AppsTable = connect(mapStateToProps, {getApps})(ConnectedAppsTable); + +export default AppsTable; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/Filters.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/Filters.js new file mode 100644 index 0000000000..8604140a62 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/Filters.js @@ -0,0 +1,74 @@ +import React from "react"; +import {Avatar, Card, Col, Row, Table, Typography, Input, Divider, Checkbox, Select, Button} from "antd"; + +const {Option} = Select; +const {Title, Text} = Typography; + +class Filters extends React.Component { + constructor(props) { + super(props); + } + + + render() { + return ( + + + + + Filter + + + + + Category +

+ + + + Platform +

+ Android
+ iOS
+ Windows
+ Default
+ + + Tags +

+ + + + Type +

+ Enterprise
+ Public
+ Web APP
+ Web Clip
+ + + Subscription +

+ Free
+ Paid
+ + + ); + } +} + + +export default Filters; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js new file mode 100644 index 0000000000..ac4d871cf0 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js @@ -0,0 +1,76 @@ +import React from "react"; +import {Avatar, Card, Col, Row, Table, Typography, Input, Divider, Checkbox, Select, Button} from "antd"; +import {connect} from "react-redux"; +import {getApps} from "../../../js/actions"; +import AppsTable from "./AppsTable"; +import Filters from "./Filters"; +import AppDetailsDrawer from "./AppDetailsDrawer"; + +const {Option} = Select; +const {Title, Text} = Typography; +const Search = Input.Search; +// connecting state.apps with the component +const mapStateToProps = state => { + return {apps: state.apps} +}; + + +class ConnectedListApps extends React.Component { + constructor(props) { + super(props); + this.state = { + isDrawerVisible: false, + selectedApp: null + } + } + + //handler to show app drawer + showDrawer = (app) => { + console.log(app); + this.setState({ + isDrawerVisible: true, + selectedApp: app + }); + }; + + // handler to close the app drawer + closeDrawer = () => { + this.setState({ + isDrawerVisible: false + }) + }; + + render() { + const {isDrawerVisible} = this.state; + return ( + +
+ + + + + + + Apps + + + console.log(value)} + style={{width: 200}} + /> + + + + + + + + + ); + } +} + +const ListApps = connect(mapStateToProps, {getApps})(ConnectedListApps); + +export default ListApps; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js index 3b093b9c8d..e32d5fff1b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js @@ -28,7 +28,7 @@ class Dashboard extends React.Component { Apps diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js new file mode 100644 index 0000000000..e24f40a6ea --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js @@ -0,0 +1,60 @@ +import React from "react"; +import "antd/dist/antd.css"; +import {PageHeader, Typography,Input, Button, Row, Col} from "antd"; +import AppList from "../../../components/apps/AppList"; +import ReleaseModal from "../../../components/apps/ReleaseModal"; + +const Search = Input.Search; + +const routes = [ + { + path: 'index', + breadcrumbName: 'Publisher', + }, + { + path: 'first', + breadcrumbName: 'Dashboard', + }, + { + path: 'second', + breadcrumbName: 'Apps', + }, +]; + + +class Apps extends React.Component { + routes; + constructor(props) { + super(props); + this.routes = props.routes; + + } + + render() { + return ( +
+ +
+ +
+ console.log(value)} + style={{ width: 200}} + /> + + + + + + + + + + ); + } +} + +export default Apps; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js index e24f40a6ea..7260a3d45b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js @@ -1,7 +1,7 @@ import React from "react"; import "antd/dist/antd.css"; import {PageHeader, Typography,Input, Button, Row, Col} from "antd"; -import AppList from "../../../components/apps/AppList"; +import ListApps from "../../../components/apps/list-apps/ListApps"; import ReleaseModal from "../../../components/apps/ReleaseModal"; const Search = Input.Search; @@ -37,18 +37,8 @@ class Apps extends React.Component { breadcrumb={{routes}} />
- -
- console.log(value)} - style={{ width: 200}} - /> - - - - + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/AddReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/AddReview.js index f242259820..fa3af4c680 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/AddReview.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/AddReview.js @@ -68,7 +68,7 @@ class AddReview extends React.Component { }); setTimeout(()=>{ - window.location.reload(); + window.location.href= uuid; },2000) }else{ this.setState({