Skip to content

Commit bcc11cd

Browse files
authored
Merge pull request #678 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 08b75a3 + f3f6392 commit bcc11cd

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/components/CippComponents/CippCADeployDrawer.jsx

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import CippJsonView from "../CippFormPages/CippJSONView";
99
import { CippApiResults } from "./CippApiResults";
1010
import { useSettings } from "../../hooks/use-settings";
1111
import { CippFormTenantSelector } from "./CippFormTenantSelector";
12+
import { CippFormCondition } from "./CippFormCondition";
1213

1314
export const CippCADeployDrawer = ({
1415
buttonText = "Deploy CA Policy",
@@ -24,6 +25,10 @@ export const CippCADeployDrawer = ({
2425
const CATemplates = ApiGetCall({ url: "/api/ListCATemplates", queryKey: "CATemplates" });
2526
const [JSONData, setJSONData] = useState();
2627
const watcher = useWatch({ control: formControl.control, name: "TemplateList" });
28+
const selectedReplaceMode = useWatch({
29+
control: formControl.control,
30+
name: "replacename",
31+
});
2732

2833
// Use external open state if provided, otherwise use internal state
2934
const drawerVisible = open !== null ? open : internalDrawerVisible;
@@ -199,13 +204,25 @@ export const CippCADeployDrawer = ({
199204
label="Disable Security Defaults if enabled when creating policy"
200205
formControl={formControl}
201206
/>
202-
203-
<CippFormComponent
204-
type="switch"
205-
name="CreateGroups"
206-
label="Create groups if they do not exist"
207+
<CippFormCondition
207208
formControl={formControl}
208-
/>
209+
field="replacename"
210+
compareType="is"
211+
compareValue="displayName"
212+
action="disable"
213+
>
214+
<CippFormComponent
215+
type="switch"
216+
name="CreateGroups"
217+
label="Create groups if they do not exist"
218+
formControl={formControl}
219+
helperText={
220+
selectedReplaceMode !== "displayName"
221+
? "Select 'Replace by display name' to create groups specified in the template."
222+
: "Enable this option to create groups that do not exist in the tenant."
223+
}
224+
/>
225+
</CippFormCondition>
209226
</Stack>
210227
</CippOffCanvas>
211228
</>

0 commit comments

Comments
 (0)