optimiz: master ui will render data in order

This commit is contained in:
ningfd
2022-07-22 14:34:17 +08:00
parent 7a6c559ab4
commit 6f882eb354
4 changed files with 70 additions and 25 deletions

View File

@@ -217,10 +217,19 @@ func (dn *DataNode) ServerAddress() pb.ServerAddress {
return pb.NewServerAddress(dn.Ip, dn.Port, dn.GrpcPort)
}
func (dn *DataNode) ToMap() interface{} {
ret := make(map[string]interface{})
ret["Url"] = dn.Url()
ret["PublicUrl"] = dn.PublicUrl
type DataNodeMap struct {
Url string `json:"Url"`
PublicUrl string `json:"PublicUrl"`
Volumes int64 `json:"Volumes"`
EcShards int64 `json:"EcShards"`
Max int64 `json:"Max"`
VolumeIds string `json:"VolumeIds"`
}
func (dn *DataNode) ToMap() DataNodeMap {
ret := DataNodeMap{}
ret.Url = dn.Url()
ret.PublicUrl = dn.PublicUrl
// aggregated volume info
var volumeCount, ecShardCount, maxVolumeCount int64
@@ -236,10 +245,10 @@ func (dn *DataNode) ToMap() interface{} {
volumeIds += " " + d.GetVolumeIds()
}
ret["Volumes"] = volumeCount
ret["EcShards"] = ecShardCount
ret["Max"] = maxVolumeCount
ret["VolumeIds"] = volumeIds
ret.Volumes = volumeCount
ret.EcShards = ecShardCount
ret.Max = maxVolumeCount
ret.VolumeIds = volumeIds
return ret
}