Skip to content

Commit 147f7fe

Browse files
authored
Merge pull request #2195 from JohnDuprey/dev
Devices Bulk Actions
2 parents 04c8cfb + 0696ae1 commit 147f7fe

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

src/components/layout/AppSidebarNav.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const AppSidebarNav = ({ items }) => {
6565
)
6666
}
6767
const navGroup = (item, index) => {
68-
const { component, name, icon, to, ...rest } = item
68+
const { component, name, icon, to, items, ...rest } = item
6969
const Component = component
7070
const navGroupKey = `${item.name.toLowerCase().replace(' ', '-')}_${index}`
7171
const navGroupIdx = `${item.section.toLowerCase().replace(' ', '-')}_${item.name
@@ -79,9 +79,7 @@ export const AppSidebarNav = ({ items }) => {
7979
visible={location.pathname.startsWith(to)}
8080
{...rest}
8181
>
82-
{item.items?.map((item, index) =>
83-
item.items ? navGroup(item, index) : navItem(item, index),
84-
)}
82+
{items?.map((item, index) => (item.items ? navGroup(item, index) : navItem(item, index)))}
8583
</Component>
8684
)
8785
}

src/views/identity/administration/Devices.jsx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { CButton } from '@coreui/react'
77
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
88
import { faEdit, faEllipsisV } from '@fortawesome/free-solid-svg-icons'
99
import { CippActionsOffcanvas } from 'src/components/utilities'
10+
import { cellGenericFormatter } from 'src/components/tables/CellGenericFormat'
1011

1112
const DevicesList = () => {
1213
const [tenantColumnSet, setTenantColumn] = useState(true)
@@ -28,6 +29,13 @@ const DevicesList = () => {
2829
{ label: 'Unique ID', value: `${row.id ?? ' '}` },
2930
]}
3031
actions={[
32+
{
33+
label: 'Enable Device',
34+
color: 'info',
35+
modal: true,
36+
modalUrl: `/api/ExecDeviceDelete?TenantFilter=${tenant.defaultDomainName}&ID=${row.id}&Action=Enable`,
37+
modalMessage: 'Are you sure you want to enable this device.',
38+
},
3139
{
3240
label: 'Disable Device',
3341
color: 'info',
@@ -39,7 +47,7 @@ const DevicesList = () => {
3947
label: 'Delete Device',
4048
color: 'warning',
4149
modal: true,
42-
modalUrl: `/api/ExecGroupsDelete?TenantFilter=${tenant.defaultDomainName}&ID=${row.id}&Action=Enable`,
50+
modalUrl: `/api/ExecDeviceDelete?TenantFilter=${tenant.defaultDomainName}&ID=${row.id}&Action=Delete`,
4351
modalMessage: 'Are you sure you want to delete this device.',
4452
},
4553
]}
@@ -75,6 +83,13 @@ const DevicesList = () => {
7583
cell: (row) => CellTip(row['displayName']),
7684
exportSelector: 'displayName',
7785
},
86+
{
87+
selector: (row) => row['accountEnabled'],
88+
name: 'Enabled',
89+
sortable: true,
90+
cell: cellGenericFormatter(),
91+
exportSelector: 'accountEnabled',
92+
},
7893
{
7994
selector: (row) => row['deviceOwnership'],
8095
name: 'Device Ownership',
@@ -146,6 +161,29 @@ const DevicesList = () => {
146161
$format: 'application/json',
147162
},
148163
columns,
164+
tableProps: {
165+
selectableRows: true,
166+
actionsList: [
167+
{
168+
label: 'Enable Device',
169+
modal: true,
170+
modalUrl: `/api/ExecDeviceDelete?TenantFilter=!Tenant&ID=!id&Action=Enable`,
171+
modalMessage: 'Are you sure you want to enable this device?',
172+
},
173+
{
174+
label: 'Disable Device',
175+
modal: true,
176+
modalUrl: `/api/ExecDeviceDelete?TenantFilter=!Tenant&ID=!id&Action=Disable`,
177+
modalMessage: 'Are you sure you want to disable this device?',
178+
},
179+
{
180+
label: 'Delete Device',
181+
modal: true,
182+
modalUrl: `/api/ExecDeviceDelete?TenantFilter=!Tenant&ID=!id&Action=Delete`,
183+
modalMessage: 'Are you sure you want to delete this device?',
184+
},
185+
],
186+
},
149187
}}
150188
/>
151189
)

0 commit comments

Comments
 (0)