diff --git a/generate-placeholders.js b/generate-placeholders.js index 34e14911edf4..9858fc7f7b7c 100644 --- a/generate-placeholders.js +++ b/generate-placeholders.js @@ -171,9 +171,7 @@ const createPlaceholderPages = () => { if (!fs.existsSync(filePath)) { // Write the placeholder page fs.writeFileSync(filePath, placeholderTemplate(title), "utf8"); - console.log(`Created placeholder page at ${filePath}`); } else { - console.log(`Placeholder page already exists at ${filePath}`); } }); }; diff --git a/src/components/CippComponents/CippFormContactSelector.jsx b/src/components/CippComponents/CippFormContactSelector.jsx new file mode 100644 index 000000000000..094f36014eb7 --- /dev/null +++ b/src/components/CippComponents/CippFormContactSelector.jsx @@ -0,0 +1,37 @@ +import React from "react"; +import { CippFormComponent } from "./CippFormComponent"; +import { useWatch } from "react-hook-form"; +import { useSettings } from "../../hooks/use-settings"; + +export const CippFormContactSelector = ({ + formControl, + name, + label, + allTenants = false, + multiple = false, + type = "multiple", + select, + addedField, + valueField, + ...other +}) => { + const currentTenant = useWatch({ control: formControl.control, name: "tenantFilter" }); + const selectedTenant = useSettings().currentTenant; + return ( + `${option.displayName} (${option.mail})`, + valueField: valueField ? valueField : "id", + queryKey: `listcontacts-${currentTenant?.value ? currentTenant.value : selectedTenant}`, + }} + /> + ); +}; diff --git a/src/components/CippFormPages/CippFormPage.jsx b/src/components/CippFormPages/CippFormPage.jsx index d034d4ef3dde..edb520d13a36 100644 --- a/src/components/CippFormPages/CippFormPage.jsx +++ b/src/components/CippFormPages/CippFormPage.jsx @@ -46,7 +46,6 @@ const CippFormPage = (props) => { delete router.query.tenantFilter; if (router.query) { - console.log(router.query); const resetValues = { ...formControl.getValues(), ...router.query, diff --git a/src/components/CippFormPages/CippJSONView.jsx b/src/components/CippFormPages/CippJSONView.jsx index 7fc6c71199b0..7686c81271cd 100644 --- a/src/components/CippFormPages/CippJSONView.jsx +++ b/src/components/CippFormPages/CippJSONView.jsx @@ -105,7 +105,6 @@ function CippJsonView({ object = { "No Data Selected": "No Data Selected" }, typ const intuneObj = intuneCollection.find( (item) => item.id === setting.settingInstance.settingDefinitionId ); - console.log(setting.settingInstance); const label = intuneObj?.displayName || setting.settingInstance.settingDefinitionId; const value = setting.settingInstance?.simpleSettingValue?.value ? setting.settingInstance?.simpleSettingValue?.value diff --git a/src/components/CippTable/CIPPTableToptoolbar.js b/src/components/CippTable/CIPPTableToptoolbar.js index 7abffe9f3aec..c3bdd65fe3f7 100644 --- a/src/components/CippTable/CIPPTableToptoolbar.js +++ b/src/components/CippTable/CIPPTableToptoolbar.js @@ -99,7 +99,6 @@ export const CIPPTableToptoolbar = ({ if (filterType === "reset") { table.resetGlobalFilter(); table.resetColumnFilters(); - console.log(table); } }; return ( diff --git a/src/components/CippWizard/CippIntunePolicy.jsx b/src/components/CippWizard/CippIntunePolicy.jsx index 6bef39b1f064..a4859fdb7d30 100644 --- a/src/components/CippWizard/CippIntunePolicy.jsx +++ b/src/components/CippWizard/CippIntunePolicy.jsx @@ -17,7 +17,6 @@ export const CippIntunePolicy = (props) => { if (CATemplates.isSuccess && watcher?.value) { const template = CATemplates.data.find((template) => template.GUID === watcher.value); if (template) { - console.log(template); const jsonTemplate = template.RAWJson ? JSON.parse(template.RAWJson) : null; setJSONData(jsonTemplate); formControl.setValue("RAWJson", template.RAWJson); diff --git a/src/pages/cipp/logs/index.js b/src/pages/cipp/logs/index.js index ce309239a88b..f98368546531 100644 --- a/src/pages/cipp/logs/index.js +++ b/src/pages/cipp/logs/index.js @@ -42,7 +42,6 @@ const Page = () => { const onSubmit = (data) => { // Set filter states based on form submission setFilterEnabled(data.toggleSwitch); - console.log(data.startDate); setDateFilter( data.startDate ? new Date(data.startDate * 1000).toISOString().split("T")[0].replace(/-/g, "") diff --git a/src/pages/cipp/settings/backup.js b/src/pages/cipp/settings/backup.js index 9938b2ec5c07..436c225aaadb 100644 --- a/src/pages/cipp/settings/backup.js +++ b/src/pages/cipp/settings/backup.js @@ -52,7 +52,6 @@ const Page = () => { const NextBackupRun = (props) => { const date = new Date(props.date * 1000); - console.log(date); if (isNaN(date)) { return "Not Scheduled"; } else { @@ -104,12 +103,10 @@ const Page = () => { }, { onSuccess: (data) => { - console.log(data.data); const jsonString = data?.data?.[0]?.Backup; if (!jsonString) { return; } - console.log(jsonString); const blob = new Blob([jsonString], { type: "application/json" }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); diff --git a/src/pages/endpoint/applications/list/add.jsx b/src/pages/endpoint/applications/list/add.jsx index 81ab6354d4aa..9ffda3f43e99 100644 --- a/src/pages/endpoint/applications/list/add.jsx +++ b/src/pages/endpoint/applications/list/add.jsx @@ -30,7 +30,6 @@ const ApplicationDeploymentForm = () => { useEffect(() => { //if the searchQuerySelection was succesful, fill in the fields. - console.log(searchQuerySelection); if (searchQuerySelection) { formControl.setValue("packagename", searchQuerySelection.value.packagename); formControl.setValue("applicationName", searchQuerySelection.value.applicationName); diff --git a/src/pages/identity/administration/groups/edit.jsx b/src/pages/identity/administration/groups/edit.jsx new file mode 100644 index 000000000000..c62cea4d8694 --- /dev/null +++ b/src/pages/identity/administration/groups/edit.jsx @@ -0,0 +1,190 @@ +import React, { useEffect } from "react"; +import { Grid, Divider, Typography } from "@mui/material"; +import { useForm, useWatch } from "react-hook-form"; +import { Layout as DashboardLayout } from "/src/layouts/index.js"; +import CippFormPage from "/src/components/CippFormPages/CippFormPage"; +import CippFormComponent from "/src/components/CippComponents/CippFormComponent"; +import { CippFormUserSelector } from "/src/components/CippComponents/CippFormUserSelector"; +import { useRouter } from "next/router"; +import { ApiGetCall } from "../../../../api/ApiCall"; +import { useSettings } from "../../../../hooks/use-settings"; +import { CippFormContactSelector } from "../../../../components/CippComponents/CippFormContactSelector"; + +const EditGroup = () => { + const router = useRouter(); + const { groupId } = router.query; + const tenantFilter = useSettings().currentTenant; + const groupInfo = ApiGetCall({ + url: `/api/ListGroups?groupID=${groupId}&tenantFilter=${tenantFilter}&members=true&owners=true`, + queryKey: `ListGroups-${groupId}`, + waiting: false, + }); + + useEffect(() => { + if (groupId) { + groupInfo.refetch(); + } + }, [router.query, groupId, tenantFilter]); + + const formControl = useForm({ + mode: "onChange", + defaultValues: { + tenantId: tenantFilter, + }, + }); + const groupType = useWatch({ control: formControl.control, name: "groupType" }); + + useEffect(() => { + if (groupInfo.isSuccess) { + const group = groupInfo.data?.groupInfo; + if (group) { + formControl.reset({ + tenantId: tenantFilter, + allowExternal: group.allowExternal, + sendCopies: group.sendCopies, + groupName: group.displayName, + groupId: group.id, + groupType: (() => { + if (group.mailEnabled && group.securityEnabled) { + return "Mail-Enabled Security"; + } + if (!group.mailEnabled && group.securityEnabled) { + return "Security"; + } + if (group.groupTypes?.includes("Unified")) { + return "Microsoft 365"; + } + if ( + (!group.groupTypes || group.groupTypes.length === 0) && + group.mailEnabled && + !group.securityEnabled + ) { + return "Distribution List"; + } + return null; // Default case, if no condition is met + })(), + }); + } + } + }, [groupInfo.isSuccess]); + + return ( + + + + Add + + + + + + + + {/* AddOwners */} + + `${option.displayName} (${option.userPrincipalName})`} + valueField="userPrincipalName" + /> + + + + Remove + + ({ + label: `${m.displayName} (${m.userPrincipalName})`, + value: m.userPrincipalName, + }))} + name="RemoveMember" + label="Remove Member" + multiple={true} + /> + + + {/* RemoveOwners */} + + ({ + label: `${o.displayName} (${o.userPrincipalName})`, + value: o.userPrincipalName, + }))} + formControl={formControl} + name="RemoveOwner" + label="Remove Owner" + multiple={true} + /> + + + {/* RemoveContacts */} + + + + + + + {/* Conditional fields */} + {(groupType === "Microsoft 365" || groupType === "Distribution List") && ( + + + + )} + + {groupType === "Microsoft 365" && ( + + + + )} + + + + + ); +}; + +EditGroup.getLayout = (page) => {page}; + +export default EditGroup; diff --git a/src/pages/identity/administration/groups/index.js b/src/pages/identity/administration/groups/index.js index b18f5bd7e37b..9c9c7e10ce58 100644 --- a/src/pages/identity/administration/groups/index.js +++ b/src/pages/identity/administration/groups/index.js @@ -2,18 +2,18 @@ import { Button } from "@mui/material"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; import { Layout as DashboardLayout } from "/src/layouts/index.js"; import Link from "next/link"; +import { EyeIcon } from "@heroicons/react/24/outline"; const Page = () => { const pageTitle = "Groups"; const actions = [ { + //tested label: "Edit Group", - type: "LINK", - link: "/[tenant]/identity/groups/[id]", - linkParams: { - tenant: "TenantFilter", - id: "mail", - }, + link: "/identity/administration/groups/edit?groupId=[id]", + multiPost: false, + icon: , + color: "success", }, { label: "Hide from Global Address List", diff --git a/src/pages/identity/administration/users/user/conditional-access.jsx b/src/pages/identity/administration/users/user/conditional-access.jsx index a8735d7c633b..bb42a2a87f03 100644 --- a/src/pages/identity/administration/users/user/conditional-access.jsx +++ b/src/pages/identity/administration/users/user/conditional-access.jsx @@ -63,7 +63,6 @@ const Page = () => { url: "/api/ExecCACheck", relatedQueryKeys: `ExecCACheck-${tenant}-${userId}-${JSON.stringify(formParams)}`, }); - console.log(postRequest); const onSubmit = (data) => { //add userId and tenantFilter to the object data.userId = {}; diff --git a/src/pages/tenant/gdap-management/onboarding/start.js b/src/pages/tenant/gdap-management/onboarding/start.js index f4456c54f43a..90de780c929d 100644 --- a/src/pages/tenant/gdap-management/onboarding/start.js +++ b/src/pages/tenant/gdap-management/onboarding/start.js @@ -155,7 +155,6 @@ const Page = () => { useEffect(() => { if (currentRelationship?.value) { - console.log("useEffect"); var currentRoles = []; if (currentInvite?.RoleMappings) { currentRoles = currentInvite?.RoleMappings; @@ -208,7 +207,6 @@ const Page = () => { startOnboarding?.data?.data?.Status !== "succeeded" && startOnboarding?.data?.data?.Status !== "failed" ) { - console.log(startOnboarding?.data?.data?.Status); const interval = setInterval(() => { startOnboarding.mutate({ url: "/api/ExecOnboardTenant", diff --git a/src/pages/tenant/standards/bpa-report/builder.js b/src/pages/tenant/standards/bpa-report/builder.js index 8bce35cfc527..16b1c4e9ecc9 100644 --- a/src/pages/tenant/standards/bpa-report/builder.js +++ b/src/pages/tenant/standards/bpa-report/builder.js @@ -148,7 +148,6 @@ const Page = () => { processAutoComplete(cleanedData); // Apply the processing to the cleaned data const jsonConfig = JSON.stringify(cleanedData, null, 2); - console.log("Cleaned Form Data:", jsonConfig); addBPATemplate.mutate({ url: "/api/AddBPATemplate", data: cleanedData }); }; @@ -175,8 +174,7 @@ const Page = () => { } }; - const onSubmit = (data) => { - }; + const onSubmit = (data) => {}; return ( <>