Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#2733 from JohnDuprey/dev
Browse files Browse the repository at this point in the history
Log subscriptions and ui tweaks
  • Loading branch information
JohnDuprey authored Jul 26, 2024
2 parents 40c8e6c + ca6ac61 commit 54383ef
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 16 deletions.
14 changes: 7 additions & 7 deletions src/views/cipp/ExtensionSync.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,49 @@ const ExtensionSync = () => {
const columns = [
{
name: 'Tenant',
selector: (row) => row['Tenant'],
selector: (row) => row?.Tenant,
sortable: true,
cell: cellGenericFormatter(),
exportSelector: 'Tenants',
},
{
name: 'Sync Type',
selector: (row) => row['SyncType'],
selector: (row) => row?.SyncType,
sortable: true,
cell: cellBadgeFormatter({ color: 'info' }),
exportSelector: 'SyncType',
},
{
name: 'Task',
selector: (row) => row['Name'],
selector: (row) => row?.Name,
sortable: true,
cell: cellGenericFormatter(),
exportSelector: 'Name',
},
{
name: 'Scheduled Time',
selector: (row) => row['ScheduledTime'],
selector: (row) => row?.ScheduledTime,
sortable: true,
cell: cellDateFormatter({ format: 'short' }),
exportSelector: 'ScheduledTime',
},
{
name: 'Last Run',
selector: (row) => row['ExecutedTime'],
selector: (row) => row?.ExecutedTime,
sortable: true,
cell: cellDateFormatter({ format: 'short' }),
exportSelector: 'ExecutedTime',
},
{
name: 'Repeats every',
selector: (row) => row['RepeatsEvery'],
selector: (row) => row?.RepeatsEvery,
sortable: true,
cell: (row) => CellTip(row['RepeatsEvery']),
exportSelector: 'RepeatsEvery',
},
{
name: 'Results',
selector: (row) => row['Results'],
selector: (row) => row?.Results,
sortable: true,
cell: cellGenericFormatter(),
exportSelector: 'Results',
Expand Down
28 changes: 19 additions & 9 deletions src/views/cipp/app-settings/CIPPSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SettingsNotifications } from 'src/views/cipp/app-settings/SettingsNotif
import { SettingsLicenses } from 'src/views/cipp/app-settings/SettingsLicenses.jsx'
import { SettingsMaintenance } from 'src/views/cipp/app-settings/SettingsMaintenance.jsx'
import { SettingsPartner } from 'src/views/cipp/app-settings/SettingsPartner.jsx'
import { SettingsWebhookSubscriptions } from 'src/views/cipp/app-settings/SettingsWebhookSubscriptions.jsx'
import useQuery from 'src/hooks/useQuery.jsx'
import { SettingsSuperAdmin } from './SettingsSuperAdmin.jsx'
import { useLoadClientPrincipalQuery } from 'src/store/api/auth.js'
Expand Down Expand Up @@ -48,16 +49,19 @@ export default function CIPPSettings() {
Notifications
</CNavItem>
<CNavItem active={active === 5} onClick={() => setActive(5)} href="#">
Partner Webhooks
Log Subscriptions
</CNavItem>
<CNavItem active={active === 6} onClick={() => setActive(6)} href="#">
Licenses
Partner Webhooks
</CNavItem>
<CNavItem active={active === 7} onClick={() => setActive(7)} href="#">
Licenses
</CNavItem>
<CNavItem active={active === 8} onClick={() => setActive(8)} href="#">
Maintenance
</CNavItem>
{superAdmin && (
<CNavItem active={active === 8} onClick={() => setActive(8)} href="#">
<CNavItem active={active === 9} onClick={() => setActive(9)} href="#">
SuperAdmin Settings
</CNavItem>
)}
Expand All @@ -84,23 +88,29 @@ export default function CIPPSettings() {
</CTabPane>
<CTabPane visible={active === 5} className="mt-3">
<CippLazy visible={active === 5}></CippLazy>
<SettingsPartner />
<SettingsWebhookSubscriptions />
</CTabPane>
<CTabPane visible={active === 6} className="mt-3">
<CippLazy visible={active === 6}>
<SettingsLicenses />
</CippLazy>
<CippLazy visible={active === 6}></CippLazy>
<SettingsPartner />
</CTabPane>
<CTabPane visible={active === 7} className="mt-3">
<CippLazy visible={active === 7}>
<SettingsMaintenance />
<SettingsLicenses />
</CippLazy>
</CTabPane>
<CTabPane visible={active === 8} className="mt-3">
<CippLazy visible={active === 8}>
<SettingsSuperAdmin />
<SettingsMaintenance />
</CippLazy>
</CTabPane>
{superAdmin && (
<CTabPane visible={active === 9} className="mt-3">
<CippLazy visible={active === 9}>
<SettingsSuperAdmin />
</CippLazy>
</CTabPane>
)}
</CTabContent>
</CippPage>
)
Expand Down
78 changes: 78 additions & 0 deletions src/views/cipp/app-settings/SettingsWebhookSubscriptions.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import React from 'react'
import { CippPageList } from 'src/components/layout/index.js'
import { cellGenericFormatter } from 'src/components/tables/CellGenericFormat'
import { cellBadgeFormatter, cellDateFormatter } from 'src/components/tables'

/**
* SettingsWebhookSubscriptions component is used to manage webhook subscriptions in a settings page.
*
* @returns {JSX.Element} The generated settings page component.
*/
export function SettingsWebhookSubscriptions() {
const columns = [
{
name: 'Tenant',
selector: (row) => row['PartitionKey'],
exportSelector: 'PartitionKey',
sortable: true,
cell: cellGenericFormatter(),
},
{
name: 'Resource',
selector: (row) => row['Resource'],
exportSelector: 'Resource',
sortable: true,
cell: cellGenericFormatter(),
},
{
name: 'Status',
selector: (row) => row['Status'],
exportSelector: 'Status',
sortable: true,
cell: cellBadgeFormatter({ color: 'info' }),
},
{
name: 'Last Update',
selector: (row) => row['Timestamp'],
sortable: true,
cell: cellDateFormatter({ format: 'short' }),
exportSelector: 'Timestamp',
},
]
return (
<>
<CippPageList
capabilities={{ allTenants: true, helpContext: 'https://google.com' }}
title="Log Subscriptions"
datatable={{
columns,
path: 'api/ExecWebhookSubscriptions',
reportName: `Log Subscriptions`,
tableProps: {
selectableRows: true,
actionsList: [
{
label: 'Resubscribe',
modal: true,
modalUrl: `/api/ExecWebhookSubscriptions?Action=Resubscribe&WebhookID=!RowKey`,
modalMessage: 'Are you sure you want to attempt to resubscribe to these webhooks?',
},
{
label: 'Unsubscribe',
modal: true,
modalUrl: `/api/ExecWebhookSubscriptions?Action=Unsubscribe&WebhookID=!RowKey`,
modalMessage: 'Are you sure you want to unsubscribe from these webhooks?',
},
{
label: 'Delete Subscription',
modal: true,
modalUrl: `/api/ExecWebhookSubscriptions?Action=Delete&WebhookID=!RowKey`,
modalMessage: 'Are you sure you want to delete these webhook entries?',
},
],
},
}}
/>
</>
)
}

0 comments on commit 54383ef

Please sign in to comment.