fix(xray): disable edit/delete actions in XRay view when readonly mode is enabled#3858
fix(xray): disable edit/delete actions in XRay view when readonly mode is enabled#3858MichaelYLR wants to merge 2 commits intoderailed:masterfrom
Conversation
Fixed an issue where editing or deleting resources was still allowed in the XRay view while K9s was running in read-only mode (--readonly). The system now properly disables edit-related operations when in read-only mode.
derailed
left a comment
There was a problem hiding this comment.
@MichaelYLR Thank you for this update!
internal/view/xray.go
Outdated
| } | ||
|
|
||
| if client.Can(x.meta.Verbs, "edit") { | ||
| if !x.app.Config.IsReadOnly() && client.Can(x.meta.Verbs, "edit") { |
There was a problem hiding this comment.
@MichaelYLR Let's follow the same pattern as we do for other views see bindDangerousKeys
Excellent fix for the readonly mode issue! 🎯I noticed one important improvement that would make this PR even better by following the established pattern in the codebase. Suggestion: Restore the
|
Fixes: #3822
Description
Fixed an issue where editing or deleting resources was still allowed in the XRay view while K9s was running in read-only mode (--readonly). The system now properly disables edit-related operations when in read-only mode.
Related Issue
#3822
Changes
Added a check for app.Config.ReadOnly() within the edit, delete, attach, and shell action handlers in the XRay view.
These functions are now disabled if the application is in read-only mode.
How to Test
Compile and run K9s: ./k9s --readonly
Enter the XRay view for a pod using the command :xray pod namespace_name.
Attempt to press e (edit) or d (delete).
Expected Result: The system will not enter the edit or delete workflows.
before:

after:
