diff --git a/package.json b/package.json index 1a5926d62bfe..f58b604c130a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cipp", - "version": "8.5.0", + "version": "8.5.1", "author": "CIPP Contributors", "homepage": "https://cipp.app/", "bugs": { @@ -112,4 +112,4 @@ "eslint": "9.35.0", "eslint-config-next": "15.5.2" } -} +} \ No newline at end of file diff --git a/public/version.json b/public/version.json index 5cf63fb43067..f39cee3866d5 100644 --- a/public/version.json +++ b/public/version.json @@ -1,3 +1,3 @@ { - "version": "8.5.0" + "version": "8.5.1" } diff --git a/src/components/CippComponents/CippAutopilotProfileDrawer.jsx b/src/components/CippComponents/CippAutopilotProfileDrawer.jsx index 9ac21d1fd858..f5b48ae54040 100644 --- a/src/components/CippComponents/CippAutopilotProfileDrawer.jsx +++ b/src/components/CippComponents/CippAutopilotProfileDrawer.jsx @@ -1,7 +1,7 @@ -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { Divider, Button } from "@mui/material"; import { Grid } from "@mui/system"; -import { useForm } from "react-hook-form"; +import { useForm, useWatch, useFormState } from "react-hook-form"; import { AccountCircle } from "@mui/icons-material"; import { CippOffCanvas } from "./CippOffCanvas"; import CippFormComponent from "./CippFormComponent"; @@ -23,9 +23,9 @@ export const CippAutopilotProfileDrawer = ({ Description: "", DeviceNameTemplate: "", languages: null, - CollectHash: true, + CollectHash: false, Assignto: true, - DeploymentMode: true, + DeploymentMode: false, HideTerms: true, HidePrivacy: true, HideChangeAccount: true, @@ -37,15 +37,36 @@ export const CippAutopilotProfileDrawer = ({ const createProfile = ApiPostCall({ urlFromData: true, - relatedQueryKeys: ["Autopilot Profiles"], + relatedQueryKeys: ["Autopilot Profiles*"], }); + // Watch the deployment mode to conditionally disable white glove + const deploymentMode = useWatch({ + control: formControl.control, + name: "DeploymentMode", + }); + + // Watch form state for validation + const { isValid, isDirty } = useFormState({ + control: formControl.control, + }); + + // Automatically disable white glove when self-deploying mode (shared) is enabled + useEffect(() => { + if (deploymentMode === true) { + // Self-deploying mode is enabled (shared mode), disable white glove + formControl.setValue("allowWhiteglove", false); + } + }, [deploymentMode, formControl]); + const handleSubmit = () => { const formData = formControl.getValues(); + // Always set HideChangeAccount to true regardless of form state + formData.HideChangeAccount = true; createProfile.mutate({ url: "/api/AddAutopilotConfig", data: formData, - relatedQueryKeys: ["Autopilot Profiles"], + relatedQueryKeys: ["Autopilot Profiles*"], }); }; @@ -69,22 +90,32 @@ export const CippAutopilotProfileDrawer = ({ onClose={handleCloseDrawer} size="lg" footer={ -