mirror of
https://shylinux.com/x/operation
synced 2025-04-24 17:08:04 +08:00
opt some
This commit is contained in:
parent
4f5556781d
commit
a7aa40ad65
55
src/operation/studio.go
Normal file
55
src/operation/studio.go
Normal file
@ -0,0 +1,55 @@
|
||||
package operation
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/operation/src/operation/model"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
type studio struct {
|
||||
Tables
|
||||
cluster Cluster
|
||||
list string `name:"list list"`
|
||||
gateway string `name:"gateway" role:"void"`
|
||||
project string `name:"project" role:"void"`
|
||||
product string `name:"product" role:"void"`
|
||||
}
|
||||
|
||||
func (s studio) List(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(s.PrefixPortal(m)).Action().Display("")
|
||||
}
|
||||
func (s studio) Gateway(m *ice.Message, arg ...string) {
|
||||
if len(arg) < 3 {
|
||||
m.Cmdy(m.Prefix(m.ActionKey()), arg[0])
|
||||
} else {
|
||||
m.Cmdy(web.SPACE, s.space(m, arg, model.CLUSTER_SPACE, model.SPACE), arg[2:])
|
||||
}
|
||||
}
|
||||
func (s studio) Project(m *ice.Message, arg ...string) {
|
||||
if len(arg) < 3 {
|
||||
m.Cmdy(m.Prefix(m.ActionKey()), s.Select, model.CLOUD_UID, arg[0], model.GATEWAY_UID, arg[1])
|
||||
} else {
|
||||
m.Cmdy(web.SPACE, s.space(m, arg, model.CLUSTER_SPACE, model.GATEWAY_SPACE, model.NAME), arg[2:])
|
||||
}
|
||||
}
|
||||
func (s studio) Product(m *ice.Message, arg ...string) {
|
||||
if len(arg) < 3 {
|
||||
m.Cmdy(m.Prefix(m.ActionKey()), s.Select, model.CLOUD_UID, arg[0], model.PROJECT_UID, arg[1])
|
||||
} else {
|
||||
m.Cmdy(web.SPACE, s.space(m, arg, model.CLUSTER_SPACE, model.GATEWAY_SPACE, model.PROJECT_NAME), arg[2:])
|
||||
}
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(studio{}) }
|
||||
|
||||
func (s studio) space(m *ice.Message, arg []string, args ...string) string {
|
||||
if s.UserPlaceRole(m); s.IsWorker(m) {
|
||||
m.Option(ice.MSG_USERROLE, aaa.TECH)
|
||||
}
|
||||
space := []ice.Any{}
|
||||
msg := m.Cmd(m.Prefix(m.ActionKey()), arg[0], arg[1])
|
||||
kit.For(args, func(key string) { space = append(space, msg.Append(key)) })
|
||||
return m.Option(ice.MSG_USERPOD, kit.Keys(space...))
|
||||
}
|
82
src/operation/studio.js
Normal file
82
src/operation/studio.js
Normal file
@ -0,0 +1,82 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { can.onmotion.hidden(can, can._status)
|
||||
can.ui = can.onappend.layout(can), can.onimport.place(can, msg)
|
||||
},
|
||||
place: function(can, msg) {
|
||||
msg.Table(function(value) {
|
||||
can.onimport.item(can, {name: value.cloud_name, _hash: [value.cloud_uid.slice(0, 12)]}, function(event, item, show, target) { can.db.cloud_uid = value.cloud_uid
|
||||
show === undefined && can.runAction(event, "gateway", [value.cloud_uid], function(msg) {
|
||||
can.onimport.gateway(can, msg, target, value.cloud_uid)
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
gateway: function(can, msg, target, cloud_uid) {
|
||||
can.onimport.itemlist(can, msg.Table(function(value) {
|
||||
return {name: value.title, _hash: target._item._hash.concat([value.space.slice(0, 12)]), action: "gateway", cloud_uid: cloud_uid, uid: value.uid, space: can.core.Keys(value.cluster_space, value.space)}
|
||||
}), function(event, item, show, target) { can.db.gateway_uid = item.uid
|
||||
show === undefined && can.runAction(event, "project", [cloud_uid, item.uid], function(msg) {
|
||||
if (msg.Length() == 0) {
|
||||
can.onimport.plugin(can, item, target)
|
||||
} else {
|
||||
can.onimport.project(can, msg, target, cloud_uid)
|
||||
}
|
||||
})
|
||||
}, function(event, item, target) {
|
||||
return can.onimport.contexts(can, item, target)
|
||||
}, target)
|
||||
},
|
||||
project: function(can, msg, target, cloud_uid) {
|
||||
can.onimport.itemlist(can, msg.Table(function(value) {
|
||||
return {name: value.name, _hash: target._item._hash.concat([value.name]), action: "project", cloud_uid: cloud_uid, uid: value.uid, space: can.core.Keys(target._item.space, value.name)}
|
||||
}), function(event, item, show, target) { can.db.project_uid = item.uid
|
||||
show === undefined && can.runAction(event, "product", [cloud_uid, item.uid], function(msg) {
|
||||
if (msg.Length() == 0) {
|
||||
can.onimport.plugin(can, item, target)
|
||||
} else {
|
||||
can.onimport.product(can, msg, target, cloud_uid)
|
||||
}
|
||||
})
|
||||
}, function(event, item, target) {
|
||||
return can.onimport.contexts(can, item, target)
|
||||
}, target)
|
||||
},
|
||||
product: function(can, msg, target, cloud_uid) {
|
||||
can.onimport.itemlist(can, msg.Table(function(value) {
|
||||
return {name: value.name, _hash: target._item._hash.concat([value.index]), action: "product", cloud_uid: cloud_uid, uid: value.uid, space: target._item.space, index: value.index}
|
||||
}), function(event, item, show, target) { can.db.product_uid = item.uid
|
||||
can.onimport.plugin(can, item, target)
|
||||
}, function() {}, target)
|
||||
},
|
||||
contexts: function(can, item, target) {
|
||||
return {meta: {
|
||||
portal: function() { can.onappend.plugin(can._root.Action, {index: web.CHAT_IFRAME, args: "/s/"+item.space+"/c/portal", style: html.FLOAT, title: item.name}) },
|
||||
desktop: function() { can.onimport.plugin(can, item, target, web.DESKTOP) },
|
||||
admin: function() { can.onappend.plugin(can._root.Action, {index: web.CHAT_IFRAME, args: "/s/"+item.space, style: html.FLOAT, title: item.name}) },
|
||||
word: function() { can.onimport.plugin(can, item, target, web.WORD) },
|
||||
vimer: function() { can.onimport.plugin(can, item, target, web.VIMER) },
|
||||
runtime: function() { can.onimport.plugin(can, item, target, cli.RUNTIME) },
|
||||
xterm: function() { can.onimport.plugin(can, item, target, cli.XTERM) },
|
||||
open: function() { can.user.open("/s/"+item.space) },
|
||||
}}
|
||||
},
|
||||
plugin: function(can, item, target, index) {
|
||||
if (!index && !item.index) {
|
||||
for (var i = 0; i < item._hash.length; i++) { if (item._hash[i] != can.db.hash[i]) { break } }
|
||||
if (i == item._hash.length) { index = can.db.hash[i] }
|
||||
} if (index) { can.onexport.hash(can, item._hash.concat([index])) }
|
||||
index = index||item.index||web.DESKTOP, item.plugin = item.plugin||{}
|
||||
can.onimport.tabsCache(can, item.plugin[index] = item.plugin[index]||{name: item.name+(index == web.DESKTOP || item.index? "": "."+index), _hash: can.core.Keys(item._hash, index)}, target, function() {
|
||||
// can.onappend.plugin(can._root.Action, {space: item.space, index: index, height: can.ConfHeight(), width: can.ConfWidth()-can.ui.project.offsetWidth}, function() {}, can.ui.content)
|
||||
can.onappend.plugin(can._root.Action, {space: item.space, index: index, height: can.ConfHeight(), width: can.ConfWidth()-can.ui.project.offsetWidth}, function(sub) {
|
||||
sub.run = function(event, cmds, cb) { can.runAction(event, item.action, [item.cloud_uid, item.uid, index].concat(cmds), cb) }
|
||||
can._plugins = (can._plugins||[]).concat(sub)
|
||||
}, can.ui.content)
|
||||
})
|
||||
},
|
||||
layout: function(can) {
|
||||
can.ui.layout(can.ConfHeight(), can.ConfWidth(), 0, function(height, width) {
|
||||
can.core.List(can._plugins, function(sub) { sub.onimport.size(sub, height, width) })
|
||||
})
|
||||
},
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user