Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package clientsystems
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 CreatePopupAction struct {
actionutils.ParentAction
}
func (this *CreatePopupAction) Init() {
this.Nav("", "", "")
}
func (this *CreatePopupAction) RunGet(params struct{}) {
this.Show()
}
func (this *CreatePopupAction) RunPost(params struct {
Name string
Codes []string
DataId string
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo(codes.ClientSystem_LogCreateSystem, params.Name)
params.Must.
Field("name", params.Name).
Require("请输入操作系统名称").
Field("dataId", params.DataId).
Require("请输入数据ID")
if len(params.Codes) == 0 {
params.Codes = []string{params.Name}
}
// 检查dataId
systemResp, err := this.RPC().FormalClientSystemRPC().FindFormalClientSystemWithDataId(this.AdminContext(), &pb.FindFormalClientSystemWithDataIdRequest{DataId: params.DataId})
if err != nil {
this.ErrorPage(err)
return
}
if systemResp.FormalClientSystem != nil {
this.Fail("该数据ID已经被 '" + systemResp.FormalClientSystem.Name + "'所使用,请换一个")
return
}
_, err = this.RPC().FormalClientSystemRPC().CreateFormalClientSystem(this.AdminContext(), &pb.CreateFormalClientSystemRequest{
Name: params.Name,
Codes: params.Codes,
DataId: params.DataId,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}