49 lines
1.0 KiB
Go
49 lines
1.0 KiB
Go
package apps
|
|
|
|
import (
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/httpdns/httpdnsutils"
|
|
)
|
|
|
|
type DeleteAction struct {
|
|
actionutils.ParentAction
|
|
}
|
|
|
|
func (this *DeleteAction) Init() {
|
|
this.Nav("httpdns", "app", "delete")
|
|
}
|
|
|
|
func (this *DeleteAction) RunGet(params struct {
|
|
AppId int64
|
|
}) {
|
|
httpdnsutils.AddLeftMenu(this.Parent())
|
|
app, err := findAppMap(this.Parent(), params.AppId)
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
httpdnsutils.AddAppTabbar(this.Parent(), app.GetString("name"), app.GetInt64("id"), "delete")
|
|
this.Data["app"] = app
|
|
domains, err := listDomainMaps(this.Parent(), app.GetInt64("id"), "")
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
this.Data["domainCount"] = len(domains)
|
|
this.Show()
|
|
}
|
|
|
|
func (this *DeleteAction) RunPost(params struct {
|
|
AppId int64
|
|
}) {
|
|
if params.AppId > 0 {
|
|
err := deleteAppByID(this.Parent(), params.AppId)
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
}
|
|
|
|
this.Success()
|
|
}
|