Change get all behaviour

This commit is contained in:
Digital Studium 2024-05-08 09:01:41 +03:00
parent 5165fa2aca
commit 7c21965500
1 changed files with 5 additions and 2 deletions

3
kls
View File

@ -78,6 +78,9 @@ def refresh_third_menu(namespace: str, api_resource: str):
menu = menus[2]
menu.rows = []
if api_resource and namespace:
if api_resource == "all":
menu.rows = kubectl(f"api-resources --verbs=get --namespaced -o name | grep -v events | xargs -n 1 kubectl get --show-kind --namespace {namespace} --ignore-not-found --no-headers -o name")
else:
menu.rows = kubectl(f"-n {namespace} get {api_resource} --no-headers --ignore-not-found")
index_before_update = menu.filtered_rows.index
menu.filtered_rows = CircularList([x for x in menu.rows if menu.filter in x]) # update filtered rows