Files
EdgeAdmin/internal/web/actions/default/servers/server/delete/index.go

38 lines
828 B
Go
Raw Normal View History

2023-08-08 18:32:58 +08:00
package deletes
2020-08-21 12:32:16 +08:00
2023-06-30 18:08:30 +08:00
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
2020-09-13 20:37:07 +08:00
"github.com/iwind/TeaGo/actions"
)
2020-08-21 12:32:16 +08:00
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "delete", "")
2020-08-21 21:09:42 +08:00
this.SecondMenu("index")
2020-08-21 12:32:16 +08:00
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}
2020-09-13 20:37:07 +08:00
func (this *IndexAction) RunPost(params struct {
ServerId int64
Must *actions.Must
}) {
// 记录日志
2023-06-30 18:08:30 +08:00
defer this.CreateLogInfo(codes.Server_LogDeleteServer, params.ServerId)
// 执行删除
_, err := this.RPC().ServerRPC().DeleteServer(this.AdminContext(), &pb.DeleteServerRequest{ServerId: params.ServerId})
2020-09-13 20:37:07 +08:00
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}