diff --git a/src/components/CippIntegrations/CippIntegrationFieldMapping.jsx b/src/components/CippIntegrations/CippIntegrationFieldMapping.jsx index 53a88787de19..d3e2ad8d728d 100644 --- a/src/components/CippIntegrations/CippIntegrationFieldMapping.jsx +++ b/src/components/CippIntegrations/CippIntegrationFieldMapping.jsx @@ -7,16 +7,19 @@ import { Tooltip, Button, Alert, + SvgIcon, } from "@mui/material"; import CippFormSection from "../CippFormPages/CippFormSection"; import { useForm } from "react-hook-form"; -import { ApiGetCall } from "../../api/ApiCall"; +import { ApiGetCall, ApiPostCall } from "../../api/ApiCall"; import { useRouter } from "next/router"; import extensions from "../../data/Extensions.json"; import React, { useEffect, useState } from "react"; import CippFormComponent from "../CippComponents/CippFormComponent"; import { Sync } from "@mui/icons-material"; import { Stack, Grid } from "@mui/system"; +import { PlusSmallIcon } from "@heroicons/react/24/outline"; +import { CippApiResults } from "../CippComponents/CippApiResults"; const CippIntegrationFieldMapping = () => { const router = useRouter(); @@ -36,6 +39,25 @@ const CippIntegrationFieldMapping = () => { const extension = extensions.find((extension) => extension.id === router.query.id); const [missingMappings, setMissingMappings] = useState([]); + const createFlexibleAssetCall = ApiPostCall({ + urlFromData: true, + queryKey: "CreateFlexibleAssetType", + }); + + const handleCreateFlexibleAsset = (assetType) => { + createFlexibleAssetCall.mutate( + { + url: "/api/ExecITGlueCreateFlexibleAssetType", + data: { AssetType: assetType }, + }, + { + onSuccess: () => { + fieldMapping.refetch(); + }, + } + ); + }; + useEffect(() => { if (fieldMapping.isSuccess) { var newMappings = {}; @@ -116,28 +138,52 @@ const CippIntegrationFieldMapping = () => { (field) => field.FieldType === header.FieldType ).map((field, fieldIndex) => ( - - (integrationField?.type === field.Type && - integrationField?.FieldType === field.FieldType) || - integrationField?.type === "unset" - )?.map((integrationField) => { - return { - label: integrationField?.name, - value: integrationField?.value, - }; - })} - formControl={formControl} - multiple={false} - creatable={false} - fullWidth - isFetching={fieldMapping.isFetching} - disableClearable={true} - /> + + + + (integrationField?.type === field.Type && + integrationField?.FieldType === field.FieldType) || + integrationField?.type === "unset" + )?.map((integrationField) => { + return { + label: integrationField?.name, + value: integrationField?.value, + }; + })} + formControl={formControl} + multiple={false} + creatable={false} + fullWidth + isFetching={fieldMapping.isFetching} + disableClearable={true} + /> + + {field.FieldName === "ConditionalAccessPolicies" && + router.query.id === "ITGlue" && ( + + + + )} + ))} @@ -148,6 +194,7 @@ const CippIntegrationFieldMapping = () => { The following mappings are missing: {missingMappings.join(", ")} )} + ) : ( diff --git a/src/data/Extensions.json b/src/data/Extensions.json index 21471f5e295c..32b160cd54a2 100644 --- a/src/data/Extensions.json +++ b/src/data/Extensions.json @@ -642,6 +642,128 @@ "fieldMapping": true, "showSyncButton": true }, + { + "name": "ITGlue", + "id": "ITGlue", + "type": "ITGlue", + "cat": "Documentation", + "logo": "/assets/integrations/itglue.png", + "logoDark": "/assets/integrations/itglue_dark.png", + "forceSyncButton": true, + "description": "Enable the ITGlue integration to sync M365 documentation", + "helpText": "This integration populates Flexible Assets, native Contacts, and native Configurations in ITGlue with Microsoft 365 tenant data including users, devices, domains, licenses, and mailboxes. Map your tenants to ITGlue organisations and optionally map Flexible Asset Types for rich M365 content.", + "links": [ + { + "name": "ITGlue API Documentation", + "url": "https://api.itglue.com/developer" + } + ], + "SettingOptions": [ + { + "type": "switch", + "name": "ITGlue.Enabled", + "label": "Enable Integration" + }, + { + "type": "select", + "name": "ITGlue.Region", + "label": "ITGlue Region", + "options": [ + { "label": "US (api.itglue.com)", "value": "api.itglue.com" }, + { "label": "EU (api.eu.itglue.com)", "value": "api.eu.itglue.com" } + ], + "condition": { + "field": "ITGlue.Enabled", + "compareType": "is", + "compareValue": true, + "action": "disable" + } + }, + { + "type": "password", + "name": "ITGlue.APIKey", + "label": "ITGlue API Key", + "placeholder": "Enter your ITGlue API Key", + "required": true, + "condition": { + "field": "ITGlue.Enabled", + "compareType": "is", + "compareValue": true, + "action": "disable" + } + }, + { + "type": "switch", + "name": "ITGlue.CreateMissingContacts", + "label": "Create or update users as native ITGlue Contacts", + "condition": { + "field": "ITGlue.Enabled", + "compareType": "is", + "compareValue": true, + "action": "disable" + } + }, + { + "type": "switch", + "name": "ITGlue.CreateMissingConfigurations", + "label": "Create or update devices as native ITGlue Configurations", + "condition": { + "field": "ITGlue.Enabled", + "compareType": "is", + "compareValue": true, + "action": "disable" + } + }, + { + "type": "switch", + "name": "ITGlue.SyncConditionalAccessPolicies", + "label": "Sync Conditional Access Policies to Flexible Assets", + "condition": { + "field": "ITGlue.Enabled", + "compareType": "is", + "compareValue": true, + "action": "disable" + } + }, + { + "type": "textField", + "name": "ITGlue.ExcludeSerials", + "label": "Exclude device serials (comma separated)", + "condition": { + "field": "ITGlue.Enabled", + "compareType": "is", + "compareValue": true, + "action": "disable" + } + }, + { + "type": "switch", + "name": "ITGlue.ImportDomains", + "label": "Import domains and license summary into organisation Quick Notes", + "condition": { + "field": "ITGlue.Enabled", + "compareType": "is", + "compareValue": true, + "action": "disable" + } + }, + { + "type": "datePicker", + "name": "ITGlue.NextSync", + "label": "Reschedule next sync date", + "helperText": "Set a future date to delay the next scheduled sync. Leave blank to sync during the next scheduled window.", + "condition": { + "field": "ITGlue.Enabled", + "compareType": "is", + "compareValue": true, + "action": "disable" + } + } + ], + "mappingRequired": true, + "fieldMapping": true, + "showSyncButton": true + }, { "name": "PasswordPusher", "id": "PWPush",