Skip to content

Commit

Permalink
fix(ui): bootstrap prompt program and verbiage updates
Browse files Browse the repository at this point in the history
Co-authored-by: Tasos Bitsios <[email protected]>
  • Loading branch information
2 people authored and PhearZero committed Jan 14, 2025
1 parent 278409e commit d6d106e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
33 changes: 23 additions & 10 deletions cmd/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package cmd
import (
"context"
"fmt"
"time"

"github.com/algorandfoundation/nodekit/api"
cmdutils "github.com/algorandfoundation/nodekit/cmd/utils"
"github.com/algorandfoundation/nodekit/cmd/utils/explanations"
Expand All @@ -18,7 +20,6 @@ import (
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log"
"github.com/spf13/cobra"
"time"
)

// bootstrapCmdShort provides a brief description of the "bootstrap" command to initialize a fresh Algorand node.
Expand All @@ -40,7 +41,7 @@ var bootstrapCmdLong = lipgloss.JoinVertical(

var tutorial = `# Welcome!
This is the beginning of your adventure into running the an Algorand node!
This is the beginning of your adventure into running an Algorand node!
`

Expand Down Expand Up @@ -84,23 +85,36 @@ var bootstrapCmd = &cobra.Command{
if _, err := p.Run(); err != nil {
log.Fatal(err)
}

if msg == nil {
return nil
}

log.Warn(style.Yellow.Render(explanations.SudoWarningMsg))
if msg.Install && !algod.IsInstalled() {
if msg.Install {
log.Warn(style.Yellow.Render(explanations.SudoWarningMsg))

err := algod.Install()
if err != nil {
return err
}
}

// Wait for algod
time.Sleep(10 * time.Second)
// Wait for algod
time.Sleep(10 * time.Second)

if !algod.IsRunning() {
log.Fatal("algod is not running")
if !algod.IsRunning() {
log.Fatal("algod is not running. Something went wrong with installation")
}
} else {
if !algod.IsRunning() {
log.Info(style.Green.Render("Starting Algod 🚀"))
log.Warn(style.Yellow.Render(explanations.SudoWarningMsg))
err := algod.Start()
if err != nil {
log.Fatal(err)
}
log.Info(style.Green.Render("Algorand started successfully 🎉"))
time.Sleep(2 * time.Second)
}
}

dataDir, err := algod.GetDataDir("")
Expand All @@ -114,7 +128,6 @@ var bootstrapCmd = &cobra.Command{
}

if msg.Catchup {

network, err := utils.GetNetworkFromDataDir(dataDir)
if err != nil {
return err
Expand Down
5 changes: 1 addition & 4 deletions ui/bootstrap/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.Question = WaitingQuestion
return m, app.EmitBootstrapSelection(app.BoostrapSelected(m.BootstrapMsg))
}

}
case "n":
{
Expand All @@ -77,10 +76,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case CatchupQuestion:
m.Question = WaitingQuestion
m.BootstrapMsg.Catchup = false
case WaitingQuestion:
return m, tea.Sequence(m.Outside.Emit(m.BootstrapMsg), tea.Quit)
return m, app.EmitBootstrapSelection(app.BoostrapSelected(m.BootstrapMsg))
}

}

case "ctrl+c", "esc", "q":
Expand Down

0 comments on commit d6d106e

Please sign in to comment.