add Volume Ids column only for max 100 volumes for convenience in the master ui.
This commit is contained in:
@@ -2,6 +2,7 @@ package topology
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
@@ -166,6 +167,7 @@ func (dn *DataNode) ToMap() interface{} {
|
||||
ret := make(map[string]interface{})
|
||||
ret["Url"] = dn.Url()
|
||||
ret["Volumes"] = dn.GetVolumeCount()
|
||||
ret["VolumeIds"] = dn.GetVolumeIds()
|
||||
ret["EcShards"] = dn.GetEcShardCount()
|
||||
ret["Max"] = dn.GetMaxVolumeCount()
|
||||
ret["Free"] = dn.FreeSpace()
|
||||
@@ -190,3 +192,19 @@ func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// GetVolumeIds returns the human readable volume ids limited to count of max 100.
|
||||
func (dn *DataNode) GetVolumeIds() string {
|
||||
volumesLen := len(dn.volumes)
|
||||
if volumesLen > 100 {
|
||||
return "..."
|
||||
}
|
||||
|
||||
ids := make([]int, 0, volumesLen)
|
||||
|
||||
for k := range dn.volumes {
|
||||
ids = append(ids, int(k))
|
||||
}
|
||||
|
||||
return util.HumanReadableInts(ids...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user