Disallow editing and deleting when in readonly mode

mine
Joscha Alisch 2020-02-04 22:10:28 +01:00
parent bc434dcfc8
commit f4511079b9
No known key found for this signature in database
GPG Key ID: 5CD84D89434B6CB5
1 changed files with 7 additions and 5 deletions

View File

@ -370,6 +370,7 @@ func (b *Browser) refreshActions() {
if b.app.ConOK() { if b.app.ConOK() {
b.namespaceActions(aa) b.namespaceActions(aa)
if !b.app.Config.K9s.GetReadOnly() {
if client.Can(b.meta.Verbs, "edit") { if client.Can(b.meta.Verbs, "edit") {
aa[ui.KeyE] = ui.NewKeyAction("Edit", b.editCmd, true) aa[ui.KeyE] = ui.NewKeyAction("Edit", b.editCmd, true)
} }
@ -377,6 +378,7 @@ func (b *Browser) refreshActions() {
aa[tcell.KeyCtrlD] = ui.NewKeyAction("Delete", b.deleteCmd, true) aa[tcell.KeyCtrlD] = ui.NewKeyAction("Delete", b.deleteCmd, true)
} }
} }
}
if !dao.IsK9sMeta(b.meta) { if !dao.IsK9sMeta(b.meta) {
aa[ui.KeyY] = ui.NewKeyAction("YAML", b.viewCmd, true) aa[ui.KeyY] = ui.NewKeyAction("YAML", b.viewCmd, true)