mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-21 02:09:05 +00:00
Bring over the TUI to interactive installer (#845)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
50
internal/agent/TUIuserdataPage.go
Normal file
50
internal/agent/TUIuserdataPage.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
// Userdata Page
|
||||
|
||||
type userdataPage struct{}
|
||||
|
||||
func (p *userdataPage) Title() string {
|
||||
return "Userdata Generated"
|
||||
}
|
||||
|
||||
func (p *userdataPage) Help() string {
|
||||
return "Press any key to return to the summary page."
|
||||
}
|
||||
|
||||
func (p *userdataPage) ID() string {
|
||||
return "userdata"
|
||||
}
|
||||
|
||||
func newUserdataPage() *userdataPage {
|
||||
return &userdataPage{}
|
||||
}
|
||||
|
||||
func (p *userdataPage) Init() tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *userdataPage) Update(msg tea.Msg) (Page, tea.Cmd) {
|
||||
switch msg.(type) {
|
||||
case tea.KeyMsg:
|
||||
// Go back to customization page
|
||||
return p, func() tea.Msg { return GoToPageMsg{PageID: "summary"} }
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func (p *userdataPage) View() string {
|
||||
s := "Userdata Generated (plain text):\n"
|
||||
cc := NewInteractiveInstallConfig(&mainModel)
|
||||
ccString, err := cc.String()
|
||||
if err == nil {
|
||||
s += "\n" + string(ccString) + "\n"
|
||||
} else {
|
||||
s += " (error displaying cloud config)\n"
|
||||
}
|
||||
return s
|
||||
}
|
Reference in New Issue
Block a user