|
@@ -87,7 +87,7 @@ func InitialModel(addresses []string, speed time.Duration, chartHeight int) Mode
|
|
|
|
|
|
|
|
for _, address := range addresses {
|
|
for _, address := range addresses {
|
|
|
var addr Address
|
|
var addr Address
|
|
|
- addr.max_results = 80
|
|
|
|
|
|
|
+ addr.MaxResults = 80
|
|
|
addr.Address = address
|
|
addr.Address = address
|
|
|
model.Addresses = append(model.Addresses, addr)
|
|
model.Addresses = append(model.Addresses, addr)
|
|
|
}
|
|
}
|
|
@@ -121,7 +121,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
|
m.ModelWidth = msg.Width
|
|
m.ModelWidth = msg.Width
|
|
|
m.ModelHeight = msg.Height
|
|
m.ModelHeight = msg.Height
|
|
|
for i, address := range m.Addresses {
|
|
for i, address := range m.Addresses {
|
|
|
- address.max_results = m.ModelWidth
|
|
|
|
|
|
|
+ address.MaxResults = m.ModelWidth
|
|
|
m.Addresses[i] = address
|
|
m.Addresses[i] = address
|
|
|
}
|
|
}
|
|
|
m.viewport.SetHeight(m.ModelHeight - m.getVerticalMargin())
|
|
m.viewport.SetHeight(m.ModelHeight - m.getVerticalMargin())
|
|
@@ -143,7 +143,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
|
cmds = append(cmds, m.Tick(), m.Poll())
|
|
cmds = append(cmds, m.Tick(), m.Poll())
|
|
|
|
|
|
|
|
case pollResultMsg:
|
|
case pollResultMsg:
|
|
|
- m.Addresses[msg.index].results = msg.results
|
|
|
|
|
|
|
+ m.Addresses[msg.index].Results = msg.results
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
m.viewport.SetContent(m.Render())
|
|
m.viewport.SetContent(m.Render())
|
|
@@ -165,10 +165,10 @@ func (m Model) View() tea.View {
|
|
|
func (m Model) Render() string {
|
|
func (m Model) Render() string {
|
|
|
var output string
|
|
var output string
|
|
|
for _, address := range m.Addresses {
|
|
for _, address := range m.Addresses {
|
|
|
- if len(address.results) == 0 {
|
|
|
|
|
|
|
+ if len(address.Results) == 0 {
|
|
|
output = output + fmt.Sprintf("\n%s\tloading...", headerStyle.Render(address.Address))
|
|
output = output + fmt.Sprintf("\n%s\tloading...", headerStyle.Render(address.Address))
|
|
|
} else if m.ModelWidth != 0 && m.ModelHeight != 0 {
|
|
} else if m.ModelWidth != 0 && m.ModelHeight != 0 {
|
|
|
- if slices.Contains(address.results, -1) {
|
|
|
|
|
|
|
+ if slices.Contains(address.Results, -1) {
|
|
|
output = output + blockStyle.Width(m.ModelWidth).Render(headerStyle.Render(
|
|
output = output + blockStyle.Width(m.ModelWidth).Render(headerStyle.Render(
|
|
|
fmt.Sprintf("\n%s\t%s",
|
|
fmt.Sprintf("\n%s\t%s",
|
|
|
secondaryColor.Render(address.Address),
|
|
secondaryColor.Render(address.Address),
|
|
@@ -196,7 +196,7 @@ func (m Model) Render() string {
|
|
|
slc = streamlinechart.New(m.ModelWidth, m.ChartHeight)
|
|
slc = streamlinechart.New(m.ModelWidth, m.ChartHeight)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- for _, v := range address.results {
|
|
|
|
|
|
|
+ for _, v := range address.Results {
|
|
|
slc.Push(v)
|
|
slc.Push(v)
|
|
|
}
|
|
}
|
|
|
|
|
|