removed use of deprecated dropdown (#28928)
towards: #28197 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
9a418cc53d
commit
014b644724
1 changed files with 65 additions and 36 deletions
|
@ -2,6 +2,10 @@ import {
|
||||||
Button,
|
Button,
|
||||||
Chip,
|
Chip,
|
||||||
ChipGroup,
|
ChipGroup,
|
||||||
|
Dropdown,
|
||||||
|
DropdownItem,
|
||||||
|
DropdownList,
|
||||||
|
MenuToggle,
|
||||||
OverflowMenu,
|
OverflowMenu,
|
||||||
OverflowMenuContent,
|
OverflowMenuContent,
|
||||||
OverflowMenuControl,
|
OverflowMenuControl,
|
||||||
|
@ -10,13 +14,9 @@ import {
|
||||||
OverflowMenuItem,
|
OverflowMenuItem,
|
||||||
Spinner,
|
Spinner,
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import {
|
|
||||||
Dropdown,
|
|
||||||
DropdownItem,
|
|
||||||
KebabToggle,
|
|
||||||
} from "@patternfly/react-core/deprecated";
|
|
||||||
import {
|
import {
|
||||||
EditAltIcon,
|
EditAltIcon,
|
||||||
|
EllipsisVIcon,
|
||||||
ExternalLinkAltIcon,
|
ExternalLinkAltIcon,
|
||||||
Remove2Icon,
|
Remove2Icon,
|
||||||
ShareAltIcon,
|
ShareAltIcon,
|
||||||
|
@ -255,19 +255,32 @@ export const ResourcesTab = ({ isShared = false }: ResourcesTabProps) => {
|
||||||
</OverflowMenuItem>
|
</OverflowMenuItem>
|
||||||
<OverflowMenuItem>
|
<OverflowMenuItem>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
position="right"
|
popperProps={{
|
||||||
toggle={
|
position: "right",
|
||||||
<KebabToggle
|
}}
|
||||||
onToggle={(_event, open) =>
|
onOpenChange={(isOpen) =>
|
||||||
toggleOpen(resource._id, "contextOpen", open)
|
toggleOpen(resource._id, "contextOpen", isOpen)
|
||||||
}
|
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
isOpen={details[resource._id]?.contextOpen}
|
toggle={(ref) => (
|
||||||
isPlain
|
<MenuToggle
|
||||||
dropdownItems={[
|
variant="plain"
|
||||||
|
ref={ref}
|
||||||
|
onClick={() =>
|
||||||
|
toggleOpen(
|
||||||
|
resource._id,
|
||||||
|
"contextOpen",
|
||||||
|
!details[resource._id]?.contextOpen,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
isExpanded={details[resource._id]?.contextOpen}
|
||||||
|
>
|
||||||
|
<EllipsisVIcon />
|
||||||
|
</MenuToggle>
|
||||||
|
)}
|
||||||
|
isOpen={!!details[resource._id]?.contextOpen}
|
||||||
|
>
|
||||||
|
<DropdownList>
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
key="edit"
|
|
||||||
isDisabled={
|
isDisabled={
|
||||||
details[resource._id]?.permissions?.length ===
|
details[resource._id]?.permissions?.length ===
|
||||||
0
|
0
|
||||||
|
@ -281,9 +294,8 @@ export const ResourcesTab = ({ isShared = false }: ResourcesTabProps) => {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<EditAltIcon /> {t("edit")}
|
<EditAltIcon /> {t("edit")}
|
||||||
</DropdownItem>,
|
</DropdownItem>
|
||||||
<ContinueCancelModal
|
<ContinueCancelModal
|
||||||
key="unShare"
|
|
||||||
buttonTitle={
|
buttonTitle={
|
||||||
<>
|
<>
|
||||||
<Remove2Icon /> {t("unShare")}
|
<Remove2Icon /> {t("unShare")}
|
||||||
|
@ -300,25 +312,39 @@ export const ResourcesTab = ({ isShared = false }: ResourcesTabProps) => {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{t("unShareAllConfirm")}
|
{t("unShareAllConfirm")}
|
||||||
</ContinueCancelModal>,
|
</ContinueCancelModal>
|
||||||
]}
|
</DropdownList>
|
||||||
/>
|
</Dropdown>
|
||||||
</OverflowMenuItem>
|
</OverflowMenuItem>
|
||||||
</OverflowMenuGroup>
|
</OverflowMenuGroup>
|
||||||
</OverflowMenuContent>
|
</OverflowMenuContent>
|
||||||
<OverflowMenuControl>
|
<OverflowMenuControl>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
position="right"
|
popperProps={{
|
||||||
toggle={
|
position: "right",
|
||||||
<KebabToggle
|
}}
|
||||||
onToggle={(_event, open) =>
|
onOpenChange={(isOpen) =>
|
||||||
toggleOpen(resource._id, "contextOpen", open)
|
toggleOpen(resource._id, "contextOpen", isOpen)
|
||||||
}
|
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
isOpen={details[resource._id]?.contextOpen}
|
toggle={(ref) => (
|
||||||
isPlain
|
<MenuToggle
|
||||||
dropdownItems={[
|
variant="plain"
|
||||||
|
ref={ref}
|
||||||
|
isExpanded={details[resource._id]?.contextOpen}
|
||||||
|
onClick={() =>
|
||||||
|
toggleOpen(
|
||||||
|
resource._id,
|
||||||
|
"contextOpen",
|
||||||
|
!details[resource._id]?.contextOpen,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<EllipsisVIcon />
|
||||||
|
</MenuToggle>
|
||||||
|
)}
|
||||||
|
isOpen={!!details[resource._id]?.contextOpen}
|
||||||
|
>
|
||||||
|
<DropdownList>
|
||||||
<OverflowMenuDropdownItem
|
<OverflowMenuDropdownItem
|
||||||
key="share"
|
key="share"
|
||||||
isShared
|
isShared
|
||||||
|
@ -327,16 +353,19 @@ export const ResourcesTab = ({ isShared = false }: ResourcesTabProps) => {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ShareAltIcon /> {t("share")}
|
<ShareAltIcon /> {t("share")}
|
||||||
</OverflowMenuDropdownItem>,
|
</OverflowMenuDropdownItem>
|
||||||
<OverflowMenuDropdownItem
|
<OverflowMenuDropdownItem
|
||||||
key="edit"
|
key="edit"
|
||||||
isShared
|
isShared
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
toggleOpen(resource._id, "editDialogOpen", true)
|
toggleOpen(resource._id, "editDialogOpen", true)
|
||||||
}
|
}
|
||||||
|
isDisabled={
|
||||||
|
details[resource._id]?.permissions?.length === 0
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<EditAltIcon /> {t("edit")}
|
<EditAltIcon /> {t("edit")}
|
||||||
</OverflowMenuDropdownItem>,
|
</OverflowMenuDropdownItem>
|
||||||
<ContinueCancelModal
|
<ContinueCancelModal
|
||||||
key="unShare"
|
key="unShare"
|
||||||
buttonTitle={
|
buttonTitle={
|
||||||
|
@ -354,9 +383,9 @@ export const ResourcesTab = ({ isShared = false }: ResourcesTabProps) => {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{t("unShareAllConfirm")}
|
{t("unShareAllConfirm")}
|
||||||
</ContinueCancelModal>,
|
</ContinueCancelModal>
|
||||||
]}
|
</DropdownList>
|
||||||
/>
|
</Dropdown>
|
||||||
</OverflowMenuControl>
|
</OverflowMenuControl>
|
||||||
</OverflowMenu>
|
</OverflowMenu>
|
||||||
</Td>
|
</Td>
|
||||||
|
|
Loading…
Reference in a new issue