Skip to content

Commit 54383ef

Browse files
authored
Merge pull request #2733 from JohnDuprey/dev
Log subscriptions and ui tweaks
2 parents 40c8e6c + ca6ac61 commit 54383ef

File tree

3 files changed

+104
-16
lines changed

3 files changed

+104
-16
lines changed

src/views/cipp/ExtensionSync.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,49 @@ const ExtensionSync = () => {
1919
const columns = [
2020
{
2121
name: 'Tenant',
22-
selector: (row) => row['Tenant'],
22+
selector: (row) => row?.Tenant,
2323
sortable: true,
2424
cell: cellGenericFormatter(),
2525
exportSelector: 'Tenants',
2626
},
2727
{
2828
name: 'Sync Type',
29-
selector: (row) => row['SyncType'],
29+
selector: (row) => row?.SyncType,
3030
sortable: true,
3131
cell: cellBadgeFormatter({ color: 'info' }),
3232
exportSelector: 'SyncType',
3333
},
3434
{
3535
name: 'Task',
36-
selector: (row) => row['Name'],
36+
selector: (row) => row?.Name,
3737
sortable: true,
3838
cell: cellGenericFormatter(),
3939
exportSelector: 'Name',
4040
},
4141
{
4242
name: 'Scheduled Time',
43-
selector: (row) => row['ScheduledTime'],
43+
selector: (row) => row?.ScheduledTime,
4444
sortable: true,
4545
cell: cellDateFormatter({ format: 'short' }),
4646
exportSelector: 'ScheduledTime',
4747
},
4848
{
4949
name: 'Last Run',
50-
selector: (row) => row['ExecutedTime'],
50+
selector: (row) => row?.ExecutedTime,
5151
sortable: true,
5252
cell: cellDateFormatter({ format: 'short' }),
5353
exportSelector: 'ExecutedTime',
5454
},
5555
{
5656
name: 'Repeats every',
57-
selector: (row) => row['RepeatsEvery'],
57+
selector: (row) => row?.RepeatsEvery,
5858
sortable: true,
5959
cell: (row) => CellTip(row['RepeatsEvery']),
6060
exportSelector: 'RepeatsEvery',
6161
},
6262
{
6363
name: 'Results',
64-
selector: (row) => row['Results'],
64+
selector: (row) => row?.Results,
6565
sortable: true,
6666
cell: cellGenericFormatter(),
6767
exportSelector: 'Results',

src/views/cipp/app-settings/CIPPSettings.jsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { SettingsNotifications } from 'src/views/cipp/app-settings/SettingsNotif
1010
import { SettingsLicenses } from 'src/views/cipp/app-settings/SettingsLicenses.jsx'
1111
import { SettingsMaintenance } from 'src/views/cipp/app-settings/SettingsMaintenance.jsx'
1212
import { SettingsPartner } from 'src/views/cipp/app-settings/SettingsPartner.jsx'
13+
import { SettingsWebhookSubscriptions } from 'src/views/cipp/app-settings/SettingsWebhookSubscriptions.jsx'
1314
import useQuery from 'src/hooks/useQuery.jsx'
1415
import { SettingsSuperAdmin } from './SettingsSuperAdmin.jsx'
1516
import { useLoadClientPrincipalQuery } from 'src/store/api/auth.js'
@@ -48,16 +49,19 @@ export default function CIPPSettings() {
4849
Notifications
4950
</CNavItem>
5051
<CNavItem active={active === 5} onClick={() => setActive(5)} href="#">
51-
Partner Webhooks
52+
Log Subscriptions
5253
</CNavItem>
5354
<CNavItem active={active === 6} onClick={() => setActive(6)} href="#">
54-
Licenses
55+
Partner Webhooks
5556
</CNavItem>
5657
<CNavItem active={active === 7} onClick={() => setActive(7)} href="#">
58+
Licenses
59+
</CNavItem>
60+
<CNavItem active={active === 8} onClick={() => setActive(8)} href="#">
5761
Maintenance
5862
</CNavItem>
5963
{superAdmin && (
60-
<CNavItem active={active === 8} onClick={() => setActive(8)} href="#">
64+
<CNavItem active={active === 9} onClick={() => setActive(9)} href="#">
6165
SuperAdmin Settings
6266
</CNavItem>
6367
)}
@@ -84,23 +88,29 @@ export default function CIPPSettings() {
8488
</CTabPane>
8589
<CTabPane visible={active === 5} className="mt-3">
8690
<CippLazy visible={active === 5}></CippLazy>
87-
<SettingsPartner />
91+
<SettingsWebhookSubscriptions />
8892
</CTabPane>
8993
<CTabPane visible={active === 6} className="mt-3">
90-
<CippLazy visible={active === 6}>
91-
<SettingsLicenses />
92-
</CippLazy>
94+
<CippLazy visible={active === 6}></CippLazy>
95+
<SettingsPartner />
9396
</CTabPane>
9497
<CTabPane visible={active === 7} className="mt-3">
9598
<CippLazy visible={active === 7}>
96-
<SettingsMaintenance />
99+
<SettingsLicenses />
97100
</CippLazy>
98101
</CTabPane>
99102
<CTabPane visible={active === 8} className="mt-3">
100103
<CippLazy visible={active === 8}>
101-
<SettingsSuperAdmin />
104+
<SettingsMaintenance />
102105
</CippLazy>
103106
</CTabPane>
107+
{superAdmin && (
108+
<CTabPane visible={active === 9} className="mt-3">
109+
<CippLazy visible={active === 9}>
110+
<SettingsSuperAdmin />
111+
</CippLazy>
112+
</CTabPane>
113+
)}
104114
</CTabContent>
105115
</CippPage>
106116
)
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import React from 'react'
2+
import { CippPageList } from 'src/components/layout/index.js'
3+
import { cellGenericFormatter } from 'src/components/tables/CellGenericFormat'
4+
import { cellBadgeFormatter, cellDateFormatter } from 'src/components/tables'
5+
6+
/**
7+
* SettingsWebhookSubscriptions component is used to manage webhook subscriptions in a settings page.
8+
*
9+
* @returns {JSX.Element} The generated settings page component.
10+
*/
11+
export function SettingsWebhookSubscriptions() {
12+
const columns = [
13+
{
14+
name: 'Tenant',
15+
selector: (row) => row['PartitionKey'],
16+
exportSelector: 'PartitionKey',
17+
sortable: true,
18+
cell: cellGenericFormatter(),
19+
},
20+
{
21+
name: 'Resource',
22+
selector: (row) => row['Resource'],
23+
exportSelector: 'Resource',
24+
sortable: true,
25+
cell: cellGenericFormatter(),
26+
},
27+
{
28+
name: 'Status',
29+
selector: (row) => row['Status'],
30+
exportSelector: 'Status',
31+
sortable: true,
32+
cell: cellBadgeFormatter({ color: 'info' }),
33+
},
34+
{
35+
name: 'Last Update',
36+
selector: (row) => row['Timestamp'],
37+
sortable: true,
38+
cell: cellDateFormatter({ format: 'short' }),
39+
exportSelector: 'Timestamp',
40+
},
41+
]
42+
return (
43+
<>
44+
<CippPageList
45+
capabilities={{ allTenants: true, helpContext: 'https://google.com' }}
46+
title="Log Subscriptions"
47+
datatable={{
48+
columns,
49+
path: 'api/ExecWebhookSubscriptions',
50+
reportName: `Log Subscriptions`,
51+
tableProps: {
52+
selectableRows: true,
53+
actionsList: [
54+
{
55+
label: 'Resubscribe',
56+
modal: true,
57+
modalUrl: `/api/ExecWebhookSubscriptions?Action=Resubscribe&WebhookID=!RowKey`,
58+
modalMessage: 'Are you sure you want to attempt to resubscribe to these webhooks?',
59+
},
60+
{
61+
label: 'Unsubscribe',
62+
modal: true,
63+
modalUrl: `/api/ExecWebhookSubscriptions?Action=Unsubscribe&WebhookID=!RowKey`,
64+
modalMessage: 'Are you sure you want to unsubscribe from these webhooks?',
65+
},
66+
{
67+
label: 'Delete Subscription',
68+
modal: true,
69+
modalUrl: `/api/ExecWebhookSubscriptions?Action=Delete&WebhookID=!RowKey`,
70+
modalMessage: 'Are you sure you want to delete these webhook entries?',
71+
},
72+
],
73+
},
74+
}}
75+
/>
76+
</>
77+
)
78+
}

0 commit comments

Comments
 (0)