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"
|
2020-11-17 15:41:43 +08:00
|
|
|
"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
|
|
|
|
|
}) {
|
2020-11-17 15:41:43 +08:00
|
|
|
// 记录日志
|
2023-06-30 18:08:30 +08:00
|
|
|
defer this.CreateLogInfo(codes.Server_LogDeleteServer, params.ServerId)
|
2020-11-17 15:41:43 +08:00
|
|
|
|
|
|
|
|
// 执行删除
|
2020-12-19 19:08:39 +08:00
|
|
|
_, 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()
|
|
|
|
|
}
|