Skip to content

Commit 06b708f

Browse files
add device actions
1 parent 35c31a5 commit 06b708f

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

src/views/identity/administration/Devices.jsx

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,55 @@ import React, { useEffect, useState } from 'react'
22
import { useSelector } from 'react-redux'
33
import { CellTip, cellBooleanFormatter } from 'src/components/tables'
44
import { CippPageList } from 'src/components/layout'
5+
import { Link } from 'react-router-dom'
6+
import { CButton } from '@coreui/react'
7+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
8+
import { faEdit, faEllipsisV } from '@fortawesome/free-solid-svg-icons'
9+
import { CippActionsOffcanvas } from 'src/components/utilities'
510

611
const DevicesList = () => {
712
const [tenantColumnSet, setTenantColumn] = useState(true)
813
const tenant = useSelector((state) => state.app.currentTenant)
9-
14+
const Offcanvas = (row, rowIndex, formatExtraData) => {
15+
const tenant = useSelector((state) => state.app.currentTenant)
16+
const [ocVisible, setOCVisible] = useState(false)
17+
const editLink = `/identity/administration/groups/edit?groupId=${row.id}&tenantDomain=${tenant.defaultDomainName}`
18+
return (
19+
<>
20+
<CButton size="sm" color="link" onClick={() => setOCVisible(true)}>
21+
<FontAwesomeIcon icon={faEllipsisV} />
22+
</CButton>
23+
<CippActionsOffcanvas
24+
title="Group Information"
25+
extendedInfo={[
26+
{ label: 'Created Date (UTC)', value: `${row.createdDateTime ?? ' '}` },
27+
{ label: 'Display Name', value: `${row.displayName ?? ' '}` },
28+
{ label: 'Unique ID', value: `${row.id ?? ' '}` },
29+
]}
30+
actions={[
31+
{
32+
label: 'Disable Device',
33+
color: 'info',
34+
modal: true,
35+
modalUrl: `/api/ExecDeviceDelete?TenantFilter=${tenant.defaultDomainName}&ID=${row.id}&Action=Disable`,
36+
modalMessage: 'Are you sure you want to disable this device.',
37+
},
38+
{
39+
label: 'Delete Device',
40+
color: 'warning',
41+
modal: true,
42+
modalUrl: `/api/ExecGroupsDelete?TenantFilter=${tenant.defaultDomainName}&ID=${row.id}&Action=Enable`,
43+
modalMessage: 'Are you sure you want to delete this device.',
44+
},
45+
]}
46+
placement="end"
47+
visible={ocVisible}
48+
id={row.id}
49+
hideFunction={() => setOCVisible(false)}
50+
/>
51+
</>
52+
)
53+
}
1054
const columns = [
1155
{
1256
name: 'Tenant',
@@ -74,6 +118,11 @@ const DevicesList = () => {
74118
sortable: true,
75119
exportSelector: 'profileType',
76120
},
121+
{
122+
name: 'Actions',
123+
cell: Offcanvas,
124+
maxWidth: '20px',
125+
},
77126
]
78127
useEffect(() => {
79128
if (tenant.defaultDomainName === 'AllTenants') {

0 commit comments

Comments
 (0)