mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-07 13:41:20 +02:00
fix: display correct number of machines on dashboard
Rename members to machines to be clearer. Display the correct member count. Closes siderolabs/talos#7127. Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
This commit is contained in:
parent
cad43f0ad3
commit
b097efcde2
@ -17,14 +17,14 @@ import (
|
||||
)
|
||||
|
||||
type talosInfoData struct {
|
||||
uuid string
|
||||
clusterName string
|
||||
stage string
|
||||
ready string
|
||||
typ string
|
||||
numMembersText string
|
||||
uuid string
|
||||
clusterName string
|
||||
stage string
|
||||
ready string
|
||||
typ string
|
||||
numMachinesText string
|
||||
|
||||
numMembers int
|
||||
machineIDSet map[string]struct{}
|
||||
}
|
||||
|
||||
// TalosInfo represents the Talos info widget.
|
||||
@ -101,12 +101,12 @@ func (widget *TalosInfo) updateNodeData(data resourcedata.Data) {
|
||||
}
|
||||
case *cluster.Member:
|
||||
if data.Deleted {
|
||||
nodeData.numMembers--
|
||||
delete(nodeData.machineIDSet, res.Metadata().ID())
|
||||
} else {
|
||||
nodeData.numMembers++
|
||||
nodeData.machineIDSet[res.Metadata().ID()] = struct{}{}
|
||||
}
|
||||
|
||||
nodeData.numMembersText = strconv.Itoa(nodeData.numMembers)
|
||||
nodeData.numMachinesText = strconv.Itoa(len(nodeData.machineIDSet))
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,12 +114,13 @@ func (widget *TalosInfo) getOrCreateNodeData(node string) *talosInfoData {
|
||||
nodeData, ok := widget.nodeMap[node]
|
||||
if !ok {
|
||||
nodeData = &talosInfoData{
|
||||
uuid: notAvailable,
|
||||
clusterName: notAvailable,
|
||||
stage: notAvailable,
|
||||
ready: notAvailable,
|
||||
typ: notAvailable,
|
||||
numMembersText: notAvailable,
|
||||
uuid: notAvailable,
|
||||
clusterName: notAvailable,
|
||||
stage: notAvailable,
|
||||
ready: notAvailable,
|
||||
typ: notAvailable,
|
||||
numMachinesText: notAvailable,
|
||||
machineIDSet: make(map[string]struct{}),
|
||||
}
|
||||
|
||||
widget.nodeMap[node] = nodeData
|
||||
@ -154,8 +155,8 @@ func (widget *TalosInfo) redraw() {
|
||||
Value: data.typ,
|
||||
},
|
||||
{
|
||||
Name: "MEMBERS",
|
||||
Value: data.numMembersText,
|
||||
Name: "MACHINES",
|
||||
Value: data.numMachinesText,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user