Wizard: get rid of unneeded selected state in compliance step
Similar to the profile selector, just use the wizard store directly.
This commit is contained in:
parent
3d545ed8ae
commit
40c9abfe9b
1 changed files with 6 additions and 9 deletions
|
|
@ -59,7 +59,7 @@ const ComplianceSelectOption = ({ policy }: ComplianceSelectOptionPropType) => {
|
|||
): ComplianceSelectOptionValueType => ({
|
||||
policyID,
|
||||
profileID,
|
||||
toString: () => title,
|
||||
toString: () => title || 'None',
|
||||
});
|
||||
|
||||
const descr = (
|
||||
|
|
@ -89,7 +89,6 @@ const PolicySelector = () => {
|
|||
const hasWslTargetOnly = useHasSpecificTargetOnly('wsl');
|
||||
const dispatch = useAppDispatch();
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [selected, setSelected] = useState<string>('None');
|
||||
|
||||
const {
|
||||
data: policies,
|
||||
|
|
@ -231,13 +230,11 @@ const PolicySelector = () => {
|
|||
handlePackages(oldOscapPackages, newOscapPackages);
|
||||
handleServices(response.services);
|
||||
handleKernelAppend(response.kernel?.append);
|
||||
const compl = selection as ComplianceSelectOptionValueType;
|
||||
setSelected(compl.toString());
|
||||
dispatch(
|
||||
changeCompliance({
|
||||
profileID: compl.profileID,
|
||||
policyID: compl.policyID,
|
||||
policyTitle: compl.toString(),
|
||||
profileID: selection.profileID,
|
||||
policyID: selection.policyID,
|
||||
policyTitle: selection.toString(),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
|
@ -290,7 +287,7 @@ const PolicySelector = () => {
|
|||
} as React.CSSProperties
|
||||
}
|
||||
>
|
||||
{selected}
|
||||
{policyTitle || 'Select a policy'}
|
||||
</MenuToggle>
|
||||
);
|
||||
|
||||
|
|
@ -301,7 +298,7 @@ const PolicySelector = () => {
|
|||
isOpen={isOpen}
|
||||
onSelect={handleSelect}
|
||||
onOpenChange={handleToggle}
|
||||
selected={selected}
|
||||
selected={policyID}
|
||||
toggle={toggleCompliance}
|
||||
shouldFocusFirstItemOnOpen={false}
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue