mirror of
https://shylinux.com/x/operation
synced 2025-04-24 17:08:04 +08:00
add some
This commit is contained in:
parent
b9a4ee596e
commit
af29281507
@ -13,6 +13,6 @@ import (
|
||||
func main() { print(ice.Run()) }
|
||||
|
||||
func init() {
|
||||
ice.Info.NodeMain = "web.team.production.portal"
|
||||
ice.Info.NodeMain = "web.team.operation.portal"
|
||||
ice.Info.CodeMain = "src/operation/portal.go"
|
||||
}
|
@ -12,9 +12,11 @@ import (
|
||||
)
|
||||
|
||||
type container struct {
|
||||
ice.Space
|
||||
Table
|
||||
order string `data:"1"`
|
||||
fields string `data:"name,module,version"`
|
||||
fields string `data:"space,name"`
|
||||
foreach string `name:"foreach" help:"遍历" icon:"bi bi-card-list"`
|
||||
create string `name:"create uid* domain module version" role:"leader"`
|
||||
remove string `name:"remove" role:"leader"`
|
||||
apply string `name:"apply" role:"void"`
|
||||
@ -30,6 +32,13 @@ func (s container) Inputs(m *ice.Message, arg ...string) {
|
||||
s.Table.Inputs(m, arg...)
|
||||
}
|
||||
}
|
||||
func (s container) Foreach(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(web.SPACE, "20250211-service", "web.chat.dev.service.gateway", m.ActionKey()).Table(func(value ice.Maps) {
|
||||
if s.Select(m.Spawn(), web.SPACE, value[web.SPACE]).Length() == 0 {
|
||||
s.Insert(m, web.SPACE, value[web.SPACE])
|
||||
}
|
||||
})
|
||||
}
|
||||
func (s container) Create(m *ice.Message, arg ...string) {
|
||||
s.Table.Insert(m, kit.Simple(arg, m.OptionSimple(model.CLOUD_UID))...)
|
||||
}
|
||||
@ -39,31 +48,34 @@ func (s container) Rename(m *ice.Message, arg ...string) {
|
||||
func (s container) List(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 1 {
|
||||
s.Select(m, model.CLOUD_UID, arg[0], model.USER_UID, m.Option(model.USER_UID)).PushAction(s.Open, s.Rename)
|
||||
kit.If(m.Length() == 0, func() { m.EchoInfoButton("请申请云容器", s.Apply) })
|
||||
kit.If(s.IsLeader(m), func() { m.Action(s.Create, s.Apply) }, func() {
|
||||
if m.Length() > 0 {
|
||||
kit.If(m.Length() == 0, func() { m.EchoInfoButton("请申请云主机", s.Apply) })
|
||||
if m.IsTech() {
|
||||
m.Action(s.Foreach, s.Create, s.Apply)
|
||||
} else if s.IsLeader(m) {
|
||||
m.Action(s.Create, s.Apply)
|
||||
} else if m.Length() > 0 {
|
||||
m.Action()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
s.SelectDetail(m, model.UID, arg[1], model.CLOUD_UID, arg[0], model.USER_UID, m.Option(model.USER_UID)).PushAction(s.Open, s.Rename)
|
||||
m.EchoIFrame(web.S(arg[1]))
|
||||
m.EchoIFrame(web.S(m.Append(web.SPACE)))
|
||||
}
|
||||
m.Display("").DisplayCSS("")
|
||||
}
|
||||
func (s container) Apply(m *ice.Message, arg ...string) {
|
||||
s.Transaction(m, func() {
|
||||
msg := m.Spawn()
|
||||
msg = s.Limit(msg, 1).SelectForUpdate(msg, "(user_uid IS NULL OR user_uid = '') AND cloud_uid = ?", m.Option(model.CLOUD_UID))
|
||||
if m.Warn(msg.Length() == 0, "容器不够用啦!") {
|
||||
msg = s.Limit(msg, 1).SelectForUpdate(msg, "(user_uid IS NULL OR user_uid = '') AND (cloud_uid = ? OR cloud_uid IS NULL OR cloud_uid = '')", m.Option(model.CLOUD_UID))
|
||||
if msg.Length() == 0 {
|
||||
m.Echo("主机不够用啦!请等待管理员添加。")
|
||||
return
|
||||
}
|
||||
s.Update(m, m.OptionSimple(model.USER_UID), msg.AppendSimple(model.UID)...)
|
||||
m.Cmd(web.SPACE, msg.Append(model.UID), aaa.USER, mdb.CREATE, aaa.TECH, m.Option(model.USER_UID), kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
||||
s.Update(m, m.OptionSimple(model.CLOUD_UID, model.USER_UID), msg.AppendSimple(model.UID)...)
|
||||
m.Cmd(web.SPACE, msg.Append(web.SPACE), aaa.USER, mdb.CREATE, aaa.TECH, m.Option(model.USER_UID), kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
||||
})
|
||||
}
|
||||
func (s container) Open(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(m.Options(ice.MSG_USERPOD, "").MergePod(m.Option(model.UID)))
|
||||
m.ProcessOpen(m.Options(ice.MSG_USERPOD, "").MergePod(m.Option(web.SPACE)))
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(container{}) }
|
||||
|
@ -2,8 +2,8 @@ Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.onimport.myView(can, msg, function(value) { return [
|
||||
{view: html.TITLE, list: [value.name||"container", can.onimport.titleAction(can, value)]},
|
||||
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
|
||||
{view: html.STATUS, list: [value.module, value.version]},
|
||||
{view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
|
||||
{view: html.STATUS, list: [value.space]},
|
||||
] })
|
||||
},
|
||||
})
|
@ -32,10 +32,8 @@ type Container struct {
|
||||
db.ModelWithUID
|
||||
CloudUID string `gorm:"type:char(32);index"`
|
||||
UserUID string `gorm:"type:char(32);index"`
|
||||
Name string `gorm:"type:varchar(32);index"`
|
||||
Module string `gorm:"type:varchar(255);index"`
|
||||
Version string `gorm:"type:varchar(32);index"`
|
||||
Domain string `gorm:"type:char(255);index"`
|
||||
Space string `gorm:"type:char(128);uniqueIndex"`
|
||||
Name string `gorm:"type:char(64)"`
|
||||
}
|
||||
|
||||
func init() { db.CmdModels("", &UserCloud{}, &Cloud{}, &Release{}, &Container{}) }
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"portal": "系统运维",
|
||||
"container": "容器",
|
||||
"container": "云主机",
|
||||
"release": "发布",
|
||||
"icons": {
|
||||
"container": "https://img.icons8.com/officel/80/activity-grid.png",
|
||||
|
Loading…
x
Reference in New Issue
Block a user