diff --git a/src/components/CippCards/CippDomainCards.jsx b/src/components/CippCards/CippDomainCards.jsx index a1fdb6a74199..0da5fb61de97 100644 --- a/src/components/CippCards/CippDomainCards.jsx +++ b/src/components/CippCards/CippDomainCards.jsx @@ -10,6 +10,8 @@ import { Typography, Chip, Stack, + Divider, + FormControlLabel, } from "@mui/material"; import SearchIcon from "@mui/icons-material/Search"; import ClearIcon from "@mui/icons-material/Clear"; @@ -19,7 +21,7 @@ import ErrorIcon from "@mui/icons-material/Error"; import WarningIcon from "@mui/icons-material/Warning"; import HelpIcon from "@mui/icons-material/Help"; import MoreVertIcon from "@mui/icons-material/MoreVert"; -import { Controller, get, useForm } from "react-hook-form"; +import { Controller, useForm } from "react-hook-form"; import { ApiGetCall } from "/src/api/ApiCall"; import CippButtonCard from "/src/components/CippCards/CippButtonCard"; import { CippCodeBlock } from "/src/components/CippComponents/CippCodeBlock"; @@ -268,6 +270,60 @@ function DomainResultCard({ title, data, isFetching, info, type }) { ), } + : type === "HTTPS" + ? { + children: ( + <> + {data?.Tests?.map((test, index) => ( + <> + dns.Unicode), + "DNSName" + ), + }, + ]} + /> + + + + ))} + + ), + } : {}; return ( @@ -326,6 +382,9 @@ export const CippDomainCards = ({ domain: propDomain = "", fullwidth = false }) }); const [optionsVisible, setOptionsVisible] = useState(false); const [domain, setDomain] = useState(propDomain); + const [selector, setSelector] = useState(""); + const [spfRecord, setSpfRecord] = useState(""); + const [subdomains, setSubdomains] = useState(""); const enableHttps = watch("enableHttps"); useEffect(() => { @@ -337,6 +396,9 @@ export const CippDomainCards = ({ domain: propDomain = "", fullwidth = false }) const onSubmit = (values) => { setDomain(values.domain); + setSelector(values.dkimSelector); + setSpfRecord(values.spfRecord); + setSubdomains(values.subdomains); }; const handleClear = () => { @@ -344,6 +406,10 @@ export const CippDomainCards = ({ domain: propDomain = "", fullwidth = false }) setValue("spfRecord", ""); setValue("dkimSelector", ""); setValue("subdomains", ""); + setDomain(""); + setSelector(""); + setSpfRecord(""); + setSubdomains(""); }; // API calls with dynamic queryKey using domain @@ -370,8 +436,8 @@ export const CippDomainCards = ({ domain: propDomain = "", fullwidth = false }) const { data: spfData, isFetching: spfLoading } = ApiGetCall({ url: "/api/ListDomainHealth", - queryKey: `spf-${domain}`, - data: { Domain: domain, Action: "ReadSPFRecord" }, + queryKey: `spf-${domain}-${spfRecord}`, + data: { Domain: domain, Action: "ReadSPFRecord", Record: spfRecord }, waiting: !!domain, }); @@ -384,8 +450,8 @@ export const CippDomainCards = ({ domain: propDomain = "", fullwidth = false }) const { data: dkimData, isFetching: dkimLoading } = ApiGetCall({ url: "/api/ListDomainHealth", - queryKey: `dkim-${domain}`, - data: { Domain: domain, Action: "ReadDkimRecord" }, + queryKey: `dkim-${domain}-${selector}`, + data: { Domain: domain, Action: "ReadDkimRecord", Selector: selector }, waiting: !!domain, }); @@ -403,6 +469,13 @@ export const CippDomainCards = ({ domain: propDomain = "", fullwidth = false }) waiting: !!domain, }); + const { data: httpsData, isFetching: httpsLoading } = ApiGetCall({ + url: "/api/ListDomainHealth", + queryKey: `https-${domain}-${subdomains}`, + data: { Domain: domain, Action: "TestHttpsCertificate", Subdomains: subdomains }, + waiting: !!domain && enableHttps, + }); + // Adjust grid item size based on fullwidth prop const gridItemSize = fullwidth ? 12 : 4; @@ -438,45 +511,50 @@ export const CippDomainCards = ({ domain: propDomain = "", fullwidth = false }) - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - {enableHttps && ( + ( - + )} /> - )} - + ( + + )} + /> + ( + } + label="Enable HTTPS check" + /> + )} + /> + {enableHttps && ( + ( + + )} + /> + )} + + @@ -605,6 +683,25 @@ export const CippDomainCards = ({ domain: propDomain = "", fullwidth = false }) } /> + {enableHttps && ( + + + + + } + /> + + )} )} diff --git a/src/components/CippCards/CippPropertyListCard.jsx b/src/components/CippCards/CippPropertyListCard.jsx index 62b4578358d6..b5952305fa79 100644 --- a/src/components/CippCards/CippPropertyListCard.jsx +++ b/src/components/CippCards/CippPropertyListCard.jsx @@ -44,6 +44,12 @@ export const CippPropertyListCard = (props) => { }; const setPadding = isLabelPresent ? { py: 0.5, px: 3 } : { py: 1.5, px: 3 }; + const handleActionDisabled = (row, action) => { + if (action?.condition) { + return !action.condition(row); + } + return false; + }; return ( <> @@ -133,7 +139,7 @@ export const CippPropertyListCard = (props) => { {actionItems?.length > 0 && actionItems.map((item, index) => ( {item.icon}} label={item.label} onClick={ @@ -148,6 +154,7 @@ export const CippPropertyListCard = (props) => { createDialog.handleOpen(); } } + disabled={handleActionDisabled(data, item)} /> ))} diff --git a/src/components/CippTable/CippDataTable.js b/src/components/CippTable/CippDataTable.js index 64663b55d5eb..0eb40ee4d575 100644 --- a/src/components/CippTable/CippDataTable.js +++ b/src/components/CippTable/CippDataTable.js @@ -156,6 +156,13 @@ export const CippDataTable = (props) => { const memoizedColumns = useMemo(() => usedColumns, [usedColumns]); const memoizedData = useMemo(() => usedData, [usedData]); + const handleActionDisabled = (row, action) => { + if (action?.condition) { + return !action.condition(row); + } + return false; + }; + const table = useMaterialReactTable({ mrtTheme: (theme) => ({ baseBackgroundColor: theme.palette.background.paper, @@ -173,7 +180,6 @@ export const CippDataTable = (props) => { ) : undefined, onColumnVisibilityChange: setColumnVisibility, ...modeInfo, - renderRowActionMenuItems: actions ? ({ closeMenu, row }) => [ actions.map((action, index) => ( @@ -195,6 +201,7 @@ export const CippDataTable = (props) => { closeMenu(); } }} + disabled={handleActionDisabled(row.original, action)} > {action.icon} diff --git a/src/pages/email/administration/mailboxes/index.js b/src/pages/email/administration/mailboxes/index.js index b03919b9d752..146b7463a85a 100644 --- a/src/pages/email/administration/mailboxes/index.js +++ b/src/pages/email/administration/mailboxes/index.js @@ -2,6 +2,7 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; import Link from "next/link"; import { Button } from "@mui/material"; +import { Row } from "jspdf-autotable"; const Page = () => { const pageTitle = "Mailboxes"; @@ -35,6 +36,18 @@ const Page = () => { ID: "UPN", }, confirmText: "Are you sure you want to convert this mailbox to a shared mailbox?", + condition: (row) => row.recipientTypeDetails !== "SharedMailbox", + }, + { + label: "Convert to User Mailbox", + type: "GET", + url: "/api/ExecConvertToSharedMailbox", + data: { + ID: "UPN", + ConvertToUser: true, + }, + confirmText: "Are you sure you want to convert this mailbox to a user mailbox?", + condition: (row) => row.recipientTypeDetails !== "UserMailbox", }, { label: "Convert to Room Mailbox", @@ -44,6 +57,7 @@ const Page = () => { ID: "UPN", }, confirmText: "Are you sure you want to convert this mailbox to a room mailbox?", + condition: (row) => row.recipientTypeDetails !== "RoomMailbox", }, { label: "Hide from Global Address List", diff --git a/src/utils/get-cipp-formatting.js b/src/utils/get-cipp-formatting.js index a1dbf12c0349..916c9d461dc3 100644 --- a/src/utils/get-cipp-formatting.js +++ b/src/utils/get-cipp-formatting.js @@ -108,6 +108,8 @@ export const getCippFormatting = (data, cellName, type, canReceive) => { "purchaseDate", "NextOccurrence", "LastOccurrence", + "NotBefore", + "NotAfter", ]; const matchDateTime = /[dD]ate[tT]ime/;