From 45fa3756cf91cea07fc8093feea85952826ae10b Mon Sep 17 00:00:00 2001 From: Jr7468 Date: Tue, 28 Jan 2025 13:04:52 +0000 Subject: [PATCH 01/17] Add speed dial actions for bug reporting and feature requests --- .../CippComponents/CippSpeedDial.jsx | 222 ++++++++++++++++++ src/pages/_app.js | 15 ++ 2 files changed, 237 insertions(+) create mode 100644 src/components/CippComponents/CippSpeedDial.jsx diff --git a/src/components/CippComponents/CippSpeedDial.jsx b/src/components/CippComponents/CippSpeedDial.jsx new file mode 100644 index 000000000000..805ca4a66fe9 --- /dev/null +++ b/src/components/CippComponents/CippSpeedDial.jsx @@ -0,0 +1,222 @@ +import React, { useState, useEffect } from "react"; +import { + SpeedDial, + SpeedDialAction, + SpeedDialIcon, + Dialog, + DialogTitle, + DialogContent, + DialogActions, + Button, + Snackbar, + Alert, + CircularProgress, +} from "@mui/material"; +import { Close as CloseIcon } from "@mui/icons-material"; +import { useForm } from "react-hook-form"; +import { CippFormComponent } from "/src/components/CippComponents/CippFormComponent"; + +const CippSpeedDial = ({ + actions = [], + position = { bottom: 16, right: 16 }, + icon, + openIcon = , +}) => { + const [openDialogs, setOpenDialogs] = useState({}); + const [loading, setLoading] = useState(false); + const [showSnackbar, setShowSnackbar] = useState(false); + const [speedDialOpen, setSpeedDialOpen] = useState(false); + const [isHovering, setIsHovering] = useState(false); + const [snackbarMessage, setSnackbarMessage] = useState(""); + + const formControls = actions.reduce((acc, action) => { + if (action.form) { + acc[action.id] = useForm({ + mode: "onChange", + defaultValues: action.form.defaultValues || {}, + }); + } + return acc; + }, {}); + + const handleSpeedDialClose = () => { + if (!isHovering) { + setTimeout(() => { + setSpeedDialOpen(false); + }, 200); + } + }; + + const handleMouseEnter = () => { + setIsHovering(true); + setSpeedDialOpen(true); + }; + + const handleMouseLeave = () => { + setIsHovering(false); + handleSpeedDialClose(); + }; + + const handleDialogOpen = (actionId) => { + setOpenDialogs((prev) => ({ ...prev, [actionId]: true })); + }; + + const handleDialogClose = (actionId) => { + setOpenDialogs((prev) => ({ ...prev, [actionId]: false })); + }; + + const handleSubmit = async (actionId, data) => { + if (!actions.find((a) => a.id === actionId)?.onSubmit) return; + + setLoading(true); + try { + const action = actions.find((a) => a.id === actionId); + const result = await action.onSubmit(data); + + if (result.success) { + formControls[actionId]?.reset(); + handleDialogClose(actionId); + } + setSnackbarMessage(result.message); + setShowSnackbar(true); + } catch (error) { + console.error(`Error submitting ${actionId}:`, error); + setSnackbarMessage("An error occurred while submitting"); + setShowSnackbar(true); + } finally { + setLoading(false); + } + }; + + useEffect(() => { + const handleClickOutside = (event) => { + if (speedDialOpen) { + const speedDial = document.querySelector('[aria-label="Navigation SpeedDial"]'); + if (speedDial && !speedDial.contains(event.target)) { + setSpeedDialOpen(false); + } + } + }; + + document.addEventListener("click", handleClickOutside); + return () => { + document.removeEventListener("click", handleClickOutside); + }; + }, [speedDialOpen]); + + return ( + <> + } + open={speedDialOpen} + onClose={handleSpeedDialClose} + onOpen={() => setSpeedDialOpen(true)} + onMouseEnter={handleMouseEnter} + onMouseLeave={handleMouseLeave} + > + {actions.map((action) => ( + { + if (action.form) { + handleDialogOpen(action.id); + } else if (action.onClick) { + action.onClick(); + } + setSpeedDialOpen(false); + }} + tooltipOpen + sx={{ + "&.MuiSpeedDialAction-fab": { + backgroundColor: "background.paper", + "&:hover": { + backgroundColor: "action.hover", + }, + }, + "& .MuiSpeedDialAction-staticTooltipLabel": { + cursor: "pointer", + whiteSpace: "nowrap", + marginRight: "10px", + padding: "6px 10px", + "&:hover": { + backgroundColor: "action.hover", + }, + }, + }} + /> + ))} + + + {actions + .filter((action) => action.form) + .map((action) => ( + handleDialogClose(action.id)} + maxWidth="md" + fullWidth + > + {action.form.title} + + + + + + + + + ))} + + setShowSnackbar(false)} + anchorOrigin={{ vertical: "bottom", horizontal: "center" }} + > + setShowSnackbar(false)} severity="success" sx={{ width: "100%" }}> + {snackbarMessage} + + + + ); +}; + +export default CippSpeedDial; diff --git a/src/pages/_app.js b/src/pages/_app.js index 702eb328927c..1dd1e6971768 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -36,6 +36,21 @@ const App = (props) => { const getLayout = Component.getLayout ?? ((page) => page); const preferredTheme = useMediaPredicate("(prefers-color-scheme: dark)") ? "dark" : "light"; + const speedDialActions = [ + { + id: "bug-report", + icon: , + name: "Report Bug", + href: "https://github.com/KelvinTegelaar/CIPP/issues/new?template=bug.yml", + }, + { + id: "feature-request", + icon: , + name: "Request Feature", + href: "https://github.com/KelvinTegelaar/CIPP/issues/new?template=feature.yml", + }, + ]; + return ( From 32cbe0277a43203638631961e22c77d4772f906b Mon Sep 17 00:00:00 2001 From: Jr7468 Date: Fri, 31 Jan 2025 08:48:00 +0000 Subject: [PATCH 02/17] Add Speed Dial component with help, bug report, and feedback actions --- src/pages/_app.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/pages/_app.js b/src/pages/_app.js index 1dd1e6971768..b4ac447e1829 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -20,6 +20,12 @@ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns"; import TimeAgo from "javascript-time-ago"; import en from "javascript-time-ago/locale/en.json"; +import CippSpeedDial from 'src/components/CippComponents/CippSpeedDial' +import { + Help as HelpIcon, + BugReport as BugReportIcon, + Feedback as FeedbackIcon, +} from '@mui/icons-material' import React from "react"; TimeAgo.addDefaultLocale(en); @@ -84,6 +90,11 @@ const App = (props) => { {getLayout()} + } + position={{ bottom: 16, right: 16 }} + /> {settings?.showDevtools && ( From 205fa4ca188ecb9060b3420a0f9147062ecc97ee Mon Sep 17 00:00:00 2001 From: Jr7468 Date: Fri, 31 Jan 2025 08:50:04 +0000 Subject: [PATCH 03/17] Prettier fix --- src/pages/_app.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/_app.js b/src/pages/_app.js index b4ac447e1829..c4884343f139 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -20,12 +20,12 @@ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns"; import TimeAgo from "javascript-time-ago"; import en from "javascript-time-ago/locale/en.json"; -import CippSpeedDial from 'src/components/CippComponents/CippSpeedDial' +import CippSpeedDial from "src/components/CippComponents/CippSpeedDial"; import { Help as HelpIcon, BugReport as BugReportIcon, Feedback as FeedbackIcon, -} from '@mui/icons-material' +} from "@mui/icons-material"; import React from "react"; TimeAgo.addDefaultLocale(en); @@ -90,11 +90,11 @@ const App = (props) => { {getLayout()} - } - position={{ bottom: 16, right: 16 }} - /> + } + position={{ bottom: 16, right: 16 }} + /> {settings?.showDevtools && ( From 65da8b660e90cc07a0e9dd46890ca5fb917d6ab0 Mon Sep 17 00:00:00 2001 From: Jr7468 Date: Fri, 31 Jan 2025 09:24:13 +0000 Subject: [PATCH 04/17] Tested and works properly on my Dev Env now! --- src/components/CippComponents/CippSpeedDial.jsx | 2 +- src/pages/_app.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/CippComponents/CippSpeedDial.jsx b/src/components/CippComponents/CippSpeedDial.jsx index 805ca4a66fe9..4313ace7a7ef 100644 --- a/src/components/CippComponents/CippSpeedDial.jsx +++ b/src/components/CippComponents/CippSpeedDial.jsx @@ -14,7 +14,7 @@ import { } from "@mui/material"; import { Close as CloseIcon } from "@mui/icons-material"; import { useForm } from "react-hook-form"; -import { CippFormComponent } from "/src/components/CippComponents/CippFormComponent"; +import { CippFormComponent } from "../../components/CippComponents/CippFormComponent"; const CippSpeedDial = ({ actions = [], diff --git a/src/pages/_app.js b/src/pages/_app.js index c4884343f139..b764d3f36c12 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -20,7 +20,7 @@ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns"; import TimeAgo from "javascript-time-ago"; import en from "javascript-time-ago/locale/en.json"; -import CippSpeedDial from "src/components/CippComponents/CippSpeedDial"; +import CippSpeedDial from "../components/CippComponents/CippSpeedDial"; import { Help as HelpIcon, BugReport as BugReportIcon, From 6c432d3d77631c3cc94d15cd560c2456dd9ff70b Mon Sep 17 00:00:00 2001 From: Jr7468 Date: Fri, 31 Jan 2025 09:26:28 +0000 Subject: [PATCH 05/17] Add onClick handlers to Speed Dial GitHub links --- src/pages/_app.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/_app.js b/src/pages/_app.js index b764d3f36c12..271c911a2c5b 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -48,12 +48,14 @@ const App = (props) => { icon: , name: "Report Bug", href: "https://github.com/KelvinTegelaar/CIPP/issues/new?template=bug.yml", + onClick: () => window.open("https://github.com/KelvinTegelaar/CIPP/issues/new?template=bug.yml", "_blank") }, { id: "feature-request", icon: , name: "Request Feature", href: "https://github.com/KelvinTegelaar/CIPP/issues/new?template=feature.yml", + onClick: () => window.open("https://github.com/KelvinTegelaar/CIPP/issues/new?template=feature.yml", "_blank") }, ]; From d6eaf09fef428c52f1565655b4b5548959c19e6e Mon Sep 17 00:00:00 2001 From: Jr7468 Date: Fri, 31 Jan 2025 14:19:04 +0000 Subject: [PATCH 06/17] Add Discord link to Speed Dial component --- public/discord-mark-blue.svg | 1 + src/pages/_app.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 public/discord-mark-blue.svg diff --git a/public/discord-mark-blue.svg b/public/discord-mark-blue.svg new file mode 100644 index 000000000000..4cadbc7f7ed3 --- /dev/null +++ b/public/discord-mark-blue.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/_app.js b/src/pages/_app.js index 271c911a2c5b..e520d50c5822 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -26,6 +26,8 @@ import { BugReport as BugReportIcon, Feedback as FeedbackIcon, } from "@mui/icons-material"; +import { SvgIcon } from "@mui/material"; +import discordIcon from "../../public/discord-mark-blue.svg"; import React from "react"; TimeAgo.addDefaultLocale(en); @@ -57,6 +59,16 @@ const App = (props) => { href: "https://github.com/KelvinTegelaar/CIPP/issues/new?template=feature.yml", onClick: () => window.open("https://github.com/KelvinTegelaar/CIPP/issues/new?template=feature.yml", "_blank") }, + { + id: "discord", + icon: ( + + + ), + name: "Join the Discord!", + href: "https://discord.gg/cyberdrain", + onClick: () => window.open("https://discord.gg/cyberdrain", "_blank") + }, ]; return ( From dc9c7c336cec58c5d45e229f89d90c44321d4c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Kj=C3=A6rg=C3=A5rd?= Date: Mon, 3 Feb 2025 19:12:04 +0100 Subject: [PATCH 07/17] feat: Add Edit Contact page with form functionality --- .../email/administration/contacts/edit.jsx | 236 ++++++++++++++++++ .../email/administration/contacts/index.js | 8 +- 2 files changed, 240 insertions(+), 4 deletions(-) create mode 100644 src/pages/email/administration/contacts/edit.jsx diff --git a/src/pages/email/administration/contacts/edit.jsx b/src/pages/email/administration/contacts/edit.jsx new file mode 100644 index 000000000000..12846ae3140a --- /dev/null +++ b/src/pages/email/administration/contacts/edit.jsx @@ -0,0 +1,236 @@ +import React, { useEffect } from "react"; +import { useRouter } from "next/router"; +import { Grid, Divider } from "@mui/material"; +import { useForm } from "react-hook-form"; +import { useSelector } from "react-redux"; +import { Layout as DashboardLayout } from "/src/layouts/index.js"; +import CippFormPage from "/src/components/CippFormPages/CippFormPage"; +import CippFormComponent from "/src/components/CippComponents/CippFormComponent"; +import { useSettings } from "../../../../hooks/use-settings"; +import { ApiGetCall } from "../../../../api/ApiCall"; + +const EditContact = () => { + const tenantDomain = useSettings().currentTenant; + const router = useRouter(); + const { id } = router.query; + + const contactInfo = ApiGetCall({ + url: `/api/ListContacts?tenantFilter=${tenantDomain}&id=${id}`, + queryKey: `ListContacts-${id}`, + waiting: false, + }); + + useEffect(() => { + if (id) { + contactInfo.refetch(); + } + }, [router.query, id, tenantDomain]); + + const formControl = useForm({ + mode: "onChange", + defaultValues: { + displayName: "", + firstName: "", + lastName: "", + email: "", + hidefromGAL: false, + streetAddress: "", + postalCode: "", + city: "", + country: "", + companyName: "", + mobilePhone: "", + businessPhone: "", + jobTitle: "", + }, + }); + + useEffect(() => { + if (contactInfo.isSuccess && contactInfo.data?.Results?.[0]) { + const contact = contactInfo.data.Results[0]; + formControl.reset({ + displayName: contact.displayName || "", + firstName: contact.firstName || "", + lastName: contact.lastName || "", + email: contact.mail || "", + hidefromGAL: contact.hidefromGAL || false, + streetAddress: contact.streetAddress || "", + postalCode: contact.postalCode || "", + city: contact.city || "", + country: contact.countryOrRegion || "", + companyName: contact.companyName || "", + mobilePhone: contact.mobilePhone || "", + businessPhone: contact.phone || "", + jobTitle: contact.jobTitle || "", + }); + } + }, [contactInfo.isSuccess, contactInfo.data, contactInfo.isFetching]); + + if (contactInfo.isLoading) { + return
Loading...
; + } + + return ( + { + return { + tenantID: tenantDomain, + firstName: values.firstName, + lastName: values.lastName, + displayName: values.displayName, + mail: values.email, + hidefromGAL: values.hidefromGAL, + ContactID: contactInfo.data?.Results?.[0]?.id, + StreetAddress: values.streetAddress, + PostalCode: values.postalCode, + City: values.city, + Country: values.country, + companyName: values.companyName, + MobilePhone: values.mobilePhone, + BusinessPhone: values.businessPhone, + jobTitle: values.jobTitle, + }; + }} + > + + {/* Display Name */} + + + + + {/* First Name and Last Name */} + + + + + + + + + + {/* Email */} + + + + + {/* Hide from GAL */} + + + + + + + {/* Company Information */} + + + + + + + + + + {/* Address Information */} + + + + + + + + + + + + + + + + {/* Phone Numbers */} + + + + + + + + + ); +}; + +EditContact.getLayout = (page) => {page}; + +export default EditContact; diff --git a/src/pages/email/administration/contacts/index.js b/src/pages/email/administration/contacts/index.js index ac22d6596579..e08ab4e7d785 100644 --- a/src/pages/email/administration/contacts/index.js +++ b/src/pages/email/administration/contacts/index.js @@ -3,7 +3,7 @@ import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx" import { Edit, PersonAdd } from "@mui/icons-material"; import { Button } from "@mui/material"; import Link from "next/link"; -import TrashIcon from '@heroicons/react/24/outline/TrashIcon'; +import TrashIcon from "@heroicons/react/24/outline/TrashIcon"; const Page = () => { const pageTitle = "Contacts"; @@ -20,14 +20,14 @@ const Page = () => { color: "danger", icon: , }, - /* TODO: Implement edit contact { label: "Edit Contact", - link: "/email/administration/edit-contact/[id]", + link: "/email/administration/contacts/edit?id={id}", multiPost: false, + postEntireRow: true, icon: , color: "warning", - },*/ + }, ]; const simpleColumns = ["displayName", "mail", "companyName", "onPremisesSyncEnabled"]; From 3f7e051e2126c7a703ca7360d4325871e4871ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Kj=C3=A6rg=C3=A5rd?= Date: Mon, 3 Feb 2025 23:42:15 +0100 Subject: [PATCH 08/17] move up --- .../email/administration/contacts/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/pages/email/administration/contacts/index.js b/src/pages/email/administration/contacts/index.js index e08ab4e7d785..8d512604501f 100644 --- a/src/pages/email/administration/contacts/index.js +++ b/src/pages/email/administration/contacts/index.js @@ -9,6 +9,15 @@ const Page = () => { const pageTitle = "Contacts"; const actions = [ + , + { + label: "Edit Contact", + link: "/email/administration/contacts/edit?id=[id]", + multiPost: false, + postEntireRow: true, + icon: , + color: "warning", + }, { label: "Remove Contact", type: "GET", @@ -20,14 +29,6 @@ const Page = () => { color: "danger", icon: , }, - { - label: "Edit Contact", - link: "/email/administration/contacts/edit?id={id}", - multiPost: false, - postEntireRow: true, - icon: , - color: "warning", - }, ]; const simpleColumns = ["displayName", "mail", "companyName", "onPremisesSyncEnabled"]; From fa7eda9bb3837ef78c789cb1382935bfe1fa57ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Kj=C3=A6rg=C3=A5rd?= Date: Tue, 4 Feb 2025 01:29:44 +0100 Subject: [PATCH 09/17] make it actually work --- .../email/administration/contacts/edit.jsx | 52 +++++++++++-------- .../email/administration/contacts/index.js | 6 ++- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/pages/email/administration/contacts/edit.jsx b/src/pages/email/administration/contacts/edit.jsx index 12846ae3140a..56bf1e557f6e 100644 --- a/src/pages/email/administration/contacts/edit.jsx +++ b/src/pages/email/administration/contacts/edit.jsx @@ -46,21 +46,29 @@ const EditContact = () => { }); useEffect(() => { - if (contactInfo.isSuccess && contactInfo.data?.Results?.[0]) { - const contact = contactInfo.data.Results[0]; + if (contactInfo.isSuccess && contactInfo.data?.[0]) { + const contact = contactInfo.data[0]; + // Get the address info from the first address entry + const address = contact.addresses?.[0] || {}; + + // Find phone numbers by type + const phones = contact.phones || []; + const mobilePhone = phones.find((p) => p.type === "mobile")?.number; + const businessPhone = phones.find((p) => p.type === "business")?.number; + formControl.reset({ displayName: contact.displayName || "", - firstName: contact.firstName || "", - lastName: contact.lastName || "", + firstName: contact.givenName || "", + lastName: contact.surname || "", email: contact.mail || "", hidefromGAL: contact.hidefromGAL || false, - streetAddress: contact.streetAddress || "", - postalCode: contact.postalCode || "", - city: contact.city || "", - country: contact.countryOrRegion || "", + streetAddress: address.street || "", + postalCode: address.postalCode || "", + city: address.city || "", + country: address.countryOrRegion || "", companyName: contact.companyName || "", - mobilePhone: contact.mobilePhone || "", - businessPhone: contact.phone || "", + mobilePhone: mobilePhone || "", + businessPhone: businessPhone || "", jobTitle: contact.jobTitle || "", }); } @@ -74,26 +82,28 @@ const EditContact = () => { { return { tenantID: tenantDomain, - firstName: values.firstName, - lastName: values.lastName, - displayName: values.displayName, - mail: values.email, + ContactID: contactInfo.data?.[0]?.id, + DisplayName: values.displayName, hidefromGAL: values.hidefromGAL, - ContactID: contactInfo.data?.Results?.[0]?.id, + email: values.email, + FirstName: values.firstName, + LastName: values.lastName, + Title: values.jobTitle, StreetAddress: values.streetAddress, PostalCode: values.postalCode, City: values.city, - Country: values.country, - companyName: values.companyName, - MobilePhone: values.mobilePhone, - BusinessPhone: values.businessPhone, - jobTitle: values.jobTitle, + CountryOrRegion: values.country, + Company: values.companyName, + mobilePhone: values.mobilePhone, + phone: values.businessPhone, }; }} > diff --git a/src/pages/email/administration/contacts/index.js b/src/pages/email/administration/contacts/index.js index 8d512604501f..9d75996d8652 100644 --- a/src/pages/email/administration/contacts/index.js +++ b/src/pages/email/administration/contacts/index.js @@ -9,7 +9,6 @@ const Page = () => { const pageTitle = "Contacts"; const actions = [ - , { label: "Edit Contact", link: "/email/administration/contacts/edit?id=[id]", @@ -17,6 +16,7 @@ const Page = () => { postEntireRow: true, icon: , color: "warning", + condition: (row) => !row.onPremisesSyncEnabled, }, { label: "Remove Contact", @@ -25,9 +25,11 @@ const Page = () => { data: { GUID: "id", }, - confirmText: "Are you sure you want to delete this contact?", + confirmText: + "Are you sure you want to delete this contact? Remember this will not work if the contact is AD Synced.", color: "danger", icon: , + condition: (row) => !row.onPremisesSyncEnabled, }, ]; From b0e222da1efa5c9b5cfc0916395461dff75c171d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Kj=C3=A6rg=C3=A5rd?= Date: Tue, 4 Feb 2025 17:14:12 +0100 Subject: [PATCH 10/17] Country selector --- src/pages/email/administration/contacts/edit.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pages/email/administration/contacts/edit.jsx b/src/pages/email/administration/contacts/edit.jsx index 56bf1e557f6e..4981c10fe029 100644 --- a/src/pages/email/administration/contacts/edit.jsx +++ b/src/pages/email/administration/contacts/edit.jsx @@ -8,6 +8,7 @@ import CippFormPage from "/src/components/CippFormPages/CippFormPage"; import CippFormComponent from "/src/components/CippComponents/CippFormComponent"; import { useSettings } from "../../../../hooks/use-settings"; import { ApiGetCall } from "../../../../api/ApiCall"; +import countryList from "/src/data/countryList.json"; const EditContact = () => { const tenantDomain = useSettings().currentTenant; @@ -65,7 +66,9 @@ const EditContact = () => { streetAddress: address.street || "", postalCode: address.postalCode || "", city: address.city || "", - country: address.countryOrRegion || "", + country: address.countryOrRegion + ? countryList.find((c) => c.Name === address.countryOrRegion)?.Code || "" + : "", companyName: contact.companyName || "", mobilePhone: mobilePhone || "", businessPhone: businessPhone || "", @@ -100,7 +103,7 @@ const EditContact = () => { StreetAddress: values.streetAddress, PostalCode: values.postalCode, City: values.city, - CountryOrRegion: values.country, + CountryOrRegion: values.country?.value || values.country, Company: values.companyName, mobilePhone: values.mobilePhone, phone: values.businessPhone, @@ -210,9 +213,14 @@ const EditContact = () => { ({ + label: Name, + value: Code, + }))} formControl={formControl} /> From 7e2c987dad5d51cbb85dad04f22b5d5be0e93f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Kj=C3=A6rg=C3=A5rd?= Date: Tue, 4 Feb 2025 18:06:05 +0100 Subject: [PATCH 11/17] fix: Update label for GAL visibility and disable creatable option for country selection --- src/pages/email/administration/contacts/edit.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/email/administration/contacts/edit.jsx b/src/pages/email/administration/contacts/edit.jsx index 4981c10fe029..87e9febc70f9 100644 --- a/src/pages/email/administration/contacts/edit.jsx +++ b/src/pages/email/administration/contacts/edit.jsx @@ -163,7 +163,7 @@ const EditContact = () => { @@ -217,6 +217,7 @@ const EditContact = () => { label="Country" name="country" multiple={false} + creatable={false} options={countryList.map(({ Code, Name }) => ({ label: Name, value: Code, From 0bcf8944d54009e89de000f8bb2f16043de85c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Kj=C3=A6rg=C3=A5rd?= Date: Tue, 4 Feb 2025 21:22:09 +0100 Subject: [PATCH 12/17] add conditional --- src/pages/email/transport/list-connectors/index.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pages/email/transport/list-connectors/index.js b/src/pages/email/transport/list-connectors/index.js index 477b191fdff5..c77da7d7ece4 100644 --- a/src/pages/email/transport/list-connectors/index.js +++ b/src/pages/email/transport/list-connectors/index.js @@ -22,6 +22,7 @@ const Page = () => { type: "POST", url: "/api/EditExConnector", icon: , + condition: (row) => !row.Enabled, data: { State: "Enable", GUID: "Guid", @@ -35,6 +36,7 @@ const Page = () => { type: "POST", url: "/api/EditExConnector", icon: , + condition: (row) => row.Enabled, data: { State: "Disable", GUID: "Guid", @@ -82,11 +84,6 @@ const Page = () => { actions={actions} offCanvas={offCanvas} simpleColumns={simpleColumns} - titleButton={{ - label: "Deploy Connector", - href: "/email/connectors/deploy-connector", - startIcon: , // Added icon - }} cardButton={ <>