修复IP地址不能修改在线状态的Bug

This commit is contained in:
刘祥超
2021-09-15 11:46:50 +08:00
parent 713de74abb
commit a885fdbea7
10 changed files with 28 additions and 11 deletions

View File

@@ -95,6 +95,7 @@ func (this *CreateBatchAction) RunPost(params struct {
Name: "IP地址", Name: "IP地址",
Ip: ip, Ip: ip,
CanAccess: true, CanAccess: true,
IsUp: true,
}) })
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -185,6 +185,7 @@ func (this *CreateNodeAction) RunPost(params struct {
Name: addr.GetString("name"), Name: addr.GetString("name"),
Ip: addr.GetString("ip"), Ip: addr.GetString("ip"),
CanAccess: addr.GetBool("canAccess"), CanAccess: addr.GetBool("canAccess"),
IsUp: addr.GetBool("isUp"),
}) })
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -31,6 +31,7 @@ func UpdateNodeIPAddresses(parentAction *actionutils.ParentAction, nodeId int64,
Name: addr.GetString("name"), Name: addr.GetString("name"),
CanAccess: addr.GetBool("canAccess"), CanAccess: addr.GetBool("canAccess"),
IsOn: isOn, IsOn: isOn,
IsUp: addr.GetBool("isUp"),
}) })
if err != nil { if err != nil {
return err return err
@@ -42,6 +43,7 @@ func UpdateNodeIPAddresses(parentAction *actionutils.ParentAction, nodeId int64,
Name: addr.GetString("name"), Name: addr.GetString("name"),
Ip: addr.GetString("ip"), Ip: addr.GetString("ip"),
CanAccess: addr.GetBool("canAccess"), CanAccess: addr.GetBool("canAccess"),
IsUp: addr.GetBool("isUp"),
}) })
if err != nil { if err != nil {
return err return err

View File

@@ -55,7 +55,6 @@ func (this *UpdatePopupAction) RunPost(params struct {
if address == nil { if address == nil {
this.Fail("找不到要修改的地址") this.Fail("找不到要修改的地址")
} }
isUp = address.IsUp
} }
ip := net.ParseIP(params.IP) ip := net.ParseIP(params.IP)

View File

@@ -79,8 +79,8 @@ func (this *CreateNodeAction) RunPost(params struct {
nodeId := createResp.NsNodeId nodeId := createResp.NsNodeId
// IP地址 // IP地址
for _, address := range ipAddresses { for _, addrMap := range ipAddresses {
addressId := address.GetInt64("id") addressId := addrMap.GetInt64("id")
if addressId > 0 { if addressId > 0 {
_, err = this.RPC().NodeIPAddressRPC().UpdateNodeIPAddressNodeId(this.AdminContext(), &pb.UpdateNodeIPAddressNodeIdRequest{ _, err = this.RPC().NodeIPAddressRPC().UpdateNodeIPAddressNodeId(this.AdminContext(), &pb.UpdateNodeIPAddressNodeIdRequest{
NodeIPAddressId: addressId, NodeIPAddressId: addressId,
@@ -90,9 +90,10 @@ func (this *CreateNodeAction) RunPost(params struct {
_, err = this.RPC().NodeIPAddressRPC().CreateNodeIPAddress(this.AdminContext(), &pb.CreateNodeIPAddressRequest{ _, err = this.RPC().NodeIPAddressRPC().CreateNodeIPAddress(this.AdminContext(), &pb.CreateNodeIPAddressRequest{
NodeId: nodeId, NodeId: nodeId,
Role: nodeconfigs.NodeRoleDNS, Role: nodeconfigs.NodeRoleDNS,
Name: address.GetString("name"), Name: addrMap.GetString("name"),
Ip: address.GetString("ip"), Ip: addrMap.GetString("ip"),
CanAccess: address.GetBool("canAccess"), CanAccess: addrMap.GetBool("canAccess"),
IsUp: addrMap.GetBool("isUp"),
}) })
} }
if err != nil { if err != nil {

View File

@@ -73,7 +73,7 @@
<div style="margin-top: 0.5em" v-if="node.group != null"> <div style="margin-top: 0.5em" v-if="node.group != null">
<span class="ui label tiny grey basic">分组:{{node.group.name}}</span> <span class="ui label tiny grey basic">分组:{{node.group.name}}</span>
</div> </div>
<div style="margin-top: 0.5em"> <div style="margin-top: 0.5em" v-if="node.secondaryClusters != null && node.secondaryClusters.length > 0">
<node-clusters-labels :v-primary-cluster="node.cluster" :v-secondary-clusters="node.secondaryClusters" size="tiny"></node-clusters-labels> <node-clusters-labels :v-primary-cluster="node.cluster" :v-secondary-clusters="node.secondaryClusters" size="tiny"></node-clusters-labels>
</div> </div>
</td> </td>

View File

@@ -40,7 +40,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td>阈值</td> <td>阈值设置</td>
<td> <td>
<div v-if="addr.thresholds.length > 0"> <div v-if="addr.thresholds.length > 0">
<node-ip-address-thresholds-view :v-thresholds="addr.thresholds"></node-ip-address-thresholds-view> <node-ip-address-thresholds-view :v-thresholds="addr.thresholds"></node-ip-address-thresholds-view>

View File

@@ -37,8 +37,17 @@
<input type="text" name="name" maxlength="50" v-model="addr.name"/> <input type="text" name="name" maxlength="50" v-model="addr.name"/>
</td> </td>
</tr> </tr>
<tr>
<td>在线状态</td>
<td>
<select class="ui dropdown auto-width" name="isUp" v-model="addr.isUp">
<option value="1">在线</option>
<option value="0">离线</option>
</select>
</td>
</tr>
<tr v-if="teaIsPlus && supportThresholds"> <tr v-if="teaIsPlus && supportThresholds">
<td>上线阈值</td> <td>阈值设置</td>
<td> <td>
<node-ip-address-thresholds-box :v-thresholds="addr.thresholds"></node-ip-address-thresholds-box> <node-ip-address-thresholds-box :v-thresholds="addr.thresholds"></node-ip-address-thresholds-box>
</td> </td>

View File

@@ -1,3 +1,5 @@
Tea.context(function () { Tea.context(function () {
this.success = NotifySuccess("保存成功", Tea.url(".", {addrId: this.addr.id})) this.success = NotifySuccess("保存成功", Tea.url(".", {addrId: this.addr.id}))
this.addr.isUp = this.addr.isUp ? 1 : 0
}) })

View File

@@ -19,7 +19,9 @@
<div> <div>
<div v-for="(address, index) in node.ipAddresses" class="ui label tiny basic"> <div v-for="(address, index) in node.ipAddresses" class="ui label tiny basic">
{{address.ip}} {{address.ip}}
<span class="small" v-if="address.name.length > 0">{{address.name}}<span v-if="!address.canAccess">,不可访问</span></span> <span class="small" v-if="address.name.length > 0">{{address.name}}<span v-if="!address.canAccess">,不可访问</span></span> &nbsp;
<span class="small red" v-if="!address.isOn">[off]</span>
<span class="small red" v-if="!address.isUp">[down]</span>
<span class="small" v-if="address.name.length == 0 && !address.canAccess">(不可访问)</span> <span class="small" v-if="address.name.length == 0 && !address.canAccess">(不可访问)</span>
</div> </div>
</div> </div>