diff --git a/package.json b/package.json index 20dbe08ec9be..35da2539bbdb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cipp", - "version": "10.3.0", + "version": "10.3.1", "author": "CIPP Contributors", "homepage": "https://cipp.app/", "bugs": { diff --git a/public/version.json b/public/version.json index 7b3daeee0d1d..5646fed27b32 100644 --- a/public/version.json +++ b/public/version.json @@ -1,3 +1,3 @@ { - "version": "10.3.0" + "version": "10.3.1" } diff --git a/src/components/CippWizard/CippWizardVacationConfirmation.jsx b/src/components/CippWizard/CippWizardVacationConfirmation.jsx index 7df79784eda0..aa4867bfcb71 100644 --- a/src/components/CippWizard/CippWizardVacationConfirmation.jsx +++ b/src/components/CippWizard/CippWizardVacationConfirmation.jsx @@ -1,54 +1,67 @@ -import { Alert, Button, Card, CardContent, CardHeader, Chip, Divider, Stack, Typography } from "@mui/material"; -import { Grid } from "@mui/system"; -import { CippWizardStepButtons } from "./CippWizardStepButtons"; -import { CippApiResults } from "../CippComponents/CippApiResults"; -import { ApiPostCall } from "../../api/ApiCall"; -import { useWatch } from "react-hook-form"; -import Link from "next/link"; +import { + Alert, + Button, + Card, + CardContent, + CardHeader, + Chip, + Divider, + Stack, + Typography, +} from '@mui/material' +import { Grid } from '@mui/system' +import { CippWizardStepButtons } from './CippWizardStepButtons' +import { CippApiResults } from '../CippComponents/CippApiResults' +import { ApiPostCall } from '../../api/ApiCall' +import { useWatch } from 'react-hook-form' +import Link from 'next/link' export const CippWizardVacationConfirmation = (props) => { - const { formControl, onPreviousStep, currentStep, lastStep } = props; + const { formControl, onPreviousStep, currentStep, lastStep } = props - const values = useWatch({ control: formControl.control }); + const values = useWatch({ control: formControl.control }) - const caExclusion = ApiPostCall({ relatedQueryKeys: ["VacationMode"] }); - const mailboxVacation = ApiPostCall({ relatedQueryKeys: ["VacationMode"] }); - const forwardingVacation = ApiPostCall({ relatedQueryKeys: ["VacationMode"] }); - const oooVacation = ApiPostCall({ relatedQueryKeys: ["VacationMode"] }); + const caExclusion = ApiPostCall({ relatedQueryKeys: ['VacationMode'] }) + const mailboxVacation = ApiPostCall({ relatedQueryKeys: ['VacationMode'] }) + const forwardingVacation = ApiPostCall({ relatedQueryKeys: ['VacationMode'] }) + const oooVacation = ApiPostCall({ relatedQueryKeys: ['VacationMode'] }) - const tenantFilter = values.tenantFilter?.value || values.tenantFilter; + const tenantFilter = values.tenantFilter?.value || values.tenantFilter const isSubmitting = caExclusion.isPending || mailboxVacation.isPending || forwardingVacation.isPending || - oooVacation.isPending; + oooVacation.isPending const hasSubmitted = caExclusion.isSuccess || mailboxVacation.isSuccess || forwardingVacation.isSuccess || - oooVacation.isSuccess; + oooVacation.isSuccess const handleSubmit = () => { if (values.enableCAExclusion) { - caExclusion.mutate({ - url: "/api/ExecCAExclusion", - data: { - tenantFilter, - Users: values.Users, - PolicyId: values.PolicyId?.value, - StartDate: values.startDate, - EndDate: values.endDate, - vacation: true, - reference: values.reference || null, - postExecution: values.postExecution || [], - excludeLocationAuditAlerts: values.excludeLocationAuditAlerts || false, - }, - }); + const policies = Array.isArray(values.PolicyId) ? values.PolicyId : [values.PolicyId] + policies.forEach((policy) => { + caExclusion.mutate({ + url: '/api/ExecCAExclusion', + data: { + tenantFilter, + Users: values.Users, + PolicyId: policy?.value ?? policy, + StartDate: values.startDate, + EndDate: values.endDate, + vacation: true, + reference: values.reference || null, + postExecution: values.postExecution || [], + excludeLocationAuditAlerts: values.excludeLocationAuditAlerts || false, + }, + }) + }) } if (values.enableMailboxPermissions) { mailboxVacation.mutate({ - url: "/api/ExecScheduleMailboxVacation", + url: '/api/ExecScheduleMailboxVacation', data: { tenantFilter, mailboxOwners: values.Users, @@ -63,7 +76,7 @@ export const CippWizardVacationConfirmation = (props) => { reference: values.reference || null, postExecution: values.postExecution || [], }, - }); + }) } if (values.enableForwarding) { @@ -76,20 +89,46 @@ export const CippWizardVacationConfirmation = (props) => { endDate: values.endDate, reference: values.reference || null, postExecution: values.postExecution || [], - }; + } - if (values.forwardOption === "internalAddress") { - forwardingData.ForwardInternal = values.forwardInternal; + if (values.forwardOption === 'internalAddress') { + forwardingData.ForwardInternal = values.forwardInternal } - if (values.forwardOption === "ExternalAddress") { - forwardingData.ForwardExternal = values.forwardExternal; + if (values.forwardOption === 'ExternalAddress') { + forwardingData.ForwardExternal = values.forwardExternal } forwardingVacation.mutate({ - url: "/api/ExecScheduleForwardingVacation", + url: '/api/ExecScheduleForwardingVacation', data: forwardingData, - }); + }) + } + + if (values.enableForwarding) { + const forwardingData = { + tenantFilter, + Users: values.Users, + forwardOption: values.forwardOption, + KeepCopy: values.forwardKeepCopy || false, + startDate: values.startDate, + endDate: values.endDate, + reference: values.reference || null, + postExecution: values.postExecution || [], + } + + if (values.forwardOption === 'internalAddress') { + forwardingData.ForwardInternal = values.forwardInternal + } + + if (values.forwardOption === 'ExternalAddress') { + forwardingData.ForwardExternal = values.forwardExternal + } + + forwardingVacation.mutate({ + url: '/api/ExecScheduleForwardingVacation', + data: forwardingData, + }) } if (values.enableOOO) { @@ -102,47 +141,53 @@ export const CippWizardVacationConfirmation = (props) => { endDate: values.endDate, reference: values.reference || null, postExecution: values.postExecution || [], - }; + } // Calendar options — only include when truthy if (values.oooCreateOOFEvent) { - oooData.CreateOOFEvent = true; - if (values.oooOOFEventSubject) oooData.OOFEventSubject = values.oooOOFEventSubject; + oooData.CreateOOFEvent = true + if (values.oooOOFEventSubject) oooData.OOFEventSubject = values.oooOOFEventSubject } if (values.oooAutoDeclineFutureRequests) { - oooData.AutoDeclineFutureRequestsWhenOOF = true; + oooData.AutoDeclineFutureRequestsWhenOOF = true } if (values.oooDeclineEvents) { - oooData.DeclineEventsForScheduledOOF = true; - if (values.oooDeclineMeetingMessage) oooData.DeclineMeetingMessage = values.oooDeclineMeetingMessage; + oooData.DeclineEventsForScheduledOOF = true + if (values.oooDeclineMeetingMessage) + oooData.DeclineMeetingMessage = values.oooDeclineMeetingMessage } oooVacation.mutate({ - url: "/api/ExecScheduleOOOVacation", + url: '/api/ExecScheduleOOOVacation', data: oooData, - }); + }) } - }; + } const formatDate = (epoch) => { - if (!epoch) return "Not set"; - return new Date(epoch * 1000).toLocaleString(); - }; + if (!epoch) return 'Not set' + return new Date(epoch * 1000).toLocaleString() + } const formatUsers = (users) => { - if (!users || users.length === 0) return "None"; - return users.map((u) => u.label || u.value || u).join(", "); - }; + if (!users || users.length === 0) return 'None' + return users.map((u) => u.label || u.value || u).join(', ') + } const formatForwardingTarget = () => { - if (values.forwardOption === "internalAddress") { - return values.forwardInternal?.label || values.forwardInternal?.value || values.forwardInternal || "Not set"; + if (values.forwardOption === 'internalAddress') { + return ( + values.forwardInternal?.label || + values.forwardInternal?.value || + values.forwardInternal || + 'Not set' + ) } - if (values.forwardOption === "ExternalAddress") { - return values.forwardExternal || "Not set"; + if (values.forwardOption === 'ExternalAddress') { + return values.forwardExternal || 'Not set' } - return "Not set"; - }; + return 'Not set' + } return ( @@ -157,7 +202,7 @@ export const CippWizardVacationConfirmation = (props) => { Tenant - {tenantFilter || "Not selected"} + {tenantFilter || 'Not selected'} @@ -200,13 +245,13 @@ export const CippWizardVacationConfirmation = (props) => { values.enableMailboxPermissions, values.enableForwarding, values.enableOOO, - ].filter(Boolean).length; - const mdSize = enabledCount >= 4 ? 3 : enabledCount === 3 ? 4 : enabledCount === 2 ? 6 : 12; + ].filter(Boolean).length + const mdSize = enabledCount >= 4 ? 3 : enabledCount === 3 ? 4 : enabledCount === 2 ? 6 : 12 return ( {values.enableCAExclusion && ( - + } @@ -216,10 +261,14 @@ export const CippWizardVacationConfirmation = (props) => {
- Policy + {Array.isArray(values.PolicyId) && values.PolicyId.length > 1 + ? 'Policies' + : 'Policy'} - {values.PolicyId?.label || "Not selected"} + {Array.isArray(values.PolicyId) && values.PolicyId.length > 0 + ? values.PolicyId.map((p) => p.label || p.value).join(', ') + : 'Not selected'}
{values.excludeLocationAuditAlerts && ( @@ -237,7 +286,7 @@ export const CippWizardVacationConfirmation = (props) => { {values.enableMailboxPermissions && ( - + } @@ -256,8 +305,9 @@ export const CippWizardVacationConfirmation = (props) => { Permission Types - {(values.permissionTypes || []).map((p) => p.label || p.value).join(", ") || - "None"} + {(values.permissionTypes || []) + .map((p) => p.label || p.value) + .join(', ') || 'None'} {values.includeCalendar && ( @@ -266,8 +316,8 @@ export const CippWizardVacationConfirmation = (props) => { Calendar - {values.calendarPermission?.label || "Not set"} - {values.canViewPrivateItems ? " (Can view private items)" : ""} + {values.calendarPermission?.label || 'Not set'} + {values.canViewPrivateItems ? ' (Can view private items)' : ''} )} @@ -279,7 +329,7 @@ export const CippWizardVacationConfirmation = (props) => { {values.enableForwarding && ( - + } @@ -298,14 +348,18 @@ export const CippWizardVacationConfirmation = (props) => { Forwarding Type - {values.forwardOption === "ExternalAddress" ? "External Address" : "Internal Address"} + {values.forwardOption === 'ExternalAddress' + ? 'External Address' + : 'Internal Address'}
Keep Copy - {values.forwardKeepCopy ? "Yes" : "No"} + + {values.forwardKeepCopy ? 'Yes' : 'No'} +
@@ -315,7 +369,7 @@ export const CippWizardVacationConfirmation = (props) => { {values.enableOOO && ( - + } @@ -327,11 +381,13 @@ export const CippWizardVacationConfirmation = (props) => { Internal Message - + {values.oooInternalMessage - ? String(values.oooInternalMessage).replace(/[<>]/g, "").slice(0, 120) + - (String(values.oooInternalMessage).replace(/[<>]/g, "").length > 120 ? "…" : "") - : "Not set"} + ? String(values.oooInternalMessage).replace(/[<>]/g, '').slice(0, 120) + + (String(values.oooInternalMessage).replace(/[<>]/g, '').length > 120 + ? '…' + : '') + : 'Not set'} {values.oooExternalMessage && ( @@ -339,13 +395,17 @@ export const CippWizardVacationConfirmation = (props) => { External Message - - {String(values.oooExternalMessage).replace(/[<>]/g, "").slice(0, 120) + - (String(values.oooExternalMessage).replace(/[<>]/g, "").length > 120 ? "…" : "")} + + {String(values.oooExternalMessage).replace(/[<>]/g, '').slice(0, 120) + + (String(values.oooExternalMessage).replace(/[<>]/g, '').length > 120 + ? '…' + : '')} )} - {(values.oooCreateOOFEvent || values.oooAutoDeclineFutureRequests || values.oooDeclineEvents) && ( + {(values.oooCreateOOFEvent || + values.oooAutoDeclineFutureRequests || + values.oooDeclineEvents) && (
Calendar Options @@ -369,7 +429,7 @@ export const CippWizardVacationConfirmation = (props) => { )} - ); + ) })()} {/* API Results */} @@ -379,7 +439,13 @@ export const CippWizardVacationConfirmation = (props) => { {values.enableOOO && } {/* Navigation + Custom Submit */} - + {currentStep > 0 && ( ) : ( - )} - ); -}; + ) +} diff --git a/src/pages/cipp/snooze-alert.js b/src/pages/cipp/snooze-alert.js index ff0249a4869c..c902fa4f59c0 100644 --- a/src/pages/cipp/snooze-alert.js +++ b/src/pages/cipp/snooze-alert.js @@ -6,7 +6,7 @@ import { ApiPostCall } from '../../api/ApiCall' import { CippApiResults } from '../../components/CippComponents/CippApiResults' import CippPageCard from '../../components/CippCards/CippPageCard' -const VALID_DURATIONS = [7, 14, 30, -1] +const VALID_DURATIONS = [7, 14, 30, 90, -1] const durationLabel = (d) => { if (d === -1) return 'forever' diff --git a/src/utils/get-cipp-filter-variant.js b/src/utils/get-cipp-filter-variant.js index 539fbd464cfb..7fbebba78273 100644 --- a/src/utils/get-cipp-filter-variant.js +++ b/src/utils/get-cipp-filter-variant.js @@ -120,6 +120,7 @@ export const getCippFilterVariant = (providedColumnKeys, arg) => { filterVariant: "select", sortingFn: "boolean", filterFn: "equals", + filterSelectOptions: ["Yes", "No"], }; }