mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-10 01:10:29 +08:00
[网站域名]在列表中可以查看网站域名列表,并可以筛选
This commit is contained in:
46
internal/web/actions/default/servers/serverNamesPopup.go
Normal file
46
internal/web/actions/default/servers/serverNamesPopup.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package servers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
)
|
||||
|
||||
type ServerNamesPopupAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *ServerNamesPopupAction) Init() {
|
||||
this.Nav("", "", "")
|
||||
}
|
||||
|
||||
func (this *ServerNamesPopupAction) RunGet(params struct {
|
||||
ServerId int64
|
||||
}) {
|
||||
serverNamesResp, err := this.RPC().ServerRPC().FindServerNames(this.AdminContext(), &pb.FindServerNamesRequest{ServerId: params.ServerId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
serverNames := []*serverconfigs.ServerNameConfig{}
|
||||
if len(serverNamesResp.ServerNamesJSON) > 0 {
|
||||
err = json.Unmarshal(serverNamesResp.ServerNamesJSON, &serverNames)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
result := []string{}
|
||||
for _, serverName := range serverNames {
|
||||
if len(serverName.SubNames) == 0 {
|
||||
result = append(result, serverName.Name)
|
||||
} else {
|
||||
result = append(result, serverName.SubNames...)
|
||||
}
|
||||
}
|
||||
this.Data["serverNames"] = result
|
||||
|
||||
this.Show()
|
||||
}
|
||||
Reference in New Issue
Block a user