1.4.5.2
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
//go:build plus
|
||||
|
||||
package scripts
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type ScriptAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *ScriptAction) Init() {
|
||||
this.Nav("", "", "")
|
||||
}
|
||||
|
||||
func (this *ScriptAction) RunGet(params struct {
|
||||
ScriptId int64
|
||||
}) {
|
||||
scriptResp, err := this.RPC().ScriptRPC().FindEnabledScript(this.AdminContext(), &pb.FindEnabledScriptRequest{ScriptId: params.ScriptId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
var script = scriptResp.Script
|
||||
if script == nil {
|
||||
this.NotFound("script", params.ScriptId)
|
||||
return
|
||||
}
|
||||
|
||||
this.Data["script"] = maps.Map{
|
||||
"id": script.Id,
|
||||
"name": script.Name,
|
||||
"filename": script.Filename,
|
||||
"code": script.Code,
|
||||
"isOn": script.IsOn,
|
||||
}
|
||||
|
||||
this.Show()
|
||||
}
|
||||
Reference in New Issue
Block a user