Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add kernel version to zui #2058

Merged
merged 4 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cmds/modules/zui/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"fmt"
"strings"
"syscall"
"unsafe"

"github.com/gizak/termui/v3/widgets"
"github.com/pkg/errors"
Expand Down Expand Up @@ -43,6 +45,7 @@ func headerRenderer(ctx context.Context, c zbus.Client, h *widgets.Paragraph, r
"\n" +
" This is node %s (farmer %s)\n" +
" running Zero-OS version [%s](fg:blue) (mode [%s](fg:cyan))\n" +
" kernel: %s\n" +
" cache disk: %s"

host := stubs.NewVersionMonitorStub(c)
Expand Down Expand Up @@ -77,7 +80,15 @@ func headerRenderer(ctx context.Context, c zbus.Client, h *widgets.Paragraph, r
cache = red("no ssd disks detected")
}

h.Text = fmt.Sprintf(s, nodeID, farm, version.String(), env.RunningMode.String(), cache)
var utsname syscall.Utsname
var uname string
if err := syscall.Uname(&utsname); err != nil {
uname = red(err.Error())
} else {
uname = green(string(unsafe.Slice((*byte)(unsafe.Pointer(&utsname.Release)), len(utsname.Release))))
}

h.Text = fmt.Sprintf(s, nodeID, farm, version.String(), env.RunningMode.String(), uname, cache)
r.Signal()
}
}()
Expand Down
4 changes: 2 additions & 2 deletions cmds/modules/zui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ func action(ctx *cli.Context) error {

header := widgets.NewParagraph()
header.Border = true
header.SetRect(0, 0, width, 7)
header.SetRect(0, 0, width, 8)

netgrid := ui.NewGrid()
netgrid.Title = "Network"
netgrid.SetRect(0, 7, width, 14)
netgrid.SetRect(0, 8, width, 14)

resources := ui.NewGrid()
resources.Title = "Provision"
Expand Down