@@ -16,6 +16,12 @@ export const RowActionsMenu: FC<RowActionsMenuProps> = ({ item, onOpen, onEdit }
1616 const popoverRef = useRef < MenuDomRef > ( null ) ;
1717 const [ open , setOpen ] = useState ( false ) ;
1818
19+ // Determine if the resource is managed by Flux based on the presence of the Flux label
20+
21+ const isFluxManaged = ! ! ( item ?. metadata ?. labels as unknown as Record < string , unknown > | undefined ) ?. [
22+ 'kustomize.toolkit.fluxcd.io/name'
23+ ] ;
24+
1925 const handleOpenerClick = ( e : Ui5CustomEvent < ButtonDomRef , ButtonClickEventDetail > ) => {
2026 if ( popoverRef . current && e . currentTarget ) {
2127 popoverRef . current . opener = e . currentTarget as unknown as HTMLElement ;
@@ -30,8 +36,12 @@ export const RowActionsMenu: FC<RowActionsMenuProps> = ({ item, onOpen, onEdit }
3036 ref = { popoverRef }
3137 open = { open }
3238 onItemClick = { ( event ) => {
33- const element = event . detail . item as HTMLElement ;
39+ const element = event . detail . item as HTMLElement & { disabled ?: boolean } ;
3440 const action = element . dataset . action ;
41+ // If Edit is disabled (Flux-managed), ignore the click
42+ if ( action === 'edit' && isFluxManaged ) {
43+ return ;
44+ }
3545 if ( action === 'delete' ) {
3646 onOpen ( item ) ;
3747 } else if ( action === 'edit' ) {
@@ -40,7 +50,12 @@ export const RowActionsMenu: FC<RowActionsMenuProps> = ({ item, onOpen, onEdit }
4050 setOpen ( false ) ;
4151 } }
4252 >
43- < MenuItem text = { t ( 'ManagedResources.editAction' , 'Edit' ) } icon = "edit" data-action = "edit" />
53+ < MenuItem
54+ text = { t ( 'ManagedResources.editAction' , 'Edit' ) }
55+ icon = "edit"
56+ data-action = "edit"
57+ disabled = { isFluxManaged }
58+ />
4459 < MenuItem text = { t ( 'ManagedResources.deleteAction' ) } icon = "delete" data-action = "delete" />
4560 </ Menu >
4661 </ >
0 commit comments