mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-07 05:31:20 +02:00
Move dashboard package into a common location where both Talos and talosctl can use it. Add support for overriding stdin, stdout, stderr and ctt in process runner. Create a dashboard service which runs the dashboard on /dev/tty2. Redirect kernel messages to tty1 and switch to tty2 after starting the dashboard on it. Related to siderolabs/talos#6841, siderolabs/talos#4791. Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
40 lines
878 B
Go
40 lines
878 B
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package components
|
|
|
|
import (
|
|
"sort"
|
|
|
|
"github.com/gizak/termui/v3/widgets"
|
|
"github.com/siderolabs/gen/maps"
|
|
|
|
"github.com/siderolabs/talos/internal/pkg/dashboard/data"
|
|
)
|
|
|
|
// NodeTabs represents the bottom bar with node list.
|
|
type NodeTabs struct {
|
|
widgets.TabPane
|
|
}
|
|
|
|
// NewNodeTabs initializes NodeTabs.
|
|
func NewNodeTabs() *NodeTabs {
|
|
tabs := &NodeTabs{
|
|
TabPane: *widgets.NewTabPane(),
|
|
}
|
|
|
|
return tabs
|
|
}
|
|
|
|
// Update implements the DataWidget interface.
|
|
func (widget *NodeTabs) Update(node string, data *data.Data) {
|
|
nodes := maps.Keys(data.Nodes)
|
|
sort.Strings(nodes)
|
|
|
|
widget.TabNames = nodes
|
|
if widget.ActiveTabIndex > len(nodes) {
|
|
widget.ActiveTabIndex = 0
|
|
}
|
|
}
|