diff --git a/docs/cluster-watcher.md b/docs/cluster-watcher.md index 20358c8..1c50ecc 100644 --- a/docs/cluster-watcher.md +++ b/docs/cluster-watcher.md @@ -345,6 +345,18 @@ everything at once. - **Workloads:** one table for every kind, filtered by cluster, namespace, kind, node and state and searched by name, problems first, paged. The same table filtered to `vm` is the **VMs** page. +- **Platforms (#80):** every cluster, array and VM host says what it runs + on, the way people name it: OpenShift, OKD, Kubernetes, VMware vSphere, + Nutanix, Proxmox VE, Hyper-V, KVM, Pure FlashArray, Pure FlashBlade, + IBM i, IBM Power, Vault or OpenBao. A cluster's comes from the + distribution its watcher reports (OpenShift's from its cluster version), + a host's VMs' from their hypervisor. It's a label on the Clusters cards, + in the Workloads "Where" column and cluster picker, on a host's VM line + and in the network map's cluster boxes. Workloads filters by it + (`/workloads?platform=VMware vSphere`), with a count on each choice. The + API gives `platform` on each cluster, workload row and VM link, and the + workload list adds `platforms` (counts, before the platform, state and + kind filters) and `platform_of` (each source's). - **A controller, VM or node:** its record, its pods (for a controller or a node), its warning events, its history, its incidents. For operators and admins, the last log lines of a failing container, when the cluster diff --git a/internal/server/mapviews.go b/internal/server/mapviews.go index 137721e..6cde23a 100644 --- a/internal/server/mapviews.go +++ b/internal/server/mapviews.go @@ -289,7 +289,7 @@ func (srv *Server) networkView(focus string, now time.Time) (*MapView, bool) { _, conds := srv.view(now) for _, c := range srv.clusterViews(now, conds) { v.Boxes = append(v.Boxes, MapBox{ID: "cluster:" + c.Name, Kind: "cluster", Name: c.Name, Status: c.Status, - Sub: c.Summary, Count: c.Nodes}) + Sub: c.Platform + " · " + c.Summary, Count: c.Nodes}) } case "site", "group": diff --git a/internal/server/platform.go b/internal/server/platform.go new file mode 100644 index 0000000..2382748 --- /dev/null +++ b/internal/server/platform.go @@ -0,0 +1,81 @@ +package server + +import ( + "cmp" + "strings" + + "github.com/cairnobs/cairnobs/internal/report" +) + +// Platforms (#80): what a cluster, array or VM host is, said the way people +// name it, so the pages can show OpenShift apart from plain Kubernetes and +// VMware apart from Nutanix or Proxmox. A cluster's comes from the +// distribution its watcher reports; a host's VMs' from their hypervisor. + +// platformOf names the platform from a cluster's distribution, or for a +// host's own VMs (distribution ""), from their hypervisor fact. +func platformOf(distribution, hypervisor string) string { + switch d := distribution; { + case d == "OpenShift", d == "OKD": + return d + case d == "vCenter": + return "VMware vSphere" + case d == "Prism Central": + return "Nutanix" + case strings.HasPrefix(d, "Proxmox"): + return "Proxmox VE" + case d == "Purity//FB": + return "Pure FlashBlade" + case strings.HasPrefix(d, "Purity"): + return "Pure FlashArray" + case d == ibmiDistribution: + return "IBM i" + case d == hmcDistribution: + return "IBM Power" + case d == "OpenBao": + return d + case strings.HasPrefix(d, "Vault"): + return "Vault" + case d != "": + return "Kubernetes" + } + switch hypervisor { + case "Hyper-V": + return "Hyper-V" + case "libvirt": + return "KVM" + case "vSphere": + return "VMware vSphere" + } + return "" +} + +// platform is the source's: a cluster's from its distribution (a cluster +// agent that hasn't said is Kubernetes), a host's from its VMs. +func (s wsnap) platform() string { + if s.host { + for _, r := range s.recs { + if h, _ := r.Facts["hypervisor"].(string); h != "" { + return platformOf("", h) + } + } + return "KVM" // a host lists VMs through libvirt unless it says otherwise + } + if p := platformOf(s.distribution(), ""); p != "" { + return p + } + return "Kubernetes" +} + +// clusterPlatform is a stored cluster source's platform, from its own +// record (vmLinks reads the store directly, under its lock). +func clusterPlatform(recs map[string]*wrec) string { + d := distributionOf(func(yield func(report.Workload) bool) { + for _, r := range recs { + if !yield(r.Workload) { + return + } + } + }) + return cmp.Or(platformOf(d, ""), "Kubernetes") +} diff --git a/internal/server/vmlink.go b/internal/server/vmlink.go index de4f9cb..29d1d9e 100644 --- a/internal/server/vmlink.go +++ b/internal/server/vmlink.go @@ -1,6 +1,7 @@ package server import ( + "cmp" "strings" "github.com/cairnobs/cairnobs/internal/report" @@ -21,8 +22,9 @@ type VMLink struct { State string `json:"state"` Word string `json:"word"` Href string `json:"href"` - OnHost bool `json:"on_host,omitempty"` // Source is a host running libvirt, not a cluster - Title string `json:"title,omitempty"` // the cluster's own name, when it isn't Source's (Proxmox) + OnHost bool `json:"on_host,omitempty"` // Source is a host running libvirt, not a cluster + Title string `json:"title,omitempty"` // the cluster's own name, when it isn't Source's (Proxmox) + Platform string `json:"platform,omitempty"` // what Source runs on: VMware vSphere, OpenShift, KVM (#80) key string // its condition's key: vm/// } @@ -56,7 +58,7 @@ func (srv *Server) vmLinks() (byHost map[string]VMLink, byVM map[string]HostLink ws := &srv.wl ws.mu.RLock() for src, s := range ws.src { - title := "" + title, plat := "", clusterPlatform(s.recs) if r, ok := s.recs[report.ClusterSelf]; ok && r.Name != "" && r.Name != src { title = r.Name } @@ -75,7 +77,7 @@ func (srv *Server) vmLinks() (byHost map[string]VMLink, byVM map[string]HostLink if _, ok := vmOf[u]; ok { dupVM[u] = true } - vmOf[u] = VMLink{Source: src, Title: title, Namespace: r.Namespace, Name: r.Name, Node: r.Node, State: r.State, Word: r.Word, + vmOf[u] = VMLink{Source: src, Title: title, Platform: plat, Namespace: r.Namespace, Name: r.Name, Node: r.Node, State: r.State, Word: r.Word, Href: workloadHref(src, r.Namespace, r.Name), key: "vm/" + src + "/" + r.Namespace + "/" + r.Name} } } @@ -90,7 +92,8 @@ func (srv *Server) vmLinks() (byHost map[string]VMLink, byVM map[string]HostLink if _, ok := vmOf[u]; ok { dupVM[u] = true } - vmOf[u] = VMLink{Source: h.name, Name: r.Name, State: r.State, Word: r.Word, + hv, _ := r.Facts["hypervisor"].(string) + vmOf[u] = VMLink{Source: h.name, Platform: cmp.Or(platformOf("", hv), "KVM"), Name: r.Name, State: r.State, Word: r.Word, Href: workloadHref(h.name, "", r.Name), OnHost: true, key: "vm/" + h.name + "//" + r.Name} } } diff --git a/internal/server/vmlink_test.go b/internal/server/vmlink_test.go index f415239..89e9438 100644 --- a/internal/server/vmlink_test.go +++ b/internal/server/vmlink_test.go @@ -32,7 +32,7 @@ func TestVMLinkedToItsHost(t *testing.T) { // Running: linked both ways; silence is the guest's or the network's. hosts, conds := a.view(now) - if hosts[0].VM == nil || hosts[0].VM.Name != "db" || hosts[0].VM.Source != "prod" || hosts[0].VM.Href != "/workloads?source=prod&ns=vms&q=db" { + if hosts[0].VM == nil || hosts[0].VM.Name != "db" || hosts[0].VM.Source != "prod" || hosts[0].VM.Href != "/workloads?source=prod&ns=vms&q=db" || hosts[0].VM.Platform != "Kubernetes" { t.Fatalf("host's VM: %+v", hosts[0].VM) } silent := find(conds, "silent/node1") @@ -45,6 +45,9 @@ func TestVMLinkedToItsHost(t *testing.T) { if rec.Code != http.StatusOK || len(list.Workloads) != 1 || list.Workloads[0].Host == nil || list.Workloads[0].Host.Name != "node1" { t.Fatalf("VM's host: %d %s", rec.Code, rec.Body) } + if list.Workloads[0].Platform != "Kubernetes" { + t.Errorf("VM's platform: %q", list.Workloads[0].Platform) + } // The VM is down: one incident for it, the host held under it. sendBatch(t, a, tok, report.Workloads{Records: []report.Workload{vm(report.StateDown, "Can't be scheduled")}}) @@ -130,6 +133,31 @@ func TestHostVMs(t *testing.T) { if rec.Code != http.StatusOK || len(list.Workloads) != 2 || len(list.Hypervisors) != 1 || list.Hypervisors[0] != "kvm1" { t.Fatalf("list: %d %s", rec.Code, rec.Body) } + for _, w := range list.Workloads { + if w.Platform != "KVM" { + t.Errorf("%s: platform %q, want KVM", w.Name, w.Platform) + } + } + // ?platform= keeps one platform's, and the counts say how many each has. + var by struct { + Workloads []WorkloadRow + Platforms map[string]int + PlatformOf map[string]string `json:"platform_of"` + } + _ = json.Unmarshal(get(a.Handler(), "/api/v1/workloads?platform=KVM", devCookie(t, a.Handler())).Body.Bytes(), &by) + if len(by.Workloads) != 2 || by.Platforms["KVM"] != 2 || by.PlatformOf["kvm1"] != "KVM" { + t.Errorf("platform=KVM: %d rows, %v, %v", len(by.Workloads), by.Platforms, by.PlatformOf) + } + _ = json.Unmarshal(get(a.Handler(), "/api/v1/workloads?platform=Hyper-V", devCookie(t, a.Handler())).Body.Bytes(), &by) + if len(by.Workloads) != 0 || by.Platforms["KVM"] != 2 { + t.Errorf("platform=Hyper-V: %d rows, %v", len(by.Workloads), by.Platforms) + } + hosts, _ := a.view(now) + for _, h := range hosts { + if h.Name == "web" && (h.VM == nil || h.VM.Platform != "KVM") { + t.Errorf("web's VM: %+v", h.VM) + } + } for _, w := range list.Workloads { if w.Name == "web" && (w.Host == nil || w.Host.Name != "web" || w.Usage == nil || w.Usage.CPU != 0.5) { t.Errorf("web: host %+v usage %+v", w.Host, w.Usage) diff --git a/internal/server/workloads.go b/internal/server/workloads.go index 0a4ed50..42688df 100644 --- a/internal/server/workloads.go +++ b/internal/server/workloads.go @@ -15,6 +15,7 @@ import ( "errors" "fmt" "io" + "iter" "log" "maps" "net/http" @@ -576,8 +577,14 @@ func (s wsnap) kindLabel() string { return "IBM i partition" case n == "Array": return "Pure array" + case n == "vCenter": + return "VMware vCenter" + case n == "Prism Central": + return "Nutanix Prism Central" + case n == "HMC": + return "IBM Power HMC" case n != "Cluster": - return n // vCenter, Prism Central, HMC, Vault, OpenBao + return n // Vault, OpenBao case strings.HasPrefix(d, "Proxmox"): return "Proxmox cluster" case d == "OpenShift", d == "OKD": @@ -652,14 +659,34 @@ func (s wsnap) nodeNoun() string { return "Node" } +// distribution is what the source's watcher says it is: on its own +// record, or for OpenShift and OKD on the cluster version's, which is +// where the cluster watcher reads it. func (s wsnap) distribution() string { - for _, r := range s.recs { - if r.Kind == report.KindCluster && r.ID == report.ClusterSelf { - d, _ := r.Facts["distribution"].(string) + return distributionOf(func(yield func(report.Workload) bool) { + for _, r := range s.recs { + if !yield(r) { + return + } + } + }) +} + +func distributionOf(recs iter.Seq[report.Workload]) string { + ocp := "" + for r := range recs { + if r.Kind != report.KindCluster { + continue + } + d, _ := r.Facts["distribution"].(string) + switch { + case r.ID == report.ClusterSelf && d != "": return d + case strings.HasPrefix(r.Name, "clusterversion/") && d != "": + ocp = d } } - return "" + return ocp } // alertable applies a workload's alert setting: off drops it, and only @@ -1166,6 +1193,9 @@ type ClusterView struct { // workloads", "CPU 54% · system ASP 85% · 4 of 5 subsystems active". Group string `json:"group"` Summary string `json:"summary"` + // Platform is what it runs on, said the way people name it: + // OpenShift, Kubernetes, VMware vSphere, Nutanix, Proxmox VE (#80). + Platform string `json:"platform"` } // expectSubsystems marks an IBM i partition's subsystems that @@ -1356,7 +1386,7 @@ func (srv *Server) clusterViews(now time.Time, conds []Condition) []ClusterView if s.host { continue // a host's VMs: on its page and Workloads, not Clusters } - v := ClusterView{Name: s.name, Agent: s.agent, Problems: probs[s.name], Kinds: map[string]map[string]int{}, Noun: s.noun(), NodeNoun: s.nodeNoun(), Group: s.group()} + v := ClusterView{Name: s.name, Agent: s.agent, Problems: probs[s.name], Kinds: map[string]map[string]int{}, Noun: s.noun(), NodeNoun: s.nodeNoun(), Group: s.group(), Platform: s.platform()} v.Status, v.Word, _ = srv.sourceStatus(s, now) if !s.heard.IsZero() { h := s.heard @@ -1511,6 +1541,8 @@ func rank(sev string) int { // WorkloadRow is one workload in the Workloads list. type WorkloadRow struct { Source string `json:"source"` + // Platform is what Source runs on: OpenShift, VMware vSphere, KVM (#80). + Platform string `json:"platform"` report.Workload Severity string `json:"severity"` // Host is the host agent inside a VM, linked by its SMBIOS UUID. @@ -1526,13 +1558,17 @@ type WorkloadRow struct { // handleWorkloadList is every workload, most in need first: ?source=, // ?kind=, ?ns=, ?node=, ?owner=, ?show= (problems, good, waiting, off), -// ?q= (name, namespace, owner or node), ?offset=, ?limit= (100, at most -// 1000). counts leave show and kind out and kinds leaves kind out, so each -// choice can say how many it holds; namespaces are the chosen cluster's. +// ?q= (name, namespace, owner or node), ?platform= (#80), ?offset=, +// ?limit= (100, at most 1000). counts leave show and kind out, kinds +// leaves kind out and platforms leaves platform, show and kind out, so +// each choice can say how many it holds; namespaces are the chosen +// cluster's. platform_of names each source's platform, for the picker. func (srv *Server) handleWorkloadList(w http.ResponseWriter, r *http.Request) { now := time.Now() qv := r.URL.Query() source, kind, ns, node, owner, show := qv.Get("source"), qv.Get("kind"), qv.Get("ns"), qv.Get("node"), qv.Get("owner"), qv.Get("show") + platform := qv.Get("platform") + platforms, platformOfSource := map[string]int{}, map[string]string{} q := strings.ToLower(strings.TrimSpace(qv.Get("q"))) offset, limit := page(r, 100, 1000) counts := map[string]int{"all": 0, "problems": 0, "good": 0, "waiting": 0, "off": 0} @@ -1543,6 +1579,8 @@ func (srv *Server) handleWorkloadList(w http.ResponseWriter, r *http.Request) { snaps := srv.workloadSnapshot() byPVC, byVolume := volumeLinks(snaps) for _, s := range snaps { + plat := s.platform() + platformOfSource[s.name] = plat if source != "" && s.name != source { continue } @@ -1560,6 +1598,10 @@ func (srv *Server) handleWorkloadList(w http.ResponseWriter, r *http.Request) { if q != "" && !strings.Contains(strings.ToLower(rec.Name+" "+rec.Namespace+" "+rec.Owner+" "+rec.Node), q) { continue } + platforms[plat]++ + if platform != "" && plat != platform { + continue + } sev := stateSeverity(rec.State) counts["all"]++ switch sev { @@ -1575,7 +1617,7 @@ func (srv *Server) handleWorkloadList(w http.ResponseWriter, r *http.Request) { if kind != "" && rec.Kind != kind { continue } - row := WorkloadRow{Source: s.name, Workload: rec, Severity: sev, Usage: s.usageOf(rec.ID, now)} + row := WorkloadRow{Source: s.name, Platform: plat, Workload: rec, Severity: sev, Usage: s.usageOf(rec.ID, now)} if h, ok := byVM["vm/"+s.name+"/"+rec.Namespace+"/"+rec.Name]; ok && rec.Kind == report.KindVM { row.Host = &h } @@ -1600,7 +1642,8 @@ func (srv *Server) handleWorkloadList(w http.ResponseWriter, r *http.Request) { // Facts and labels stay for whoever opens a row: the list is the rest. win := window(rows, offset, limit) writeJSON(w, http.StatusOK, map[string]any{"workloads": win, "total": len(rows), "offset": offset, "limit": limit, - "counts": counts, "kinds": kinds, "namespaces": namespaces, "clusters": names(srv.clusterSnaps()), "hypervisors": names(srv.hostVMSnaps())}) + "counts": counts, "kinds": kinds, "namespaces": namespaces, "clusters": names(srv.clusterSnaps()), "hypervisors": names(srv.hostVMSnaps()), + "platforms": platforms, "platform_of": platformOfSource}) } // lowerFirst lowers a word's first letter, for the middle of a sentence, diff --git a/internal/server/workloads_test.go b/internal/server/workloads_test.go index 4e57057..e6d5a9a 100644 --- a/internal/server/workloads_test.go +++ b/internal/server/workloads_test.go @@ -698,19 +698,56 @@ func TestClusterKind(t *testing.T) { snap := func(d string) wsnap { return wsnap{recs: []report.Workload{{Kind: report.KindCluster, ID: report.ClusterSelf, Facts: map[string]any{"distribution": d}}}} } - for d, want := range map[string][2]string{ - "": {"Kubernetes cluster", "Kubernetes"}, - "OpenShift": {"OpenShift cluster", "Kubernetes"}, - "Proxmox VE": {"Proxmox cluster", "Virtualization"}, - "vCenter": {"vCenter", "Virtualization"}, - "Prism Central": {"Prism Central", "Virtualization"}, - "HMC": {"HMC", "IBM i"}, - "IBM i": {"IBM i partition", "IBM i"}, - "Purity//FA": {"Pure array", "Storage"}, - "OpenBao": {"OpenBao", "Secrets"}, + for d, want := range map[string][3]string{ + "": {"Kubernetes cluster", "Kubernetes", "Kubernetes"}, + "OpenShift": {"OpenShift cluster", "Kubernetes", "OpenShift"}, + "OKD": {"OKD cluster", "Kubernetes", "OKD"}, + "Proxmox VE": {"Proxmox cluster", "Virtualization", "Proxmox VE"}, + "vCenter": {"VMware vCenter", "Virtualization", "VMware vSphere"}, + "Prism Central": {"Nutanix Prism Central", "Virtualization", "Nutanix"}, + "HMC": {"IBM Power HMC", "IBM i", "IBM Power"}, + "IBM i": {"IBM i partition", "IBM i", "IBM i"}, + "Purity//FA": {"Pure array", "Storage", "Pure FlashArray"}, + "Purity//FB": {"Pure array", "Storage", "Pure FlashBlade"}, + "Vault": {"Vault", "Secrets", "Vault"}, + "OpenBao": {"OpenBao", "Secrets", "OpenBao"}, } { - if got := [2]string{snap(d).kindLabel(), snap(d).group()}; got != want { + if got := [3]string{snap(d).kindLabel(), snap(d).group(), snap(d).platform()}; got != want { t.Errorf("%q: %v, want %v", d, got, want) } } } + +// A host's own VMs are on the platform their hypervisor names (#80). +func TestHostPlatform(t *testing.T) { + vm := func(h string) wsnap { + return wsnap{host: true, recs: []report.Workload{{Kind: report.KindVM, Name: "a", Facts: map[string]any{"hypervisor": h}}}} + } + for h, want := range map[string]string{"Hyper-V": "Hyper-V", "libvirt": "KVM", "": "KVM"} { + if got := vm(h).platform(); got != want { + t.Errorf("hypervisor %q: %q, want %q", h, got, want) + } + } + if got := (wsnap{host: true}).platform(); got != "KVM" { + t.Errorf("a host with no VMs: %q", got) + } +} + +// OpenShift says so on its cluster version, not on the cluster's own +// record: that's where the cluster watcher reads it (#80). +func TestOpenShiftPlatform(t *testing.T) { + s := wsnap{recs: []report.Workload{ + {Kind: report.KindCluster, ID: report.ClusterSelf, Name: "prod"}, + {Kind: report.KindCluster, ID: "cv", Name: "clusterversion/version", Facts: map[string]any{"distribution": "OpenShift", "version": "4.20.3"}}, + }} + if got := [3]string{s.platform(), s.kindLabel(), s.group()}; got != [3]string{"OpenShift", "OpenShift cluster", "Kubernetes"} { + t.Errorf("OpenShift: %v", got) + } + recs := map[string]*wrec{} + for _, r := range s.recs { + recs[r.ID] = &wrec{Workload: r} + } + if got := clusterPlatform(recs); got != "OpenShift" { + t.Errorf("clusterPlatform: %q", got) + } +} diff --git a/web/src/lib/Platform.svelte b/web/src/lib/Platform.svelte new file mode 100644 index 0000000..18b16c2 --- /dev/null +++ b/web/src/lib/Platform.svelte @@ -0,0 +1,34 @@ + + +{#if p}{p}{/if} + + diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index e6d9bc7..1e22435 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -36,7 +36,7 @@ export interface Host { export interface HostEvents { at: string; since: string; list: EventGroup[]; error?: string } export interface EventGroup { log: string; source: string; id: number; level: 'critical' | 'error'; count: number; first: string; last: string; message?: string } /** A cluster's VM, as linked to a host (internal/server/vmlink.go). */ -export interface VMLink { source: string; namespace?: string; name: string; node?: string; state: string; word: string; href: string; on_host?: boolean; title?: string } +export interface VMLink { source: string; namespace?: string; name: string; node?: string; state: string; word: string; href: string; on_host?: boolean; title?: string; platform?: string } /** The libvirt VMs a host runs. */ export interface HostVMCount { total: number; running: number; error?: string; href: string } export interface UnitView { name: string; load: string; active: string; sub: string; restarts: number; since?: string; host: string; severity: Severity; word: string } @@ -88,6 +88,8 @@ export interface Cluster { noun: string; node_noun: string; /** The Clusters page's section (Kubernetes, Virtualization, Storage, IBM i, Secrets), and its state in a line, in its kind's terms. */ group: string; summary: string; + /** What it runs on, the way people name it: OpenShift, Kubernetes, VMware vSphere, Nutanix (#80). */ + platform?: string; /** An IBM i partition's own numbers, in place of nodes. */ partition?: PartitionNums; } @@ -101,7 +103,8 @@ export interface ClusterPart { name: string; title: string; state: string; word: export interface ClusterNode { name: string; state: string; severity: Severity; word: string; since?: string; facts?: Record } /** A row of the workloads list: GET /api/v1/workloads. */ export interface Workload { - source: string; kind: string; id: string; name: string; namespace?: string; owner?: string; node?: string; + /** platform is what source runs on: OpenShift, VMware vSphere, KVM (#80). */ + source: string; platform?: string; kind: string; id: string; name: string; namespace?: string; owner?: string; node?: string; state: string; severity: Severity; word: string; since?: string; alert?: string; labels?: Record; facts?: Record; /** For a VM: the host agent inside it, linked by its SMBIOS UUID. */ diff --git a/web/src/routes/clusters/+page.svelte b/web/src/routes/clusters/+page.svelte index 05f6346..a75d81e 100644 --- a/web/src/routes/clusters/+page.svelte +++ b/web/src/routes/clusters/+page.svelte @@ -3,6 +3,7 @@ import { replaceState } from '$app/navigation'; import Icon from '$lib/Icon.svelte'; import Panel from '$lib/Panel.svelte'; + import Platform from '$lib/Platform.svelte'; import Status from '$lib/Status.svelte'; import ArrayIO from '$lib/ArrayIO.svelte'; import VaultLeases from '$lib/VaultLeases.svelte'; @@ -64,7 +65,7 @@ if (show === 'problems' && !needsLook(c)) return false; if (!q) return true; const f = q.toLowerCase(); - return [c.name, c.title, c.read_by, c.version, c.noun].some((x) => x?.toLowerCase().includes(f)); + return [c.name, c.title, c.read_by, c.version, c.noun, c.platform].some((x) => x?.toLowerCase().includes(f)); }; const sections = $derived( groups @@ -98,7 +99,7 @@
- + {#each sections as x (x.g)}{/each} @@ -114,6 +115,7 @@
+ {c.heard ? `Heard ${ago(c.heard)}` : 'Never heard from'}{#if c.listed} · listed in full {ago(c.listed)}{/if}
diff --git a/web/src/routes/hosts/[name]/+page.svelte b/web/src/routes/hosts/[name]/+page.svelte index ff89de1..2d68937 100644 --- a/web/src/routes/hosts/[name]/+page.svelte +++ b/web/src/routes/hosts/[name]/+page.svelte @@ -1,6 +1,7 @@ @@ -114,10 +123,10 @@ {/if} @@ -131,6 +140,15 @@ {/each}
+{#if platformList.length > 1 || platform} +
+ + {#each platformList as [p, n] (p)} + + {/each} + {#if platform && !platforms[platform]}{/if} +
+{/if}
{#each Object.keys(kindNames) as k} @@ -139,7 +157,7 @@ {#if node}{/if} {#if owner}{/if} {#if source && clusters.length + hypervisors.length <= 1}{/if} - {#if source || kind || ns || node || owner || show || q}{/if} + {#if source || platform || kind || ns || node || owner || show || q}{/if}
@@ -153,7 +171,7 @@ {kindWord[w.kind] ?? w.kind} {#if w.usage}{cores(w.usage.cpu)} CPU{#if w.usage.cpu_pct}{' '}= 90}>{Math.round(w.usage.cpu_pct)}%{/if} · {bytes(w.usage.mem)}{#if w.usage.mem_pct}{' '}= 90}>{Math.round(w.usage.mem_pct)}%{/if}{:else}—{/if} {#if w.node}{:else}—{/if} - {#if hypervisors.includes(w.source)}{w.source}{:else}{sourceLabel(w.source)}{/if} + {#if hypervisors.includes(w.source)}{w.source}{:else}{sourceLabel(w.source)}{/if} {w.since ? ago(w.since) : '—'} {#if open === w.source + '/' + w.id} @@ -193,6 +211,8 @@