@@ -29,7 +29,7 @@ export interface HasKeyProps<ReasonEvent> {
29
29
Key ?: Key ;
30
30
predicate ?: ( capabilitiesRegistry : unknown ) => [ boolean , ReasonEvent ] ; // returns a boolean and an event if the user does not have the permission
31
31
children : React . ReactNode ;
32
- allowClick ?: boolean ;
32
+ notifyOnclick ?: boolean ;
33
33
invert_action ?: InvertAction [ ] ;
34
34
}
35
35
@@ -40,7 +40,13 @@ export const createCanShow = (
40
40
CAN : ( action : string , subject : string ) => boolean ,
41
41
eventBus : ( ) => EventBus < ReasonEvent >
42
42
) => {
43
- return ( { Key, children, predicate, invert_action = [ 'disable' ] } : HasKeyProps < ReasonEvent > ) => {
43
+ return ( {
44
+ Key,
45
+ children,
46
+ notifyOnclick = true ,
47
+ predicate,
48
+ invert_action = [ 'disable' ]
49
+ } : HasKeyProps < ReasonEvent > ) => {
44
50
if ( ! children ) {
45
51
return null ;
46
52
}
@@ -65,11 +71,12 @@ export const createCanShow = (
65
71
return null ;
66
72
}
67
73
68
- const isClickable = children && ( children as React . ReactElement ) . props . onClick ;
69
- const pointerEvents = isClickable ? 'auto' : 'none' ;
74
+ const pointerEvents = notifyOnclick ? 'auto' : 'none' ;
75
+ console . log ( 'cant perform action ' , reason , eventBus ) ;
70
76
71
- const onClick = isClickable
72
- ? ( ) => {
77
+ const onClick = notifyOnclick
78
+ ? ( e : React . MouseEvent < HTMLDivElement | HTMLElement > ) => {
79
+ e . stopPropagation ( ) ;
73
80
console . log ( 'cant perform action : reason' , reason , eventBus ) ;
74
81
const mesheryEventBus = eventBus ( ) ;
75
82
mesheryEventBus . publish ( reason ) ;
@@ -85,6 +92,7 @@ export const createCanShow = (
85
92
pointerEvents,
86
93
opacity : opacity
87
94
} }
95
+ onClick = { onClick }
88
96
>
89
97
{ React . cloneElement ( children as React . ReactElement , {
90
98
style : {
0 commit comments