remove deprecated select (#29082)
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
cca660067a
commit
aeed5eee17
2 changed files with 26 additions and 11 deletions
|
@ -10,7 +10,7 @@ export default class PasswordPolicies {
|
|||
}
|
||||
|
||||
addPolicy(name: string) {
|
||||
cy.get(".pf-v5-c-select").click().contains(name).click();
|
||||
cy.findByTestId("add-policy").click().parent().contains(name).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,11 @@ import {
|
|||
EmptyStateActions,
|
||||
EmptyStateHeader,
|
||||
EmptyStateFooter,
|
||||
Select,
|
||||
SelectOption,
|
||||
MenuToggle,
|
||||
SelectList,
|
||||
} from "@patternfly/react-core";
|
||||
import { Select, SelectOption } from "@patternfly/react-core/deprecated";
|
||||
import { PlusCircleIcon } from "@patternfly/react-icons";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
|
@ -51,21 +54,33 @@ const PolicySelect = ({ onSelect, selectedPolicies }: PolicySelectProps) => {
|
|||
|
||||
return (
|
||||
<Select
|
||||
width={300}
|
||||
style={{
|
||||
width: "300px",
|
||||
}}
|
||||
onSelect={(_, selection) => {
|
||||
onSelect(selection as PasswordPolicyTypeRepresentation);
|
||||
setOpen(false);
|
||||
}}
|
||||
onToggle={(_event, value) => setOpen(value)}
|
||||
toggle={(ref) => (
|
||||
<MenuToggle
|
||||
ref={ref}
|
||||
onClick={() => setOpen(!open)}
|
||||
isExpanded={open}
|
||||
isDisabled={policies?.length === 0}
|
||||
data-testid="add-policy"
|
||||
>
|
||||
{t("addPolicy")}
|
||||
</MenuToggle>
|
||||
)}
|
||||
isOpen={open}
|
||||
selections={t("addPolicy")}
|
||||
isDisabled={policies?.length === 0}
|
||||
>
|
||||
{policies?.map((policy) => (
|
||||
<SelectOption key={policy.id} value={policy}>
|
||||
{policy.displayName}
|
||||
</SelectOption>
|
||||
))}
|
||||
<SelectList>
|
||||
{policies?.map((policy) => (
|
||||
<SelectOption key={policy.id} value={policy}>
|
||||
{policy.displayName}
|
||||
</SelectOption>
|
||||
))}
|
||||
</SelectList>
|
||||
</Select>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue