实现基础的IP地址阈值

This commit is contained in:
刘祥超
2021-09-12 20:21:32 +08:00
parent 4d5a4d501a
commit c95dde5187
31 changed files with 788 additions and 267 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/ipAddresses/ipaddressutils"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/maps"
@@ -79,14 +80,12 @@ func (this *DetailAction) RunGet(params struct {
var ipAddresses = ipAddressesResp.Addresses
ipAddressMaps := []maps.Map{}
for _, addr := range ipAddressesResp.Addresses {
var thresholds = []*nodeconfigs.NodeValueThresholdConfig{}
if len(addr.ThresholdsJSON) > 0 {
err = json.Unmarshal(addr.ThresholdsJSON, &thresholds)
if err != nil {
this.ErrorPage(err)
return
}
thresholds, err := ipaddressutils.InitNodeIPAddressThresholds(this.Parent(), addr.Id)
if err != nil {
this.ErrorPage(err)
return
}
ipAddressMaps = append(ipAddressMaps, maps.Map{
"id": addr.Id,
"name": addr.Name,