|
|
@ -32,29 +32,72 @@ let config = null;
|
|
|
|
const columns = [
|
|
|
|
const columns = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: 'Device',
|
|
|
|
title: 'Device',
|
|
|
|
dataIndex: 'name',
|
|
|
|
dataIndex: 'device',
|
|
|
|
width: 100,
|
|
|
|
width: 100,
|
|
|
|
|
|
|
|
render: device => device.name
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: 'Owner',
|
|
|
|
title: 'Owner',
|
|
|
|
dataIndex: 'enrolmentInfo',
|
|
|
|
dataIndex: 'device',
|
|
|
|
key: 'owner',
|
|
|
|
key: 'owner',
|
|
|
|
render: enrolmentInfo => enrolmentInfo.owner
|
|
|
|
render: device => device.enrolmentInfo.owner
|
|
|
|
// todo add filtering options
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: 'Ownership',
|
|
|
|
title: 'Action Type',
|
|
|
|
dataIndex: 'enrolmentInfo',
|
|
|
|
dataIndex: 'actionType',
|
|
|
|
key: 'ownership',
|
|
|
|
key: 'actionType',
|
|
|
|
render: enrolmentInfo => enrolmentInfo.ownership
|
|
|
|
render: actionType => actionType.toLowerCase()
|
|
|
|
// todo add filtering options
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: 'Status',
|
|
|
|
title: 'Action',
|
|
|
|
dataIndex: 'enrolmentInfo',
|
|
|
|
dataIndex: 'action',
|
|
|
|
key: 'status',
|
|
|
|
key: 'action',
|
|
|
|
render: (enrolmentInfo) => {
|
|
|
|
render: action => action.toLowerCase()
|
|
|
|
const status = enrolmentInfo.status.toLowerCase();
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: 'Triggered By',
|
|
|
|
|
|
|
|
dataIndex: 'actionTriggeredBy',
|
|
|
|
|
|
|
|
key: 'actionTriggeredBy'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: 'Action Triggered At',
|
|
|
|
|
|
|
|
dataIndex: 'actionTriggeredTimestamp',
|
|
|
|
|
|
|
|
key: 'actionTriggeredTimestamp'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: 'Action Status',
|
|
|
|
|
|
|
|
dataIndex: 'status',
|
|
|
|
|
|
|
|
key: 'actionStatus',
|
|
|
|
|
|
|
|
render: (status) => {
|
|
|
|
|
|
|
|
let color = "#f9ca24";
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
|
|
|
|
case "COMPLETED":
|
|
|
|
|
|
|
|
color = "#badc58";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "REPEATED":
|
|
|
|
|
|
|
|
color = "#6ab04c";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "ERROR":
|
|
|
|
|
|
|
|
case "INVALID":
|
|
|
|
|
|
|
|
case "UNAUTHORIZED":
|
|
|
|
|
|
|
|
color = "#ff7979";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "IN_PROGRESS":
|
|
|
|
|
|
|
|
color = "#f9ca24";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "PENDING":
|
|
|
|
|
|
|
|
color = "#636e72";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return <Tag color={color}>{status.toLowerCase()}</Tag>;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: 'Device Status',
|
|
|
|
|
|
|
|
dataIndex: 'device',
|
|
|
|
|
|
|
|
key: 'deviceStatus',
|
|
|
|
|
|
|
|
render: (device) => {
|
|
|
|
|
|
|
|
const status = device.enrolmentInfo.status.toLowerCase();
|
|
|
|
let color = "#f9ca24";
|
|
|
|
let color = "#f9ca24";
|
|
|
|
switch (status) {
|
|
|
|
switch (status) {
|
|
|
|
case "active":
|
|
|
|
case "active":
|
|
|
@ -75,18 +118,6 @@ const columns = [
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return <Tag color={color}>{status}</Tag>;
|
|
|
|
return <Tag color={color}>{status}</Tag>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// todo add filtering options
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: 'Last Updated',
|
|
|
|
|
|
|
|
dataIndex: 'enrolmentInfo',
|
|
|
|
|
|
|
|
key: 'dateOfLastUpdate',
|
|
|
|
|
|
|
|
render: (data) => {
|
|
|
|
|
|
|
|
const {dateOfLastUpdate} = data;
|
|
|
|
|
|
|
|
const timeAgoString = getTimeAgo(dateOfLastUpdate);
|
|
|
|
|
|
|
|
return <Tooltip title={new Date(dateOfLastUpdate).toString()}>{timeAgoString}</Tooltip>;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// todo add filtering options
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
@ -135,14 +166,15 @@ class InstalledDevicesTable extends React.Component {
|
|
|
|
//send request to the invoker
|
|
|
|
//send request to the invoker
|
|
|
|
axios.get(
|
|
|
|
axios.get(
|
|
|
|
window.location.origin + config.serverConfig.invoker.uri +
|
|
|
|
window.location.origin + config.serverConfig.invoker.uri +
|
|
|
|
config.serverConfig.invoker.deviceMgt +
|
|
|
|
config.serverConfig.invoker.store +
|
|
|
|
"/devices?" + encodedExtraParams,
|
|
|
|
`/admin/subscription/${this.props.uuid}?` + encodedExtraParams,
|
|
|
|
).then(res => {
|
|
|
|
).then(res => {
|
|
|
|
if (res.status === 200) {
|
|
|
|
if (res.status === 200) {
|
|
|
|
const pagination = {...this.state.pagination};
|
|
|
|
const pagination = {...this.state.pagination};
|
|
|
|
|
|
|
|
console.log(res.data.data.data);
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
loading: false,
|
|
|
|
loading: false,
|
|
|
|
data: res.data.data.devices,
|
|
|
|
data: res.data.data.data,
|
|
|
|
pagination,
|
|
|
|
pagination,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -179,7 +211,7 @@ class InstalledDevicesTable extends React.Component {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<Table
|
|
|
|
<Table
|
|
|
|
columns={columns}
|
|
|
|
columns={columns}
|
|
|
|
rowKey={record => (record.deviceIdentifier + record.enrolmentInfo.owner + record.enrolmentInfo.ownership)}
|
|
|
|
rowKey={record => (record.device.deviceIdentifier + record.device.enrolmentInfo.owner + record.device.enrolmentInfo.ownership)}
|
|
|
|
dataSource={data}
|
|
|
|
dataSource={data}
|
|
|
|
pagination={{
|
|
|
|
pagination={{
|
|
|
|
...pagination,
|
|
|
|
...pagination,
|
|
|
|