前端页面

This commit is contained in:
robin
2026-02-24 22:43:49 +08:00
parent 2eb32b9f1f
commit 4d275c921d
18 changed files with 611 additions and 485 deletions

View File

@@ -3,6 +3,7 @@ package sandbox
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/policies"
)
type IndexAction struct {
@@ -15,21 +16,29 @@ func (this *IndexAction) Init() {
func (this *IndexAction) RunGet(params struct{}) {
httpdnsutils.AddLeftMenu(this.Parent())
this.Data["clusters"] = policies.LoadAvailableDeployClusters()
this.Data["apps"] = []map[string]interface{}{
{
"id": int64(1),
"name": "主站移动业务",
"appId": "ab12xc34s2",
"id": int64(1),
"name": "主站移动业务",
"appId": "ab12xc34s2",
"clusterId": int64(1),
"domains": []string{"api.business.com", "www.aliyun.com"},
},
{
"id": int64(2),
"name": "视频网关业务",
"appId": "vd8992ksm1",
"id": int64(2),
"name": "支付网关业务",
"appId": "vd8992ksm1",
"clusterId": int64(2),
"domains": []string{"payment.business.com"},
},
{
"id": int64(3),
"name": "海外灰度测试",
"appId": "ov7711hkq9",
"id": int64(3),
"name": "海外灰度测试",
"appId": "ov7711hkq9",
"clusterId": int64(1),
"domains": []string{"global.example.com", "edge.example.com"},
},
}
this.Show()

View File

@@ -6,6 +6,7 @@ import (
"strconv"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/policies"
"github.com/iwind/TeaGo/maps"
)
@@ -14,10 +15,11 @@ type TestAction struct {
}
func (this *TestAction) RunPost(params struct {
AppId string
Domain string
ClientIp string
Qtype string
AppId string
ClusterId int64
Domain string
ClientIp string
Qtype string
}) {
if len(params.ClientIp) == 0 {
params.ClientIp = "203.0.113.100"
@@ -40,7 +42,11 @@ func (this *TestAction) RunPost(params struct {
query.Set("dn", params.Domain)
query.Set("cip", params.ClientIp)
query.Set("qtype", params.Qtype)
requestURL := "https://api.httpdns.example.com/resolve?" + query.Encode()
clusterServiceDomain := policies.LoadClusterGatewayByID(params.ClusterId)
if len(clusterServiceDomain) == 0 {
clusterServiceDomain = "gw.httpdns.example.com"
}
requestURL := "https://" + clusterServiceDomain + "/resolve?" + query.Encode()
this.Data["result"] = maps.Map{
"code": 0,