forked from x/icebergs
add some
This commit is contained in:
parent
8abffce38c
commit
28792874d4
@ -432,7 +432,7 @@ func init() {
|
||||
}},
|
||||
}, StatsAction(), DreamAction(), DreamTablesAction(), mdb.ImportantHashAction(
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icons,repos,binary,template,restart",
|
||||
html.BUTTON, kit.JoinWord(PORTAL, ADMIN, DESKTOP, WORD, STATUS, VIMER, COMPILE, XTERM, DREAM),
|
||||
html.BUTTON, kit.JoinWord(PORTAL, DESKTOP, ADMIN, WORD, STATUS, VIMER, COMPILE, XTERM, DREAM),
|
||||
ctx.TOOLS, kit.Simple(SPIDE, STORE, MATRIX, ROUTE),
|
||||
)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
@ -482,17 +482,10 @@ func DreamProcessIframe(m *ice.Message, arg ...string) {
|
||||
if !kit.HasPrefixList(arg, ctx.ACTION, m.ShortKey()) && !kit.HasPrefixList(arg, ctx.ACTION, m.CommandKey()) {
|
||||
return
|
||||
}
|
||||
if m.Option(mdb.TYPE) == MASTER && m.IsLocalhost() {
|
||||
m.ProcessOpen(SpideOrigin(m, m.Option(mdb.NAME)) + C(m.ShortKey()))
|
||||
return
|
||||
}
|
||||
if len(arg) == 2 {
|
||||
defer m.Push(TITLE, kit.Keys(m.Option(mdb.NAME), m.ShortKey()))
|
||||
}
|
||||
DreamProcess(m, CHAT_IFRAME, func() string {
|
||||
if m.Option(mdb.TYPE) == MASTER {
|
||||
return SpideOrigin(m, m.Option(mdb.NAME)) + C(m.ShortKey())
|
||||
}
|
||||
return S(kit.Keys(m.Option(ice.MSG_USERPOD), m.Option(mdb.NAME))) + C(m.ShortKey())
|
||||
}, arg...)
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ func _matrix_list(m *ice.Message, domain string, fields ...string) (server []str
|
||||
kit.If(value[mdb.STATUS] == cli.STOP, func() { value[mdb.ICONS] = nfs.USR_ICONS_ICEBERGS })
|
||||
kit.If(value[mdb.STATUS] == cli.STOP, func() { button = []ice.Any{cli.START, mdb.REMOVE} })
|
||||
m.PushRecord(value, fields...).PushButton(button...)
|
||||
case SERVER:
|
||||
case SERVER, MASTER:
|
||||
server = append(server, kit.Keys(domain, value[mdb.NAME]))
|
||||
}
|
||||
})
|
||||
@ -42,13 +42,15 @@ func _matrix_list(m *ice.Message, domain string, fields ...string) (server []str
|
||||
}
|
||||
func _matrix_action(m *ice.Message, action string, arg ...string) {
|
||||
switch domain := kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME)); action {
|
||||
case PORTAL, ADMIN, DESKTOP, OPEN:
|
||||
case PORTAL, ADMIN:
|
||||
if kit.HasPrefixList(arg, ctx.RUN) {
|
||||
ProcessIframe(m, "", "", arg...)
|
||||
} else {
|
||||
title, link := kit.Keys(domain, kit.Select("", action, action != OPEN)), kit.Select("", S(domain), domain != "")+kit.Select("", C(action), action != OPEN)
|
||||
ProcessIframe(m, kit.Select(ice.CONTEXTS, title), kit.Select(nfs.PS, link), arg...).ProcessField(ctx.ACTION, action, ctx.RUN)
|
||||
}
|
||||
case OPEN:
|
||||
m.ProcessOpen(kit.Select(nfs.PS, S(domain), domain != ""))
|
||||
default:
|
||||
if !kit.HasPrefixList(arg, ctx.RUN) {
|
||||
kit.If(action == XTERM, func() { arg = []string{cli.SH} })
|
||||
|
@ -1,16 +1,20 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { var list = {}, domain = {"": true}
|
||||
msg.Table(function(value) { var name = value.name||"", _domain = value.domain||""; domain[_domain] = true, list[name] = list[name]||{}, list[name][_domain] = value })
|
||||
_init: function(can, msg) { var list = {}, domain = [""]
|
||||
msg.Table(function(value) {
|
||||
var name = value.name, _domain = value.domain
|
||||
domain.indexOf(_domain) == -1 && (domain.push(_domain))
|
||||
list[name] = list[name]||{}, list[name][_domain] = value
|
||||
})
|
||||
can.ui = can.page.Appends(can, can._output, [{view: [wiki.CONTENT, html.TABLE], list: [
|
||||
{type: html.THEAD, list: [{type: html.TR, list: can.core.Item(domain, function(domain) {
|
||||
{type: html.THEAD, list: [{type: html.TR, list: can.core.List(domain, function(domain) {
|
||||
return {type: html.TH, list: [can.onimport.item(can, list[""][domain], list)]}
|
||||
}) }]},
|
||||
{type: html.TBODY, list: can.core.Item(list, function(name, value) { if (!name) { return }
|
||||
return {type: html.TR, list: can.core.Item(domain, function(domain) { var item = value[domain]
|
||||
return {type: html.TR, list: can.core.List(domain, function(domain) { var item = value[domain]
|
||||
return {type: html.TD, list: [item? can.onimport.item(can, item, list): can.onimport.void(can, name, domain, list)]}
|
||||
})}
|
||||
})},
|
||||
] }]), can.onmotion.delay(can, function() { can.Status(mdb.COUNT, can.core.Item(list).length+"x"+can.core.Item(domain).length) })
|
||||
] }]), can.onmotion.delay(can, function() { can.Status(mdb.COUNT, can.core.Item(list).length+"x"+can.core.List(domain).length) })
|
||||
},
|
||||
void: function(can, name, domain, list) {
|
||||
return {view: html.ACTION, _init: function(target) { var worker = list[name][""], server = list[""][domain]
|
||||
|
@ -141,7 +141,8 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
|
||||
switch c := value[mdb.TARGET].(type) {
|
||||
case (*websocket.Conn): // 转发报文
|
||||
kit.If(value[mdb.TYPE] == MASTER && msg.Option(ice.MSG_HANDLE) == ice.FALSE, func() {
|
||||
msg.Options(ice.MSG_USERWEB, value[mdb.TEXT], ice.MSG_USERPOD, kit.Keys(target[1:]))
|
||||
msg.Optionv(ice.MSG_USERWEB, kit.Simple(value[mdb.TEXT], msg.Optionv(ice.MSG_USERWEB)))
|
||||
msg.Optionv(ice.MSG_USERPOD, kit.Simple(kit.Keys(target[1:]), msg.Optionv(ice.MSG_USERPOD)))
|
||||
})
|
||||
_space_echo(msg, source, target, c)
|
||||
case ice.Handler: // 接收响应
|
||||
@ -189,7 +190,8 @@ func _space_exec(m *ice.Message, name string, source, target []string, c *websoc
|
||||
}
|
||||
m.Option(ice.MSG_HANDLE, ice.TRUE)
|
||||
defer m.Cost(kit.Format("%v->%v %v %v", source, target, m.Detailv(), m.FormatSize()))
|
||||
_space_echo(m.Set(ice.MSG_OPTS).Options(m.OptionSimple(ice.MSG_USERWEB, ice.MSG_USERPOD, ice.MSG_HANDLE, ice.LOG_DEBUG, ice.LOG_DISABLE, ice.LOG_TRACEID)), []string{}, kit.Reverse(kit.Simple(source)), c)
|
||||
m.Options(ice.MSG_USERWEB, m.Optionv(ice.MSG_USERWEB), ice.MSG_USERPOD, m.Optionv(ice.MSG_USERPOD))
|
||||
_space_echo(m.Set(ice.MSG_OPTS).Options(m.OptionSimple(ice.MSG_HANDLE, ice.LOG_DEBUG, ice.LOG_DISABLE, ice.LOG_TRACEID)), []string{}, kit.Reverse(kit.Simple(source)), c)
|
||||
}
|
||||
func _space_echo(m *ice.Message, source, target []string, c *websocket.Conn) {
|
||||
defer func() { m.WarnNotValid(recover()) }()
|
||||
@ -211,8 +213,10 @@ func _space_send(m *ice.Message, name string, arg ...string) (h string) {
|
||||
}
|
||||
if target := kit.Split(name, nfs.PT, nfs.PT); !mdb.HashSelectDetail(m, target[0], func(value ice.Map) {
|
||||
if c, ok := value[mdb.TARGET].(*websocket.Conn); !m.WarnNotValid(!ok, mdb.TARGET) {
|
||||
kit.If(kit.Format(value[mdb.TYPE]) == MASTER && value[mdb.NAME] != ice.OPS, func() {
|
||||
m.Options(ice.MSG_USERWEB, value[mdb.TEXT], ice.MSG_USERPOD, "", ice.MSG_USERHOST, "", ice.MSG_USERWEB0, m.Option(ice.MSG_USERWEB), ice.MSG_USERPOD0, name)
|
||||
kit.If(kit.Format(value[mdb.TYPE]) == MASTER, func() {
|
||||
m.Optionv(ice.MSG_USERWEB, kit.Simple(value[mdb.TEXT], m.Optionv(ice.MSG_USERWEB)))
|
||||
m.Optionv(ice.MSG_USERPOD, kit.Simple(kit.Keys(target[1:]), m.Optionv(ice.MSG_USERPOD)))
|
||||
m.Options(ice.MSG_USERHOST, "", ice.MSG_USERWEB0, m.Option(ice.MSG_USERWEB), ice.MSG_USERPOD0, name)
|
||||
})
|
||||
kit.For([]string{ice.MSG_USERROLE, ice.LOG_TRACEID}, func(k string) { m.Optionv(k, m.Optionv(k)) })
|
||||
m.Option(ice.MSG_HANDLE, ice.FALSE)
|
||||
|
@ -157,7 +157,9 @@ func init() {
|
||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(aaa.IsTechOrRoot(m), func() { m.PushButton(kit.Dict(m.CommandKey(), m.Commands("").Help)) })
|
||||
}},
|
||||
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, "", cli.Shell(m), arg...) }},
|
||||
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||
web.DreamProcess(m, "", cli.SH, arg...)
|
||||
}},
|
||||
}, web.DreamTablesAction(), chat.FavorAction(), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,path")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||
if web.IsLocalHost(m) {
|
||||
@ -167,13 +169,12 @@ func init() {
|
||||
}
|
||||
} else {
|
||||
kit.If(m.Length() == 0, func() {
|
||||
if arg[0] == SH {
|
||||
arg[0] = cli.Shell(m)
|
||||
}
|
||||
kit.If(arg[0] == cli.SH, func() { arg[0] = cli.Shell(m) })
|
||||
arg[0] = m.Cmdx("", mdb.CREATE, arg)
|
||||
mdb.HashSelect(m, arg[0])
|
||||
})
|
||||
m.Push(mdb.HASH, arg[0]).Action(ice.APP)
|
||||
m.Push(mdb.HASH, arg[0])
|
||||
kit.If(m.IsLocalhost(), func() { m.Action(ice.APP) })
|
||||
ctx.DisplayLocal(m, "")
|
||||
}
|
||||
}},
|
||||
|
@ -21,14 +21,14 @@ type matrix struct {
|
||||
|
||||
func (s matrix) List(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(SSH_RELAY, web.DREAM).Table(func(value ice.Maps) {
|
||||
if value[mdb.STATUS] == cli.STOP {
|
||||
m.PushButton()
|
||||
} else if value[web.SPACE] == ice.CONTEXTS {
|
||||
if value[web.SPACE] == ice.CONTEXTS {
|
||||
m.PushButton(s.Portal, s.Desktop, s.Dream, s.Admin, s.Open, s.Word, s.Status, s.Vimer, s.Compile, s.Runtime, s.Xterm)
|
||||
} else if value[mdb.STATUS] == cli.STOP {
|
||||
m.PushButton()
|
||||
} else if value[MACHINE] == tcp.LOCALHOST {
|
||||
m.PushButton(s.Portal, s.Word, s.Status, s.Vimer, s.Compile, s.Runtime, s.Xterm, s.Desktop, s.Admin, s.Open)
|
||||
} else {
|
||||
m.PushButton(s.Portal, s.Vimer, s.Runtime, s.Xterm, s.Desktop, s.Admin, s.Open)
|
||||
m.PushButton(s.Portal, s.Desktop, s.Admin, s.Open, s.Vimer, s.Runtime, s.Xterm)
|
||||
}
|
||||
}).Action(html.FILTER).Display("").Sort("type,status,space,machine", []string{web.SERVER, web.WORKER, ""}, []string{cli.START, cli.STOP, ""}, "str_r", "str")
|
||||
}
|
||||
@ -69,6 +69,10 @@ func (s matrix) iframe(m *ice.Message, arg ...string) {
|
||||
m.ProcessIframe(s.title(m), s.link(m), arg...)
|
||||
}
|
||||
func (s matrix) open(m *ice.Message, arg ...string) {
|
||||
if m.ActionKey() == web.OPEN {
|
||||
m.ProcessOpen(s.link(m))
|
||||
return
|
||||
}
|
||||
if kit.HasPrefixList(arg, ctx.RUN) || m.Option(MACHINE) == "" {
|
||||
m.ProcessIframe(s.title(m), s.link(m), arg...)
|
||||
} else {
|
||||
|
@ -3,7 +3,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
msg.Table(function(value) {
|
||||
if (value.space == ice.CONTEXTS) { value.space = "" }
|
||||
if (value.machine == tcp.LOCALHOST) { value.machine = "" }
|
||||
var space = value.space, _machine = value.machine;
|
||||
var space = value.space, _machine = value.machine
|
||||
machine.indexOf(_machine) == -1 && (machine.push(_machine))
|
||||
list[space] = list[space]||{}, list[space][_machine] = value
|
||||
})
|
||||
@ -30,6 +30,6 @@ Volcanos(chat.ONIMPORT, {
|
||||
]}
|
||||
},
|
||||
style: function(can, item, list) { var space = item.space, machine = item.machine, worker = list[space][""]
|
||||
return !worker? html.NOTICE: (worker.status != cli.STOP && item.status != cli.STOP && (item.version != worker.version || item.time < worker.time))? html.DANGER: ""
|
||||
return !worker? html.NOTICE: (worker.status != cli.STOP && item.status != cli.STOP && (item.version != worker.version || item.time > worker.time))? html.DANGER: ""
|
||||
},
|
||||
}, [""])
|
||||
|
Loading…
x
Reference in New Issue
Block a user