Skip to content

Commit 4b415d5

Browse files
authored
Merge pull request KelvinTegelaar#9 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents eaf09af + 3775e99 commit 4b415d5

File tree

11 files changed

+67
-36
lines changed

11 files changed

+67
-36
lines changed

src/components/layout/AppHeader.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,13 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
2121
import { faCaretSquareLeft, faCaretSquareRight } from '@fortawesome/free-solid-svg-icons'
2222
import { toggleSidebarShow } from 'src/store/features/app'
2323
import { useMediaPredicate } from 'react-media-hook'
24-
import { useGenericGetRequestQuery } from 'src/store/api/app'
25-
24+
import { useLoadAlertsDashQuery } from 'src/store/api/app'
2625
const AppHeader = () => {
2726
const dispatch = useDispatch()
2827
const sidebarShow = useSelector((state) => state.app.sidebarShow)
2928
const currentTheme = useSelector((state) => state.app.currentTheme)
3029
const preferredTheme = useMediaPredicate('(prefers-color-scheme: dark)') ? 'impact' : 'cyberdrain'
31-
const {
32-
data: dashboard,
33-
isLoading: isLoadingDash,
34-
isSuccess: issuccessDash,
35-
} = useGenericGetRequestQuery({ path: '/api/GetCippAlerts' })
30+
const { data: dashboard } = useLoadAlertsDashQuery()
3631

3732
return (
3833
<>

src/data/Extensions.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
[
2+
{
3+
"name": "CIPP-API Integration",
4+
"type": "CIPP-API",
5+
"cat": "API",
6+
"forceSyncButton": false,
7+
"helpText": "This integration allows you to use to enable API access outside of CIPP usage. Requires Global Administrator permissions inside your tenant for activation of the API. These credentials will only be shown once.",
8+
"SettingOptions": [
9+
{
10+
"type": "checkbox",
11+
"name": "cippapi.ResetPassword",
12+
"label": "Reset application secret - this will invalidate all existing API tokens"
13+
},
14+
{
15+
"type": "checkbox",
16+
"name": "cippapi.Enabled",
17+
"label": "Enable Integration"
18+
}
19+
]
20+
},
221
{
322
"name": "Gradient Integration",
423
"type": "Gradient",
@@ -32,7 +51,6 @@
3251
}
3352
]
3453
},
35-
3654
{
3755
"name": "Halo PSA Ticketing Integration",
3856
"type": "HaloPSA",

src/store/api/app.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ export const appApi = baseApi.injectEndpoints({
2020
params: { localversion: localVersion },
2121
}),
2222
}),
23+
loadAlertsDash: builder.query({
24+
queryFn: (_args, _baseQueryApi, _options, baseQuery) =>
25+
baseQuery({ path: '/version_latest.txt' }).then(({ data }) =>
26+
baseQuery({
27+
path: '/api/GetCippAlerts',
28+
params: { localversion: data.replace(/(\r\n|\n|\r)/gm, '') },
29+
}),
30+
),
31+
}),
2332
loadDash: builder.query({
2433
query: (localVersion) => ({
2534
path: '/api/GetDashboard',
@@ -114,6 +123,7 @@ export const {
114123
useLoadVersionRemoteQuery,
115124
useLoadVersionsQuery,
116125
useLoadDashQuery,
126+
useLoadAlertsDashQuery,
117127
useExecPermissionsAccessCheckQuery,
118128
useLazyExecPermissionsAccessCheckQuery,
119129
useExecTenantsAccessCheckQuery,

src/views/cipp/CIPPSettings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ const ExtensionsTab = () => {
13531353
<CRow>
13541354
{Extensions.map((integration) => (
13551355
<CCol xs={12} lg={6} xl={6} className="mb-3">
1356-
<CCard>
1356+
<CCard className="d-flex flex-column h-100">
13571357
<CCardHeader>
13581358
<CCardTitle>{integration.name}</CCardTitle>
13591359
</CCardHeader>

src/views/email-exchange/connectors/AddConnectorTemplate.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import { CippContentCard, CippPage } from 'src/components/layout'
55
import { RFFCFormTextarea } from 'src/components/forms'
66
import { useLazyGenericPostRequestQuery } from 'src/store/api/app'
77

8-
const TransportAddTemplate = () => {
8+
const ConnectorAddTemplate = () => {
99
const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()
1010

1111
const handleSubmit = async (values) => {
1212
// alert(JSON.stringify(values, null, 2))
1313
// @todo hook this up
14-
genericPostRequest({ path: '/api/AddTransportTemplate', values })
14+
genericPostRequest({ path: '/api/AddEXConnectorTemplate', values })
1515
}
1616

1717
return (
18-
<CippPage tenantSelector={false} title="Add Transport Rule Template">
18+
<CippPage tenantSelector={false} title="Add Exchange Connector Template">
1919
<CippContentCard title="Template Details">
2020
{postResults.isFetching && (
2121
<CCallout color="info">
@@ -32,7 +32,7 @@ const TransportAddTemplate = () => {
3232
<CCol>
3333
<RFFCFormTextarea
3434
name="PowerShellCommand"
35-
label="New-TransportRule parameters"
35+
label="New-InboundConnector / New-Outbound Connector parameters"
3636
placeholder={'Enter the JSON parameters for your rule.'}
3737
/>
3838
</CCol>
@@ -58,4 +58,4 @@ const TransportAddTemplate = () => {
5858
)
5959
}
6060

61-
export default TransportAddTemplate
61+
export default ConnectorAddTemplate

src/views/email-exchange/connectors/ConnectorList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const ConnectorList = () => {
143143
title="Connector List"
144144
titleButton={
145145
<>
146-
<TitleButton href="/email/transport/add-connector" title="Deploy Connector" />
146+
<TitleButton href="/email/connectors/deploy-connector" title="Deploy Connector" />
147147
</>
148148
}
149149
tenantSelector={true}

src/views/email-exchange/connectors/DeployConnector.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Error.propTypes = {
3131

3232
const requiredArray = (value) => (value && value.length !== 0 ? undefined : 'Required')
3333
const DeployConnectorTemplate = () => {
34-
const [intuneGetRequest, intuneTemplates] = useLazyGenericGetRequestQuery()
34+
const [EXConnectorGetRequest, EXConnectorTemplates] = useLazyGenericGetRequestQuery()
3535
const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()
3636

3737
const handleSubmit = async (values) => {
@@ -51,7 +51,7 @@ const DeployConnectorTemplate = () => {
5151
{({ form }) => (
5252
<OnChange name={field}>
5353
{(value) => {
54-
let template = intuneTemplates.data.filter(function (obj) {
54+
let template = EXConnectorTemplates.data.filter(function (obj) {
5555
return obj.GUID === value
5656
})
5757
// console.log(template[0][set])
@@ -86,7 +86,7 @@ const DeployConnectorTemplate = () => {
8686
<Field name="selectedTenants" validate={requiredArray}>
8787
{(props) => (
8888
<WizardTableField
89-
reportName="Add-MEM-Policy-Tenant-Selector"
89+
reportName="Add-EX-Connector-Tenant-Selector"
9090
keyField="defaultDomainName"
9191
path="/api/ListTenants?AllTenantSelector=true"
9292
columns={[
@@ -121,12 +121,12 @@ const DeployConnectorTemplate = () => {
121121
<hr className="my-4" />
122122
<CRow>
123123
<CCol md={12}>
124-
{intuneTemplates.isUninitialized &&
125-
intuneGetRequest({ path: 'api/ListExConnectorTemplates' })}
126-
{intuneTemplates.isSuccess && (
124+
{EXConnectorTemplates.isUninitialized &&
125+
EXConnectorGetRequest({ path: 'api/ListExConnectorTemplates' })}
126+
{EXConnectorTemplates.isSuccess && (
127127
<RFFCFormSelect
128128
name="TemplateList"
129-
values={intuneTemplates.data?.map((template) => ({
129+
values={EXConnectorTemplates.data?.map((template) => ({
130130
value: template.GUID,
131131
label: template.name,
132132
}))}

src/views/email-exchange/connectors/ListConnectorTemplates.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
88
import { useLazyGenericGetRequestQuery } from 'src/store/api/app'
99
import { CippPageList } from 'src/components/layout'
1010
import { ModalService } from 'src/components/utilities'
11+
import { TitleButton } from 'src/components/buttons'
1112

1213
const ConnectorListTemplates = () => {
1314
const tenant = useSelector((state) => state.app.currentTenant)
1415

1516
const [ExecuteGetRequest, getResults] = useLazyGenericGetRequestQuery()
1617
const Offcanvas = (row, rowIndex, formatExtraData) => {
1718
const [ocVisible, setOCVisible] = useState(false)
18-
const handleDeleteIntuneTemplate = (apiurl, message) => {
19+
const handleDeleteEXConnectorTemplate = (apiurl, message) => {
1920
ModalService.confirm({
2021
title: 'Confirm',
2122
body: <div>{message}</div>,
@@ -34,7 +35,7 @@ const ConnectorListTemplates = () => {
3435
variant="ghost"
3536
color="danger"
3637
onClick={() =>
37-
handleDeleteIntuneTemplate(
38+
handleDeleteEXConnectorTemplate(
3839
`/api/RemoveExConnectorTemplate?ID=${row.GUID}`,
3940
'Do you want to delete the template?',
4041
)
@@ -98,6 +99,7 @@ const ConnectorListTemplates = () => {
9899
)}
99100
<CippPageList
100101
title="Exchange Connector Templates"
102+
titleButton={<TitleButton href="/email/connectors/add-template" title="Add Template" />}
101103
datatable={{
102104
reportName: `${tenant?.defaultDomainName}-Groups`,
103105
path: '/api/ListExconnectorTemplates',

src/views/email-exchange/transport/DeployTransport.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Error.propTypes = {
3131

3232
const requiredArray = (value) => (value && value.length !== 0 ? undefined : 'Required')
3333
const AddPolicy = () => {
34-
const [intuneGetRequest, intuneTemplates] = useLazyGenericGetRequestQuery()
34+
const [TransportGetRequest, TransportTemplates] = useLazyGenericGetRequestQuery()
3535
const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()
3636

3737
const handleSubmit = async (values) => {
@@ -41,7 +41,7 @@ const AddPolicy = () => {
4141
values.TemplateType = values.Type
4242
genericPostRequest({ path: '/api/AddTransportRule', values: values })
4343
}
44-
/* eslint-disable react/prop-types */
44+
//* eslint-disable react/prop-types */
4545
const WhenFieldChanges = ({ field, set }) => (
4646
<Field name={set} subscription={{}}>
4747
{(
@@ -52,7 +52,7 @@ const AddPolicy = () => {
5252
{({ form }) => (
5353
<OnChange name={field}>
5454
{(value) => {
55-
let template = intuneTemplates.data.filter(function (obj) {
55+
let template = TransportTemplates.data.filter(function (obj) {
5656
return obj.GUID === value
5757
})
5858
// console.log(template[0][set])
@@ -73,7 +73,7 @@ const AddPolicy = () => {
7373
<CippWizard
7474
initialValues={{ ...formValues }}
7575
onSubmit={handleSubmit}
76-
wizardTitle="Add Intune policy"
76+
wizardTitle="Add Transport Rule"
7777
>
7878
<CippWizard.Page
7979
title="Tenant Choice"
@@ -87,7 +87,7 @@ const AddPolicy = () => {
8787
<Field name="selectedTenants" validate={requiredArray}>
8888
{(props) => (
8989
<WizardTableField
90-
reportName="Add-MEM-Policy-Tenant-Selector"
90+
reportName="Add-Transport-Rule-Tenant-Selector"
9191
keyField="defaultDomainName"
9292
path="/api/ListTenants?AllTenantSelector=true"
9393
columns={[
@@ -122,12 +122,12 @@ const AddPolicy = () => {
122122
<hr className="my-4" />
123123
<CRow>
124124
<CCol md={12}>
125-
{intuneTemplates.isUninitialized &&
126-
intuneGetRequest({ path: 'api/ListTransportRulesTemplates' })}
127-
{intuneTemplates.isSuccess && (
125+
{TransportTemplates.isUninitialized &&
126+
TransportGetRequest({ path: 'api/ListTransportRulesTemplates' })}
127+
{TransportTemplates.isSuccess && (
128128
<RFFCFormSelect
129129
name="TemplateList"
130-
values={intuneTemplates.data?.map((template) => ({
130+
values={TransportTemplates.data?.map((template) => ({
131131
value: template.GUID,
132132
label: template.name,
133133
}))}
@@ -160,7 +160,7 @@ const AddPolicy = () => {
160160
{!postResults.isSuccess && (
161161
<FormSpy>
162162
{(props) => {
163-
/* eslint-disable react/prop-types */
163+
//* eslint-disable react/prop-types */
164164
return (
165165
<>
166166
<CRow>

src/views/email-exchange/transport/ListTransportTemplates.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const TransportListTemplates = () => {
1616
const [ExecuteGetRequest, getResults] = useLazyGenericGetRequestQuery()
1717
const Offcanvas = (row, rowIndex, formatExtraData) => {
1818
const [ocVisible, setOCVisible] = useState(false)
19-
const handleDeleteIntuneTemplate = (apiurl, message) => {
19+
const handleDeleteTransportTemplate = (apiurl, message) => {
2020
ModalService.confirm({
2121
title: 'Confirm',
2222
body: <div>{message}</div>,
@@ -35,7 +35,7 @@ const TransportListTemplates = () => {
3535
variant="ghost"
3636
color="danger"
3737
onClick={() =>
38-
handleDeleteIntuneTemplate(
38+
handleDeleteTransportTemplate(
3939
`/api/RemoveTransportRuleTemplate?ID=${row.GUID}`,
4040
'Do you want to delete the template?',
4141
)

0 commit comments

Comments
 (0)