Skip to content

Commit

Permalink
Merge pull request #74 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 7, 2025
2 parents 6d4b105 + 823b4db commit c283b9a
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 36 deletions.
35 changes: 31 additions & 4 deletions src/components/CippIntegrations/CippApiClientManagement.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Button, Stack, SvgIcon, Menu, MenuItem, ListItemText } from "@mui/material";
import { Button, Stack, SvgIcon, Menu, MenuItem, ListItemText, Alert } from "@mui/material";
import { useState } from "react";
import isEqual from "lodash/isEqual";
import { useForm } from "react-hook-form";
import { ApiGetCall, ApiPostCall } from "/src/api/ApiCall";
import { ApiGetCall, ApiGetCallWithPagination, ApiPostCall } from "/src/api/ApiCall";
import { CippDataTable } from "../CippTable/CippDataTable";
import {
ChevronDownIcon,
Expand All @@ -15,6 +16,7 @@ import { CippApiDialog } from "../CippComponents/CippApiDialog";
import { Create, Key, Save, Sync } from "@mui/icons-material";
import { CippPropertyListCard } from "../CippCards/CippPropertyListCard";
import { CippCopyToClipBoard } from "../CippComponents/CippCopyToClipboard";
import { Box } from "@mui/system";

const CippApiClientManagement = () => {
const [openAddClientDialog, setOpenAddClientDialog] = useState(false);
Expand All @@ -36,6 +38,12 @@ const CippApiClientManagement = () => {
queryKey: "AzureConfiguration",
});

const apiClients = ApiGetCallWithPagination({
url: "/api/ExecApiClient",
data: { Action: "List" },
queryKey: "ApiClients",
});

const handleMenuOpen = (event) => {
setMenuAnchorEl(event.currentTarget);
};
Expand Down Expand Up @@ -223,7 +231,27 @@ const CippApiClientManagement = () => {
showDivider={false}
isFetching={azureConfig.isFetching}
/>

{azureConfig.isSuccess && Array.isArray(azureConfig.data?.Results?.ClientIDs) && (
<>
{!isEqual(
apiClients.data?.pages?.[0]?.Results?.filter((c) => c.Enabled)
.map((c) => c.ClientId)
.sort(),
azureConfig.data?.Results?.ClientIDs?.sort()
) && (
<Box sx={{ px: 3 }}>
<Alert severity="warning">
You have unsaved changes. Click Actions &gt; Save Azure Configuration to update
the allowed API Clients.
</Alert>
</Box>
)}
</>
)}
{}
<Box>
<CippApiResults apiObject={postCall} />
</Box>
<CippDataTable
actions={actions}
title="CIPP-API Clients"
Expand All @@ -235,7 +263,6 @@ const CippApiClientManagement = () => {
simpleColumns={["Enabled", "AppName", "ClientId", "Role", "IPRange"]}
queryKey={`ApiClients`}
/>
<CippApiResults apiObject={postCall} />
</Stack>

<CippApiDialog
Expand Down
82 changes: 50 additions & 32 deletions src/pages/tools/templatelib/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const TemplateLibrary = () => {
Command: { value: `New-CIPPTemplateRun` },
Parameters: { TemplateSettings: { ...values } },
ScheduledTime: unixTime,
Recurrence: { value: "4h" },
Recurrence: { value: values.tenantFilter?.value ? "4h" : "7d" },
};
};

Expand Down Expand Up @@ -108,38 +108,44 @@ const TemplateLibrary = () => {
</Grid>
</Grid>
<Divider sx={{ my: 2, width: "100%" }} />
<CippFormCondition
formControl={formControl}
field="templateRepo"
compareType="isNot"
compareValue={''}
>
<Grid item xs={12}>
<Typography variant="h6">Conditional Access</Typography>
<CippFormComponent
type="switch"
name="ca"
label="Create Conditional Access Templates"
formControl={formControl}
/>
</Grid>

<Grid item xs={12}>
<Typography variant="h6">Conditional Access</Typography>
<CippFormComponent
type="switch"
name="ca"
label="Create Conditional Access Templates"
formControl={formControl}
/>
</Grid>

<Grid item xs={12}>
<Typography variant="h6">Intune</Typography>
<CippFormComponent
type="switch"
name="intuneconfig"
label="Create Intune Configuration Templates"
formControl={formControl}
/>
<CippFormComponent
type="switch"
name="intunecompliance"
label="Create Intune Compliance Templates"
formControl={formControl}
/>
<CippFormComponent
type="switch"
name="intuneprotection"
label="Create Intune Protection Templates"
formControl={formControl}
/>
</Grid>
<Grid item xs={12}>
<Typography variant="h6">Intune</Typography>
<CippFormComponent
type="switch"
name="intuneconfig"
label="Create Intune Configuration Templates"
formControl={formControl}
/>
<CippFormComponent
type="switch"
name="intunecompliance"
label="Create Intune Compliance Templates"
formControl={formControl}
/>
<CippFormComponent
type="switch"
name="intuneprotection"
label="Create Intune Protection Templates"
formControl={formControl}
/>
</Grid>
</CippFormCondition>
<CippFormCondition
formControl={formControl}
field="templateRepo"
Expand All @@ -160,6 +166,18 @@ const TemplateLibrary = () => {
label="Create Group Templates"
formControl={formControl}
/>
<CippFormComponent
type="switch"
name="policyTemplates"
label="Create Policy Templates"
formControl={formControl}
/>
<CippFormComponent
type="switch"
name="caTemplates"
label="Create CA Templates"
formControl={formControl}
/>
</Grid>
</CippFormCondition>
</Grid>
Expand Down

0 comments on commit c283b9a

Please sign in to comment.