Open sawwheet opened 1 year ago
Thank you for sharing! This could definitely be useful. (When I have time) I will look into why marking/unmarking does a refresh and if possible, see if I can include some of your suggestions.
I also had this problem
I patched it like this:
@@ -1129,20 +1130,24 @@
"Mark or unmark the item under cursor."
(interactive)
(let ((item (kubel--get-resource-under-cursor)))
(unless (-contains? kubel--selected-items item)
(progn
(push item kubel--selected-items)
+ (setf (aref (tabulated-list-get-entry) 0)
+ (kubel--propertize-status item))
(forward-line 1)
- (kubel)))))
+ (tabulated-list-print t t)))))
(defun kubel-unmark-item ()
"Unmark the item under cursor."
(interactive)
(let ((item (kubel--get-resource-under-cursor)))
(when (-contains? kubel--selected-items item)
(progn
(setq kubel--selected-items (delete item kubel--selected-items))
- (kubel)))))
+ (setf (aref (tabulated-list-get-entry) 0)
+ (substring-no-properties item))
+ (tabulated-list-print t t)))))
(defun kubel-mark-all ()
"Mark all items."
@@ -1153,13 +1158,19 @@
(while (not (eobp))
(push (kubel--get-resource-under-cursor) kubel--selected-items)
(forward-line 1)))
- (kubel))
+ (dolist (entry tabulated-list-entries)
+ (cl-destructuring-bind (id descs) entry
+ (setf (aref descs 0) (kubel--propertize-status (aref descs 0)))))
+ (tabulated-list-print t t))
(defun kubel-unmark-all ()
"Unmark all items."
(interactive)
(setq kubel--selected-items '())
- (kubel))
+ (dolist (entry tabulated-list-entries)
+ (cl-destructuring-bind (id descs) entry
+ (setf (aref descs 0) (string-remove-prefix "*" (substring-no-properties (aref descs 0))))))
+ (tabulated-list-print t t))
;; popups
I thought that maybe setting tabulated-list-entries
to a function and only caching the entrylist
might be better. (i.e. to separate the kubectl invocation from the generating of tabulated entries)
Hopefully this helps
Hey! Great work on this package, its simpler than kubernetes-el and works with all resources which is a must for me.
One thing I don't like is that marking and unmarking calls the kubel command, causing a full refresh. This is very slow when marking multiple pods.
I hacked together a simple solution:
Which basically uses highlighting as the mark indicator, which is instant and does not require calling propertize status and refreshing kubel.
the
delete-marked-items
function is just something i wanted for easier visibility of my k8s resources.I definitley did not look through the entire package, so im not sure if there is some other reason the current implementation