From cd0c81165b27d916bf0d262970b788f849de7196 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 29 Sep 2022 00:30:18 -0700 Subject: [PATCH] re-order the support perf UI (#4268) --- cmd/speedtest-spinner.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/speedtest-spinner.go b/cmd/speedtest-spinner.go index 8ffe7c33..97245304 100644 --- a/cmd/speedtest-spinner.go +++ b/cmd/speedtest-spinner.go @@ -113,11 +113,10 @@ func (m *speedTestUI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { func (m *speedTestUI) View() string { // Quit when there is an error if m.result.Err != "" { - return fmt.Sprintf("\n%s: ✗ (Err: %s)\n", m.result.Type.Name(), m.result.Err) + return fmt.Sprintf("\n%s: %s (Err: %s)\n", m.result.Type.Name(), crossTickCell, m.result.Err) } var s strings.Builder - s.WriteString("\n") // Set table header table := tablewriter.NewWriter(&s) @@ -144,6 +143,13 @@ func (m *speedTestUI) View() string { return in[:max] + "..." } + // Print the spinner + if !m.quitting { + s.WriteString(fmt.Sprintf("\n%s: %s\n\n", m.result.Type.Name(), m.spinner.View())) + } else { + s.WriteString(fmt.Sprintf("\n%s: %s\n\n", m.result.Type.Name(), m.spinner.Style.Render(tickCell))) + } + if ores != nil { table.SetHeader([]string{"", "Throughput", "IOPS"}) data := make([][]string, 2) @@ -198,8 +204,8 @@ func (m *speedTestUI) View() string { if nodeResult.Error != "" { data = append(data, []string{ trailerIfGreaterThan(nodeResult.Endpoint, 64), - "✗", - "✗", + crossTickCell, + crossTickCell, "Err: " + nodeResult.Error, }) } else { @@ -238,8 +244,8 @@ func (m *speedTestUI) View() string { data = append(data, []string{ trailerIfGreaterThan(driveResult.Endpoint, 64), result.Path, - "✗", - "✗", + crossTickCell, + crossTickCell, "Err: " + result.Error, }) } else { @@ -258,11 +264,5 @@ func (m *speedTestUI) View() string { table.Render() } - // Print the spinner - if !m.quitting { - s.WriteString(fmt.Sprintf("\n%s: %s", m.result.Type.Name(), m.spinner.View())) - } else { - s.WriteString(fmt.Sprintf("\n%s: ✔\n", m.result.Type.Name())) - } return s.String() }