mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-12 19:30:26 +08:00
[API节点]支持HTTP API
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
"github.com/iwind/TeaGo/logs"
|
"github.com/iwind/TeaGo/logs"
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
"time"
|
"time"
|
||||||
@@ -52,11 +53,44 @@ func (this *IndexAction) RunGet(params struct{}) {
|
|||||||
status.IsActive = status.IsActive && time.Now().Unix()-status.UpdatedAt <= 60 // N秒之内认为活跃
|
status.IsActive = status.IsActive && time.Now().Unix()-status.UpdatedAt <= 60 // N秒之内认为活跃
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rest地址
|
||||||
|
restAccessAddrs := []string{}
|
||||||
|
if node.RestIsOn {
|
||||||
|
if len(node.RestHTTPJSON) > 0 {
|
||||||
|
httpConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||||
|
err = json.Unmarshal(node.RestHTTPJSON, httpConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_ = httpConfig.Init()
|
||||||
|
if httpConfig.IsOn && len(httpConfig.Listen) > 0 {
|
||||||
|
for _, listen := range httpConfig.Listen {
|
||||||
|
restAccessAddrs = append(restAccessAddrs, listen.FullAddresses()...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(node.RestHTTPSJSON) > 0 {
|
||||||
|
httpsConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||||
|
err = json.Unmarshal(node.RestHTTPSJSON, httpsConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_ = httpsConfig.Init()
|
||||||
|
if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 {
|
||||||
|
restAccessAddrs = append(restAccessAddrs, httpsConfig.FullAddresses()...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nodeMaps = append(nodeMaps, maps.Map{
|
nodeMaps = append(nodeMaps, maps.Map{
|
||||||
"id": node.Id,
|
"id": node.Id,
|
||||||
"isOn": node.IsOn,
|
"isOn": node.IsOn,
|
||||||
"name": node.Name,
|
"name": node.Name,
|
||||||
"accessAddrs": node.AccessAddrs,
|
"accessAddrs": node.AccessAddrs,
|
||||||
|
"restAccessAddrs": restAccessAddrs,
|
||||||
"status": maps.Map{
|
"status": maps.Map{
|
||||||
"isActive": status.IsActive,
|
"isActive": status.IsActive,
|
||||||
"updatedAt": status.UpdatedAt,
|
"updatedAt": status.UpdatedAt,
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
ListensJSON []byte
|
ListensJSON []byte
|
||||||
CertIdsJSON []byte
|
CertIdsJSON []byte
|
||||||
AccessAddrsJSON []byte
|
AccessAddrsJSON []byte
|
||||||
|
|
||||||
|
RestIsOn bool
|
||||||
|
RestListensJSON []byte
|
||||||
|
|
||||||
IsOn bool
|
IsOn bool
|
||||||
|
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
@@ -59,6 +63,27 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rest监听地址
|
||||||
|
restHTTPConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||||
|
restHTTPSConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||||
|
if params.RestIsOn {
|
||||||
|
restListens := []*serverconfigs.NetworkAddressConfig{}
|
||||||
|
err = json.Unmarshal(params.RestListensJSON, &restListens)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, addr := range restListens {
|
||||||
|
if addr.Protocol.IsHTTPFamily() {
|
||||||
|
restHTTPConfig.IsOn = true
|
||||||
|
restHTTPConfig.Listen = append(restHTTPConfig.Listen, addr)
|
||||||
|
} else if addr.Protocol.IsHTTPSFamily() {
|
||||||
|
restHTTPSConfig.IsOn = true
|
||||||
|
restHTTPSConfig.Listen = append(restHTTPSConfig.Listen, addr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 证书
|
// 证书
|
||||||
certIds := []int64{}
|
certIds := []int64{}
|
||||||
if len(params.CertIdsJSON) > 0 {
|
if len(params.CertIdsJSON) > 0 {
|
||||||
@@ -68,7 +93,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 && len(certIds) == 0 {
|
if ((httpsConfig.IsOn && len(httpsConfig.Listen) > 0) || (restHTTPSConfig.IsOn && len(httpsConfig.Listen) > 0)) && len(certIds) == 0 {
|
||||||
this.Fail("请添加至少一个证书")
|
this.Fail("请添加至少一个证书")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +124,10 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
IsOn: true,
|
IsOn: true,
|
||||||
SSLPolicyId: sslPolicyId,
|
SSLPolicyId: sslPolicyId,
|
||||||
}
|
}
|
||||||
|
restHTTPSConfig.SSLPolicyRef = &sslconfigs.SSLPolicyRef{
|
||||||
|
IsOn: true,
|
||||||
|
SSLPolicyId: sslPolicyId,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 访问地址
|
// 访问地址
|
||||||
@@ -123,11 +152,25 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restHTTPJSON, err := json.Marshal(restHTTPConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
restHTTPSJSON, err := json.Marshal(restHTTPSConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
createResp, err := this.RPC().APINodeRPC().CreateAPINode(this.AdminContext(), &pb.CreateAPINodeRequest{
|
createResp, err := this.RPC().APINodeRPC().CreateAPINode(this.AdminContext(), &pb.CreateAPINodeRequest{
|
||||||
Name: params.Name,
|
Name: params.Name,
|
||||||
Description: params.Description,
|
Description: params.Description,
|
||||||
HttpJSON: httpJSON,
|
HttpJSON: httpJSON,
|
||||||
HttpsJSON: httpsJSON,
|
HttpsJSON: httpsJSON,
|
||||||
|
RestIsOn: params.RestIsOn,
|
||||||
|
RestHTTPJSON: restHTTPJSON,
|
||||||
|
RestHTTPSJSON: restHTTPSJSON,
|
||||||
AccessAddrsJSON: params.AccessAddrsJSON,
|
AccessAddrsJSON: params.AccessAddrsJSON,
|
||||||
IsOn: params.IsOn,
|
IsOn: params.IsOn,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -87,6 +87,34 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rest地址
|
||||||
|
restAccessAddrs := []*serverconfigs.NetworkAddressConfig{}
|
||||||
|
if node.RestIsOn {
|
||||||
|
if len(node.RestHTTPJSON) > 0 {
|
||||||
|
httpConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||||
|
err = json.Unmarshal(node.RestHTTPJSON, httpConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if httpConfig.IsOn && len(httpConfig.Listen) > 0 {
|
||||||
|
restAccessAddrs = append(restAccessAddrs, httpConfig.Listen...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(node.RestHTTPSJSON) > 0 {
|
||||||
|
httpsConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||||
|
err = json.Unmarshal(node.RestHTTPSJSON, httpsConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 {
|
||||||
|
restAccessAddrs = append(restAccessAddrs, httpsConfig.Listen...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.Data["node"] = maps.Map{
|
this.Data["node"] = maps.Map{
|
||||||
"id": node.Id,
|
"id": node.Id,
|
||||||
"name": node.Name,
|
"name": node.Name,
|
||||||
@@ -94,6 +122,8 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
"isOn": node.IsOn,
|
"isOn": node.IsOn,
|
||||||
"listens": listens,
|
"listens": listens,
|
||||||
"accessAddrs": accessAddrs,
|
"accessAddrs": accessAddrs,
|
||||||
|
"restIsOn": node.RestIsOn,
|
||||||
|
"restAccessAddrs": restAccessAddrs,
|
||||||
"hasHTTPS": sslPolicyId > 0,
|
"hasHTTPS": sslPolicyId > 0,
|
||||||
"certs": certs,
|
"certs": certs,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ func init() {
|
|||||||
TeaGo.BeforeStart(func(server *TeaGo.Server) {
|
TeaGo.BeforeStart(func(server *TeaGo.Server) {
|
||||||
server.
|
server.
|
||||||
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeSetting)).
|
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeSetting)).
|
||||||
Helper(settingutils.NewHelper("apiNodes")).
|
Helper(settingutils.NewAdvancedHelper("apiNodes")).
|
||||||
Prefix("/api/node").
|
Prefix("/api/node").
|
||||||
|
|
||||||
// 这里不受Helper的约束
|
// 这里不受Helper的约束
|
||||||
|
|||||||
@@ -57,6 +57,28 @@ func (this *UpdateAction) RunGet(params struct {
|
|||||||
listens = append(listens, httpConfig.Listen...)
|
listens = append(listens, httpConfig.Listen...)
|
||||||
listens = append(listens, httpsConfig.Listen...)
|
listens = append(listens, httpsConfig.Listen...)
|
||||||
|
|
||||||
|
restHTTPConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||||
|
if len(node.RestHTTPJSON) > 0 {
|
||||||
|
err = json.Unmarshal(node.RestHTTPJSON, restHTTPConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
restHTTPSConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||||
|
if len(node.RestHTTPSJSON) > 0 {
|
||||||
|
err = json.Unmarshal(node.RestHTTPSJSON, restHTTPSConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听地址
|
||||||
|
restListens := []*serverconfigs.NetworkAddressConfig{}
|
||||||
|
restListens = append(restListens, restHTTPConfig.Listen...)
|
||||||
|
restListens = append(restListens, restHTTPSConfig.Listen...)
|
||||||
|
|
||||||
// 证书信息
|
// 证书信息
|
||||||
certs := []*sslconfigs.SSLCertConfig{}
|
certs := []*sslconfigs.SSLCertConfig{}
|
||||||
sslPolicyId := int64(0)
|
sslPolicyId := int64(0)
|
||||||
@@ -95,6 +117,8 @@ func (this *UpdateAction) RunGet(params struct {
|
|||||||
"description": node.Description,
|
"description": node.Description,
|
||||||
"isOn": node.IsOn,
|
"isOn": node.IsOn,
|
||||||
"listens": listens,
|
"listens": listens,
|
||||||
|
"restIsOn": node.RestIsOn,
|
||||||
|
"restListens": restListens,
|
||||||
"certs": certs,
|
"certs": certs,
|
||||||
"sslPolicyId": sslPolicyId,
|
"sslPolicyId": sslPolicyId,
|
||||||
"accessAddrs": accessAddrs,
|
"accessAddrs": accessAddrs,
|
||||||
@@ -109,6 +133,8 @@ func (this *UpdateAction) RunPost(params struct {
|
|||||||
Name string
|
Name string
|
||||||
SslPolicyId int64
|
SslPolicyId int64
|
||||||
ListensJSON []byte
|
ListensJSON []byte
|
||||||
|
RestIsOn bool
|
||||||
|
RestListensJSON []byte
|
||||||
CertIdsJSON []byte
|
CertIdsJSON []byte
|
||||||
AccessAddrsJSON []byte
|
AccessAddrsJSON []byte
|
||||||
Description string
|
Description string
|
||||||
@@ -143,6 +169,27 @@ func (this *UpdateAction) RunPost(params struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rest监听地址
|
||||||
|
restHTTPConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||||
|
restHTTPSConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||||
|
if params.RestIsOn {
|
||||||
|
restListens := []*serverconfigs.NetworkAddressConfig{}
|
||||||
|
err = json.Unmarshal(params.RestListensJSON, &restListens)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, addr := range restListens {
|
||||||
|
if addr.Protocol.IsHTTPFamily() {
|
||||||
|
restHTTPConfig.IsOn = true
|
||||||
|
restHTTPConfig.Listen = append(restHTTPConfig.Listen, addr)
|
||||||
|
} else if addr.Protocol.IsHTTPSFamily() {
|
||||||
|
restHTTPSConfig.IsOn = true
|
||||||
|
restHTTPSConfig.Listen = append(restHTTPSConfig.Listen, addr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 证书
|
// 证书
|
||||||
certIds := []int64{}
|
certIds := []int64{}
|
||||||
if len(params.CertIdsJSON) > 0 {
|
if len(params.CertIdsJSON) > 0 {
|
||||||
@@ -152,7 +199,7 @@ func (this *UpdateAction) RunPost(params struct {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 && len(certIds) == 0 {
|
if ((httpsConfig.IsOn && len(httpsConfig.Listen) > 0) || (restHTTPSConfig.IsOn && len(httpsConfig.Listen) > 0)) && len(certIds) == 0 {
|
||||||
this.Fail("请添加至少一个证书")
|
this.Fail("请添加至少一个证书")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,6 +243,10 @@ func (this *UpdateAction) RunPost(params struct {
|
|||||||
IsOn: true,
|
IsOn: true,
|
||||||
SSLPolicyId: sslPolicyId,
|
SSLPolicyId: sslPolicyId,
|
||||||
}
|
}
|
||||||
|
restHTTPSConfig.SSLPolicyRef = &sslconfigs.SSLPolicyRef{
|
||||||
|
IsOn: true,
|
||||||
|
SSLPolicyId: sslPolicyId,
|
||||||
|
}
|
||||||
|
|
||||||
// 访问地址
|
// 访问地址
|
||||||
accessAddrs := []*serverconfigs.NetworkAddressConfig{}
|
accessAddrs := []*serverconfigs.NetworkAddressConfig{}
|
||||||
@@ -218,6 +269,16 @@ func (this *UpdateAction) RunPost(params struct {
|
|||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
restHTTPJSON, err := json.Marshal(restHTTPConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
restHTTPSJSON, err := json.Marshal(restHTTPSConfig)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
_, err = this.RPC().APINodeRPC().UpdateAPINode(this.AdminContext(), &pb.UpdateAPINodeRequest{
|
_, err = this.RPC().APINodeRPC().UpdateAPINode(this.AdminContext(), &pb.UpdateAPINodeRequest{
|
||||||
NodeId: params.NodeId,
|
NodeId: params.NodeId,
|
||||||
@@ -225,6 +286,9 @@ func (this *UpdateAction) RunPost(params struct {
|
|||||||
Description: params.Description,
|
Description: params.Description,
|
||||||
HttpJSON: httpJSON,
|
HttpJSON: httpJSON,
|
||||||
HttpsJSON: httpsJSON,
|
HttpsJSON: httpsJSON,
|
||||||
|
RestIsOn: params.RestIsOn,
|
||||||
|
RestHTTPJSON: restHTTPJSON,
|
||||||
|
RestHTTPSJSON: restHTTPSJSON,
|
||||||
AccessAddrsJSON: params.AccessAddrsJSON,
|
AccessAddrsJSON: params.AccessAddrsJSON,
|
||||||
IsOn: params.IsOn,
|
IsOn: params.IsOn,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>节点名称</th>
|
<th>节点名称</th>
|
||||||
<th>访问地址</th>
|
<th>GRPC访问地址</th>
|
||||||
|
<th>HTTP访问地址</th>
|
||||||
<th class="width6 center">版本号</th>
|
<th class="width6 center">版本号</th>
|
||||||
<th class="width5 center">CPU</th>
|
<th class="width5 center">CPU</th>
|
||||||
<th class="width5 center">内存</th>
|
<th class="width5 center">内存</th>
|
||||||
@@ -22,8 +23,15 @@
|
|||||||
<td>{{node.name}}</td>
|
<td>{{node.name}}</td>
|
||||||
<td>
|
<td>
|
||||||
<div v-if="node.accessAddrs != null && node.accessAddrs.length > 0">
|
<div v-if="node.accessAddrs != null && node.accessAddrs.length > 0">
|
||||||
<span class="ui label tiny basic" v-for="addr in node.accessAddrs">{{addr}}</span>
|
<span class="ui label tiny basic" v-for="addr in node.accessAddrs" style="margin-bottom: 0.5em">{{addr}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="disabled">-</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div v-if="node.restAccessAddrs != null && node.restAccessAddrs.length > 0">
|
||||||
|
<span class="ui label tiny basic" v-for="addr in node.restAccessAddrs" style="margin-bottom: 0.5em">{{addr}}</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="disabled">-</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<span v-if="node.status.buildVersion.length > 0">v{{node.status.buildVersion}}</span>
|
<span v-if="node.status.buildVersion.length > 0">v{{node.status.buildVersion}}</span>
|
||||||
|
|||||||
@@ -10,10 +10,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>进程监听端口 *</td>
|
<td>GRPC监听端口 *</td>
|
||||||
<td>
|
<td>
|
||||||
<network-addresses-box :v-name="'listensJSON'" :v-server-type="'httpWeb'" @change="changeListens"></network-addresses-box>
|
<network-addresses-box :v-name="'listensJSON'" :v-server-type="'httpWeb'" @change="changeListens"></network-addresses-box>
|
||||||
<p class="comment">API节点进程监听的网络端口。</p>
|
<p class="comment">通过GRPC访问API节点进程监听的网络端口。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="hasHTTPS">
|
<tr v-if="hasHTTPS">
|
||||||
@@ -23,17 +23,30 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>外部访问地址 *</td>
|
<td>GRPC 外部访问地址 *</td>
|
||||||
<td>
|
<td>
|
||||||
<api-node-addresses-box :v-name="'accessAddrsJSON'"></api-node-addresses-box>
|
<api-node-addresses-box :v-name="'accessAddrsJSON'"></api-node-addresses-box>
|
||||||
<p class="comment">边缘节点和管理平台等外部节点访问API节点的网络地址。</p>
|
<p class="comment">边缘节点和管理平台等外部节点访问API节点的网络地址,需要保证其他节点能够通过此地址访问到API节点服务。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tbody v-show="moreOptionsVisible">
|
<tbody v-show="moreOptionsVisible">
|
||||||
|
<tr>
|
||||||
|
<td :class="{'color-border': restIsOn}">是否开启HTTP API端口</td>
|
||||||
|
<td>
|
||||||
|
<checkbox name="restIsOn" v-model="restIsOn">是否启用HTTP API</checkbox>
|
||||||
|
<p class="comment">启用后用户可以通过HTTP API调用服务接口。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="restIsOn">
|
||||||
|
<td class="color-border">HTTP API监听端口</td>
|
||||||
|
<td>
|
||||||
|
<network-addresses-box :v-name="'restListensJSON'" :v-server-type="'httpWeb'" @change="changeRestListens"></network-addresses-box>
|
||||||
|
<p class="comment">HTTP API节点进程监听的网络端口。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>描述</td>
|
<td>描述</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -1,8 +1,27 @@
|
|||||||
Tea.context(function () {
|
Tea.context(function () {
|
||||||
this.hasHTTPS = false
|
this.hasHTTPS = false
|
||||||
|
this.grpcAddrs = []
|
||||||
|
this.restAddrs = []
|
||||||
|
|
||||||
this.changeListens = function (addrs) {
|
this.changeListens = function (addrs) {
|
||||||
this.hasHTTPS = addrs.$any(function (k, v) {
|
this.grpcAddrs = addrs
|
||||||
|
|
||||||
|
this.hasHTTPS = this.grpcAddrs.$any(function (k, v) {
|
||||||
return v.protocol == "https"
|
return v.protocol == "https"
|
||||||
})
|
}) || (this.restIsOn && this.restAddrs.$any(function (k, v) {
|
||||||
|
return v.protocol == "https"
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.changeRestListens = function (addrs) {
|
||||||
|
this.restAddrs = addrs
|
||||||
|
|
||||||
|
this.hasHTTPS = this.grpcAddrs.$any(function (k, v) {
|
||||||
|
return v.protocol == "https"
|
||||||
|
}) || (this.node.restIsOn && this.restAddrs.$any(function (k, v) {
|
||||||
|
return v.protocol == "https"
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
this.restIsOn = false
|
||||||
})
|
})
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>进程监听端口</td>
|
<td>GRPC监听端口</td>
|
||||||
<td>
|
<td>
|
||||||
<network-addresses-view :v-addresses="node.listens"></network-addresses-view>
|
<network-addresses-view :v-addresses="node.listens"></network-addresses-view>
|
||||||
<p class="comment">API节点进程监听的网络端口。</p>
|
<p class="comment">API节点进程监听的网络端口。</p>
|
||||||
@@ -28,10 +28,17 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>外部访问地址</td>
|
<td>GRPC外部访问地址</td>
|
||||||
<td>
|
<td>
|
||||||
<network-addresses-view :v-addresses="node.accessAddrs"></network-addresses-view>
|
<network-addresses-view :v-addresses="node.accessAddrs"></network-addresses-view>
|
||||||
<p class="comment">外部访问API节点的网络地址。</p>
|
<p class="comment">通过GRPC访问API节点的网络地址。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="node.restIsOn">
|
||||||
|
<td>HTTP外部访问地址</td>
|
||||||
|
<td>
|
||||||
|
<network-addresses-view :v-addresses="node.restAccessAddrs"></network-addresses-view>
|
||||||
|
<p class="comment">通过HTTP访问API节点的网络地址。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>进程监听端口 *</td>
|
<td>GRPC监听端口 *</td>
|
||||||
<td>
|
<td>
|
||||||
<network-addresses-box :v-name="'listensJSON'" :v-server-type="'httpWeb'" :v-addresses="node.listens" @change="changeListens"></network-addresses-box>
|
<network-addresses-box :v-name="'listensJSON'" :v-server-type="'httpWeb'" :v-addresses="node.listens" @change="changeListens"></network-addresses-box>
|
||||||
<p class="comment">API节点进程监听的网络端口。</p>
|
<p class="comment">通过GRPC访问API节点进程监听的网络端口。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="hasHTTPS">
|
<tr v-if="hasHTTPS">
|
||||||
@@ -26,17 +26,30 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>外部访问地址 *</td>
|
<td>GRPC访问地址 *</td>
|
||||||
<td>
|
<td>
|
||||||
<api-node-addresses-box :v-name="'accessAddrsJSON'" :v-addrs="node.accessAddrs"></api-node-addresses-box>
|
<api-node-addresses-box :v-name="'accessAddrsJSON'" :v-addrs="node.accessAddrs"></api-node-addresses-box>
|
||||||
<p class="comment">边缘节点和管理平台等外部节点访问API节点的网络地址。</p>
|
<p class="comment">边缘节点和管理平台等外部节点访问API节点的网络地址,需要保证其他节点能够通过此地址访问到API节点服务。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tbody v-show="moreOptionsVisible">
|
<tbody v-show="moreOptionsVisible">
|
||||||
|
<tr>
|
||||||
|
<td :class="{'color-border': node.restIsOn}">是否开启HTTP API端口</td>
|
||||||
|
<td>
|
||||||
|
<checkbox name="restIsOn" v-model="node.restIsOn">是否启用HTTP API</checkbox>
|
||||||
|
<p class="comment">启用后用户可以通过HTTP API调用服务接口。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="node.restIsOn">
|
||||||
|
<td class="color-border">HTTP API监听端口</td>
|
||||||
|
<td>
|
||||||
|
<network-addresses-box :v-name="'restListensJSON'" :v-server-type="'httpWeb'" @change="changeRestListens" :v-addresses="node.restListens"></network-addresses-box>
|
||||||
|
<p class="comment">HTTP API节点进程监听的网络端口。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>描述</td>
|
<td>描述</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -3,10 +3,29 @@ Tea.context(function () {
|
|||||||
|
|
||||||
this.hasHTTPS = this.node.listens.$any(function (k, v) {
|
this.hasHTTPS = this.node.listens.$any(function (k, v) {
|
||||||
return v.protocol == "https"
|
return v.protocol == "https"
|
||||||
})
|
}) || (this.node.restIsOn && this.node.restListens.$any(function (k, v) {
|
||||||
this.changeListens = function (addrs) {
|
|
||||||
this.hasHTTPS = addrs.$any(function (k, v) {
|
|
||||||
return v.protocol == "https"
|
return v.protocol == "https"
|
||||||
})
|
}))
|
||||||
|
this.grpcAddrs = []
|
||||||
|
this.restAddrs = []
|
||||||
|
|
||||||
|
this.changeListens = function (addrs) {
|
||||||
|
this.grpcAddrs = addrs
|
||||||
|
|
||||||
|
this.hasHTTPS = this.grpcAddrs.$any(function (k, v) {
|
||||||
|
return v.protocol == "https"
|
||||||
|
}) || (this.node.restIsOn && this.restAddrs.$any(function (k, v) {
|
||||||
|
return v.protocol == "https"
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
this.changeRestListens = function (addrs) {
|
||||||
|
this.restAddrs = addrs
|
||||||
|
|
||||||
|
this.hasHTTPS = this.grpcAddrs.$any(function (k, v) {
|
||||||
|
return v.protocol == "https"
|
||||||
|
}) || (this.node.restIsOn && this.restAddrs.$any(function (k, v) {
|
||||||
|
return v.protocol == "https"
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user