前端页面
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package clusters
|
||||
|
||||
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 CertsAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *CertsAction) Init() {
|
||||
this.Nav("httpdns", "cluster", "certs")
|
||||
}
|
||||
|
||||
func (this *CertsAction) RunGet(params struct{}) {
|
||||
httpdnsutils.AddLeftMenu(this.Parent())
|
||||
this.Data["certs"] = policies.LoadPublicSNICertificates()
|
||||
this.Show()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package clusters
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
type CheckPortsAction struct { actionutils.ParentAction }
|
||||
func (this *CheckPortsAction) RunPost(params struct{ NodeId int64 }) {
|
||||
this.Data["results"] = []maps.Map{}
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package clusters
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
|
||||
)
|
||||
|
||||
type ClusterAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *ClusterAction) Init() {
|
||||
this.Nav("httpdns", "cluster", "index")
|
||||
}
|
||||
|
||||
func (this *ClusterAction) RunGet(params struct {
|
||||
ClusterId int64
|
||||
InstalledState int
|
||||
ActiveState int
|
||||
Keyword string
|
||||
}) {
|
||||
httpdnsutils.AddLeftMenu(this.Parent())
|
||||
cluster := pickCluster(params.ClusterId)
|
||||
this.Data["clusterId"] = params.ClusterId
|
||||
this.Data["cluster"] = cluster
|
||||
this.Data["installState"] = params.InstalledState
|
||||
this.Data["activeState"] = params.ActiveState
|
||||
this.Data["keyword"] = params.Keyword
|
||||
nodes := mockNodes(params.ClusterId, params.InstalledState, params.ActiveState, params.Keyword)
|
||||
this.Data["nodes"] = nodes
|
||||
this.Data["hasNodes"] = len(nodes) > 0
|
||||
this.Data["page"] = ""
|
||||
this.Show()
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type IndexAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *IndexAction) Init() {
|
||||
this.Nav("", "node", "node")
|
||||
this.SecondMenu("nodes")
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunGet(params struct {
|
||||
ClusterId int64
|
||||
NodeId int64
|
||||
}) {
|
||||
this.Data["clusterId"] = params.ClusterId
|
||||
this.Data["nodeId"] = params.NodeId
|
||||
this.Data["currentCluster"] = maps.Map{"id": params.ClusterId, "name": "Mock Cluster"}
|
||||
|
||||
this.Data["nodeDatetime"] = "2026-02-22 12:00:00"
|
||||
this.Data["nodeTimeDiff"] = 0
|
||||
this.Data["shouldUpgrade"] = false
|
||||
this.Data["newVersion"] = ""
|
||||
|
||||
this.Data["node"] = maps.Map{
|
||||
"id": params.NodeId,
|
||||
"name": "Mock HTTPDNS Node",
|
||||
"ipAddresses": []maps.Map{{"ip": "100.200.100.200", "name": "Public IP", "canAccess": true, "isOn": true, "isUp": true}},
|
||||
"cluster": maps.Map{"id": params.ClusterId, "name": "Mock Cluster", "installDir": "/opt/edge-httpdns"},
|
||||
"installDir": "/opt/edge-httpdns",
|
||||
"isInstalled": true,
|
||||
"uniqueId": "m-1234567890",
|
||||
"secret": "mock-secret-key",
|
||||
"isOn": true,
|
||||
"isUp": true,
|
||||
"apiNodeAddrs": []string{"192.168.1.100:8001"},
|
||||
"login": nil,
|
||||
|
||||
"status": maps.Map{
|
||||
"isActive": true,
|
||||
"updatedAt": 1670000000,
|
||||
"hostname": "node-01.local",
|
||||
"cpuUsage": 0.15,
|
||||
"cpuUsageText": "15.00%",
|
||||
"memUsage": 0.45,
|
||||
"memUsageText": "45.00%",
|
||||
"connectionCount": 100,
|
||||
"buildVersion": "1.0.0",
|
||||
"cpuPhysicalCount": 4,
|
||||
"cpuLogicalCount": 8,
|
||||
"load1m": "0.50",
|
||||
"load5m": "0.60",
|
||||
"load15m": "0.70",
|
||||
"cacheTotalDiskSize": "10G",
|
||||
"cacheTotalMemorySize": "2G",
|
||||
"exePath": "/opt/edge-httpdns/bin/edge-httpdns",
|
||||
"apiSuccessPercent": 100.0,
|
||||
"apiAvgCostSeconds": 0.05,
|
||||
},
|
||||
}
|
||||
|
||||
this.Show()
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type InstallAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *InstallAction) Init() {
|
||||
this.Nav("", "node", "install")
|
||||
this.SecondMenu("nodes")
|
||||
}
|
||||
|
||||
func (this *InstallAction) RunGet(params struct{ ClusterId int64; NodeId int64 }) {
|
||||
this.Data["clusterId"] = params.ClusterId
|
||||
this.Data["nodeId"] = params.NodeId
|
||||
this.Data["currentCluster"] = maps.Map{"id": params.ClusterId, "name": "Mock Cluster"}
|
||||
|
||||
this.Data["apiEndpoints"] = "\"http://127.0.0.1:7788\""
|
||||
this.Data["sshAddr"] = "192.168.1.100:22"
|
||||
|
||||
this.Data["node"] = maps.Map{
|
||||
"id": params.NodeId,
|
||||
"name": "Mock Node",
|
||||
"isInstalled": false,
|
||||
"uniqueId": "m-1234567890",
|
||||
"secret": "mock-secret-key",
|
||||
"installDir": "/opt/edge-httpdns",
|
||||
"cluster": maps.Map{"installDir": "/opt/edge-httpdns"},
|
||||
}
|
||||
this.Data["installStatus"] = nil
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *InstallAction) RunPost(params struct{ NodeId int64 }) {
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type LogsAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *LogsAction) Init() {
|
||||
this.Nav("", "node", "log")
|
||||
this.SecondMenu("nodes")
|
||||
}
|
||||
|
||||
func (this *LogsAction) RunGet(params struct{ ClusterId int64; NodeId int64 }) {
|
||||
this.Data["clusterId"] = params.ClusterId
|
||||
this.Data["nodeId"] = params.NodeId
|
||||
this.Data["currentCluster"] = maps.Map{"id": params.ClusterId, "name": "Mock Cluster"}
|
||||
|
||||
this.Data["dayFrom"] = ""
|
||||
this.Data["dayTo"] = ""
|
||||
this.Data["keyword"] = ""
|
||||
this.Data["level"] = ""
|
||||
this.Data["logs"] = []maps.Map{}
|
||||
this.Data["page"] = ""
|
||||
this.Data["node"] = maps.Map{"id": params.NodeId, "name": "Mock Node"}
|
||||
|
||||
this.Show()
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
)
|
||||
|
||||
type StartAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *StartAction) RunPost(params struct{ NodeId int64 }) {
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type StatusAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *StatusAction) Init() {
|
||||
this.Nav("", "node", "status")
|
||||
this.SecondMenu("nodes")
|
||||
}
|
||||
|
||||
func (this *StatusAction) RunPost(params struct{ NodeId int64 }) {
|
||||
this.Data["installStatus"] = maps.Map{
|
||||
"isRunning": false,
|
||||
"isFinished": true,
|
||||
"isOk": true,
|
||||
"error": "",
|
||||
"errorCode": "",
|
||||
}
|
||||
this.Data["isInstalled"] = true
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
)
|
||||
|
||||
type StopAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *StopAction) RunPost(params struct{ NodeId int64 }) {
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type UpdateAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *UpdateAction) Init() {
|
||||
this.Nav("", "node", "update")
|
||||
this.SecondMenu("nodes")
|
||||
}
|
||||
|
||||
func (this *UpdateAction) RunGet(params struct{ ClusterId int64; NodeId int64 }) {
|
||||
this.Data["clusterId"] = params.ClusterId
|
||||
this.Data["nodeId"] = params.NodeId
|
||||
this.Data["currentCluster"] = maps.Map{"id": params.ClusterId, "name": "Mock Cluster"}
|
||||
|
||||
this.Data["clusters"] = []maps.Map{{"id": params.ClusterId, "name": "Mock Cluster"}}
|
||||
this.Data["loginId"] = 0
|
||||
this.Data["sshHost"] = "192.168.1.100"
|
||||
this.Data["sshPort"] = 22
|
||||
this.Data["grant"] = nil
|
||||
this.Data["apiNodeAddrs"] = []string{}
|
||||
|
||||
this.Data["node"] = maps.Map{
|
||||
"id": params.NodeId,
|
||||
"name": "Mock Node",
|
||||
"isOn": true,
|
||||
"ipAddresses": []maps.Map{},
|
||||
}
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *UpdateAction) RunPost(params struct{ NodeId int64 }) {
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
)
|
||||
|
||||
type UpdateInstallStatusAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *UpdateInstallStatusAction) RunPost(params struct{ NodeId int64 }) {
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package clusters
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
|
||||
)
|
||||
|
||||
type ClusterSettingsAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *ClusterSettingsAction) Init() {
|
||||
this.Nav("httpdns", "cluster", "settings")
|
||||
}
|
||||
|
||||
func (this *ClusterSettingsAction) RunGet(params struct {
|
||||
ClusterId int64
|
||||
}) {
|
||||
httpdnsutils.AddLeftMenu(this.Parent())
|
||||
cluster := pickCluster(params.ClusterId)
|
||||
installDir := cluster.GetString("installDir")
|
||||
if len(installDir) == 0 {
|
||||
installDir = "/opt/edge-httpdns"
|
||||
}
|
||||
this.Data["cluster"] = cluster
|
||||
this.Data["settings"] = map[string]interface{}{
|
||||
"region": cluster.GetString("region"),
|
||||
"gatewayDomain": cluster.GetString("gatewayDomain"),
|
||||
"cacheTtl": cluster.GetInt("cacheTtl"),
|
||||
"fallbackTimeout": cluster.GetInt("fallbackTimeout"),
|
||||
"installDir": installDir,
|
||||
"isOn": cluster.GetBool("isOn"),
|
||||
}
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *ClusterSettingsAction) RunPost(params struct {
|
||||
ClusterId int64
|
||||
Name string
|
||||
Region string
|
||||
GatewayDomain string
|
||||
CacheTtl int32
|
||||
FallbackTimeout int32
|
||||
InstallDir string
|
||||
IsOn bool
|
||||
}) {
|
||||
// Mock successful save
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package clusters
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
|
||||
)
|
||||
|
||||
type CreateAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *CreateAction) Init() {
|
||||
this.Nav("httpdns", "cluster", "")
|
||||
}
|
||||
|
||||
func (this *CreateAction) RunGet(params struct{}) {
|
||||
httpdnsutils.AddLeftMenu(this.Parent())
|
||||
this.Show()
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package clusters
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type CreateNodeAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *CreateNodeAction) Init() {
|
||||
this.Nav("", "node", "createNode")
|
||||
this.SecondMenu("nodes")
|
||||
}
|
||||
|
||||
func (this *CreateNodeAction) RunGet(params struct{ ClusterId int64 }) {
|
||||
httpdnsutils.AddLeftMenu(this.Parent())
|
||||
this.Data["clusterId"] = params.ClusterId
|
||||
this.Data["cluster"] = maps.Map{"id": params.ClusterId, "name": "Mock Cluster"}
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *CreateNodeAction) RunPost(params struct {
|
||||
ClusterId int64
|
||||
Name string
|
||||
}) {
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package clusters
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
|
||||
)
|
||||
|
||||
type DeleteAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *DeleteAction) Init() {
|
||||
this.Nav("httpdns", "cluster", "delete")
|
||||
}
|
||||
|
||||
func (this *DeleteAction) RunGet(params struct {
|
||||
ClusterId int64
|
||||
}) {
|
||||
httpdnsutils.AddLeftMenu(this.Parent())
|
||||
cluster := pickCluster(params.ClusterId)
|
||||
this.Data["cluster"] = cluster
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *DeleteAction) RunPost(params struct {
|
||||
ClusterId int64
|
||||
}) {
|
||||
_ = params.ClusterId
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package clusters
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
)
|
||||
type DeleteNodeAction struct { actionutils.ParentAction }
|
||||
func (this *DeleteNodeAction) RunPost(params struct{ ClusterId int64; NodeId int64 }) { this.Success() }
|
||||
@@ -0,0 +1,20 @@
|
||||
package clusters
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
|
||||
)
|
||||
|
||||
type IndexAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *IndexAction) Init() {
|
||||
this.Nav("httpdns", "cluster", "")
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunGet(params struct{}) {
|
||||
httpdnsutils.AddLeftMenu(this.Parent())
|
||||
this.Data["clusters"] = mockClusters()
|
||||
this.Show()
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package clusters
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/clusters/cluster/node"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||
"github.com/iwind/TeaGo"
|
||||
)
|
||||
|
||||
func init() {
|
||||
TeaGo.BeforeStart(func(server *TeaGo.Server) {
|
||||
server.
|
||||
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeHttpDNS)).
|
||||
Data("teaMenu", "httpdns").
|
||||
Data("teaSubMenu", "cluster").
|
||||
Prefix("/httpdns/clusters").
|
||||
Get("", new(IndexAction)).
|
||||
Get("/create", new(CreateAction)).
|
||||
Get("/cluster", new(ClusterAction)).
|
||||
GetPost("/cluster/settings", new(ClusterSettingsAction)).
|
||||
GetPost("/delete", new(DeleteAction)).
|
||||
// Node level
|
||||
GetPost("/createNode", new(CreateNodeAction)).
|
||||
Post("/deleteNode", new(DeleteNodeAction)).
|
||||
Get("/upgradeRemote", new(UpgradeRemoteAction)).
|
||||
GetPost("/updateNodeSSH", new(UpdateNodeSSHAction)).
|
||||
Post("/checkPorts", new(CheckPortsAction)).
|
||||
|
||||
// Node internal pages
|
||||
Prefix("/httpdns/clusters/cluster/node").
|
||||
Get("", new(node.IndexAction)).
|
||||
Get("/logs", new(node.LogsAction)).
|
||||
GetPost("/update", new(node.UpdateAction)).
|
||||
GetPost("/install", new(node.InstallAction)).
|
||||
Post("/status", new(node.StatusAction)).
|
||||
Post("/updateInstallStatus", new(node.UpdateInstallStatusAction)).
|
||||
Post("/start", new(node.StartAction)).
|
||||
Post("/stop", new(node.StopAction)).
|
||||
EndAll()
|
||||
})
|
||||
}
|
||||
126
EdgeAdmin/internal/web/actions/default/httpdns/clusters/mock.go
Normal file
126
EdgeAdmin/internal/web/actions/default/httpdns/clusters/mock.go
Normal file
@@ -0,0 +1,126 @@
|
||||
package clusters
|
||||
|
||||
import "github.com/iwind/TeaGo/maps"
|
||||
|
||||
func mockClusters() []maps.Map {
|
||||
return []maps.Map{
|
||||
{
|
||||
"id": int64(1),
|
||||
"name": "gateway-cn-hz",
|
||||
"region": "cn-hangzhou",
|
||||
"gatewayDomain": "gw-hz.httpdns.example.com",
|
||||
"installDir": "/opt/edge-httpdns",
|
||||
"countAllNodes": 3,
|
||||
"countActiveNodes": 3,
|
||||
"countApps": 5,
|
||||
"cacheTtl": 30,
|
||||
"fallbackTimeout": 300,
|
||||
"isOn": true,
|
||||
},
|
||||
{
|
||||
"id": int64(2),
|
||||
"name": "gateway-cn-bj",
|
||||
"region": "cn-beijing",
|
||||
"gatewayDomain": "gw-bj.httpdns.example.com",
|
||||
"installDir": "/opt/edge-httpdns",
|
||||
"countAllNodes": 3,
|
||||
"countActiveNodes": 2,
|
||||
"countApps": 2,
|
||||
"cacheTtl": 30,
|
||||
"fallbackTimeout": 300,
|
||||
"isOn": true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func pickCluster(clusterId int64) maps.Map {
|
||||
clusters := mockClusters()
|
||||
if clusterId <= 0 {
|
||||
return clusters[0]
|
||||
}
|
||||
for _, c := range clusters {
|
||||
if c.GetInt64("id") == clusterId {
|
||||
return c
|
||||
}
|
||||
}
|
||||
return clusters[0]
|
||||
}
|
||||
|
||||
func mockNodes(clusterId int64, installState int, activeState int, keyword string) []maps.Map {
|
||||
_ = clusterId
|
||||
return []maps.Map{
|
||||
{
|
||||
"id": int64(101),
|
||||
"name": "45.250.184.56",
|
||||
"isInstalled": true,
|
||||
"isOn": true,
|
||||
"isUp": true,
|
||||
"installStatus": maps.Map{
|
||||
"isRunning": false,
|
||||
"isFinished": true,
|
||||
"isOk": true,
|
||||
"error": "",
|
||||
},
|
||||
"status": maps.Map{
|
||||
"isActive": true,
|
||||
"updatedAt": 1700000000,
|
||||
"hostname": "node-01",
|
||||
"cpuUsage": 0.0253,
|
||||
"cpuUsageText": "2.53%",
|
||||
"memUsage": 0.5972,
|
||||
"memUsageText": "59.72%",
|
||||
"load1m": 0.02,
|
||||
},
|
||||
"ipAddresses": []maps.Map{
|
||||
{
|
||||
"id": 1,
|
||||
"name": "",
|
||||
"ip": "45.250.184.56",
|
||||
"canAccess": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"id": int64(102),
|
||||
"name": "45.250.184.53",
|
||||
"isInstalled": true,
|
||||
"isOn": true,
|
||||
"isUp": true,
|
||||
"installStatus": maps.Map{
|
||||
"isRunning": false,
|
||||
"isFinished": true,
|
||||
"isOk": true,
|
||||
"error": "",
|
||||
},
|
||||
"status": maps.Map{
|
||||
"isActive": true,
|
||||
"updatedAt": 1700000000,
|
||||
"hostname": "node-02",
|
||||
"cpuUsage": 0.0039,
|
||||
"cpuUsageText": "0.39%",
|
||||
"memUsage": 0.0355,
|
||||
"memUsageText": "3.55%",
|
||||
"load1m": 0.0,
|
||||
},
|
||||
"ipAddresses": []maps.Map{
|
||||
{
|
||||
"id": 2,
|
||||
"name": "",
|
||||
"ip": "45.250.184.53",
|
||||
"canAccess": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func mockCerts() []maps.Map {
|
||||
return []maps.Map{
|
||||
{
|
||||
"id": int64(11),
|
||||
"domain": "resolve.edge.example.com",
|
||||
"issuer": "Mock CA",
|
||||
"expiresAt": "2026-12-31 23:59:59",
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package clusters
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type UpdateNodeSSHAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *UpdateNodeSSHAction) RunGet(params struct {
|
||||
NodeId int64
|
||||
}) {
|
||||
this.Data["nodeId"] = params.NodeId
|
||||
this.Data["clusterId"] = 0
|
||||
this.Data["node"] = maps.Map{
|
||||
"id": params.NodeId,
|
||||
"name": "Mock Node",
|
||||
}
|
||||
this.Data["loginId"] = 0
|
||||
this.Data["params"] = maps.Map{
|
||||
"host": "1.2.3.4",
|
||||
"port": 22,
|
||||
"grantId": 0,
|
||||
}
|
||||
this.Data["grant"] = nil
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *UpdateNodeSSHAction) RunPost(params struct {
|
||||
NodeId int64
|
||||
LoginId int64
|
||||
SshHost string
|
||||
SshPort int
|
||||
GrantId int64
|
||||
}) {
|
||||
this.Success()
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package clusters
|
||||
|
||||
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
|
||||
type UpgradeRemoteAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *UpgradeRemoteAction) RunGet(params struct {
|
||||
NodeId int64
|
||||
ClusterId int64
|
||||
}) {
|
||||
this.Data["nodeId"] = params.NodeId
|
||||
this.Data["clusterId"] = params.ClusterId
|
||||
this.Show()
|
||||
}
|
||||
Reference in New Issue
Block a user