mirror of
https://shylinux.com/x/operation
synced 2025-04-24 17:08:04 +08:00
add some
This commit is contained in:
parent
bb06a72e52
commit
ad73f75781
3
src/operation/container.css
Normal file
3
src/operation/container.css
Normal file
@ -0,0 +1,3 @@
|
||||
$output div.code {
|
||||
padding:0;
|
||||
}
|
60
src/operation/container.go
Normal file
60
src/operation/container.go
Normal file
@ -0,0 +1,60 @@
|
||||
package operation
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
"shylinux.com/x/operation/src/operation/model"
|
||||
)
|
||||
|
||||
type container struct {
|
||||
Table
|
||||
order string `data:"1"`
|
||||
fields string `data:"name,module,version"`
|
||||
create string `name:"create uid* domain module version" role:"leader"`
|
||||
remove string `name:"remove" role:"leader"`
|
||||
apply string `name:"apply" role:"void"`
|
||||
rename string `name:"rename name" role:"void"`
|
||||
open string `name:"open" role:"void"`
|
||||
}
|
||||
|
||||
func (s container) Create(m *ice.Message, arg ...string) {
|
||||
s.Table.Insert(m, kit.Simple(arg, m.OptionSimple(model.CLOUD_UID))...)
|
||||
}
|
||||
func (s container) Rename(m *ice.Message, arg ...string) {
|
||||
s.Table.Update(m, m.OptionSimple(model.NAME), m.OptionSimple(model.CLOUD_UID, model.UID)...)
|
||||
}
|
||||
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 {
|
||||
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.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, "容器不够用啦!") {
|
||||
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))
|
||||
})
|
||||
}
|
||||
func (s container) Open(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(m.Options(ice.MSG_USERPOD, "").MergePod(m.Option(model.UID)))
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(container{}) }
|
9
src/operation/container.js
Normal file
9
src/operation/container.js
Normal file
@ -0,0 +1,9 @@
|
||||
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]},
|
||||
] })
|
||||
},
|
||||
})
|
@ -28,5 +28,14 @@ type Release struct {
|
||||
db.ModelContent
|
||||
CloudUID string `gorm:"type:char(32);index"`
|
||||
}
|
||||
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"`
|
||||
}
|
||||
|
||||
func init() { db.CmdModels("", &UserCloud{}, &Cloud{}, &Release{}) }
|
||||
func init() { db.CmdModels("", &UserCloud{}, &Cloud{}, &Release{}, &Container{}) }
|
||||
|
@ -1,7 +1,9 @@
|
||||
{
|
||||
"portal": "系统运维",
|
||||
"container": "容器",
|
||||
"release": "发布",
|
||||
"icons": {
|
||||
"container": "https://img.icons8.com/officel/80/activity-grid.png",
|
||||
"release": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||
},
|
||||
"input": {
|
||||
|
@ -9,6 +9,8 @@ type release struct {
|
||||
remove string `name:"remove" role:"leader"`
|
||||
}
|
||||
|
||||
func (s release) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||
func (s release) List(m *ice.Message, arg ...string) {
|
||||
s.ValueList(m, arg).Display("")
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(release{}) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user