Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cipp",
"version": "8.5.0",
"version": "8.5.1",
"author": "CIPP Contributors",
"homepage": "https://cipp.app/",
"bugs": {
Expand Down Expand Up @@ -112,4 +112,4 @@
"eslint": "9.35.0",
"eslint-config-next": "15.5.2"
}
}
}
2 changes: 1 addition & 1 deletion public/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "8.5.0"
"version": "8.5.1"
}
82 changes: 59 additions & 23 deletions src/components/CippComponents/CippAutopilotProfileDrawer.jsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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,
Expand All @@ -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*"],
});
};

Expand All @@ -69,22 +90,32 @@ export const CippAutopilotProfileDrawer = ({
onClose={handleCloseDrawer}
size="lg"
footer={
<div style={{ display: "flex", gap: "8px", justifyContent: "flex-start" }}>
<Button
variant="contained"
color="primary"
onClick={handleSubmit}
disabled={createProfile.isLoading}
<div>
<CippApiResults apiObject={createProfile} />
<div
style={{
display: "flex",
gap: "8px",
justifyContent: "flex-start",
marginTop: "16px",
}}
>
{createProfile.isLoading
? "Creating..."
: createProfile.isSuccess
? "Create Another"
: "Create Profile"}
</Button>
<Button variant="outlined" onClick={handleCloseDrawer}>
Close
</Button>
<Button
variant="contained"
color="primary"
onClick={handleSubmit}
disabled={createProfile.isLoading || !isValid}
>
{createProfile.isLoading
? "Creating..."
: createProfile.isSuccess
? "Create Another"
: "Create Profile"}
</Button>
<Button variant="outlined" onClick={handleCloseDrawer}>
Close
</Button>
</div>
</div>
}
>
Expand Down Expand Up @@ -114,6 +145,7 @@ export const CippAutopilotProfileDrawer = ({
name="DisplayName"
formControl={formControl}
validators={{ required: "Display Name is required" }}
required={true}
/>
</Grid>

Expand Down Expand Up @@ -202,6 +234,12 @@ export const CippAutopilotProfileDrawer = ({
label="Allow White Glove OOBE"
name="allowWhiteglove"
formControl={formControl}
disabled={deploymentMode === true}
helperText={
deploymentMode === true
? "White Glove is not supported with Self-deploying mode (shared devices)"
: undefined
}
/>
<CippFormComponent
type="switch"
Expand All @@ -210,8 +248,6 @@ export const CippAutopilotProfileDrawer = ({
formControl={formControl}
/>
</Grid>

<CippApiResults apiObject={createProfile} />
</Grid>
</CippOffCanvas>
</>
Expand Down
24 changes: 24 additions & 0 deletions src/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
AutoStories,
Gavel,
Celebration,
ClearAll as ClearAllIcon,
} from "@mui/icons-material";
import { SvgIcon } from "@mui/material";
import discordIcon from "../../public/discord-mark-blue.svg";
Expand Down Expand Up @@ -196,6 +197,29 @@ const App = (props) => {
},
]
: []), // toRemove
{
// add clear cache action that removes the persisted query cache from local storage and reloads the page
id: "clearCache",
icon: <ClearAllIcon />,
name: "Clear Cache and Reload",
onClick: () => {
// Clear the TanStack Query cache
queryClient.clear();

// Remove persisted cache from localStorage
if (typeof window !== "undefined") {
// Remove the persisted query cache keys
Object.keys(localStorage).forEach((key) => {
if (key.startsWith("REACT_QUERY_OFFLINE_CACHE")) {
localStorage.removeItem(key);
}
});
}

// Force refresh the page to bypass browser cache and reload JavaScript
window.location.reload(true);
},
},
{
id: "license",
icon: <Gavel />,
Expand Down
7 changes: 0 additions & 7 deletions src/utils/get-cipp-filter-variant.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,4 @@ export const getCippFilterVariant = (providedColumnKeys, arg) => {
filterFn: "betweenInclusive",
};
}

// Default fallback for any remaining cases - use text filter to avoid localeCompare issues
return {
filterVariant: "text",
sortingFn: "alphanumeric",
filterFn: "includes",
};
};