From efd7b34e609376b7d0940705d9f6bac82b7e24ba Mon Sep 17 00:00:00 2001 From: Amanda <74random.amanda@gmail.com> Date: Sat, 14 Mar 2020 11:23:12 +0530 Subject: [PATCH] Add OSVersion column to DevicesTable component --- .../Reports/components/DevicesTable/index.js | 17 +++++++++++------ .../src/scenes/Home/scenes/Reports/index.js | 2 +- .../Reports/scenes/OutdatedOSVersion/index.js | 8 ++++++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/components/DevicesTable/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/components/DevicesTable/index.js index 8be97a11b1..bc283b737d 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/components/DevicesTable/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/components/DevicesTable/index.js @@ -116,12 +116,6 @@ const columns = [ }, // todo add filtering options }, - { - title: 'OS Version', - dataIndex: 'deviceInfo', - key: 'osVersion', - render: deviceInfo => deviceInfo.osVersion, - }, ]; const getTimeAgo = time => { @@ -185,6 +179,17 @@ class deviceTable extends React.Component { .then(res => { if (res.status === 200) { const pagination = { ...this.state.pagination }; + if ( + res.data.data.devices.length && + res.data.data.devices[0].hasOwnProperty('deviceInfo') + ) { + columns.push({ + title: 'OS Version', + dataIndex: 'deviceInfo', + key: 'osVersion', + render: deviceInfo => deviceInfo.osVersion, + }); + } this.setState({ loading: false, data: res.data.data, diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/index.js index 2963289c4f..5a15b83241 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/index.js @@ -178,7 +178,7 @@ class Reports extends React.Component { style={{ fontSize: '25px', color: '#08c' }} />
Report based on device OS version
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/scenes/OutdatedOSVersion/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/scenes/OutdatedOSVersion/index.js index a5955f4472..fca5ca7534 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/scenes/OutdatedOSVersion/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Reports/scenes/OutdatedOSVersion/index.js @@ -121,10 +121,14 @@ class OutdatedOSversionReport extends React.Component {+ This report displays devices with an OS Version below the + specified version. +