@@ -4,11 +4,14 @@ import { getName, getUID } from '@odf/shared/selectors';
44import { TopologyDataContext } from '@odf/shared/topology' ;
55import { ResourceIcon } from '@openshift-console/dynamic-plugin-sdk' ;
66import {
7- OptionsMenu ,
8- OptionsMenuItem ,
9- OptionsMenuToggle ,
10- } from '@patternfly/react-core/deprecated' ;
11- import { Button , ButtonVariant } from '@patternfly/react-core' ;
7+ Button ,
8+ ButtonVariant ,
9+ MenuToggle ,
10+ MenuToggleElement ,
11+ Select ,
12+ SelectList ,
13+ SelectOption ,
14+ } from '@patternfly/react-core' ;
1215import { AngleRightIcon } from '@patternfly/react-icons' ;
1316import { useVisualizationController } from '@patternfly/react-topology' ;
1417import { STEP_INTO_EVENT , STEP_TO_CLUSTER } from '../constants' ;
@@ -49,12 +52,7 @@ const TopologyNavigationBar: React.FC<TopologyNavigationBarProps> = ({
4952 const uid = getUID ( node ) ;
5053 const name = getName ( node ) ;
5154 return (
52- < OptionsMenuItem
53- onSelect = { onSelect }
54- isSelected = { selected === name }
55- key = { uid }
56- id = { name }
57- >
55+ < SelectOption isSelected = { selected === name } key = { uid } id = { name } >
5856 < ResourceIcon
5957 groupVersionKind = { {
6058 group : NodeModel . apiGroup ,
@@ -63,24 +61,27 @@ const TopologyNavigationBar: React.FC<TopologyNavigationBarProps> = ({
6361 } }
6462 />
6563 { name }
66- </ OptionsMenuItem >
64+ </ SelectOption >
6765 ) ;
6866 } ) ,
69- [ nodes , selected , onSelect ]
70- ) ;
71-
72- const onToggle = ( ) => setOpen ( ( o ) => ! o ) ;
73-
74- const toggle = React . useMemo (
75- ( ) => < OptionsMenuToggle onToggle = { onToggle } toggleTemplate = { selected } /> ,
76- [ selected ]
67+ [ nodes , selected ]
7768 ) ;
7869
7970 const onStorageClusterClick = ( e : React . MouseEvent < HTMLButtonElement > ) => {
8071 e . stopPropagation ( ) ;
8172 controller . fireEvent ( STEP_TO_CLUSTER ) ;
8273 } ;
8374
75+ const onToggleClick = ( ) => {
76+ setOpen ( ! isOpen ) ;
77+ } ;
78+
79+ const toggle = ( toggleRef : React . Ref < MenuToggleElement > ) => (
80+ < MenuToggle ref = { toggleRef } onClick = { onToggleClick } isExpanded = { isOpen } >
81+ { selected }
82+ </ MenuToggle >
83+ ) ;
84+
8485 return (
8586 < TopologyNavigationBarGroup >
8687 < TopologyNavigationItem >
@@ -101,12 +102,17 @@ const TopologyNavigationBar: React.FC<TopologyNavigationBarProps> = ({
101102 kind : NodeModel . kind ,
102103 } }
103104 />
104- < OptionsMenu
105+ < Select
105106 id = "node-menu"
106- menuItems = { menuItems }
107- toggle = { toggle }
108107 isOpen = { isOpen }
109- />
108+ onOpenChange = { ( newOpenState ) => setOpen ( newOpenState ) }
109+ onSelect = { onSelect }
110+ selected = { selected }
111+ toggle = { toggle }
112+ shouldFocusToggleOnSelect
113+ >
114+ < SelectList > { menuItems } </ SelectList >
115+ </ Select >
110116 </ TopologyNavigationItem >
111117 </ TopologyNavigationBarGroup >
112118 ) ;
0 commit comments