This commit is contained in:
IT 老营长 @云轩领航-创始人 2025-02-16 17:16:52 +08:00
parent 4f972c0473
commit 8419bfdd9c

View File

@ -5,30 +5,31 @@ import (
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
)
type travel struct {
ice.Hash
list string `name:"list hash auto" help:"travel"`
list string `name:"list list" help:"遍历"`
}
func (s travel) MachineMonitor(m *ice.Message, arg ...string) {
m.Cmd("").Table(func(value ice.Maps) {
switch value[nfs.MODULE] {
case "2025-dev.shylinux.com/x/20250215-cluster":
m.Cmdy(web.SPACE, value[mdb.NAME], m.PrefixKey(), m.ActionKey())
case "2025-dev.shylinux.com/x/20250213-machine":
m.Cmdy(web.SPACE, value[mdb.NAME], "web.chat.dev.machine.monitor")
}
})
}
func (s travel) ServiceMonitor(m *ice.Message, arg ...string) {
}
func (s travel) List(m *ice.Message, arg ...string) {
m.Cmd(web.SPACE, ice.OPS, web.DREAM, web.SERVER).Table(func(value ice.Maps) {
if len(arg) == 0 {
m.PushRecord(value, "time,name,module,version")
} else {
switch value[nfs.MODULE] {
case "2025-dev.shylinux.com/x/20250215-cluster":
m.Cmdy(web.SPACE, value[mdb.NAME], m.PrefixKey(), arg).RewriteAppend(func(val, key string, index int) string {
kit.If(key == web.SPACE, func() { val = kit.Keys(value[mdb.NAME], val) })
return val
})
case arg[0]:
m.Cmd(web.SPACE, value[mdb.NAME], arg[1:]).Table(func(val ice.Maps, index int, head []string) {
m.Push(web.SPACE, value[mdb.NAME]).PushRecord(val, head...)
})
}
}
})
m.Action(s.MachineMonitor, s.ServiceMonitor)
}
func init() { ice.Cmd("web.chat.dev.cluster.travel", travel{}) }