实现监控节点在线状态
This commit is contained in:
7
internal/const/const_demo.go
Normal file
7
internal/const/const_demo.go
Normal file
@@ -0,0 +1,7 @@
|
||||
// +build demo
|
||||
|
||||
package teaconst
|
||||
|
||||
const (
|
||||
IsDemo = true
|
||||
)
|
||||
7
internal/const/const_normal.go
Normal file
7
internal/const/const_normal.go
Normal file
@@ -0,0 +1,7 @@
|
||||
// +build !demo
|
||||
|
||||
package teaconst
|
||||
|
||||
const (
|
||||
IsDemo = false
|
||||
)
|
||||
@@ -46,6 +46,12 @@ func (this *IndexAction) RunGet(params struct{}) {
|
||||
}
|
||||
|
||||
nodeMap := maps.Map{}
|
||||
if message.Node != nil {
|
||||
nodeMap = maps.Map{
|
||||
"id": message.Node.Id,
|
||||
"name": message.Node.Name,
|
||||
}
|
||||
}
|
||||
|
||||
messages = append(messages, maps.Map{
|
||||
"id": message.Id,
|
||||
|
||||
@@ -2,6 +2,7 @@ package servers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
@@ -109,6 +110,11 @@ func (this *CreateAction) RunPost(params struct {
|
||||
}
|
||||
}
|
||||
case serverconfigs.ServerTypeTCPProxy:
|
||||
// 在DEMO模式下不能创建
|
||||
if teaconst.IsDemo {
|
||||
this.Fail("DEMO模式下不能创建TCP反向代理")
|
||||
}
|
||||
|
||||
listen := []*serverconfigs.NetworkAddressConfig{}
|
||||
err := json.Unmarshal([]byte(params.Addresses), &listen)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user