MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / uniqueSortedVMStatuses

Function uniqueSortedVMStatuses

internal/ui/components/search.go:219–239  ·  view source on GitHub ↗
(vms []*api.VM)

Source from the content-addressed store, hash-verified

217}
218
219func uniqueSortedVMStatuses(vms []*api.VM) []string {
220 set := map[string]struct{}{}
221 for _, vm := range vms {
222 if vm == nil {
223 continue
224 }
225 status := strings.TrimSpace(vm.Status)
226 if status == "" {
227 continue
228 }
229 set[status] = struct{}{}
230 }
231
232 out := make([]string, 0, len(set))
233 for status := range set {
234 out = append(out, status)
235 }
236 sort.Strings(out)
237
238 return out
239}
240
241func uniqueSortedVMNodes(vms []*api.VM) []string {
242 set := map[string]struct{}{}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected