diff --git a/src/pages/identity/administration/devices/index.js b/src/pages/identity/administration/devices/index.js index 230e20e9bb71..09bd9ef0d42f 100644 --- a/src/pages/identity/administration/devices/index.js +++ b/src/pages/identity/administration/devices/index.js @@ -46,7 +46,7 @@ const Page = () => { type: "POST", url: "/api/ExecGetRecoveryKey", data: { - GUID: "id", + GUID: "deviceId", }, confirmText: "Are you sure you want to retrieve the BitLocker keys?", multiPost: false, diff --git a/src/pages/tenant/gdap-management/onboarding/start.js b/src/pages/tenant/gdap-management/onboarding/start.js index cb6a58d3d675..e63e53ba63a9 100644 --- a/src/pages/tenant/gdap-management/onboarding/start.js +++ b/src/pages/tenant/gdap-management/onboarding/start.js @@ -53,12 +53,9 @@ const Page = () => { data: { TenantFilter: "", Endpoint: "tenantRelationships/delegatedAdminRelationships", - $filter: - "(status eq 'active' or status eq 'approvalPending') and not startsWith(displayName,'MLT_')", }, queryKey: "GDAPRelationshipOnboarding", }); - const onboardingList = ApiGetCallWithPagination({ url: "/api/ListTenantOnboarding", queryKey: "ListTenantOnboarding", @@ -108,7 +105,11 @@ const Page = () => { (relationship) => relationship?.id === queryId ); - if (relationship) { + if ( + relationship && + (relationship?.status === "active" || relationship?.status === "approvalPending") && + !relationship?.customer?.displayName.startsWith("MLT_") + ) { formValue = { label: (relationship?.customer?.displayName ?? "Pending Invite") + diff --git a/src/pages/tenant/standards/bpa-report/builder.js b/src/pages/tenant/standards/bpa-report/builder.js index 9ccbec216736..b943e243ec21 100644 --- a/src/pages/tenant/standards/bpa-report/builder.js +++ b/src/pages/tenant/standards/bpa-report/builder.js @@ -4,19 +4,14 @@ import { Container, Typography, Button, - FormControl, - InputLabel, - Select, - MenuItem, Grid, IconButton, Stack, SvgIcon, } from "@mui/material"; import { useEffect, useState } from "react"; -import Head from "next/head"; import DeleteIcon from "@mui/icons-material/Delete"; -import { useForm } from "react-hook-form"; +import { useForm, useWatch } from "react-hook-form"; import CippButtonCard from "../../../../components/CippCards/CippButtonCard"; import CippFormComponent from "../../../../components/CippComponents/CippFormComponent"; import { ArrowLeftIcon } from "@mui/x-date-pickers"; @@ -25,6 +20,7 @@ import { CippFormCondition } from "../../../../components/CippComponents/CippFor import { ApiGetCall, ApiPostCall } from "../../../../api/ApiCall"; import { CippApiResults } from "../../../../components/CippComponents/CippApiResults"; import { CippHead } from "../../../../components/CippComponents/CippHead"; +import { Add, Save } from "@mui/icons-material"; const Page = () => { const router = useRouter(); @@ -55,18 +51,28 @@ const Page = () => { template.name = `${template.name} (Clone)`; } setLayoutMode(template.style); - //if the template style is tenant, create enough cards to hold the frontend fields - if (template.style === "Tenant") { - setBlockCards( - template.Fields.map((field, index) => { - return { - id: `block-${index}`, - }; - }) - ); - } + setBlockCards( + template.Fields.map((field, index) => { + return { + id: `block-${index}`, + }; + }) + ); + + const convertedTemplate = { + ...template, + Fields: template.Fields.map((field) => ({ + ...field, + ExtractFields: field.ExtractFields + ? field.ExtractFields.map((ef) => ({ + label: ef, + value: ef, + })) + : [], + })), + }; - formControl.reset(template); + formControl.reset(convertedTemplate); } } }, [bpaTemplateList.isSuccess]); @@ -152,10 +158,9 @@ const Page = () => { addBPATemplate.mutate({ url: "/api/AddBPATemplate", data: cleanedData }); }; - const handleLayoutModeChange = (event) => { - const newMode = event.target.value; + const handleLayoutModeChange = (newMode) => { setLayoutMode(newMode); - formControl.setValue("style", newMode); + //formControl.setValue("style", newMode); // Reset cards based on the layout mode if (newMode === "Table") { @@ -175,6 +180,14 @@ const Page = () => { } }; + const style = useWatch({ control: formControl.control, name: "style" }); + + useEffect(() => { + if (style && style !== layoutMode) { + handleLayoutModeChange(style); + } + }, [style]); + const onSubmit = (data) => {}; return ( <> @@ -209,55 +222,43 @@ const Page = () => { - } title="Report Settings" > - + {/* First item for Report Name and Layout Mode */} - - Layout Mode - - + - - {/* Third item for Buttons */} - {layoutMode === "Tenant" && ( - - - - - - )} - {/* Canvas Area */} - - Canvas - + + Fields + + {blockCards.map((block, index) => ( @@ -269,16 +270,16 @@ const Page = () => { key={block.id} > handleRemoveBlock(block.id)} // Remove block on click - > - - - ) + handleRemoveBlock(block.id)} // Remove block on click + > + + } > {/* Form inside each card */} @@ -310,7 +311,8 @@ const Page = () => { @@ -477,13 +479,17 @@ const Page = () => { type="autoComplete" formControl={formControl} multiple={false} - api={{ - queryKey: `ListBPA`, - url: "/api/ListBPA", - dataKey: "Keys", - labelField: (option) => `${option}`, - valueField: (option) => `${option}`, - }} + options={ + bpaTemplateList.data + ?.flatMap( + (template) => template.Fields?.map((field) => field.name) ?? [] + ) + .filter( + (value, index, self) => value && self.indexOf(value) === index + ) + .map((field) => ({ label: field, value: field })) + .sort((a, b) => a.label.localeCompare(b.label)) ?? [] + } />