mirror of
https://shylinux.com/x/icebergs
synced 2025-05-02 19:47:02 +08:00
add matrix
This commit is contained in:
parent
acb9cc0eb0
commit
e5b1f1cc97
@ -22,14 +22,14 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
func _dream_list(m *ice.Message) *ice.Message {
|
||||
func _dream_list(m *ice.Message, simple bool) *ice.Message {
|
||||
if ice.Info.NodeType == WORKER {
|
||||
return m
|
||||
}
|
||||
list := m.CmdMap(SPACE, mdb.NAME)
|
||||
mdb.HashSelect(m).Table(func(value ice.Maps) {
|
||||
if space, ok := list[value[mdb.NAME]]; ok {
|
||||
if m.IsCliUA() {
|
||||
if m.IsCliUA() || simple {
|
||||
m.Push(mdb.TYPE, space[mdb.TYPE]).Push(cli.STATUS, cli.START)
|
||||
m.Push(nfs.MODULE, space[nfs.MODULE]).Push(nfs.VERSION, space[nfs.VERSION]).Push(mdb.TEXT, "")
|
||||
m.PushButton(cli.STOP)
|
||||
@ -77,7 +77,7 @@ func _dream_list_icon(m *ice.Message) {
|
||||
return value
|
||||
})
|
||||
}
|
||||
func _dream_list_more(m *ice.Message) *ice.Message {
|
||||
func _dream_list_more(m *ice.Message, simple bool) *ice.Message {
|
||||
if m.IsCliUA() {
|
||||
return m
|
||||
}
|
||||
@ -90,15 +90,24 @@ func _dream_list_more(m *ice.Message) *ice.Message {
|
||||
case SERVER:
|
||||
value[mdb.ICONS] = nfs.USR_ICONS_ICEBERGS
|
||||
value[mdb.TEXT] = kit.JoinLine(value[nfs.MODULE], value[mdb.TEXT])
|
||||
msg := gdb.Event(m.Spawn(value), DREAM_TABLES)
|
||||
defer m.PushButton(strings.Join(msg.Appendv(ctx.ACTION), ""))
|
||||
|
||||
if simple {
|
||||
defer m.PushButton("")
|
||||
} else {
|
||||
msg := gdb.Event(m.Spawn(value), DREAM_TABLES)
|
||||
defer m.PushButton(strings.Join(msg.Appendv(ctx.ACTION), ""))
|
||||
}
|
||||
case MASTER:
|
||||
if spide, ok := list[value[mdb.NAME]]; ok {
|
||||
value[mdb.ICONS] = kit.Select(value[mdb.ICONS], spide[mdb.ICONS])
|
||||
}
|
||||
value[mdb.TEXT] = kit.JoinLine(value[nfs.MODULE], value[mdb.TEXT])
|
||||
msg := gdb.Event(m.Spawn(value), DREAM_TABLES)
|
||||
defer m.PushButton(strings.Join(msg.Appendv(ctx.ACTION), ""))
|
||||
if simple {
|
||||
defer m.PushButton("")
|
||||
} else {
|
||||
msg := gdb.Event(m.Spawn(value), DREAM_TABLES)
|
||||
defer m.PushButton(strings.Join(msg.Appendv(ctx.ACTION), ""))
|
||||
}
|
||||
case aaa.LOGIN:
|
||||
value[mdb.ICONS] = kit.Select(value[mdb.ICONS], agentIcons[value[AGENT]])
|
||||
value[mdb.TEXT] = kit.JoinWord(value[AGENT], value[cli.SYSTEM], value[aaa.IP])
|
||||
@ -235,7 +244,7 @@ func init() {
|
||||
case mdb.CREATE:
|
||||
switch arg[0] {
|
||||
case mdb.NAME, nfs.TEMPLATE:
|
||||
_dream_list(m).Cut("name,status,time")
|
||||
_dream_list(m, true).Cut("name,status,time")
|
||||
return
|
||||
case nfs.BINARY:
|
||||
m.Cmdy(nfs.DIR, ice.BIN, "path,size,time", kit.Dict(nfs.DIR_TYPE, nfs.TYPE_BIN))
|
||||
@ -422,9 +431,10 @@ func init() {
|
||||
html.BUTTON, kit.JoinWord(PORTAL, ADMIN, DESKTOP, WIKI_WORD, STATUS, VIMER, XTERM, COMPILE),
|
||||
)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
_dream_list(m)
|
||||
simple := m.Option("dream.simple") == ice.TRUE
|
||||
_dream_list(m, simple)
|
||||
_dream_list_icon(m)
|
||||
_dream_list_more(m)
|
||||
_dream_list_more(m, simple)
|
||||
stat := map[string]int{}
|
||||
m.Table(func(value ice.Maps) { stat[value[mdb.TYPE]]++; stat[value[mdb.STATUS]]++ })
|
||||
kit.If(stat[cli.START] == stat[WORKER], func() { delete(stat, cli.START) })
|
||||
|
@ -195,7 +195,7 @@ func _space_echo(m *ice.Message, source, target []string, c *websocket.Conn) {
|
||||
func _space_send(m *ice.Message, name string, arg ...string) (h string) {
|
||||
withecho := true
|
||||
kit.If(len(arg) > 0 && arg[0] == "toast", func() { withecho = false; m.Option(ice.MSG_DEBUG, ice.FALSE) })
|
||||
wait, done := m.Wait(kit.Select("", "180s", withecho), func(msg *ice.Message, arg ...string) {
|
||||
wait, done := m.Wait(kit.Select("", m.OptionDefault("space.timeout", "180s"), withecho), func(msg *ice.Message, arg ...string) {
|
||||
m.Cost(kit.Format("%v->[%v] %v %v", m.Optionv(ice.MSG_SOURCE), name, m.Detailv(), msg.FormatSize())).Copy(msg)
|
||||
})
|
||||
if withecho {
|
||||
|
@ -18,7 +18,7 @@ const STORE = "store"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
STORE: {Name: "store refresh", Help: "系统商店", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
STORE: {Name: "store refresh", Help: "空间商店", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(SPIDE, mdb.INPUTS, arg) }},
|
||||
mdb.CREATE: {Name: "create name* origin* icons", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("name,origin,icons"), mdb.TYPE, nfs.REPOS)
|
||||
|
@ -81,6 +81,7 @@ func init() {
|
||||
ice.Index.Register(Index, &Frame{},
|
||||
BROAD, SERVE, SPACE, ROUTE, DREAM, STORE,
|
||||
SHARE, TOKEN, SPIDE, CACHE, ADMIN, STATS, COUNT,
|
||||
MATRIX,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,13 @@ func init() {
|
||||
m.Option(ice.EXIT, ice.TRUE)
|
||||
}
|
||||
uri := "/publish/" + kit.Format(value[nfs.FILE])
|
||||
kit.If(m.Spawn().ParseLink(ice.Info.Domain).Option(ice.MSG_USERPOD), func(p string) { uri = kit.MergeURL(uri, ice.POD, p) })
|
||||
m.Debug("what %v", uri)
|
||||
m.Debug("what %v", ice.Info.Make.Domain)
|
||||
kit.If(m.Spawn().Options(ice.MSG_USERPOD, "").ParseLink(ice.Info.Make.Domain).Option(ice.MSG_USERPOD), func(p string) {
|
||||
m.Debug("what %v", p)
|
||||
uri = kit.MergeURL(uri, ice.POD, p)
|
||||
})
|
||||
m.Debug("what %v", uri)
|
||||
dir := path.Join(kit.Format(value[nfs.PATH]), kit.Format(value[nfs.FILE]))
|
||||
web.GoToast(m, web.DOWNLOAD, func(toast func(name string, count, total int)) []string {
|
||||
switch web.SpideSave(m, dir, uri, func(count, total, value int) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user