1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
shaoying 2020-09-27 20:04:37 +08:00
parent fe92530fcd
commit a23567b254
5 changed files with 13 additions and 16 deletions

View File

@ -23,6 +23,7 @@ var NodeName = ""
var NodeType = ""
func NodeInfo(m *ice.Message, kind, name string) {
name = strings.ReplaceAll(name, ".", "_")
m.Conf(RUNTIME, "node.type", kind)
m.Conf(RUNTIME, "node.name", name)
NodeName = name

View File

@ -109,7 +109,7 @@ func init() {
return
}
m.Push("type", MYSELF)
m.Push("route", MYSELF)
m.Push("route", cli.NodeName)
m.Table(func(index int, value map[string]string, field []string) {
m.PushRender(kit.MDB_LINK, "a", value[kit.SSH_ROUTE],

View File

@ -18,19 +18,11 @@ import (
)
func _space_list(m *ice.Message, space string) {
if space == "" {
m.Richs(SPACE, nil, kit.MDB_FOREACH, func(key string, value map[string]interface{}) {
m.Push(key, value, []string{kit.MDB_TIME, kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_TEXT})
m.PushRender(kit.MDB_LINK, "a", kit.Format(value[kit.MDB_NAME]), kit.MergeURL(m.Option(ice.MSG_USERWEB), "pod", kit.Keys(m.Option("pod"), value[kit.MDB_NAME])))
})
m.Sort(kit.MDB_NAME)
return
}
m.Richs(SPACE, nil, space, func(key string, value map[string]interface{}) {
m.Push("detail", value)
m.Push(kit.MDB_KEY, kit.MDB_LINK)
m.PushRender(kit.MDB_VALUE, "a", kit.MergeURL(m.Option(ice.MSG_USERWEB), "pod", kit.Keys(m.Option("pod"), value[kit.MDB_NAME])))
m.Option(mdb.FIELDS, "time,type,name,text")
m.Cmdy(mdb.SELECT, SPACE, "", mdb.HASH, kit.MDB_HASH, space)
m.Table(func(index int, value map[string]string, head []string) {
m.PushRender(kit.MDB_LINK, "a", kit.Format(value[kit.MDB_NAME]),
kit.MergeURL(m.Option(ice.MSG_USERWEB), kit.SSH_POD, kit.Keys(m.Option(kit.SSH_POD), value[kit.MDB_NAME])))
})
}
func _space_dial(m *ice.Message, dev, name string, arg ...string) {
@ -235,7 +227,7 @@ func init() {
return
}
if arg[0] == "" || arg[0] == MYSELF {
if arg[0] == "" || arg[0] == MYSELF || arg[0] == cli.NodeName {
// 本地命令
m.Cmdy(arg[1:])
return

View File

@ -88,7 +88,7 @@ export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -sL $ctx_dev >$ct
"base", `
# 生产环境
mkdir contexts; cd contexts
export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -sL $ctx_dev >$ctx_temp; source $ctx_temp ice
export ctx_log=/dev/stdout ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -sL $ctx_dev >$ctx_temp; source $ctx_temp ice
`,
"miss", `
# 开发环境

View File

@ -63,6 +63,10 @@ func (m *Message) AddCmd(cmd *Command) string {
}
func (m *Message) PushRender(key, view, name string, arg ...string) *Message {
if m.Option(MSG_USERUA) == "" {
return m
}
if strings.Contains(m.Option(MSG_USERUA), "curl") {
return m
}