-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# This is a combination of 51 commits.
# This is the 1st commit message: feat: add prompt-ui # This is the commit message #2: feat: configure and set algod data directory # This is the commit message #3: fix: RX/TX display # This is the commit message #4: fix: bit rate display for GB # This is the commit message #5: fix: configuration override order # This is the commit message #6: feat: handle invalid configuration and token gracefully # This is the commit message #7: test: fix test state # This is the commit message #8: fix: loading of custom endpoint address # This is the commit message #9: fix: loading default port # This is the commit message #10: test: clear viper settings # This is the commit message #11: fix: finds path to directory and gives cmd instruction # This is the commit message #12: feat: adds node start and node stop commands # This is the commit message #13: fix: add -y # This is the commit message #14: fix: turn script into indivudal commands # This is the commit message #15: feat: check if sudo, clarify shell # This is the commit message #16: chore: make more go idiomatic # This is the commit message #17: fix: fix proper path check # This is the commit message #18: fix: interact with systemctl, cleanup prompts # This is the commit message #19: fix: remove sudo # This is the commit message #20: fix: separate commands # This is the commit message #21: fix: proper algorand service name # This is the commit message #22: fix: calling with sudo # This is the commit message #23: chore: testing systemctl # This is the commit message #24: fix: checks algorand system service has been enabled directly # This is the commit message #25: feat: implements editAlgorandServiceFile # This is the commit message #26: fix: else statement # This is the commit message #27: fix: quick check branch # This is the commit message #28: fix: string template # This is the commit message #29: feat: adds upgrade # This is the commit message #30: chore: removeu nnecessary code # This is the commit message #31: fix: check that installed and candidate are the same # This is the commit message #32: chore: improve print # This is the commit message #33: chore: add more output # This is the commit message #34: fix: single quote # This is the commit message #35: fix: -y # This is the commit message #36: fix: systemctl # This is the commit message #37: fix: upgrade and sudo text # This is the commit message #38: chore: go mod tidy # This is the commit message #39: fix: upgrade # This is the commit message #40: feat: disable ui elements while syncing # This is the commit message #41: feat: skip account loading on syncing feat: remove offline account expires date # This is the commit message #42: feat: installs algod and sets up service on mac # This is the commit message #43: feat: refactor, + mac # This is the commit message #44: feat: adds uninstall, mac only # This is the commit message #45: fix: remove plist file # This is the commit message #46: chore: rename # This is the commit message #47: test: protocol snapshots and 100% # This is the commit message #48: test: status snapshots and 100% # This is the commit message #49: test: error page snapshots and 100% # This is the commit message #50: test: controls snapshots # This is the commit message #51: test: accounts snapshots
- Loading branch information
1 parent
70456da
commit ecf00bd
Showing
10 changed files
with
316 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
╭──────╮ | ||
────────────────────────────────────┤ test ├──────────────────────────────────── | ||
╰──────╯ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package ui | ||
|
||
import ( | ||
"bytes" | ||
"github.com/algorandfoundation/hack-tui/ui/controls" | ||
tea "github.com/charmbracelet/bubbletea" | ||
"github.com/charmbracelet/x/ansi" | ||
"github.com/charmbracelet/x/exp/golden" | ||
"github.com/charmbracelet/x/exp/teatest" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func Test_ErrorSnapshot(t *testing.T) { | ||
t.Run("Visible", func(t *testing.T) { | ||
model := ErrorViewModel{ | ||
Height: 20, | ||
Width: 40, | ||
controls: controls.New(" Error "), | ||
Message: "a test error", | ||
} | ||
got := ansi.Strip(model.View()) | ||
golden.RequireEqual(t, []byte(got)) | ||
}) | ||
} | ||
|
||
func Test_ErrorMessages(t *testing.T) { | ||
tm := teatest.NewTestModel( | ||
t, ErrorViewModel{Message: "a test error"}, | ||
teatest.WithInitialTermSize(120, 80), | ||
) | ||
|
||
// Wait for prompt to exit | ||
teatest.WaitFor( | ||
t, tm.Output(), | ||
func(bts []byte) bool { | ||
return bytes.Contains(bts, []byte("a test error")) | ||
}, | ||
teatest.WithCheckInterval(time.Millisecond*100), | ||
teatest.WithDuration(time.Second*3), | ||
) | ||
// Resize Message | ||
tm.Send(tea.WindowSizeMsg{ | ||
Width: 50, | ||
Height: 20, | ||
}) | ||
|
||
// Send quit key | ||
tm.Send(tea.QuitMsg{}) | ||
|
||
tm.WaitFinished(t, teatest.WithFinalTimeout(time.Second)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package accounts | ||
|
||
import ( | ||
"bytes" | ||
"github.com/algorandfoundation/hack-tui/api" | ||
"github.com/algorandfoundation/hack-tui/internal" | ||
tea "github.com/charmbracelet/bubbletea" | ||
"github.com/charmbracelet/x/ansi" | ||
"github.com/charmbracelet/x/exp/golden" | ||
"github.com/charmbracelet/x/exp/teatest" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func Test_Snapshot(t *testing.T) { | ||
t.Run("Visible", func(t *testing.T) { | ||
model := New(&internal.StateModel{ | ||
Status: internal.StatusModel{}, | ||
Metrics: internal.MetricsModel{}, | ||
Accounts: nil, | ||
ParticipationKeys: nil, | ||
Admin: false, | ||
Watching: false, | ||
}) | ||
got := ansi.Strip(model.View()) | ||
golden.RequireEqual(t, []byte(got)) | ||
}) | ||
} | ||
|
||
func Test_Messages(t *testing.T) { | ||
var testKeys = []api.ParticipationKey{ | ||
{ | ||
Address: "ABC", | ||
EffectiveFirstValid: nil, | ||
EffectiveLastValid: nil, | ||
Id: "", | ||
Key: api.AccountParticipation{ | ||
SelectionParticipationKey: nil, | ||
StateProofKey: nil, | ||
VoteFirstValid: 0, | ||
VoteKeyDilution: 0, | ||
VoteLastValid: 0, | ||
VoteParticipationKey: nil, | ||
}, | ||
LastBlockProposal: nil, | ||
LastStateProof: nil, | ||
LastVote: nil, | ||
}, | ||
} | ||
sm := &internal.StateModel{ | ||
Status: internal.StatusModel{}, | ||
Metrics: internal.MetricsModel{}, | ||
Accounts: nil, | ||
ParticipationKeys: &testKeys, | ||
Admin: false, | ||
Watching: false, | ||
} | ||
values := make(map[string]internal.Account) | ||
for _, key := range *sm.ParticipationKeys { | ||
val, ok := values[key.Address] | ||
if !ok { | ||
values[key.Address] = internal.Account{ | ||
Address: key.Address, | ||
Status: "Offline", | ||
Balance: 0, | ||
Expires: time.Unix(0, 0), | ||
Keys: 1, | ||
} | ||
} else { | ||
val.Keys++ | ||
values[key.Address] = val | ||
} | ||
} | ||
sm.Accounts = values | ||
// Create the Model | ||
m := New(sm) | ||
|
||
tm := teatest.NewTestModel( | ||
t, m, | ||
teatest.WithInitialTermSize(80, 40), | ||
) | ||
|
||
// Wait for prompt to exit | ||
teatest.WaitFor( | ||
t, tm.Output(), | ||
func(bts []byte) bool { | ||
return bytes.Contains(bts, []byte("(k)eys")) | ||
}, | ||
teatest.WithCheckInterval(time.Millisecond*100), | ||
teatest.WithDuration(time.Second*3), | ||
) | ||
|
||
tm.Send(*sm) | ||
|
||
tm.Send(tea.KeyMsg{ | ||
Type: tea.KeyRunes, | ||
Runes: []rune("enter"), | ||
}) | ||
|
||
tm.Send(tea.KeyMsg{ | ||
Type: tea.KeyRunes, | ||
Runes: []rune("ctrl+c"), | ||
}) | ||
|
||
tm.WaitFinished(t, teatest.WithFinalTimeout(time.Second)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
╭──────────────────────────────────────────╮ | ||
──────────────────┤ (g)enerate | (a)ccounts | (k)eys | (t)xn ├────────────────── | ||
╰──────────────────────────────────────────╯ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
a test error | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
╭───────╮ | ||
───────────────────────────────────┤ Error ├─────────────────────────────────── | ||
╰───────╯ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Loading... | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
╭────────────────────────────────────────────────────────────────────────────────────────╮ | ||
│ Latest Round: 1337 SYNCING │ | ||
│ │ | ||
│ -- 0 round average -- │ | ||
│ Round time: 0.00s 0 KB/s TX │ | ||
│ TPS: 0.00 0 KB/s RX │ | ||
╰────────────────────────────────────────────────────────────────────────────────────────╯ |