Skip to content

Commit 98e2f2a

Browse files
committed
Merge branch 'main' of https://github.com/Techary/CIPP
2 parents 69f6ddf + 79006d9 commit 98e2f2a

6 files changed

Lines changed: 331 additions & 24 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Azure Static Web Apps CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build_and_deploy_job:
10+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
11+
runs-on: ubuntu-latest
12+
name: Build and Deploy Job
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
submodules: true
17+
lfs: false
18+
- name: Build And Deploy
19+
id: builddeploy
20+
uses: Azure/static-web-apps-deploy@v1
21+
with:
22+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_RED_BAY_037300C03 }}
23+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
24+
action: "upload"
25+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
26+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
27+
app_location: "/" # App source code path
28+
api_location: "" # Api source code path - optional
29+
output_location: "/out" # Built app content directory - optional
30+
###### End of Repository/Build Configurations ######
31+
32+
close_pull_request_job:
33+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
34+
runs-on: ubuntu-latest
35+
name: Close Pull Request Job
36+
steps:
37+
- name: Close Pull Request
38+
id: closepullrequest
39+
uses: Azure/static-web-apps-deploy@v1
40+
with:
41+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_RED_BAY_037300C03 }}
42+
action: "close"
43+
44+

.github/workflows/pr_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ jobs:
5959
...context.repo,
6060
pull_number: context.issue.number,
6161
state: 'closed'
62-
});
62+
});

src/components/CippComponents/CippApplicationDeployDrawer.jsx

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ export const CippApplicationDeployDrawer = ({
208208
label: "CW Command",
209209
isSponsor: false,
210210
},
211+
{
212+
value: "NCentral",
213+
label: "N-able N-Central",
214+
isSponsor: false,
215+
},
211216
]}
212217
formControl={formControl}
213218
multiple={false}
@@ -375,6 +380,74 @@ export const CippApplicationDeployDrawer = ({
375380
))}
376381
</CippFormCondition>
377382

383+
{/* For "NCentral" */}
384+
<CippFormCondition
385+
formControl={formControl}
386+
field="rmmname.value"
387+
compareType="is"
388+
compareValue="NCentral"
389+
>
390+
<Grid size={{ md: 6, xs: 12 }}>
391+
<CippFormComponent
392+
type="textField"
393+
label="N-Central Server Address (e.g., ncentral.yourdomain.com)"
394+
name="params.ServerAddress"
395+
formControl={formControl}
396+
validators={{ required: "Server Address is required" }}
397+
/>
398+
</Grid>
399+
<Grid size={{ md: 6, xs: 12 }}>
400+
<CippFormComponent
401+
type="textField"
402+
label="Server Port (default: 443)"
403+
name="params.ServerPort"
404+
formControl={formControl}
405+
defaultValue="443"
406+
/>
407+
</Grid>
408+
{selectedTenants?.map((tenant, index) => (
409+
<Grid size={{ md: 6, xs: 12 }} key={tenant.addedFields.customerId || index}>
410+
<CippFormComponent
411+
type="textField"
412+
label={`Customer ID for ${tenant.label}`}
413+
name={`params.CustomerID.${tenant.addedFields.customerId}`}
414+
formControl={formControl}
415+
validators={{ required: `Customer ID for ${tenant.label} is required` }}
416+
/>
417+
</Grid>
418+
))}
419+
{selectedTenants?.map((tenant, index) => (
420+
<Grid
421+
size={{ md: 6, xs: 12 }}
422+
key={`${tenant.addedFields.customerId}_name_${index}`}
423+
>
424+
<CippFormComponent
425+
type="textField"
426+
label={`Customer Name for ${tenant.label}`}
427+
name={`params.CustomerName.${tenant.addedFields.customerId}`}
428+
formControl={formControl}
429+
validators={{ required: `Customer Name for ${tenant.label} is required` }}
430+
/>
431+
</Grid>
432+
))}
433+
{selectedTenants?.map((tenant, index) => (
434+
<Grid
435+
size={{ md: 6, xs: 12 }}
436+
key={`${tenant.addedFields.customerId}_token_${index}`}
437+
>
438+
<CippFormComponent
439+
type="textField"
440+
label={`Registration Token for ${tenant.label}`}
441+
name={`params.RegistrationToken.${tenant.addedFields.customerId}`}
442+
formControl={formControl}
443+
validators={{
444+
required: `Registration Token for ${tenant.label} is required`,
445+
}}
446+
/>
447+
</Grid>
448+
))}
449+
</CippFormCondition>
450+
378451
{/* Assign To Options */}
379452
<Grid size={{ xs: 12 }}>
380453
<CippFormComponent

src/components/CippIntegrations/CippIntegrationFieldMapping.jsx

Lines changed: 70 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ import {
77
Tooltip,
88
Button,
99
Alert,
10+
SvgIcon,
1011
} from "@mui/material";
1112
import CippFormSection from "../CippFormPages/CippFormSection";
1213
import { useForm } from "react-hook-form";
13-
import { ApiGetCall } from "../../api/ApiCall";
14+
import { ApiGetCall, ApiPostCall } from "../../api/ApiCall";
1415
import { useRouter } from "next/router";
1516
import extensions from "../../data/Extensions.json";
1617
import React, { useEffect, useState } from "react";
1718
import CippFormComponent from "../CippComponents/CippFormComponent";
1819
import { Sync } from "@mui/icons-material";
1920
import { Stack, Grid } from "@mui/system";
21+
import { PlusSmallIcon } from "@heroicons/react/24/outline";
22+
import { CippApiResults } from "../CippComponents/CippApiResults";
2023

2124
const CippIntegrationFieldMapping = () => {
2225
const router = useRouter();
@@ -36,6 +39,25 @@ const CippIntegrationFieldMapping = () => {
3639
const extension = extensions.find((extension) => extension.id === router.query.id);
3740
const [missingMappings, setMissingMappings] = useState([]);
3841

42+
const createFlexibleAssetCall = ApiPostCall({
43+
urlFromData: true,
44+
queryKey: "CreateFlexibleAssetType",
45+
});
46+
47+
const handleCreateFlexibleAsset = (assetType) => {
48+
createFlexibleAssetCall.mutate(
49+
{
50+
url: "/api/ExecITGlueCreateFlexibleAssetType",
51+
data: { AssetType: assetType },
52+
},
53+
{
54+
onSuccess: () => {
55+
fieldMapping.refetch();
56+
},
57+
}
58+
);
59+
};
60+
3961
useEffect(() => {
4062
if (fieldMapping.isSuccess) {
4163
var newMappings = {};
@@ -116,28 +138,52 @@ const CippIntegrationFieldMapping = () => {
116138
(field) => field.FieldType === header.FieldType
117139
).map((field, fieldIndex) => (
118140
<Grid size={{ xs: 12, md: 6 }} key={`field-${headerIndex}-${fieldIndex}`}>
119-
<CippFormComponent
120-
name={field.FieldName}
121-
type="autoComplete"
122-
label={field.FieldLabel}
123-
options={fieldMapping?.data?.IntegrationFields?.filter(
124-
(integrationField) =>
125-
(integrationField?.type === field.Type &&
126-
integrationField?.FieldType === field.FieldType) ||
127-
integrationField?.type === "unset"
128-
)?.map((integrationField) => {
129-
return {
130-
label: integrationField?.name,
131-
value: integrationField?.value,
132-
};
133-
})}
134-
formControl={formControl}
135-
multiple={false}
136-
creatable={false}
137-
fullWidth
138-
isFetching={fieldMapping.isFetching}
139-
disableClearable={true}
140-
/>
141+
<Stack direction="row" spacing={1} alignItems="flex-start">
142+
<Box sx={{ flexGrow: 1 }}>
143+
<CippFormComponent
144+
name={field.FieldName}
145+
type="autoComplete"
146+
label={field.FieldLabel}
147+
options={fieldMapping?.data?.IntegrationFields?.filter(
148+
(integrationField) =>
149+
(integrationField?.type === field.Type &&
150+
integrationField?.FieldType === field.FieldType) ||
151+
integrationField?.type === "unset"
152+
)?.map((integrationField) => {
153+
return {
154+
label: integrationField?.name,
155+
value: integrationField?.value,
156+
};
157+
})}
158+
formControl={formControl}
159+
multiple={false}
160+
creatable={false}
161+
fullWidth
162+
isFetching={fieldMapping.isFetching}
163+
disableClearable={true}
164+
/>
165+
</Box>
166+
{field.FieldName === "ConditionalAccessPolicies" &&
167+
router.query.id === "ITGlue" && (
168+
<Tooltip title="Create Flexible Asset Type">
169+
<Button
170+
size="small"
171+
variant="contained"
172+
onClick={() =>
173+
handleCreateFlexibleAsset("ConditionalAccessPolicies")
174+
}
175+
disabled={
176+
createFlexibleAssetCall.isPending || fieldMapping.isFetching
177+
}
178+
sx={{ mt: 1, minWidth: "auto" }}
179+
>
180+
<SvgIcon>
181+
<PlusSmallIcon />
182+
</SvgIcon>
183+
</Button>
184+
</Tooltip>
185+
)}
186+
</Stack>
141187
</Grid>
142188
))}
143189
</Grid>
@@ -148,6 +194,7 @@ const CippIntegrationFieldMapping = () => {
148194
The following mappings are missing: {missingMappings.join(", ")}
149195
</Alert>
150196
)}
197+
<CippApiResults apiObject={createFlexibleAssetCall} />
151198
</>
152199
</CippFormSection>
153200
) : (

src/components/CippWizard/CippWizardOffboarding.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,27 @@ export const CippWizardOffboarding = (props) => {
432432
type="switch"
433433
formControl={formControl}
434434
/>
435+
436+
<CippFormCondition
437+
formControl={formControl}
438+
field={"postExecution.psa"}
439+
compareType="is"
440+
compareValue={true}
441+
>
442+
<Grid size={{ sm: 12, xs: 12 }}>
443+
<CippFormComponent
444+
name="postExecution.psaTicketId"
445+
label="PSA Ticket ID"
446+
type="textField"
447+
fullWidth
448+
formControl={formControl}
449+
inputProps={{
450+
inputMode: "numeric",
451+
pattern: "[0-9]*",
452+
}}
453+
/>
454+
</Grid>
455+
</CippFormCondition>
435456
</Grid>
436457

437458
<Grid size={{ sm: 12, xs: 12 }}>

0 commit comments

Comments
 (0)