mirror of
https://github.com/status-im/status-go-monitor.git
synced 2025-01-12 04:14:11 +00:00
add Stringer for AppData
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
febde4aeba
commit
b80307301e
20
model.go
20
model.go
@ -1,13 +1,25 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/dannypsnl/redux/v2/rematch"
|
"github.com/dannypsnl/redux/v2/rematch"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AppData struct {
|
type AppData struct {
|
||||||
Node NodeInfo // info about current node
|
Node *NodeInfo // info about current node
|
||||||
Peers []Peer // list of peers for the node
|
Peers []Peer // list of peers for the node
|
||||||
Current int // currently selected peer
|
Current int // currently selected peer
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d AppData) String() string {
|
||||||
|
peers := make([]string, len(d.Peers))
|
||||||
|
for i, p := range d.Peers {
|
||||||
|
peers[i] = p.String()
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("AppData{Node: %v, Current: %d, Peers: [%v]}",
|
||||||
|
d.Node, d.Current, strings.Join(peers, ","))
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppModel struct {
|
type AppModel struct {
|
||||||
@ -16,7 +28,7 @@ type AppModel struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *AppModel) SetInfo(s AppData, node NodeInfo) AppData {
|
func (m *AppModel) SetInfo(s AppData, node NodeInfo) AppData {
|
||||||
s.Node = node
|
s.Node = &node
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user