Skip to content

Commit 3199162

Browse files
authored
Merge pull request #4325 from kris6673/feat-ap-deployments
Feat: Add Autopilot Deployments report
2 parents eeaa2fd + 9b67a2f commit 3199162

File tree

3 files changed

+124
-1
lines changed

3 files changed

+124
-1
lines changed

src/layouts/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ export const nativeMenuItems = [
264264
items: [
265265
{ title: "Analytics Device Score", path: "/endpoint/reports/analyticsdevicescore" },
266266
{ title: "Work from anywhere", path: "/endpoint/reports/workfromanywhere" },
267+
{ title: "Autopilot Deployments", path: "/endpoint/reports/autopilot-deployment" },
267268
],
268269
},
269270
],
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import { EyeIcon, DocumentTextIcon } from "@heroicons/react/24/outline";
2+
import { Layout as DashboardLayout } from "/src/layouts/index.js";
3+
import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx";
4+
import { useSettings } from "/src/hooks/use-settings";
5+
import { CheckCircle, Error, Warning, Refresh } from "@mui/icons-material";
6+
7+
const Page = () => {
8+
const pageTitle = "Autopilot Deployments";
9+
const tenantFilter = useSettings().currentTenant;
10+
11+
// Actions for viewing device in Intune and deployment details
12+
const actions = [
13+
{
14+
label: "View Device in Intune",
15+
link: `https://intune.microsoft.com/${tenantFilter}/#view/Microsoft_Intune_Devices/DeviceSettingsMenuBlade/~/overview/mdmDeviceId/[deviceId]`,
16+
color: "info",
17+
icon: <EyeIcon />,
18+
target: "_blank",
19+
multiPost: false,
20+
external: true,
21+
},
22+
{
23+
label: "View Deployment Details",
24+
link: `https://intune.microsoft.com/${tenantFilter}/#view/Microsoft_Intune_DeviceSettings/DeploymentOverviewMenuBlade/~/autopilotDeployment/deploymentProfileId/[windowsAutopilotDeploymentProfileDisplayName]`,
25+
color: "info",
26+
icon: <DocumentTextIcon />,
27+
target: "_blank",
28+
multiPost: false,
29+
external: true,
30+
},
31+
];
32+
33+
// Extended info fields for the off-canvas panel
34+
const offCanvas = {
35+
extendedInfoFields: [
36+
"id",
37+
"deviceId",
38+
"userId",
39+
"eventDateTime",
40+
"deviceRegisteredDateTime",
41+
"enrollmentStartDateTime",
42+
"enrollmentType",
43+
"deviceSerialNumber",
44+
"managedDeviceName",
45+
"userPrincipalName",
46+
"windowsAutopilotDeploymentProfileDisplayName",
47+
"enrollmentState",
48+
"windows10EnrollmentCompletionPageConfigurationDisplayName",
49+
"deploymentState",
50+
"deviceSetupStatus",
51+
"accountSetupStatus",
52+
"osVersion",
53+
"deploymentDuration",
54+
"deploymentTotalDuration",
55+
"deviceSetupDuration",
56+
"accountSetupDuration",
57+
"deploymentStartDateTime",
58+
"deploymentEndDateTime",
59+
"enrollmentFailureDetails",
60+
],
61+
actions: actions,
62+
};
63+
64+
// Columns to be displayed in the table (most important first)
65+
const simpleColumns = [
66+
"managedDeviceName",
67+
"eventDateTime",
68+
"deviceSerialNumber",
69+
"userPrincipalName",
70+
"deploymentState",
71+
"enrollmentState",
72+
"enrollmentType",
73+
"deploymentTotalDuration",
74+
"windowsAutopilotDeploymentProfileDisplayName",
75+
"enrollmentFailureDetails",
76+
];
77+
78+
// Predefined filters for common deployment scenarios
79+
const filterList = [
80+
{
81+
filterName: "Failed Deployments",
82+
value: [{ id: "deploymentState", value: "failed" }],
83+
type: "column",
84+
},
85+
{
86+
filterName: "Successful Deployments",
87+
value: [{ id: "deploymentState", value: "success" }],
88+
type: "column",
89+
},
90+
];
91+
92+
return (
93+
<CippTablePage
94+
title={pageTitle}
95+
apiUrl="/api/ListGraphRequest"
96+
apiData={{
97+
endpoint: "deviceManagement/autopilotEvents",
98+
$orderBy: "enrollmentStartDateTime desc",
99+
$top: 999,
100+
}}
101+
apiDataKey="Results"
102+
actions={actions}
103+
offCanvas={offCanvas}
104+
simpleColumns={simpleColumns}
105+
filters={filterList}
106+
/>
107+
);
108+
};
109+
110+
Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>;
111+
112+
export default Page;

src/utils/get-cipp-formatting.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,17 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
645645
);
646646
}
647647

648-
const durationArray = ["autoExtendDuration"];
648+
// ISO 8601 Duration Formatting
649+
// Add property names here to automatically format ISO 8601 duration strings (e.g., "PT1H23M30S")
650+
// into human-readable format (e.g., "1 hour 23 minutes 30 seconds") across all CIPP tables.
651+
// This works for any API response property that contains ISO 8601 duration format.
652+
const durationArray = [
653+
"autoExtendDuration", // GDAP page (/tenant/gdap-management/relationships)
654+
"deploymentDuration", // AutoPilot deployments (/endpoint/reports/autopilot-deployment)
655+
"deploymentTotalDuration", // AutoPilot deployments (/endpoint/reports/autopilot-deployment)
656+
"deviceSetupDuration", // AutoPilot deployments (/endpoint/reports/autopilot-deployment)
657+
"accountSetupDuration" // AutoPilot deployments (/endpoint/reports/autopilot-deployment)
658+
];
649659
if (durationArray.includes(cellName)) {
650660
isoDuration.setLocales(
651661
{

0 commit comments

Comments
 (0)