From 7dc9fbb04bc030d298d88b8d97156a3c6b6f425c Mon Sep 17 00:00:00 2001 From: shamalka Date: Wed, 23 Oct 2019 15:02:32 +0530 Subject: [PATCH 1/2] Fix error on retrieving location --- .../common/device/details/DeviceLocation.java | 40 ++++++------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceLocation.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceLocation.java index 71270b1683..09ae42117c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceLocation.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceLocation.java @@ -56,45 +56,29 @@ public class DeviceLocation implements Serializable { @ApiModelProperty(name = "updatedTime", value = "Update time of the device.", required = true) private Date updatedTime; @ApiModelProperty(name = "altitude", value = "Device altitude.", required = true) - private Double altitude; + private double altitude; @ApiModelProperty(name = "speed", value = "Device speed.", required = true) - private Float speed; + private float speed; @ApiModelProperty(name = "bearing", value = "Device bearing.", required = true) - private Float bearing; + private float bearing; @ApiModelProperty(name = "distance", value = "Device distance.", required = true) - private Double distance; + private double distance; - public Double getDistance() { - return distance; - } + public double getAltitude() { return altitude; } - public void setDistance(Double distance) { - this.distance = distance; - } + public void setAltitude(double altitude) { this.altitude = altitude; } - public Double getAltitude() { - return altitude; - } + public float getSpeed() { return speed; } - public Float getSpeed() { - return speed; - } + public void setSpeed(float speed) { this.speed = speed; } - public void setSpeed(Float speed) { - this.speed = speed; - } + public float getBearing() { return bearing; } - public Float getBearing() { - return bearing; - } + public void setBearing(float bearing) { this.bearing = bearing; } - public void setBearing(Float bearing) { - this.bearing = bearing; - } + public double getDistance() { return distance; } - public void setAltitude(Double altitude) { - this.altitude = altitude; - } + public void setDistance(double distance) { this.distance = distance; } public int getDeviceId() { return deviceId; From 22cd3a09f1b83a6c760245d256722ab42d8ca3c3 Mon Sep 17 00:00:00 2001 From: shamalka Date: Wed, 23 Oct 2019 17:18:33 +0530 Subject: [PATCH 2/2] Add tabs on user info modal --- .../DeviceTypes/DeviceTypesTable.js | 23 +++++++--- .../src/components/Devices/DevicesTable.js | 45 ++++++++++++------- .../components/Devices/ReportDevicesTable.js | 1 - .../src/components/Groups/GroupsTable.js | 3 +- .../src/components/Policies/PoliciesTable.js | 3 +- .../src/components/Roles/RolesTable.js | 22 ++++++--- .../src/components/Users/UsersDevices.js | 1 - .../src/components/Users/UsersTable.js | 34 +++++++++----- 8 files changed, 89 insertions(+), 43 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/DeviceTypes/DeviceTypesTable.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/DeviceTypes/DeviceTypesTable.js index 5e1a5494ca..42af8271b7 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/DeviceTypes/DeviceTypesTable.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/DeviceTypes/DeviceTypesTable.js @@ -18,7 +18,7 @@ import React from "react"; import axios from "axios"; -import {Tag, message, notification, Table, Typography, Tooltip, Icon, Divider, Card, Col, Row, Select} from "antd"; +import {message, notification, Typography, Icon, Card, Col, Row} from "antd"; import TimeAgo from 'javascript-time-ago' // Load locale-specific relative date/time formatting rules. @@ -113,16 +113,27 @@ class DeviceTypesTable extends React.Component { render() { const {data, pagination, loading, selectedRows} = this.state; - + const { Meta } = Card; const itemCard = data.map((data) => - - - {data.name} + + , + ,]} + > + } + title={data.name} + /> + ); return ( -
+
{itemCard} diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Devices/DevicesTable.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Devices/DevicesTable.js index 21fe449b48..38e5444aeb 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Devices/DevicesTable.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/components/Devices/DevicesTable.js @@ -18,7 +18,7 @@ import React from "react"; import axios from "axios"; -import {Tag, message, notification, Table, Typography, Tooltip, Icon, Divider, Button, Modal, Select} from "antd"; +import {Tag, message, notification, Table, Typography, Tooltip, Icon, Modal, Select} from "antd"; import TimeAgo from 'javascript-time-ago' // Load locale-specific relative date/time formatting rules. @@ -133,18 +133,11 @@ class DeviceTable extends React.Component { selectedRows: [], deviceGroups: [], groupModalVisible: false, - selectedGroupId: [] + selectedGroupId: [], + selectedRowKeys:[] }; } - rowSelection = { - onChange: (selectedRowKeys, selectedRows) => { - this.setState({ - selectedRows: selectedRows - }); - } - }; - componentDidMount() { this.fetch(); } @@ -249,6 +242,9 @@ class DeviceTable extends React.Component { ).then(res => { if (res.status === 200) { this.fetch(); + this.setState({ + selectedRowKeys:[] + }) notification["success"]({ message: "Done", duration: 4, @@ -409,11 +405,30 @@ class DeviceTable extends React.Component { }); }; - render() { - const {data, pagination, loading, selectedRows} = this.state; + onSelectChange = (selectedRowKeys, selectedRows) => { + this.setState({ + selectedRowKeys, + selectedRows: selectedRows + }); + }; + render() { + const {data, pagination, loading, selectedRows, selectedRowKeys} = this.state; const isSelectedSingle = this.state.selectedRows.length == 1; + let selectedText; + if(isSelectedSingle){ + selectedText = "You have selected 1 device" + }else{ + selectedText = "You have selected " + this.state.selectedRows.length + " devices" + } + + const rowSelection = { + selectedRowKeys, + selectedRows, + onChange: this.onSelectChange, + }; + let item = this.state.deviceGroups.map((data) =>
@@ -453,10 +467,11 @@ class DeviceTable extends React.Component { onOk={this.handleOk} onCancel={this.handleCancel} > +

{selectedText}