Files
EdgeAdmin/internal/web/actions/default/servers/server/delete/index.go
2023-08-08 18:32:58 +08:00

38 lines
828 B
Go

package deletes
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
)
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "delete", "")
this.SecondMenu("index")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}
func (this *IndexAction) RunPost(params struct {
ServerId int64
Must *actions.Must
}) {
// 记录日志
defer this.CreateLogInfo(codes.Server_LogDeleteServer, params.ServerId)
// 执行删除
_, err := this.RPC().ServerRPC().DeleteServer(this.AdminContext(), &pb.DeleteServerRequest{ServerId: params.ServerId})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}