siderolabs / omni

SaaS-simple deployment of Kubernetes - on your own hardware.
Other
523 stars 31 forks source link

feat: implement labels completion for clusters and machines #252

Closed Unix4ever closed 4 months ago

Unix4ever commented 4 months ago

New virtual resource LabelsCompletion can now be used to query all labels. And it works for any resources in the default namespace. To get the completions for any resource it is enough to pass the full resource type as the completions ID.

Labels input is reusable and can be enabled for any views we need. Both mouse and keyboard control work for the completion selection. Labels now appear as the same boxes as they are displayed in the machines and cluster lists.

Label completion search looks both in keys and values until you add : to the line. Then it looks for keys that contain whatever is before : with values that contain whatever is after :.

Fixes: https://github.com/siderolabs/omni/issues/24

Unix4ever commented 4 months ago

https://github.com/siderolabs/omni/assets/830532/cb8ad2eb-aec6-4098-9435-0aaf1da69e63

smira commented 4 months ago

Looks cool... I wonder if we shouldn't apply the label to the search (showing "no matches") until it's fully built?

Unix4ever commented 4 months ago

Looks cool... I wonder if we shouldn't apply the label to the search (showing "no matches") until it's fully built?

Well, the thing is that you can both add the label and search by text at the same time. So when it shows no matches it means it couldn't find the matching text.

Unix4ever commented 4 months ago

I don't want to drop search by text as it's still useful if you need to find a node with some specific uuid for example.

smira commented 4 months ago

I don't want to drop search by text as it's still useful if you need to find a node with some specific uuid for example.

That makes sense as well. idk, just looked a bit weird that while I'm typing a label via auto-complete, it shows that nothing is found.

Unix4ever commented 4 months ago

I think I can do it smarter, but I think that might be even more confusing. So I think to leave it as is.

Unix4ever commented 4 months ago

/m