File tree Expand file tree Collapse file tree 2 files changed +25
-9
lines changed
app/javascript/components/vm-snapshot-tree-select Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -96,21 +96,23 @@ const SnapshotTree = ({ nodes }) => {
9696 } ) ;
9797
9898 const nodeClick = ( e , node ) => {
99- if ( node . metadata . selectable === false || e . target . id === selectedNode ) {
99+ if ( node . metadata . selectable === false ) {
100100 // If the clicked node is already selected or root is selected, do nothing
101- if ( e . target . id === selectedNode ) {
102- e . stopPropagation ( ) ;
103- }
104101 return ;
105102 }
106- e . stopPropagation ( ) ;
107- setSelectedNode ( e . target . id ) ;
108103
109104 // Remove 'selected' class from all elements
110105 const selectedElements = document . querySelectorAll ( '.selected-snapshot' ) ;
111106 selectedElements . forEach ( ( el ) => {
112107 el . classList . remove ( 'selected-snapshot' ) ;
113108 } ) ;
109+
110+ e . stopPropagation ( ) ;
111+ if ( node . id === selectedNode ) {
112+ setSelectedNode ( '' ) ;
113+ } else {
114+ setSelectedNode ( e . target . id ) ;
115+ }
114116 } ;
115117
116118 const addSelectedClassName = ( ) => {
@@ -133,10 +135,11 @@ const SnapshotTree = ({ nodes }) => {
133135 } , [ ] ) ;
134136
135137 const ArrowIcon = ( isOpen ) => {
138+ let icon = < ChevronRight16 /> ;
136139 if ( isOpen && isOpen . isOpen ) {
137- return < ChevronDown16 /> ;
140+ icon = < ChevronDown16 /> ;
138141 }
139- return < ChevronRight16 / >;
142+ return < div className = "arrow-div" > { icon } </ div > ;
140143 } ;
141144
142145 const NodeIcon = ( icon ) => {
Original file line number Diff line number Diff line change 1111 color : white;
1212 width : 100% ;
1313 margin-left : 0px ;
14+ pointer-events : none;
15+
16+ .arrow-div {
17+ pointer-events : all;
18+ }
19+
20+ span {
21+ pointer-events : all;
22+ }
23+ }
24+
25+ .arrow-div {
26+ display : inline-flex;
27+ margin-right : 5px ;
1428 }
1529
1630 .node-icon-div {
4155
4256 .checkbox .tree-node--focused .name {
4357 background : rgba (0 , 0 , 0 , 0.2 );
44- display : inline-flex;
4558 }
4659
4760 .checkbox .tree-node {
You can’t perform that action at this time.
0 commit comments