mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-27 05:00:25 +08:00
优化界面
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/iwind/TeaGo/logs"
|
"github.com/iwind/TeaGo/logs"
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
"github.com/iwind/TeaGo/types"
|
"github.com/iwind/TeaGo/types"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -143,10 +144,13 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
countNodes := countResp.Count
|
countNodes := countResp.Count
|
||||||
|
groupName := group.Name
|
||||||
|
if countNodes > 0 {
|
||||||
|
groupName += "(" + strconv.FormatInt(countNodes, 10) + ")"
|
||||||
|
}
|
||||||
groupMaps = append(groupMaps, maps.Map{
|
groupMaps = append(groupMaps, maps.Map{
|
||||||
"id": group.Id,
|
"id": group.Id,
|
||||||
"name": group.Name,
|
"name": groupName,
|
||||||
"countNodes": countNodes,
|
"countNodes": countNodes,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IndexAction struct {
|
type IndexAction struct {
|
||||||
@@ -151,9 +152,19 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
groupMaps := []maps.Map{}
|
groupMaps := []maps.Map{}
|
||||||
for _, group := range groupsResp.Groups {
|
for _, group := range groupsResp.Groups {
|
||||||
|
countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithGroupId(this.AdminContext(), &pb.CountAllEnabledServersWithGroupIdRequest{GroupId: group.Id})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
groupName := group.Name
|
||||||
|
if countResp.Count > 0 {
|
||||||
|
groupName += "(" + strconv.FormatInt(countResp.Count, 10) + ")"
|
||||||
|
}
|
||||||
groupMaps = append(groupMaps, maps.Map{
|
groupMaps = append(groupMaps, maps.Map{
|
||||||
"id": group.Id,
|
"id": group.Id,
|
||||||
"name": group.Name,
|
"name": groupName,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.Data["groups"] = groupMaps
|
this.Data["groups"] = groupMaps
|
||||||
|
|||||||
Reference in New Issue
Block a user