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,11 +370,13 @@ func (b *Browser) refreshActions() {
if b.app.ConOK() {
b.namespaceActions(aa)
if client.Can(b.meta.Verbs, "edit") {
aa[ui.KeyE] = ui.NewKeyAction("Edit", b.editCmd, true)
}
if client.Can(b.meta.Verbs, "delete") {
aa[tcell.KeyCtrlD] = ui.NewKeyAction("Delete", b.deleteCmd, true)
if !b.app.Config.K9s.GetReadOnly() {
if client.Can(b.meta.Verbs, "edit") {
aa[ui.KeyE] = ui.NewKeyAction("Edit", b.editCmd, true)
}
if client.Can(b.meta.Verbs, "delete") {
aa[tcell.KeyCtrlD] = ui.NewKeyAction("Delete", b.deleteCmd, true)
}
}
}