Skip to content

Commit

Permalink
Merge pull request #79 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
pull[bot] authored Feb 8, 2025
2 parents 23ceca2 + ce38565 commit 0119201
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 45 deletions.
51 changes: 29 additions & 22 deletions src/components/CippIntegrations/CippIntegrationSettings.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Box, Grid } from "@mui/material";
import { Box } from "@mui/material";
import { Grid } from "@mui/system";
import CippFormSection from "/src/components/CippFormPages/CippFormSection";
import CippFormComponent from "/src/components/CippComponents/CippFormComponent";
import { useForm } from "react-hook-form";
import { useSettings } from "/src/hooks/use-settings";
import { ApiGetCall } from "/src/api/ApiCall";
import { useRouter } from "next/router";
import extensions from "/src/data/Extensions.json";
import { useEffect } from "react";
import React, { useEffect } from "react";
import { CippFormCondition } from "../CippComponents/CippFormCondition";

const CippIntegrationSettings = ({ children }) => {
Expand Down Expand Up @@ -44,7 +45,7 @@ const CippIntegrationSettings = ({ children }) => {
<>
{integrations.isSuccess && extension ? (
<CippFormSection
queryKey={"Integrations"}
relatedQueryKeys={"Integrations"}
formControl={formControl}
formPageType="Integration"
title={extension.name}
Expand All @@ -56,10 +57,27 @@ const CippIntegrationSettings = ({ children }) => {

<Grid container sx={{ alignItems: "center" }}>
{extension.SettingOptions.map((setting, index) => (
<Grid item xs={12} md={setting.type == "switch" ? 12 : 6} key={index}>
<Box sx={{ p: 1 }}>
{setting?.condition ? (
<CippFormCondition {...setting.condition} formControl={formControl}>
<React.Fragment key={index}>
{setting?.condition ? (
<CippFormCondition {...setting.condition} formControl={formControl}>
<Grid item size={{ xs: 12, md: setting.type === "switch" ? 12 : 6 }}>
<Box sx={{ p: 1 }}>
<CippFormComponent
name={setting.name}
type={setting.type}
label={setting.label}
options={setting.options}
formControl={formControl}
placeholder={setting?.placeholder}
fullWidth
{...setting}
/>
</Box>
</Grid>
</CippFormCondition>
) : (
<Grid item size={{ xs: 12, md: setting.type === "switch" ? 12 : 6 }}>
<Box sx={{ p: 1 }}>
<CippFormComponent
name={setting.name}
type={setting.type}
Expand All @@ -70,21 +88,10 @@ const CippIntegrationSettings = ({ children }) => {
fullWidth
{...setting}
/>
</CippFormCondition>
) : (
<CippFormComponent
name={setting.name}
type={setting.type}
label={setting.label}
options={setting.options}
formControl={formControl}
placeholder={setting?.placeholder}
fullWidth
{...setting}
/>
)}
</Box>
</Grid>
</Box>
</Grid>
)}
</React.Fragment>
))}
</Grid>
</CippFormSection>
Expand Down
59 changes: 37 additions & 22 deletions src/data/Extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,17 @@
"type": "switch",
"name": "Hudu.MonitorDomains",
"label": "Monitor domains in Hudu"
},
{
"_comment": "I have added this switch as a logic check for the Hudu integration script to check against when CIPP first connects to the Hudu Instance via Connect-HuduAPI.ps1",
"type": "switch",
"name": "Hudu.CFEnabled",
"label": "Connect to HUDU through CloudFlare Tunnel with the Service Account credentials.",
"condition": {
"field": "CFZTNA.Enabled",
"compareType": "is",
"compareValue": true
}
}
],
"mappingRequired": true,
Expand All @@ -337,7 +348,7 @@
"logoDark": "/assets/integrations/pwpush_dark.png",
"forceSyncButton": false,
"description": "Enable the PasswordPusher integration to generate password links instead of plain text passwords.",
"helpText": "This integration allows you to generate password links instead of plain text passwords. Configure authentication and expiration settings that will apply to all generated passwords. If you are a PWPush Pro customer and utilizing custom domains, please do not enter your custom domain in the Base URL field.",
"helpText": "This integration allows you to generate password links instead of plain text passwords. Configure authentication and expiration settings that will apply to all generated passwords. If you are a Hosted PWPush Pro customer you can also select an account for branding if you enable Bearer Authentication. Self-Hosted must use the Email Address and API Key method for authenticated pushes.",
"links": [
{
"name": "PWPush Documentation",
Expand All @@ -352,36 +363,42 @@
{
"type": "switch",
"name": "PWPush.Enabled",
"label": "Enable Integration - Replace passwords with PWPush links"
"label": "Enable Integration"
},
{
"type": "switch",
"name": "PWPush.PWPushPro",
"label": "PWPush Pro/Premium account"
"name": "PWPush.UseBearerAuth",
"label": "Use Bearer Authentication (Hosted only)"
},
{
"type": "textField",
"name": "PWPush.BaseUrl",
"label": "PWPush URL",
"placeholder": "Enter your PWPush URL. (default: https://pwpush.com)"
},
{
"type": "textField",
"name": "PWPush.EmailAddress",
"label": "PWPush email address",
"placeholder": "Enter your email address for PWPush. (Free/Self-Hosted only)"
},
{
"type": "password",
"name": "PWPush.APIKey",
"label": "PWPush API Key",
"placeholder": "Enter your PWPush API Key. (optional)"
},
{
"type": "textField",
"name": "PWPush.EmailAddress",
"label": "PWPush email address",
"placeholder": "Enter your email address for PWPush. (Email & API Key auth)",
"condition": {
"field": "PWPush.UseBearerAuth",
"compareType": "is",
"compareValue": false
}
},
{
"type": "autoComplete",
"name": "PWPush.AccountId",
"label": "Select your PWPush Account for branding (Pro/Premium only)",
"label": "Select your PWPush Account for branding (Pro/Premium only, optional with Custom Domain)",
"multiple": false,
"creatable": false,
"api": {
"url": "/api/ExecExtensionMapping?List=PWPushFields",
"queryKey": "PWPushAccounts",
Expand All @@ -391,12 +408,11 @@
"showRefresh": true
},
"condition": {
"field": "PWPush.PWPushPro",
"field": "PWPush.UseBearerAuth",
"compareType": "is",
"compareValue": true
}
},

{
"type": "number",
"name": "PWPush.ExpireAfterDays",
Expand Down Expand Up @@ -454,7 +470,7 @@
},
{
"name": "CloudFlare ZTNA Tunnel",
"id": "CTZTNA",
"id": "CFZTNA",
"type": "ztna",
"cat": "Zero Trust Network Tunnel",
"logo": "/assets/integrations/cloudflare.png",
Expand All @@ -473,21 +489,20 @@
}
],
"SettingOptions": [
{
"type": "switch",
"name": "CFZTNA.Enabled",
"label": "Enable Integration"
},
{
"type": "password",
"name": "CloudFlareClientID.APIKey",
"name": "CFZTNA.ClientID",
"label": "CloudFlare Tunnel Service Account Client ID"
},
{
"type": "password",
"name": "CloudFlareAPIKey.APIKey",
"name": "CFZTNA.APIKey",
"label": "CloudFlare Tunnel Service Account Client Secret"
},
{
"_comment": "I have added this switch as a logic check for the Hudu integration script to check against when CIPP first connects to the Hudu Instance via Connect-HuduAPI.ps1",
"type": "switch",
"name": "Hudu.CFEnabled",
"label": " Connect to HUDU through CloudFlare Tunnel with the above Service Account credentials."
}
],
"mappingRequired": false
Expand Down
2 changes: 2 additions & 0 deletions src/pages/cipp/logs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const simpleColumns = [
"Message",
"API",
"Severity",
"AppId",
"IP",
"LogData",
];

Expand Down
15 changes: 14 additions & 1 deletion src/pages/cipp/settings/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const Page = () => {
resetForm={false}
postUrl="/api/ExecNotificationConfig"
relatedQueryKeys={["ListNotificationConfig"]}
isFetching={listNotificationConfig.isFetching}
addedButtons={
<Button variant="outlined" onClick={notificationDialog.handleOpen}>
Send Test Alert
Expand Down Expand Up @@ -150,21 +151,33 @@ const Page = () => {
</Grid>
</Box>
<CippApiDialog
row={{ writeLog: true }}
useDefaultValues={true}
title="Send Test Alert"
createDialog={notificationDialog}
fields={[
{
type: "switch",
name: "writeLog",
label: "Write Alert to Logbook (Notifications are sent hourly)",
},
{
type: "switch",
name: "sendEmailNow",
label: "Send Email Now",
},
{
type: "switch",
name: "sendWebhookNow",
label: "Send Webhook Now",
},
]}
api={{
confirmText:
"Are you sure you want to send a test alert to the email address(es) and webhook URL configured?",
url: "/api/ExecAddAlert",
type: "POST",
data: {},
data: { text: "This is a test from Notification Settings" },
}}
/>
</CippFormPage>
Expand Down

0 comments on commit 0119201

Please sign in to comment.