2020-08-21 12:32:16 +08:00
|
|
|
package delete
|
|
|
|
|
|
2020-09-13 20:37:07 +08:00
|
|
|
import (
|
2020-11-17 15:41:43 +08:00
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
2020-09-13 20:37:07 +08:00
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
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
|
|
|
// 记录日志
|
2020-11-20 15:32:42 +08:00
|
|
|
defer this.CreateLog(oplogs.LevelInfo, "删除代理服务 %d", params.ServerId)
|
2020-11-17 15:41:43 +08:00
|
|
|
|
|
|
|
|
// 执行删除
|
2020-09-13 20:37:07 +08:00
|
|
|
_, err := this.RPC().ServerRPC().DisableServer(this.AdminContext(), &pb.DisableServerRequest{ServerId: params.ServerId})
|
|
|
|
|
if err != nil {
|
|
|
|
|
this.ErrorPage(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.Success()
|
|
|
|
|
}
|