1.5.0
This commit is contained in:
@@ -97,12 +97,10 @@ function build() {
|
||||
|
||||
# create dir & copy files
|
||||
echo "copying ..."
|
||||
if [ ! -d "$DIST" ]; then
|
||||
mkdir "$DIST"
|
||||
mkdir "$DIST"/bin
|
||||
mkdir "$DIST"/configs
|
||||
mkdir "$DIST"/logs
|
||||
fi
|
||||
rm -rf "$DIST"
|
||||
mkdir -p "$DIST"/bin
|
||||
mkdir -p "$DIST"/configs
|
||||
mkdir -p "$DIST"/logs
|
||||
|
||||
cp -R "$ROOT"/../web "$DIST"/
|
||||
rm -f "$DIST"/web/tmp/*
|
||||
@@ -135,30 +133,6 @@ function build() {
|
||||
rm -f "$(basename "$EDGE_API_ZIP_FILE")"
|
||||
|
||||
# ensure edge-api package always contains fluent-bit runtime assets/packages
|
||||
FLUENT_ROOT="$ROOT/../../deploy/fluent-bit"
|
||||
FLUENT_DIST="$DIST/edge-api/deploy/fluent-bit"
|
||||
if [ -d "$FLUENT_ROOT" ]; then
|
||||
verify_fluent_bit_package_matrix "$FLUENT_ROOT" "$ARCH" || exit 1
|
||||
rm -rf "$FLUENT_DIST"
|
||||
mkdir -p "$FLUENT_DIST"
|
||||
|
||||
FLUENT_FILES=(
|
||||
"parsers.conf"
|
||||
)
|
||||
for file in "${FLUENT_FILES[@]}"; do
|
||||
if [ -f "$FLUENT_ROOT/$file" ]; then
|
||||
cp "$FLUENT_ROOT/$file" "$FLUENT_DIST/"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d "$FLUENT_ROOT/packages" ]; then
|
||||
cp -R "$FLUENT_ROOT/packages" "$FLUENT_DIST/"
|
||||
fi
|
||||
|
||||
rm -f "$FLUENT_DIST/.gitignore"
|
||||
rm -f "$FLUENT_DIST"/logs.db*
|
||||
rm -rf "$FLUENT_DIST/storage"
|
||||
fi
|
||||
|
||||
# 鍒犻櫎 MaxMind 鏁版嵁搴撴枃浠讹紙浣跨敤宓屽叆鐨勬暟鎹簱锛屼笉闇€瑕佸閮ㄦ枃浠讹級
|
||||
find . -name "*.mmdb" -type f -delete
|
||||
@@ -220,39 +194,6 @@ function build() {
|
||||
echo "[done]"
|
||||
}
|
||||
|
||||
function verify_fluent_bit_package_matrix() {
|
||||
FLUENT_ROOT=$1
|
||||
ARCH=$2
|
||||
REQUIRED_FILES=()
|
||||
if [ "$ARCH" = "amd64" ]; then
|
||||
REQUIRED_FILES=(
|
||||
"packages/linux-amd64/fluent-bit_4.2.2_amd64.deb"
|
||||
"packages/linux-amd64/fluent-bit-4.2.2-1.x86_64.rpm"
|
||||
)
|
||||
elif [ "$ARCH" = "arm64" ]; then
|
||||
REQUIRED_FILES=(
|
||||
"packages/linux-arm64/fluent-bit_4.2.2_arm64.deb"
|
||||
"packages/linux-arm64/fluent-bit-4.2.2-1.aarch64.rpm"
|
||||
)
|
||||
else
|
||||
echo "[error] unsupported arch for fluent-bit package validation: $ARCH"
|
||||
return 1
|
||||
fi
|
||||
|
||||
MISSING=0
|
||||
for FILE in "${REQUIRED_FILES[@]}"; do
|
||||
if [ ! -f "$FLUENT_ROOT/$FILE" ]; then
|
||||
echo "[error] fluent-bit matrix package missing: $FLUENT_ROOT/$FILE"
|
||||
MISSING=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$MISSING" -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
function lookup-version() {
|
||||
FILE=$1
|
||||
VERSION_DATA=$(cat "$FILE")
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package teaconst
|
||||
|
||||
const (
|
||||
Version = "1.4.9" //1.3.9
|
||||
Version = "1.5.0" //1.3.9
|
||||
|
||||
APINodeVersion = "1.4.9" //1.3.9
|
||||
APINodeVersion = "1.5.0" //1.3.9
|
||||
|
||||
ProductName = "Edge Admin"
|
||||
ProcessName = "edge-admin"
|
||||
|
||||
@@ -248,3 +248,7 @@ func (this *RPCClient) PostCategoryRPC() pb.PostCategoryServiceClient {
|
||||
func (this *RPCClient) PostRPC() pb.PostServiceClient {
|
||||
return pb.NewPostServiceClient(this.pickConn())
|
||||
}
|
||||
|
||||
func (this *RPCClient) HTTPDNSBoardRPC() pb.HTTPDNSBoardServiceClient {
|
||||
return pb.NewHTTPDNSBoardServiceClient(this.pickConn())
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
nodethresholds "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/settings/thresholds"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/cc"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/http3"
|
||||
networksecurity "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/network-security"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/pages"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/thresholds"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/uam"
|
||||
@@ -53,7 +52,6 @@ func init() {
|
||||
GetPost("/thresholds", new(thresholds.IndexAction)).
|
||||
|
||||
//
|
||||
GetPost("/network-security", new(networksecurity.IndexAction)).
|
||||
|
||||
// 节点设置相关
|
||||
Prefix("/clusters/cluster/node/settings").
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
//go:build plus
|
||||
|
||||
package networksecurity
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
)
|
||||
|
||||
type IndexAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *IndexAction) Init() {
|
||||
this.Nav("", "setting", "index")
|
||||
this.SecondMenu("networkSecurity")
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunGet(params struct {
|
||||
ClusterId int64
|
||||
}) {
|
||||
policyResp, err := this.RPC().NodeClusterRPC().FindNodeClusterNetworkSecurityPolicy(this.AdminContext(), &pb.FindNodeClusterNetworkSecurityPolicyRequest{
|
||||
NodeClusterId: params.ClusterId,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
var policy = nodeconfigs.NewNetworkSecurityPolicy()
|
||||
if len(policyResp.NetworkSecurityPolicyJSON) > 0 {
|
||||
err = json.Unmarshal(policyResp.NetworkSecurityPolicyJSON, policy)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
this.Data["policy"] = policy
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunPost(params struct {
|
||||
ClusterId int64
|
||||
Status string
|
||||
|
||||
Must *actions.Must
|
||||
CSRF *actionutils.CSRF
|
||||
}) {
|
||||
policyResp, err := this.RPC().NodeClusterRPC().FindNodeClusterNetworkSecurityPolicy(this.AdminContext(), &pb.FindNodeClusterNetworkSecurityPolicyRequest{
|
||||
NodeClusterId: params.ClusterId,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
var policy = nodeconfigs.NewNetworkSecurityPolicy()
|
||||
if len(policyResp.NetworkSecurityPolicyJSON) > 0 {
|
||||
err = json.Unmarshal(policyResp.NetworkSecurityPolicyJSON, policy)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
policy.Status = params.Status
|
||||
|
||||
err = policy.Init()
|
||||
if err != nil {
|
||||
this.Fail("配置校验失败:" + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
policyJSON, err := json.Marshal(policy)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = this.RPC().NodeClusterRPC().UpdateNodeClusterNetworkSecurityPolicy(this.AdminContext(), &pb.UpdateNodeClusterNetworkSecurityPolicyRequest{
|
||||
NodeClusterId: params.ClusterId,
|
||||
NetworkSecurityPolicyJSON: policyJSON,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
@@ -44,17 +44,10 @@ func (this *ClusterHelper) filterMenuItems1(items []maps.Map, info *pb.FindEnabl
|
||||
|
||||
func (this *ClusterHelper) filterMenuItems2(items []maps.Map, info *pb.FindEnabledNodeClusterConfigInfoResponse, clusterIdString string, selectedItem string, actionPtr actions.ActionWrapper) []maps.Map {
|
||||
if teaconst.IsPlus {
|
||||
items = append(items, maps.Map{
|
||||
"name": this.Lang(actionPtr, codes.NodeClusterMenu_SettingSecurityPolicy),
|
||||
"url": "/clusters/cluster/settings/network-security?clusterId=" + clusterIdString,
|
||||
"isActive": selectedItem == "networkSecurity",
|
||||
"isOn": info != nil && info.HasNetworkSecurityPolicy, // TODO 将来 加入 info.HasDDoSProtection
|
||||
})
|
||||
|
||||
items = append(items, maps.Map{
|
||||
"name": "-",
|
||||
})
|
||||
if plusutils.CheckComponent(plusutils.ComponentCodeScheduling) {
|
||||
items = append(items, maps.Map{
|
||||
"name": "-",
|
||||
})
|
||||
items = append(items, maps.Map{
|
||||
"name": this.Lang(actionPtr, codes.NodeClusterMenu_SettingSchedule),
|
||||
"url": "/clusters/cluster/settings/schedule?clusterId=" + clusterIdString,
|
||||
@@ -89,14 +82,12 @@ func (this *ClusterHelper) filterMenuItems2(items []maps.Map, info *pb.FindEnabl
|
||||
"isOn": info != nil && info.HasSystemServices,
|
||||
})
|
||||
|
||||
{
|
||||
items = append(items, maps.Map{
|
||||
"name": this.Lang(actionPtr, codes.NodeClusterMenu_SettingTOA),
|
||||
"url": "/clusters/cluster/settings/toa?clusterId=" + clusterIdString,
|
||||
"isActive": selectedItem == "toa",
|
||||
"isOn": info != nil && info.IsTOAEnabled,
|
||||
})
|
||||
}
|
||||
items = append(items, maps.Map{
|
||||
"name": this.Lang(actionPtr, codes.NodeClusterMenu_SettingTOA),
|
||||
"url": "/clusters/cluster/settings/toa?clusterId=" + clusterIdString,
|
||||
"isActive": selectedItem == "toa",
|
||||
"isOn": info != nil && info.IsTOAEnabled,
|
||||
})
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
//go:build plus
|
||||
|
||||
package boards
|
||||
|
||||
import (
|
||||
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dashboard/boards/boardutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type HTTPDNSAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *HTTPDNSAction) Init() {
|
||||
this.Nav("", "", "httpdns")
|
||||
this.ViewDir("@default")
|
||||
this.View("dashboard/boards/httpdns")
|
||||
}
|
||||
|
||||
func (this *HTTPDNSAction) RunGet(params struct{}) {
|
||||
if !teaconst.IsPlus {
|
||||
this.RedirectURL("/dashboard")
|
||||
return
|
||||
}
|
||||
|
||||
err := boardutils.InitBoard(this.Parent())
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Data["board"] = maps.Map{
|
||||
"countApps": 0,
|
||||
"countDomains": 0,
|
||||
"countClusters": 0,
|
||||
"countNodes": 0,
|
||||
"countOfflineNodes": 0,
|
||||
}
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *HTTPDNSAction) RunPost(params struct{}) {
|
||||
resp, err := this.RPC().HTTPDNSBoardRPC().ComposeHTTPDNSBoard(this.AdminContext(), &pb.ComposeHTTPDNSBoardRequest{})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
this.Data["board"] = maps.Map{
|
||||
"countApps": resp.CountApps,
|
||||
"countDomains": resp.CountDomains,
|
||||
"countClusters": resp.CountClusters,
|
||||
"countNodes": resp.CountNodes,
|
||||
"countOfflineNodes": resp.CountOfflineNodes,
|
||||
}
|
||||
|
||||
{
|
||||
var statMaps = []maps.Map{}
|
||||
for _, stat := range resp.HourlyTrafficStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"day": stat.Hour[4:6] + "月" + stat.Hour[6:8] + "日",
|
||||
"hour": stat.Hour[8:],
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["hourlyStats"] = statMaps
|
||||
}
|
||||
|
||||
{
|
||||
var statMaps = []maps.Map{}
|
||||
for _, stat := range resp.DailyTrafficStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"day": stat.Day[4:6] + "月" + stat.Day[6:] + "日",
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["dailyStats"] = statMaps
|
||||
}
|
||||
|
||||
{
|
||||
var statMaps = []maps.Map{}
|
||||
for _, stat := range resp.TopAppStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"appId": stat.AppId,
|
||||
"appName": stat.AppName,
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["topAppStats"] = statMaps
|
||||
}
|
||||
|
||||
{
|
||||
var statMaps = []maps.Map{}
|
||||
for _, stat := range resp.TopDomainStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"domainId": stat.DomainId,
|
||||
"domainName": stat.DomainName,
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["topDomainStats"] = statMaps
|
||||
}
|
||||
|
||||
{
|
||||
var statMaps = []maps.Map{}
|
||||
for _, stat := range resp.TopNodeStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"clusterId": stat.ClusterId,
|
||||
"nodeId": stat.NodeId,
|
||||
"nodeName": stat.NodeName,
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["topNodeStats"] = statMaps
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
stringutil "github.com/iwind/TeaGo/utils/string"
|
||||
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||
"regexp"
|
||||
"time"
|
||||
@@ -409,5 +410,55 @@ func (this *IndexAction) RunPost(params struct {
|
||||
}
|
||||
this.Data["countWeakAdmins"] = countWeakAdminsResp.Count
|
||||
|
||||
upgradeConfig, err := configloaders.LoadUpgradeConfig()
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
this.Data["autoUpgrade"] = upgradeConfig.AutoUpgrade
|
||||
|
||||
httpdnsNodeUpgradeInfo, err := this.composeHTTPDNSNodeUpgradeInfo()
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
this.Data["httpdnsNodeUpgradeInfo"] = httpdnsNodeUpgradeInfo
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
func (this *IndexAction) composeHTTPDNSNodeUpgradeInfo() (maps.Map, error) {
|
||||
clustersResp, err := this.RPC().HTTPDNSClusterRPC().ListHTTPDNSClusters(this.AdminContext(), &pb.ListHTTPDNSClustersRequest{
|
||||
Offset: 0,
|
||||
Size: 10000,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
count := 0
|
||||
version := ""
|
||||
for _, cluster := range clustersResp.Clusters {
|
||||
resp, err := this.RPC().HTTPDNSNodeRPC().FindAllUpgradeHTTPDNSNodesWithClusterId(this.AdminContext(), &pb.FindAllUpgradeHTTPDNSNodesWithClusterIdRequest{
|
||||
ClusterId: cluster.Id,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
count += len(resp.Nodes)
|
||||
for _, nodeUpgrade := range resp.Nodes {
|
||||
if len(nodeUpgrade.NewVersion) == 0 {
|
||||
continue
|
||||
}
|
||||
if len(version) == 0 || stringutil.VersionCompare(version, nodeUpgrade.NewVersion) < 0 {
|
||||
version = nodeUpgrade.NewVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return maps.Map{
|
||||
"count": count,
|
||||
"version": version,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -245,5 +245,12 @@ func (this *IndexAction) RunPost(params struct{}) {
|
||||
}
|
||||
this.Data["countWeakAdmins"] = countWeakAdminsResp.Count
|
||||
|
||||
upgradeConfig, err := configloaders.LoadUpgradeConfig()
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
this.Data["autoUpgrade"] = upgradeConfig.AutoUpgrade
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ func init() {
|
||||
Get("/waf", new(boards.WafAction)).
|
||||
Post("/wafLogs", new(boards.WafLogsAction)).
|
||||
GetPost("/dns", new(boards.DnsAction)).
|
||||
GetPost("/httpdns", new(boards.HTTPDNSAction)).
|
||||
Get("/user", new(boards.UserAction)).
|
||||
Get("/events", new(boards.EventsAction)).
|
||||
Post("/readLogs", new(boards.ReadLogsAction)).
|
||||
|
||||
@@ -1,11 +1,110 @@
|
||||
package httpdns
|
||||
|
||||
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type IndexAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunGet(params struct{}) {
|
||||
this.RedirectURL("/httpdns/clusters")
|
||||
func (this *IndexAction) Init() {
|
||||
this.Nav("", "", "httpdns")
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunGet(params struct{}) {
|
||||
this.Data["board"] = maps.Map{
|
||||
"countApps": 0,
|
||||
"countDomains": 0,
|
||||
"countClusters": 0,
|
||||
"countNodes": 0,
|
||||
"countOfflineNodes": 0,
|
||||
}
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunPost(params struct{}) {
|
||||
resp, err := this.RPC().HTTPDNSBoardRPC().ComposeHTTPDNSBoard(this.AdminContext(), &pb.ComposeHTTPDNSBoardRequest{})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Data["board"] = maps.Map{
|
||||
"countApps": resp.CountApps,
|
||||
"countDomains": resp.CountDomains,
|
||||
"countClusters": resp.CountClusters,
|
||||
"countNodes": resp.CountNodes,
|
||||
"countOfflineNodes": resp.CountOfflineNodes,
|
||||
}
|
||||
|
||||
{
|
||||
statMaps := []maps.Map{}
|
||||
for _, stat := range resp.HourlyTrafficStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"day": stat.Hour[4:6] + "月" + stat.Hour[6:8] + "日",
|
||||
"hour": stat.Hour[8:],
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["hourlyStats"] = statMaps
|
||||
}
|
||||
|
||||
{
|
||||
statMaps := []maps.Map{}
|
||||
for _, stat := range resp.DailyTrafficStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"day": stat.Day[4:6] + "月" + stat.Day[6:] + "日",
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["dailyStats"] = statMaps
|
||||
}
|
||||
|
||||
{
|
||||
statMaps := []maps.Map{}
|
||||
for _, stat := range resp.TopAppStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"appId": stat.AppId,
|
||||
"appName": stat.AppName,
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["topAppStats"] = statMaps
|
||||
}
|
||||
|
||||
{
|
||||
statMaps := []maps.Map{}
|
||||
for _, stat := range resp.TopDomainStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"domainId": stat.DomainId,
|
||||
"domainName": stat.DomainName,
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["topDomainStats"] = statMaps
|
||||
}
|
||||
|
||||
{
|
||||
statMaps := []maps.Map{}
|
||||
for _, stat := range resp.TopNodeStats {
|
||||
statMaps = append(statMaps, maps.Map{
|
||||
"clusterId": stat.ClusterId,
|
||||
"nodeId": stat.NodeId,
|
||||
"nodeName": stat.NodeName,
|
||||
"countRequests": stat.CountRequests,
|
||||
"bytes": stat.Bytes,
|
||||
})
|
||||
}
|
||||
this.Data["topNodeStats"] = statMaps
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ func init() {
|
||||
server.
|
||||
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeHttpDNS)).
|
||||
Data("teaMenu", "httpdns").
|
||||
Data("teaSubMenu", "cluster").
|
||||
Data("teaSubMenu", "board").
|
||||
Prefix("/httpdns").
|
||||
Get("", new(IndexAction)).
|
||||
GetPost("", new(IndexAction)).
|
||||
GetPost("/addPortPopup", new(AddPortPopupAction)).
|
||||
EndAll()
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ func (this *CreatePopupAction) Init() {
|
||||
}
|
||||
|
||||
func (this *CreatePopupAction) RunGet(params struct{}) {
|
||||
var authMethods = []*serverconfigs.HTTPAuthTypeDefinition{}
|
||||
authMethods := []*serverconfigs.HTTPAuthTypeDefinition{}
|
||||
for _, method := range serverconfigs.FindAllHTTPAuthTypes(teaconst.Role) {
|
||||
if !method.IsPlus || (method.IsPlus && teaconst.IsPlus) {
|
||||
authMethods = append(authMethods, method)
|
||||
@@ -59,6 +59,10 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
TypeDTimestampParamName string
|
||||
TypeDLife int
|
||||
|
||||
// TypeE
|
||||
TypeESecret string
|
||||
TypeELife int
|
||||
|
||||
// BasicAuth
|
||||
HttpAuthBasicAuthUsersJSON []byte
|
||||
BasicAuthRealm string
|
||||
@@ -81,29 +85,25 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
Field("type", params.Type).
|
||||
Require("请输入鉴权类型")
|
||||
|
||||
var ref = &serverconfigs.HTTPAuthPolicyRef{IsOn: true}
|
||||
ref := &serverconfigs.HTTPAuthPolicyRef{IsOn: true}
|
||||
var method serverconfigs.HTTPAuthMethodInterface
|
||||
|
||||
// 扩展名
|
||||
var exts = utils.NewStringsStream(params.Exts).
|
||||
exts := utils.NewStringsStream(params.Exts).
|
||||
Map(strings.TrimSpace, strings.ToLower).
|
||||
Filter(utils.FilterNotEmpty).
|
||||
Map(utils.MapAddPrefixFunc(".")).
|
||||
Unique().
|
||||
Result()
|
||||
|
||||
// 域名
|
||||
var domains = []string{}
|
||||
domains := []string{}
|
||||
if len(params.DomainsJSON) > 0 {
|
||||
var rawDomains = []string{}
|
||||
rawDomains := []string{}
|
||||
err := json.Unmarshal(params.DomainsJSON, &rawDomains)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO 如果用户填写了一个网址,应该分析域名并填入
|
||||
|
||||
domains = utils.NewStringsStream(rawDomains).
|
||||
Map(strings.TrimSpace, strings.ToLower).
|
||||
Filter(utils.FilterNotEmpty).
|
||||
@@ -116,11 +116,11 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
params.Must.
|
||||
Field("typeASecret", params.TypeASecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母、数字").
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字").
|
||||
Field("typeASignParamName", params.TypeASignParamName).
|
||||
Require("请输入签名参数").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "签名参数中只能包含字母、数字、下划线")
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "签名参数中只能包含字母、数字和下划线")
|
||||
|
||||
if params.TypeALife < 0 {
|
||||
params.TypeALife = 0
|
||||
@@ -135,8 +135,8 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
params.Must.
|
||||
Field("typeBSecret", params.TypeBSecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母、数字")
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字")
|
||||
|
||||
method = &serverconfigs.HTTPAuthTypeBMethod{
|
||||
Secret: params.TypeBSecret,
|
||||
@@ -146,8 +146,8 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
params.Must.
|
||||
Field("typeCSecret", params.TypeCSecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母、数字")
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字")
|
||||
|
||||
method = &serverconfigs.HTTPAuthTypeCMethod{
|
||||
Secret: params.TypeCSecret,
|
||||
@@ -157,14 +157,14 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
params.Must.
|
||||
Field("typeDSecret", params.TypeDSecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母、数字").
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字").
|
||||
Field("typeDSignParamName", params.TypeDSignParamName).
|
||||
Require("请输入签名参数").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "签名参数中只能包含字母、数字、下划线").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "签名参数中只能包含字母、数字和下划线").
|
||||
Field("typeDTimestampParamName", params.TypeDTimestampParamName).
|
||||
Require("请输入时间戳参数").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "时间戳参数中只能包含字母、数字、下划线")
|
||||
Require("请输入时间参数").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "时间参数中只能包含字母、数字和下划线")
|
||||
|
||||
method = &serverconfigs.HTTPAuthTypeDMethod{
|
||||
Secret: params.TypeDSecret,
|
||||
@@ -172,15 +172,26 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
TimestampParamName: params.TypeDTimestampParamName,
|
||||
Life: params.TypeDLife,
|
||||
}
|
||||
case serverconfigs.HTTPAuthTypeTypeE:
|
||||
params.Must.
|
||||
Field("typeESecret", params.TypeESecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字")
|
||||
|
||||
method = &serverconfigs.HTTPAuthTypeEMethod{
|
||||
Secret: params.TypeESecret,
|
||||
Life: params.TypeELife,
|
||||
}
|
||||
case serverconfigs.HTTPAuthTypeBasicAuth:
|
||||
var users = []*serverconfigs.HTTPAuthBasicMethodUser{}
|
||||
users := []*serverconfigs.HTTPAuthBasicMethodUser{}
|
||||
err := json.Unmarshal(params.HttpAuthBasicAuthUsersJSON, &users)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if len(users) == 0 {
|
||||
this.Fail("请添加至少一个用户")
|
||||
this.Fail("请至少添加一个用户")
|
||||
}
|
||||
method = &serverconfigs.HTTPAuthBasicMethod{
|
||||
Users: users,
|
||||
@@ -188,8 +199,9 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
Charset: params.BasicAuthCharset,
|
||||
}
|
||||
case serverconfigs.HTTPAuthTypeSubRequest:
|
||||
params.Must.Field("subRequestURL", params.SubRequestURL).
|
||||
Require("请输入子请求URL")
|
||||
params.Must.
|
||||
Field("subRequestURL", params.SubRequestURL).
|
||||
Require("请输入子请求 URL")
|
||||
if params.SubRequestFollowRequest {
|
||||
params.SubRequestMethod = ""
|
||||
}
|
||||
@@ -198,7 +210,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
Method: params.SubRequestMethod,
|
||||
}
|
||||
default:
|
||||
this.Fail("不支持的鉴权类型'" + params.Type + "'")
|
||||
this.Fail("不支持的鉴权类型 '" + params.Type + "'")
|
||||
}
|
||||
|
||||
if method == nil {
|
||||
@@ -214,7 +226,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
var paramsMap = maps.Map{}
|
||||
paramsMap := maps.Map{}
|
||||
err = json.Unmarshal(methodJSON, ¶msMap)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
@@ -231,6 +243,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
return
|
||||
}
|
||||
defer this.CreateLogInfo(codes.HTTPAuthPolicy_LogCreateHTTPAuthPolicy, createResp.HttpAuthPolicyId)
|
||||
|
||||
ref.AuthPolicyId = createResp.HttpAuthPolicyId
|
||||
ref.AuthPolicy = &serverconfigs.HTTPAuthPolicy{
|
||||
Id: createResp.HttpAuthPolicyId,
|
||||
|
||||
@@ -27,7 +27,7 @@ func (this *UpdatePopupAction) Init() {
|
||||
func (this *UpdatePopupAction) RunGet(params struct {
|
||||
PolicyId int64
|
||||
}) {
|
||||
var authMethods = []*serverconfigs.HTTPAuthTypeDefinition{}
|
||||
authMethods := []*serverconfigs.HTTPAuthTypeDefinition{}
|
||||
for _, method := range serverconfigs.FindAllHTTPAuthTypes(teaconst.Role) {
|
||||
if !method.IsPlus || (method.IsPlus && teaconst.IsPlus) {
|
||||
authMethods = append(authMethods, method)
|
||||
@@ -47,7 +47,7 @@ func (this *UpdatePopupAction) RunGet(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
var authParams = map[string]interface{}{}
|
||||
authParams := map[string]interface{}{}
|
||||
if len(policy.ParamsJSON) > 0 {
|
||||
err = json.Unmarshal(policy.ParamsJSON, &authParams)
|
||||
if err != nil {
|
||||
@@ -91,6 +91,10 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
TypeDTimestampParamName string
|
||||
TypeDLife int
|
||||
|
||||
// TypeE
|
||||
TypeESecret string
|
||||
TypeELife int
|
||||
|
||||
// BasicAuth
|
||||
HttpAuthBasicAuthUsersJSON []byte
|
||||
BasicAuthRealm string
|
||||
@@ -125,29 +129,25 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
Field("name", params.Name).
|
||||
Require("请输入名称")
|
||||
|
||||
var ref = &serverconfigs.HTTPAuthPolicyRef{IsOn: true}
|
||||
ref := &serverconfigs.HTTPAuthPolicyRef{IsOn: true}
|
||||
var method serverconfigs.HTTPAuthMethodInterface
|
||||
|
||||
// 扩展名
|
||||
var exts = utils.NewStringsStream(params.Exts).
|
||||
exts := utils.NewStringsStream(params.Exts).
|
||||
Map(strings.TrimSpace, strings.ToLower).
|
||||
Filter(utils.FilterNotEmpty).
|
||||
Map(utils.MapAddPrefixFunc(".")).
|
||||
Unique().
|
||||
Result()
|
||||
|
||||
// 域名
|
||||
var domains = []string{}
|
||||
domains := []string{}
|
||||
if len(params.DomainsJSON) > 0 {
|
||||
var rawDomains = []string{}
|
||||
rawDomains := []string{}
|
||||
err := json.Unmarshal(params.DomainsJSON, &rawDomains)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO 如果用户填写了一个网址,应该分析域名并填入
|
||||
|
||||
domains = utils.NewStringsStream(rawDomains).
|
||||
Map(strings.TrimSpace, strings.ToLower).
|
||||
Filter(utils.FilterNotEmpty).
|
||||
@@ -160,11 +160,11 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
params.Must.
|
||||
Field("typeASecret", params.TypeASecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母、数字").
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字").
|
||||
Field("typeASignParamName", params.TypeASignParamName).
|
||||
Require("请输入签名参数").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "签名参数中只能包含字母、数字、下划线")
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "签名参数中只能包含字母、数字和下划线")
|
||||
|
||||
if params.TypeALife < 0 {
|
||||
params.TypeALife = 0
|
||||
@@ -179,8 +179,8 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
params.Must.
|
||||
Field("typeBSecret", params.TypeBSecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母、数字")
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字")
|
||||
|
||||
method = &serverconfigs.HTTPAuthTypeBMethod{
|
||||
Secret: params.TypeBSecret,
|
||||
@@ -190,8 +190,8 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
params.Must.
|
||||
Field("typeCSecret", params.TypeCSecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母、数字")
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字")
|
||||
|
||||
method = &serverconfigs.HTTPAuthTypeCMethod{
|
||||
Secret: params.TypeCSecret,
|
||||
@@ -201,14 +201,14 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
params.Must.
|
||||
Field("typeDSecret", params.TypeDSecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母、数字").
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字").
|
||||
Field("typeDSignParamName", params.TypeDSignParamName).
|
||||
Require("请输入签名参数").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "签名参数中只能包含字母、数字、下划线").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "签名参数中只能包含字母、数字和下划线").
|
||||
Field("typeDTimestampParamName", params.TypeDTimestampParamName).
|
||||
Require("请输入时间戳参数").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "时间戳参数中只能包含字母、数字、下划线")
|
||||
Require("请输入时间参数").
|
||||
Match(`^[a-zA-Z0-9_]{1,40}$`, "时间参数中只能包含字母、数字和下划线")
|
||||
|
||||
method = &serverconfigs.HTTPAuthTypeDMethod{
|
||||
Secret: params.TypeDSecret,
|
||||
@@ -216,6 +216,17 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
TimestampParamName: params.TypeDTimestampParamName,
|
||||
Life: params.TypeDLife,
|
||||
}
|
||||
case serverconfigs.HTTPAuthTypeTypeE:
|
||||
params.Must.
|
||||
Field("typeESecret", params.TypeESecret).
|
||||
Require("请输入鉴权密钥").
|
||||
MaxLength(40, "鉴权密钥长度不能超过40个字符").
|
||||
Match(`^[a-zA-Z0-9]{1,40}$`, "鉴权密钥中只能包含字母和数字")
|
||||
|
||||
method = &serverconfigs.HTTPAuthTypeEMethod{
|
||||
Secret: params.TypeESecret,
|
||||
Life: params.TypeELife,
|
||||
}
|
||||
case serverconfigs.HTTPAuthTypeBasicAuth:
|
||||
users := []*serverconfigs.HTTPAuthBasicMethodUser{}
|
||||
err := json.Unmarshal(params.HttpAuthBasicAuthUsersJSON, &users)
|
||||
@@ -224,7 +235,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
return
|
||||
}
|
||||
if len(users) == 0 {
|
||||
this.Fail("请添加至少一个用户")
|
||||
this.Fail("请至少添加一个用户")
|
||||
}
|
||||
method = &serverconfigs.HTTPAuthBasicMethod{
|
||||
Users: users,
|
||||
@@ -232,8 +243,9 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
Charset: params.BasicAuthCharset,
|
||||
}
|
||||
case serverconfigs.HTTPAuthTypeSubRequest:
|
||||
params.Must.Field("subRequestURL", params.SubRequestURL).
|
||||
Require("请输入子请求URL")
|
||||
params.Must.
|
||||
Field("subRequestURL", params.SubRequestURL).
|
||||
Require("请输入子请求 URL")
|
||||
if params.SubRequestFollowRequest {
|
||||
params.SubRequestMethod = ""
|
||||
}
|
||||
@@ -242,7 +254,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
Method: params.SubRequestMethod,
|
||||
}
|
||||
default:
|
||||
this.Fail("不支持的鉴权类型'" + policyType + "'")
|
||||
this.Fail("不支持的鉴权类型 '" + policyType + "'")
|
||||
}
|
||||
|
||||
if method == nil {
|
||||
@@ -275,6 +287,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
ref.AuthPolicy = &serverconfigs.HTTPAuthPolicy{
|
||||
Id: params.PolicyId,
|
||||
Name: params.Name,
|
||||
|
||||
@@ -16,6 +16,8 @@ import (
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type ComponentsAction actions.Action
|
||||
@@ -41,12 +43,7 @@ func (this *ComponentsAction) RunGet(params struct{}) {
|
||||
|
||||
var buffer = bytes.NewBuffer([]byte{})
|
||||
|
||||
var webRoot string
|
||||
if Tea.IsTesting() {
|
||||
webRoot = Tea.Root + "/../web/public/js/components/"
|
||||
} else {
|
||||
webRoot = Tea.Root + "/web/public/js/components/"
|
||||
}
|
||||
webRoot := findComponentsRoot()
|
||||
f := files.NewFile(webRoot)
|
||||
|
||||
f.Range(func(file *files.File) {
|
||||
@@ -173,3 +170,27 @@ func (this *ComponentsAction) RunGet(params struct{}) {
|
||||
|
||||
_, _ = this.Write(componentsData)
|
||||
}
|
||||
|
||||
func findComponentsRoot() string {
|
||||
candidates := []string{
|
||||
filepath.Join(Tea.Root, "web", "public", "js", "components"),
|
||||
filepath.Join(Tea.Root, "..", "web", "public", "js", "components"),
|
||||
filepath.Join(Tea.Root, "..", "..", "web", "public", "js", "components"),
|
||||
}
|
||||
|
||||
if cwd, err := os.Getwd(); err == nil && len(cwd) > 0 {
|
||||
candidates = append(candidates,
|
||||
filepath.Join(cwd, "web", "public", "js", "components"),
|
||||
filepath.Join(cwd, "EdgeAdmin", "web", "public", "js", "components"),
|
||||
)
|
||||
}
|
||||
|
||||
for _, candidate := range candidates {
|
||||
info, err := os.Stat(candidate)
|
||||
if err == nil && info.IsDir() {
|
||||
return candidate + string(filepath.Separator)
|
||||
}
|
||||
}
|
||||
|
||||
return filepath.Join(Tea.Root, "web", "public", "js", "components") + string(filepath.Separator)
|
||||
}
|
||||
|
||||
@@ -141,7 +141,6 @@ import (
|
||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns"
|
||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/apps"
|
||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/clusters"
|
||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/clusters"
|
||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/resolveLogs"
|
||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/runtimeLogs"
|
||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/sandbox"
|
||||
|
||||
@@ -2272,6 +2272,57 @@ Vue.component("health-check-config-box", {
|
||||
</div>`
|
||||
})
|
||||
|
||||
Vue.component("httpdns-clusters-selector", {
|
||||
props: ["vClusters", "vName"],
|
||||
data: function () {
|
||||
let inputClusters = this.vClusters
|
||||
let clusters = []
|
||||
|
||||
if (inputClusters != null && inputClusters.length > 0) {
|
||||
if (inputClusters[0].isChecked !== undefined) {
|
||||
// 带 isChecked 标志的完整集群列表
|
||||
clusters = inputClusters.map(function (c) {
|
||||
return {id: c.id, name: c.name, isChecked: c.isChecked}
|
||||
})
|
||||
} else {
|
||||
// 仅包含已选集群,全部标记为选中
|
||||
clusters = inputClusters.map(function (c) {
|
||||
return {id: c.id, name: c.name, isChecked: true}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 无 prop 时从根实例读取所有集群(如创建应用页面)
|
||||
if (clusters.length === 0) {
|
||||
let rootClusters = this.$root.clusters
|
||||
if (rootClusters != null && rootClusters.length > 0) {
|
||||
clusters = rootClusters.map(function (c) {
|
||||
return {id: c.id, name: c.name, isChecked: false}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
clusters: clusters,
|
||||
fieldName: this.vName || "clusterIds"
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeCluster: function (cluster) {
|
||||
cluster.isChecked = !cluster.isChecked
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<div v-if="clusters.length > 0">
|
||||
<checkbox v-for="cluster in clusters" :key="cluster.id" :v-value="cluster.id" :value="cluster.isChecked ? cluster.id : 0" style="margin-right: 1em" @input="changeCluster(cluster)" :name="fieldName">
|
||||
{{cluster.name}}
|
||||
</checkbox>
|
||||
</div>
|
||||
<span class="grey" v-else>暂无可用集群</span>
|
||||
</div>`
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 菜单项
|
||||
*/
|
||||
@@ -11294,10 +11345,18 @@ Vue.component("http-auth-config-box", {
|
||||
if (authConfig.policyRefs == null) {
|
||||
authConfig.policyRefs = []
|
||||
}
|
||||
return {
|
||||
return {
|
||||
authConfig: authConfig
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"authConfig.isOn": function () {
|
||||
this.change()
|
||||
},
|
||||
"authConfig.isPrior": function () {
|
||||
this.change()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isOn: function () {
|
||||
return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn
|
||||
@@ -11309,18 +11368,17 @@ Vue.component("http-auth-config-box", {
|
||||
that.authConfig.policyRefs.push(resp.data.policyRef)
|
||||
that.change()
|
||||
},
|
||||
height: "28em"
|
||||
height: "32em"
|
||||
})
|
||||
},
|
||||
update: function (index, policyId) {
|
||||
let that = this
|
||||
teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, {
|
||||
callback: function (resp) {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
},
|
||||
height: "28em"
|
||||
height: "32em"
|
||||
})
|
||||
},
|
||||
remove: function (index) {
|
||||
@@ -11341,14 +11399,15 @@ Vue.component("http-auth-config-box", {
|
||||
return "URL鉴权C"
|
||||
case "typeD":
|
||||
return "URL鉴权D"
|
||||
case "typeE":
|
||||
return "URL鉴权E"
|
||||
}
|
||||
return ""
|
||||
},
|
||||
change: function () {
|
||||
let that = this
|
||||
setTimeout(function () {
|
||||
// 延时通知,是为了让表单有机会变更数据
|
||||
that.$emit("change", this.authConfig)
|
||||
that.$emit("change", that.authConfig)
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
@@ -11369,7 +11428,6 @@ Vue.component("http-auth-config-box", {
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="margin"></div>
|
||||
<!-- 鉴权方式 -->
|
||||
<div v-show="isOn()">
|
||||
<h4>鉴权方式</h4>
|
||||
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
|
||||
@@ -11385,9 +11443,7 @@ Vue.component("http-auth-config-box", {
|
||||
<tbody v-for="(ref, index) in authConfig.policyRefs" :key="ref.authPolicyId">
|
||||
<tr>
|
||||
<td>{{ref.authPolicy.name}}</td>
|
||||
<td>
|
||||
{{methodName(ref.authPolicy.type)}}
|
||||
</td>
|
||||
<td>{{methodName(ref.authPolicy.type)}}</td>
|
||||
<td>
|
||||
<span v-if="ref.authPolicy.type == 'basicAuth'">{{ref.authPolicy.params.users.length}}个用户</span>
|
||||
<span v-if="ref.authPolicy.type == 'subRequest'">
|
||||
@@ -11398,7 +11454,7 @@ Vue.component("http-auth-config-box", {
|
||||
<span v-if="ref.authPolicy.type == 'typeB'">有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
<span v-if="ref.authPolicy.type == 'typeC'">有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
<span v-if="ref.authPolicy.type == 'typeD'">{{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
|
||||
<span v-if="ref.authPolicy.type == 'typeE'">路径模式/有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
<div v-if="(ref.authPolicy.params.exts != null && ref.authPolicy.params.exts.length > 0) || (ref.authPolicy.params.domains != null && ref.authPolicy.params.domains.length > 0)">
|
||||
<grey-label v-if="ref.authPolicy.params.exts != null" v-for="ext in ref.authPolicy.params.exts">扩展名:{{ext}}</grey-label>
|
||||
<grey-label v-if="ref.authPolicy.params.domains != null" v-for="domain in ref.authPolicy.params.domains">域名:{{domain}}</grey-label>
|
||||
@@ -11420,6 +11476,7 @@ Vue.component("http-auth-config-box", {
|
||||
</div>`
|
||||
})
|
||||
|
||||
|
||||
Vue.component("http-cache-config-box", {
|
||||
props: ["v-cache-config", "v-is-location", "v-is-group", "v-cache-policy", "v-web-id"],
|
||||
data: function () {
|
||||
|
||||
@@ -2272,6 +2272,57 @@ Vue.component("health-check-config-box", {
|
||||
</div>`
|
||||
})
|
||||
|
||||
Vue.component("httpdns-clusters-selector", {
|
||||
props: ["vClusters", "vName"],
|
||||
data: function () {
|
||||
let inputClusters = this.vClusters
|
||||
let clusters = []
|
||||
|
||||
if (inputClusters != null && inputClusters.length > 0) {
|
||||
if (inputClusters[0].isChecked !== undefined) {
|
||||
// 带 isChecked 标志的完整集群列表
|
||||
clusters = inputClusters.map(function (c) {
|
||||
return {id: c.id, name: c.name, isChecked: c.isChecked}
|
||||
})
|
||||
} else {
|
||||
// 仅包含已选集群,全部标记为选中
|
||||
clusters = inputClusters.map(function (c) {
|
||||
return {id: c.id, name: c.name, isChecked: true}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 无 prop 时从根实例读取所有集群(如创建应用页面)
|
||||
if (clusters.length === 0) {
|
||||
let rootClusters = this.$root.clusters
|
||||
if (rootClusters != null && rootClusters.length > 0) {
|
||||
clusters = rootClusters.map(function (c) {
|
||||
return {id: c.id, name: c.name, isChecked: false}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
clusters: clusters,
|
||||
fieldName: this.vName || "clusterIds"
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeCluster: function (cluster) {
|
||||
cluster.isChecked = !cluster.isChecked
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<div v-if="clusters.length > 0">
|
||||
<checkbox v-for="cluster in clusters" :key="cluster.id" :v-value="cluster.id" :value="cluster.isChecked ? cluster.id : 0" style="margin-right: 1em" @input="changeCluster(cluster)" :name="fieldName">
|
||||
{{cluster.name}}
|
||||
</checkbox>
|
||||
</div>
|
||||
<span class="grey" v-else>暂无可用集群</span>
|
||||
</div>`
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 菜单项
|
||||
*/
|
||||
@@ -11294,10 +11345,18 @@ Vue.component("http-auth-config-box", {
|
||||
if (authConfig.policyRefs == null) {
|
||||
authConfig.policyRefs = []
|
||||
}
|
||||
return {
|
||||
return {
|
||||
authConfig: authConfig
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"authConfig.isOn": function () {
|
||||
this.change()
|
||||
},
|
||||
"authConfig.isPrior": function () {
|
||||
this.change()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isOn: function () {
|
||||
return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn
|
||||
@@ -11309,18 +11368,17 @@ Vue.component("http-auth-config-box", {
|
||||
that.authConfig.policyRefs.push(resp.data.policyRef)
|
||||
that.change()
|
||||
},
|
||||
height: "28em"
|
||||
height: "32em"
|
||||
})
|
||||
},
|
||||
update: function (index, policyId) {
|
||||
let that = this
|
||||
teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, {
|
||||
callback: function (resp) {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
},
|
||||
height: "28em"
|
||||
height: "32em"
|
||||
})
|
||||
},
|
||||
remove: function (index) {
|
||||
@@ -11341,14 +11399,15 @@ Vue.component("http-auth-config-box", {
|
||||
return "URL鉴权C"
|
||||
case "typeD":
|
||||
return "URL鉴权D"
|
||||
case "typeE":
|
||||
return "URL鉴权E"
|
||||
}
|
||||
return ""
|
||||
},
|
||||
change: function () {
|
||||
let that = this
|
||||
setTimeout(function () {
|
||||
// 延时通知,是为了让表单有机会变更数据
|
||||
that.$emit("change", this.authConfig)
|
||||
that.$emit("change", that.authConfig)
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
@@ -11369,7 +11428,6 @@ Vue.component("http-auth-config-box", {
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="margin"></div>
|
||||
<!-- 鉴权方式 -->
|
||||
<div v-show="isOn()">
|
||||
<h4>鉴权方式</h4>
|
||||
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
|
||||
@@ -11385,9 +11443,7 @@ Vue.component("http-auth-config-box", {
|
||||
<tbody v-for="(ref, index) in authConfig.policyRefs" :key="ref.authPolicyId">
|
||||
<tr>
|
||||
<td>{{ref.authPolicy.name}}</td>
|
||||
<td>
|
||||
{{methodName(ref.authPolicy.type)}}
|
||||
</td>
|
||||
<td>{{methodName(ref.authPolicy.type)}}</td>
|
||||
<td>
|
||||
<span v-if="ref.authPolicy.type == 'basicAuth'">{{ref.authPolicy.params.users.length}}个用户</span>
|
||||
<span v-if="ref.authPolicy.type == 'subRequest'">
|
||||
@@ -11398,7 +11454,7 @@ Vue.component("http-auth-config-box", {
|
||||
<span v-if="ref.authPolicy.type == 'typeB'">有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
<span v-if="ref.authPolicy.type == 'typeC'">有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
<span v-if="ref.authPolicy.type == 'typeD'">{{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
|
||||
<span v-if="ref.authPolicy.type == 'typeE'">路径模式/有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
<div v-if="(ref.authPolicy.params.exts != null && ref.authPolicy.params.exts.length > 0) || (ref.authPolicy.params.domains != null && ref.authPolicy.params.domains.length > 0)">
|
||||
<grey-label v-if="ref.authPolicy.params.exts != null" v-for="ext in ref.authPolicy.params.exts">扩展名:{{ext}}</grey-label>
|
||||
<grey-label v-if="ref.authPolicy.params.domains != null" v-for="domain in ref.authPolicy.params.domains">域名:{{domain}}</grey-label>
|
||||
@@ -11420,6 +11476,7 @@ Vue.component("http-auth-config-box", {
|
||||
</div>`
|
||||
})
|
||||
|
||||
|
||||
Vue.component("http-cache-config-box", {
|
||||
props: ["v-cache-config", "v-is-location", "v-is-group", "v-cache-policy", "v-web-id"],
|
||||
data: function () {
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
Vue.component("httpdns-clusters-selector", {
|
||||
props: ["vClusters", "vName"],
|
||||
data: function () {
|
||||
let inputClusters = this.vClusters
|
||||
let clusters = []
|
||||
|
||||
if (inputClusters != null && inputClusters.length > 0) {
|
||||
if (inputClusters[0].isChecked !== undefined) {
|
||||
// 带 isChecked 标志的完整集群列表
|
||||
clusters = inputClusters.map(function (c) {
|
||||
return {id: c.id, name: c.name, isChecked: c.isChecked}
|
||||
})
|
||||
} else {
|
||||
// 仅包含已选集群,全部标记为选中
|
||||
clusters = inputClusters.map(function (c) {
|
||||
return {id: c.id, name: c.name, isChecked: true}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 无 prop 时从根实例读取所有集群(如创建应用页面)
|
||||
if (clusters.length === 0) {
|
||||
let rootClusters = this.$root.clusters
|
||||
if (rootClusters != null && rootClusters.length > 0) {
|
||||
clusters = rootClusters.map(function (c) {
|
||||
return {id: c.id, name: c.name, isChecked: false}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
clusters: clusters,
|
||||
fieldName: this.vName || "clusterIds"
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeCluster: function (cluster) {
|
||||
cluster.isChecked = !cluster.isChecked
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<div v-if="clusters.length > 0">
|
||||
<checkbox v-for="cluster in clusters" :key="cluster.id" :v-value="cluster.id" :value="cluster.isChecked ? cluster.id : 0" style="margin-right: 1em" @input="changeCluster(cluster)" :name="fieldName">
|
||||
{{cluster.name}}
|
||||
</checkbox>
|
||||
</div>
|
||||
<span class="grey" v-else>暂无可用集群</span>
|
||||
</div>`
|
||||
})
|
||||
@@ -12,10 +12,18 @@ Vue.component("http-auth-config-box", {
|
||||
if (authConfig.policyRefs == null) {
|
||||
authConfig.policyRefs = []
|
||||
}
|
||||
return {
|
||||
return {
|
||||
authConfig: authConfig
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"authConfig.isOn": function () {
|
||||
this.change()
|
||||
},
|
||||
"authConfig.isPrior": function () {
|
||||
this.change()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isOn: function () {
|
||||
return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn
|
||||
@@ -27,18 +35,17 @@ Vue.component("http-auth-config-box", {
|
||||
that.authConfig.policyRefs.push(resp.data.policyRef)
|
||||
that.change()
|
||||
},
|
||||
height: "28em"
|
||||
height: "32em"
|
||||
})
|
||||
},
|
||||
update: function (index, policyId) {
|
||||
let that = this
|
||||
teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, {
|
||||
callback: function (resp) {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
},
|
||||
height: "28em"
|
||||
height: "32em"
|
||||
})
|
||||
},
|
||||
remove: function (index) {
|
||||
@@ -59,14 +66,15 @@ Vue.component("http-auth-config-box", {
|
||||
return "URL鉴权C"
|
||||
case "typeD":
|
||||
return "URL鉴权D"
|
||||
case "typeE":
|
||||
return "URL鉴权E"
|
||||
}
|
||||
return ""
|
||||
},
|
||||
change: function () {
|
||||
let that = this
|
||||
setTimeout(function () {
|
||||
// 延时通知,是为了让表单有机会变更数据
|
||||
that.$emit("change", this.authConfig)
|
||||
that.$emit("change", that.authConfig)
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
@@ -87,7 +95,6 @@ Vue.component("http-auth-config-box", {
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="margin"></div>
|
||||
<!-- 鉴权方式 -->
|
||||
<div v-show="isOn()">
|
||||
<h4>鉴权方式</h4>
|
||||
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
|
||||
@@ -103,9 +110,7 @@ Vue.component("http-auth-config-box", {
|
||||
<tbody v-for="(ref, index) in authConfig.policyRefs" :key="ref.authPolicyId">
|
||||
<tr>
|
||||
<td>{{ref.authPolicy.name}}</td>
|
||||
<td>
|
||||
{{methodName(ref.authPolicy.type)}}
|
||||
</td>
|
||||
<td>{{methodName(ref.authPolicy.type)}}</td>
|
||||
<td>
|
||||
<span v-if="ref.authPolicy.type == 'basicAuth'">{{ref.authPolicy.params.users.length}}个用户</span>
|
||||
<span v-if="ref.authPolicy.type == 'subRequest'">
|
||||
@@ -116,7 +121,7 @@ Vue.component("http-auth-config-box", {
|
||||
<span v-if="ref.authPolicy.type == 'typeB'">有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
<span v-if="ref.authPolicy.type == 'typeC'">有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
<span v-if="ref.authPolicy.type == 'typeD'">{{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
|
||||
<span v-if="ref.authPolicy.type == 'typeE'">路径模式/有效期{{ref.authPolicy.params.life}}秒</span>
|
||||
<div v-if="(ref.authPolicy.params.exts != null && ref.authPolicy.params.exts.length > 0) || (ref.authPolicy.params.domains != null && ref.authPolicy.params.domains.length > 0)">
|
||||
<grey-label v-if="ref.authPolicy.params.exts != null" v-for="ext in ref.authPolicy.params.exts">扩展名:{{ext}}</grey-label>
|
||||
<grey-label v-if="ref.authPolicy.params.domains != null" v-for="domain in ref.authPolicy.params.domains">域名:{{domain}}</grey-label>
|
||||
@@ -136,4 +141,4 @@ Vue.component("http-auth-config-box", {
|
||||
</div>
|
||||
<div class="margin"></div>
|
||||
</div>`
|
||||
})
|
||||
})
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</script>
|
||||
<script type="text/javascript" src="/js/config/brand.js"></script>
|
||||
<script type="text/javascript" src="/_/@default/@layout.js"></script>
|
||||
<script type="text/javascript" src="/js/components.js"></script>
|
||||
<script type="text/javascript" src="/js/components.js?v={$ .teaVersion}"></script>
|
||||
<script type="text/javascript" src="/js/utils.min.js"></script>
|
||||
<script type="text/javascript" src="/js/sweetalert2/dist/sweetalert2.all.min.js" async></script>
|
||||
<script type="text/javascript" src="/js/date.tea.js"></script>
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
{$layout}
|
||||
|
||||
{$template "../menu"}
|
||||
{$template "/left_menu_with_menu"}
|
||||
|
||||
<div class="right-box with-menu">
|
||||
<div class="margin"></div>
|
||||
|
||||
<warning-message>此功能为试验功能,目前只能做一些简单的网络数据包统计。</warning-message>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">启用数据包统计</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="status" v-model="policy.status">
|
||||
<option value="auto">自动</option>
|
||||
<option value="on">启用</option>
|
||||
<option value="off">停用</option>
|
||||
</select>
|
||||
<p class="comment" v-if="policy.status == 'auto'">自动根据服务器硬件配置决定是否启用,避免影响性能。</p>
|
||||
<p class="comment" v-if="policy.status == 'on'">强制启用;如果节点服务器配置较低,可能会严重影响性能,建议仅在8线程以上CPU节点服务器上选择强制启用。</p>
|
||||
<p class="comment" v-if="policy.status == 'off'">完全关闭此功能。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
@@ -6,6 +6,7 @@
|
||||
<span v-if="countTodayAttacks > 0" :class="{red: countTodayAttacks != countTodayAttacksRead}">({{countTodayAttacksFormat}})</span>
|
||||
</menu-item>
|
||||
<menu-item href="/dashboard/boards/dns" code="dns">{{LANG('admin_dashboard@ui_dns')}}</menu-item>
|
||||
<menu-item href="/dashboard/boards/httpdns" code="httpdns">HTTPDNS</menu-item>
|
||||
<menu-item href="/dashboard/boards/user" code="user">{{LANG('admin_dashboard@ui_user')}}</menu-item>
|
||||
<menu-item href="/dashboard/boards/events" code="event">{{LANG('admin_dashboard@ui_events')}}<span :class="{red: countEvents > 0}">({{countEvents}})</span></menu-item>
|
||||
</first-menu>
|
||||
</first-menu>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
.ui.message .icon {
|
||||
position: absolute;
|
||||
right: 1em;
|
||||
top: 1.8em;
|
||||
}
|
||||
.chart-box {
|
||||
height: 14em;
|
||||
}
|
||||
67
EdgeAdmin/web/views/@default/dashboard/boards/httpdns.html
Normal file
67
EdgeAdmin/web/views/@default/dashboard/boards/httpdns.html
Normal file
@@ -0,0 +1,67 @@
|
||||
{$layout}
|
||||
{$template "menu"}
|
||||
{$template "/echarts"}
|
||||
|
||||
<div style="margin-top: 0.8em" v-if="isLoading">
|
||||
<div class="ui message loading">
|
||||
<div class="ui active inline loader small"></div> 数据加载中...
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-show="!isLoading">
|
||||
<columns-grid>
|
||||
<div class="ui column">
|
||||
<h4>应用<link-icon href="/httpdns/apps"></link-icon></h4>
|
||||
<div class="value"><span>{{board.countApps}}</span>个</div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>域名<link-icon href="/httpdns/apps"></link-icon></h4>
|
||||
<div class="value"><span>{{board.countDomains}}</span>个</div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>集群<link-icon href="/httpdns/clusters"></link-icon></h4>
|
||||
<div class="value"><span>{{board.countClusters}}</span>个</div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>节点<link-icon href="/httpdns/clusters"></link-icon></h4>
|
||||
<div class="value"><span>{{board.countNodes}}</span>
|
||||
<span v-if="board.countOfflineNodes > 0" style="font-size: 1em">
|
||||
/ <a href="/httpdns/clusters"><span class="red" style="font-size: 1em">{{board.countOfflineNodes}}离线</span></a>
|
||||
</span>
|
||||
<span v-else style="font-size: 1em">个</span>
|
||||
</div>
|
||||
</div>
|
||||
</columns-grid>
|
||||
|
||||
<chart-columns-grid>
|
||||
<div class="ui column">
|
||||
<div class="ui menu text blue">
|
||||
<a href="" class="item" :class="{active: trafficTab == 'hourly'}" @click.prevent="selectTrafficTab('hourly')">24小时请求趋势</a>
|
||||
<a href="" class="item" :class="{active: trafficTab == 'daily'}" @click.prevent="selectTrafficTab('daily')">15天请求趋势</a>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<div class="chart-box" id="hourly-traffic-chart" v-show="trafficTab == 'hourly'"></div>
|
||||
<div class="chart-box" id="daily-traffic-chart" v-show="trafficTab == 'daily'"></div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<h4>应用请求排行 <span>(24小时)</span></h4>
|
||||
<div class="ui divider"></div>
|
||||
<div class="chart-box" id="top-apps-chart"></div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<h4>域名请求排行 <span>(24小时)</span></h4>
|
||||
<div class="ui divider"></div>
|
||||
<div class="chart-box" id="top-domains-chart"></div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<h4>节点访问排行 <span>(24小时)</span></h4>
|
||||
<div class="ui divider"></div>
|
||||
<div class="chart-box" id="top-nodes-chart"></div>
|
||||
</div>
|
||||
|
||||
</chart-columns-grid>
|
||||
</div>
|
||||
192
EdgeAdmin/web/views/@default/dashboard/boards/httpdns.js
Normal file
192
EdgeAdmin/web/views/@default/dashboard/boards/httpdns.js
Normal file
@@ -0,0 +1,192 @@
|
||||
Tea.context(function () {
|
||||
this.isLoading = true
|
||||
|
||||
this.$delay(function () {
|
||||
this.$post("$")
|
||||
.success(function (resp) {
|
||||
for (let k in resp.data) {
|
||||
this[k] = resp.data[k]
|
||||
}
|
||||
|
||||
this.$delay(function () {
|
||||
this.reloadHourlyTrafficChart()
|
||||
this.reloadTopAppsChart()
|
||||
this.reloadTopDomainsChart()
|
||||
this.reloadTopNodesChart()
|
||||
})
|
||||
|
||||
this.isLoading = false
|
||||
})
|
||||
})
|
||||
|
||||
this.trafficTab = "hourly"
|
||||
|
||||
this.selectTrafficTab = function (tab) {
|
||||
this.trafficTab = tab
|
||||
if (tab == "hourly") {
|
||||
this.$delay(function () {
|
||||
this.reloadHourlyTrafficChart()
|
||||
})
|
||||
} else if (tab == "daily") {
|
||||
this.$delay(function () {
|
||||
this.reloadDailyTrafficChart()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.reloadHourlyTrafficChart = function () {
|
||||
let stats = this.hourlyStats
|
||||
if (stats == null || stats.length == 0) {
|
||||
return
|
||||
}
|
||||
this.reloadTrafficChart("hourly-traffic-chart", stats, function (args) {
|
||||
return stats[args.dataIndex].day + " " + stats[args.dataIndex].hour + "时<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadDailyTrafficChart = function () {
|
||||
let stats = this.dailyStats
|
||||
if (stats == null || stats.length == 0) {
|
||||
return
|
||||
}
|
||||
this.reloadTrafficChart("daily-traffic-chart", stats, function (args) {
|
||||
return stats[args.dataIndex].day + "<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadTrafficChart = function (chartId, stats, tooltipFunc) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
|
||||
let axis = teaweb.countAxis(stats, function (v) {
|
||||
return v.countRequests
|
||||
})
|
||||
|
||||
let chart = teaweb.initChart(chartBox)
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: stats.map(function (v) {
|
||||
if (v.hour != null) {
|
||||
return v.hour
|
||||
}
|
||||
return v.day
|
||||
})
|
||||
},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + axis.unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: tooltipFunc
|
||||
},
|
||||
grid: {
|
||||
left: 50,
|
||||
top: 10,
|
||||
right: 20,
|
||||
bottom: 20
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "请求数",
|
||||
type: "line",
|
||||
data: stats.map(function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
}),
|
||||
itemStyle: {
|
||||
color: teaweb.DefaultChartColor
|
||||
},
|
||||
areaStyle: {
|
||||
color: teaweb.DefaultChartColor
|
||||
},
|
||||
smooth: true
|
||||
}
|
||||
],
|
||||
animation: true
|
||||
}
|
||||
chart.setOption(option)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.reloadTopAppsChart = function () {
|
||||
if (this.topAppStats == null || this.topAppStats.length == 0) {
|
||||
return
|
||||
}
|
||||
let axis = teaweb.countAxis(this.topAppStats, function (v) {
|
||||
return v.countRequests
|
||||
})
|
||||
teaweb.renderBarChart({
|
||||
id: "top-apps-chart",
|
||||
name: "应用",
|
||||
values: this.topAppStats,
|
||||
x: function (v) {
|
||||
return v.appName
|
||||
},
|
||||
tooltip: function (args, stats) {
|
||||
return stats[args.dataIndex].appName + "<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
},
|
||||
value: function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
},
|
||||
axis: axis
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadTopDomainsChart = function () {
|
||||
if (this.topDomainStats == null || this.topDomainStats.length == 0) {
|
||||
return
|
||||
}
|
||||
let axis = teaweb.countAxis(this.topDomainStats, function (v) {
|
||||
return v.countRequests
|
||||
})
|
||||
teaweb.renderBarChart({
|
||||
id: "top-domains-chart",
|
||||
name: "域名",
|
||||
values: this.topDomainStats,
|
||||
x: function (v) {
|
||||
return v.domainName
|
||||
},
|
||||
tooltip: function (args, stats) {
|
||||
return stats[args.dataIndex].domainName + "<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
},
|
||||
value: function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
},
|
||||
axis: axis
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadTopNodesChart = function () {
|
||||
if (this.topNodeStats == null || this.topNodeStats.length == 0) {
|
||||
return
|
||||
}
|
||||
let axis = teaweb.countAxis(this.topNodeStats, function (v) {
|
||||
return v.countRequests
|
||||
})
|
||||
teaweb.renderBarChart({
|
||||
id: "top-nodes-chart",
|
||||
name: "节点",
|
||||
values: this.topNodeStats,
|
||||
x: function (v) {
|
||||
return v.nodeName
|
||||
},
|
||||
tooltip: function (args, stats) {
|
||||
return stats[args.dataIndex].nodeName + "<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
},
|
||||
value: function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
},
|
||||
axis: axis,
|
||||
click: function (args, stats) {
|
||||
window.location = "/httpdns/clusters/cluster/node?nodeId=" + stats[args.dataIndex].nodeId + "&clusterId=" + stats[args.dataIndex].clusterId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
@@ -53,8 +53,9 @@
|
||||
<!-- 升级提醒 -->
|
||||
<div class="ui icon message error" v-if="!isLoading && nodeUpgradeInfo.count > 0">
|
||||
<i class="icon warning circle"></i>
|
||||
<a href="/clusters">
|
||||
升级提醒:有 {{nodeUpgradeInfo.count}} 个边缘节点需要升级到 v{{nodeUpgradeInfo.version}} 版本,系统正在尝试自动升级,请耐心等待...</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
|
||||
<a href="/clusters" v-if="autoUpgrade">升级提醒:有 {{nodeUpgradeInfo.count}} 个边缘节点需要升级到 v{{nodeUpgradeInfo.version}} 版本,系统正在尝试自动升级,请耐心等待...</a>
|
||||
<a href="/settings/upgrade" v-else>升级提醒:有 {{nodeUpgradeInfo.count}} 个边缘节点需要升级到 v{{nodeUpgradeInfo.version}} 版本,请到系统设置-升级设置页面自行升级...</a>
|
||||
<a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
|
||||
</div>
|
||||
<div class="ui icon message error" v-if="!isLoading && userNodeUpgradeInfo.count > 0 && teaIsPlus">
|
||||
<i class="icon warning circle"></i>
|
||||
@@ -73,7 +74,15 @@
|
||||
|
||||
<div class="ui icon message error" v-if="!isLoading && nsNodeUpgradeInfo.count > 0 && teaIsPlus">
|
||||
<i class="icon warning circle"></i>
|
||||
<a href="/ns/clusters">升级提醒:有 {{nsNodeUpgradeInfo.count}} 个DNS节点需要升级到 v{{nsNodeUpgradeInfo.version}} 版本,系统正在尝试自动升级,请耐心等待...</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
|
||||
<a href="/ns/clusters" v-if="autoUpgrade">升级提醒:有 {{nsNodeUpgradeInfo.count}} 个DNS节点需要升级到 v{{nsNodeUpgradeInfo.version}} 版本,系统正在尝试自动升级,请耐心等待...</a>
|
||||
<a href="/settings/upgrade" v-else>升级提醒:有 {{nsNodeUpgradeInfo.count}} 个DNS节点需要升级到 v{{nsNodeUpgradeInfo.version}} 版本,请到系统设置-升级设置页面自行升级...</a>
|
||||
<a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
|
||||
</div>
|
||||
<div class="ui icon message error" v-if="!isLoading && httpdnsNodeUpgradeInfo.count > 0 && teaIsPlus">
|
||||
<i class="icon warning circle"></i>
|
||||
<a href="/httpdns/clusters" v-if="autoUpgrade">升级提醒:有 {{httpdnsNodeUpgradeInfo.count}} 个HTTPDNS节点需要升级到 v{{httpdnsNodeUpgradeInfo.version}} 版本,系统正在尝试自动升级,请耐心等待...</a>
|
||||
<a href="/settings/upgrade" v-else>升级提醒:有 {{httpdnsNodeUpgradeInfo.count}} 个HTTPDNS节点需要升级到 v{{httpdnsNodeUpgradeInfo.version}} 版本,请到系统设置-升级设置页面自行升级...</a>
|
||||
<a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
|
||||
</div>
|
||||
<div class="ui icon message error" v-if="!isLoading && reportNodeUpgradeInfo.count > 0 && teaIsPlus">
|
||||
<i class="icon warning circle"></i>
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
<!-- 边缘节点升级提醒 -->
|
||||
<div class="ui icon message error" v-if="!isLoading && nodeUpgradeInfo.count > 0">
|
||||
<i class="icon warning circle"></i>
|
||||
<a href="/clusters">升级提醒:有 {{nodeUpgradeInfo.count}} 个边缘节点需要升级到 v{{nodeUpgradeInfo.version}} 版本,系统正在尝试自动升级,请耐心等待...</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
|
||||
<a href="/clusters" v-if="autoUpgrade">升级提醒:有 {{nodeUpgradeInfo.count}} 个边缘节点需要升级到 v{{nodeUpgradeInfo.version}} 版本,系统正在尝试自动升级,请耐心等待...</a>
|
||||
<a href="/settings/upgrade" v-else>升级提醒:有 {{nodeUpgradeInfo.count}} 个边缘节点需要升级到 v{{nodeUpgradeInfo.version}} 版本,请到系统设置-升级设置页面自行升级...</a>
|
||||
<a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
|
||||
</div>
|
||||
|
||||
<!-- API节点升级提醒 -->
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
Tea.context(function () {
|
||||
this.isOn = true
|
||||
|
||||
this.syncDefaultClusterEnabled = function () {
|
||||
}
|
||||
|
||||
this.success = function (resp) {
|
||||
let clusterId = 0
|
||||
if (resp != null && resp.data != null && typeof resp.data.clusterId != "undefined") {
|
||||
|
||||
8
EdgeAdmin/web/views/@default/httpdns/index.css
Normal file
8
EdgeAdmin/web/views/@default/httpdns/index.css
Normal file
@@ -0,0 +1,8 @@
|
||||
.ui.message .icon {
|
||||
position: absolute;
|
||||
right: 1em;
|
||||
top: 1.8em;
|
||||
}
|
||||
.chart-box {
|
||||
height: 14em;
|
||||
}
|
||||
62
EdgeAdmin/web/views/@default/httpdns/index.html
Normal file
62
EdgeAdmin/web/views/@default/httpdns/index.html
Normal file
@@ -0,0 +1,62 @@
|
||||
{$layout}
|
||||
{$template "/echarts"}
|
||||
|
||||
<div style="margin-top: 0.8em" v-if="isLoading">
|
||||
<div class="ui message loading">
|
||||
<div class="ui active inline loader small"></div> 数据加载中...
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-show="!isLoading">
|
||||
<div class="ui four columns grid counter-chart">
|
||||
<div class="ui column">
|
||||
<h4>应用<link-icon href="/httpdns/apps"></link-icon></h4>
|
||||
<div class="value"><span>{{board.countApps}}</span>个</div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>域名<link-icon href="/httpdns/apps"></link-icon></h4>
|
||||
<div class="value"><span>{{board.countDomains}}</span>个</div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>集群<link-icon href="/httpdns/clusters"></link-icon></h4>
|
||||
<div class="value"><span>{{board.countClusters}}</span>个</div>
|
||||
</div>
|
||||
<div class="ui column with-border">
|
||||
<h4>节点<link-icon href="/httpdns/clusters"></link-icon></h4>
|
||||
<div class="value"><span>{{board.countNodes}}</span>
|
||||
<span v-if="board.countOfflineNodes > 0" class="red" style="font-size: 1em">{{board.countOfflineNodes}}离线</span>
|
||||
<span v-else style="font-size: 1em">个</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui four columns grid chart-grid" style="margin-top: 1em">
|
||||
<div class="ui column">
|
||||
<div class="ui menu text blue small">
|
||||
<a href="" class="item" :class="{active: trafficTab == 'hourly'}" @click.prevent="selectTrafficTab('hourly')">24小时请求趋势</a>
|
||||
<a href="" class="item" :class="{active: trafficTab == 'daily'}" @click.prevent="selectTrafficTab('daily')">15天请求趋势</a>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
<div class="chart-box" id="hourly-traffic-chart" v-show="trafficTab == 'hourly'"></div>
|
||||
<div class="chart-box" id="daily-traffic-chart" v-show="trafficTab == 'daily'"></div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<h4>应用请求排行 <span>(24小时)</span></h4>
|
||||
<div class="ui divider"></div>
|
||||
<div class="chart-box" id="top-apps-chart"></div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<h4>域名请求排行 <span>(24小时)</span></h4>
|
||||
<div class="ui divider"></div>
|
||||
<div class="chart-box" id="top-domains-chart"></div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<h4>节点访问排行 <span>(24小时)</span></h4>
|
||||
<div class="ui divider"></div>
|
||||
<div class="chart-box" id="top-nodes-chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
191
EdgeAdmin/web/views/@default/httpdns/index.js
Normal file
191
EdgeAdmin/web/views/@default/httpdns/index.js
Normal file
@@ -0,0 +1,191 @@
|
||||
Tea.context(function () {
|
||||
this.isLoading = true
|
||||
|
||||
this.$delay(function () {
|
||||
this.$post("$")
|
||||
.success(function (resp) {
|
||||
for (let k in resp.data) {
|
||||
this[k] = resp.data[k]
|
||||
}
|
||||
|
||||
this.$delay(function () {
|
||||
this.reloadHourlyTrafficChart()
|
||||
this.reloadTopAppsChart()
|
||||
this.reloadTopDomainsChart()
|
||||
this.reloadTopNodesChart()
|
||||
})
|
||||
|
||||
this.isLoading = false
|
||||
})
|
||||
})
|
||||
|
||||
this.trafficTab = "hourly"
|
||||
|
||||
this.selectTrafficTab = function (tab) {
|
||||
this.trafficTab = tab
|
||||
if (tab == "hourly") {
|
||||
this.$delay(function () {
|
||||
this.reloadHourlyTrafficChart()
|
||||
})
|
||||
} else if (tab == "daily") {
|
||||
this.$delay(function () {
|
||||
this.reloadDailyTrafficChart()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.reloadHourlyTrafficChart = function () {
|
||||
let stats = this.hourlyStats
|
||||
if (stats == null || stats.length == 0) {
|
||||
return
|
||||
}
|
||||
this.reloadTrafficChart("hourly-traffic-chart", stats, function (args) {
|
||||
return stats[args.dataIndex].day + " " + stats[args.dataIndex].hour + "时<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadDailyTrafficChart = function () {
|
||||
let stats = this.dailyStats
|
||||
if (stats == null || stats.length == 0) {
|
||||
return
|
||||
}
|
||||
this.reloadTrafficChart("daily-traffic-chart", stats, function (args) {
|
||||
return stats[args.dataIndex].day + "<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadTrafficChart = function (chartId, stats, tooltipFunc) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
|
||||
let axis = teaweb.countAxis(stats, function (v) {
|
||||
return v.countRequests
|
||||
})
|
||||
|
||||
let chart = teaweb.initChart(chartBox)
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: stats.map(function (v) {
|
||||
if (v.hour != null) {
|
||||
return v.hour
|
||||
}
|
||||
return v.day
|
||||
})
|
||||
},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + axis.unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: tooltipFunc
|
||||
},
|
||||
grid: {
|
||||
left: 50,
|
||||
top: 10,
|
||||
right: 20,
|
||||
bottom: 20
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "请求数",
|
||||
type: "line",
|
||||
data: stats.map(function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
}),
|
||||
itemStyle: {
|
||||
color: teaweb.DefaultChartColor
|
||||
},
|
||||
areaStyle: {
|
||||
color: teaweb.DefaultChartColor
|
||||
},
|
||||
smooth: true
|
||||
}
|
||||
],
|
||||
animation: true
|
||||
}
|
||||
chart.setOption(option)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.reloadTopAppsChart = function () {
|
||||
if (this.topAppStats == null || this.topAppStats.length == 0) {
|
||||
return
|
||||
}
|
||||
let axis = teaweb.countAxis(this.topAppStats, function (v) {
|
||||
return v.countRequests
|
||||
})
|
||||
teaweb.renderBarChart({
|
||||
id: "top-apps-chart",
|
||||
name: "应用",
|
||||
values: this.topAppStats,
|
||||
x: function (v) {
|
||||
return v.appName
|
||||
},
|
||||
tooltip: function (args, stats) {
|
||||
return stats[args.dataIndex].appName + "<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
},
|
||||
value: function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
},
|
||||
axis: axis
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadTopDomainsChart = function () {
|
||||
if (this.topDomainStats == null || this.topDomainStats.length == 0) {
|
||||
return
|
||||
}
|
||||
let axis = teaweb.countAxis(this.topDomainStats, function (v) {
|
||||
return v.countRequests
|
||||
})
|
||||
teaweb.renderBarChart({
|
||||
id: "top-domains-chart",
|
||||
name: "域名",
|
||||
values: this.topDomainStats,
|
||||
x: function (v) {
|
||||
return v.domainName
|
||||
},
|
||||
tooltip: function (args, stats) {
|
||||
return stats[args.dataIndex].domainName + "<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
},
|
||||
value: function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
},
|
||||
axis: axis
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadTopNodesChart = function () {
|
||||
if (this.topNodeStats == null || this.topNodeStats.length == 0) {
|
||||
return
|
||||
}
|
||||
let axis = teaweb.countAxis(this.topNodeStats, function (v) {
|
||||
return v.countRequests
|
||||
})
|
||||
teaweb.renderBarChart({
|
||||
id: "top-nodes-chart",
|
||||
name: "节点",
|
||||
values: this.topNodeStats,
|
||||
x: function (v) {
|
||||
return v.nodeName
|
||||
},
|
||||
tooltip: function (args, stats) {
|
||||
return stats[args.dataIndex].nodeName + "<br/>请求数:" + teaweb.formatNumber(stats[args.dataIndex].countRequests)
|
||||
},
|
||||
value: function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
},
|
||||
axis: axis,
|
||||
click: function (args, stats) {
|
||||
window.location = "/httpdns/clusters/cluster/node?nodeId=" + stats[args.dataIndex].nodeId + "&clusterId=" + stats[args.dataIndex].clusterId
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -124,6 +124,27 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<!-- TypeE -->
|
||||
<tbody v-show="type == 'typeE'">
|
||||
<tr>
|
||||
<td>鉴权密钥 *</td>
|
||||
<td>
|
||||
<input type="text" maxlength="40" name="typeESecret" v-model="typeESecret" autocomplete="off"/>
|
||||
<p class="comment">只能包含字母、数字,长度不超过40。<a href="" @click.prevent="generateTypeESecret()">[随机生成]</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>有效时间</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" maxlength="8" name="typeELife" value="30" style="width: 7em"/>
|
||||
<span class="ui label">秒</span>
|
||||
</div>
|
||||
<p class="comment">URL 格式:<code-label>/hash/timestamp/path</code-label>;签名算法:<code-label>md5(secret + uri + timestamp)</code-label>;timestamp 为十六进制 Unix 秒数。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<!-- BasicAuth -->
|
||||
<tbody v-show="type == 'basicAuth'">
|
||||
<tr>
|
||||
@@ -138,7 +159,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="moreBasicAuthOptionsVisible">
|
||||
<td>认证领域名<em>(Realm)</em></td>
|
||||
<td>认证领域名 <em>(Realm)</em></td>
|
||||
<td>
|
||||
<input type="text" name="basicAuthRealm" value="" maxlength="100"/>
|
||||
</td>
|
||||
@@ -147,7 +168,7 @@
|
||||
<td>字符集</td>
|
||||
<td>
|
||||
<input type="text" name="basicAuthCharset" style="width: 6em" maxlength="50"/>
|
||||
<p class="comment">类似于<code-label>UTF-8</code-label>。</p>
|
||||
<p class="comment">类似于 <code-label>UTF-8</code-label>。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -186,7 +207,7 @@
|
||||
<td>限定文件扩展名</td>
|
||||
<td>
|
||||
<values-box name="exts"></values-box>
|
||||
<p class="comment">如果不为空,则表示只有这些扩展名的文件才需要鉴权;扩展名需要包含点符号(.),比如<code-label>.png</code-label></p>
|
||||
<p class="comment">如果不为空,则表示只有这些扩展名的文件才需要鉴权;扩展名需要包含点符号,比如 <code-label>.png</code-label></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -200,4 +221,4 @@
|
||||
</table>
|
||||
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
@@ -84,6 +84,18 @@ Tea.context(function () {
|
||||
this.authDescription = this.authDescription.replace("t=", this.typeDTimestampParamName + "=")
|
||||
}
|
||||
|
||||
/**
|
||||
* TypeE
|
||||
*/
|
||||
this.typeESecret = ""
|
||||
|
||||
this.generateTypeESecret = function () {
|
||||
this.$post(".random")
|
||||
.success(function (resp) {
|
||||
this.typeESecret = resp.data.random
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 基本认证
|
||||
*/
|
||||
@@ -97,4 +109,4 @@ Tea.context(function () {
|
||||
* 子请求
|
||||
*/
|
||||
this.subRequestFollowRequest = 1
|
||||
})
|
||||
})
|
||||
|
||||
@@ -122,6 +122,27 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<!-- TypeE -->
|
||||
<tbody v-show="type == 'typeE'">
|
||||
<tr>
|
||||
<td>鉴权密钥 *</td>
|
||||
<td>
|
||||
<input type="text" maxlength="40" name="typeESecret" v-model="typeESecret" autocomplete="off"/>
|
||||
<p class="comment">只能包含字母、数字,长度不超过40。<a href="" @click.prevent="generateTypeESecret()">[随机生成]</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>有效时间</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" maxlength="8" name="typeELife" value="30" style="width: 7em" v-model="policy.params.life"/>
|
||||
<span class="ui label">秒</span>
|
||||
</div>
|
||||
<p class="comment">URL 格式:<code-label>/hash/timestamp/path</code-label>;签名算法:<code-label>md5(secret + uri + timestamp)</code-label>;timestamp 为十六进制 Unix 秒数。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<!-- BasicAuth -->
|
||||
<tbody v-show="type == 'basicAuth'">
|
||||
<tr>
|
||||
@@ -136,7 +157,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="moreBasicAuthOptionsVisible">
|
||||
<td>认证领域名<em>(Realm)</em></td>
|
||||
<td>认证领域名 <em>(Realm)</em></td>
|
||||
<td>
|
||||
<input type="text" name="basicAuthRealm" value="" maxlength="100" v-model="policy.params.realm"/>
|
||||
</td>
|
||||
@@ -145,7 +166,7 @@
|
||||
<td>字符集</td>
|
||||
<td>
|
||||
<input type="text" name="basicAuthCharset" style="width: 6em" v-model="policy.params.charset" maxlength="50"/>
|
||||
<p class="comment">类似于<code-label>utf-8</code-label>。</p>
|
||||
<p class="comment">类似于 <code-label>utf-8</code-label>。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -185,7 +206,7 @@
|
||||
<td>限定文件扩展名</td>
|
||||
<td>
|
||||
<values-box name="exts" :v-values="policy.params.exts"></values-box>
|
||||
<p class="comment">如果不为空,则表示只有这些扩展名的文件才需要鉴权;扩展名需要包含点符号(.),比如<code-label>.png</code-label></p>
|
||||
<p class="comment">如果不为空,则表示只有这些扩展名的文件才需要鉴权;扩展名需要包含点符号,比如 <code-label>.png</code-label></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -203,4 +224,4 @@
|
||||
</table>
|
||||
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
@@ -115,6 +115,22 @@ Tea.context(function () {
|
||||
this.authDescription = this.authDescription.replace("t=", this.typeDTimestampParamName + "=")
|
||||
}
|
||||
|
||||
/**
|
||||
* TypeE
|
||||
*/
|
||||
this.typeESecret = ""
|
||||
|
||||
if (this.policy.type == "typeE") {
|
||||
this.typeESecret = this.policy.params.secret
|
||||
}
|
||||
|
||||
this.generateTypeESecret = function () {
|
||||
this.$post(".random")
|
||||
.success(function (resp) {
|
||||
this.typeESecret = resp.data.random
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 基本鉴权
|
||||
*/
|
||||
@@ -128,4 +144,4 @@ Tea.context(function () {
|
||||
* 子请求
|
||||
*/
|
||||
this.subRequestFollowRequest = (this.policy.params.method != null && this.policy.params.method.length > 0) ? 0 : 1
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user