mirror of
https://shylinux.com/x/icebergs
synced 2025-06-26 18:37:29 +08:00
add some
This commit is contained in:
parent
a840ff12ea
commit
da31659105
@ -68,6 +68,7 @@ const (
|
|||||||
BLACK = "black"
|
BLACK = "black"
|
||||||
SILVER = "silver"
|
SILVER = "silver"
|
||||||
DANGER = "danger"
|
DANGER = "danger"
|
||||||
|
NOTICE = "notice"
|
||||||
|
|
||||||
PROJECT = "project"
|
PROJECT = "project"
|
||||||
CONTENT = "content"
|
CONTENT = "content"
|
||||||
|
@ -105,10 +105,7 @@ func init() {
|
|||||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, nfs.TRASH); _matrix_dream(m, "") }},
|
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, nfs.TRASH); _matrix_dream(m, "") }},
|
||||||
cli.START: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, "") }},
|
cli.START: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, "") }},
|
||||||
cli.STOP: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, "") }},
|
cli.STOP: {Hand: func(m *ice.Message, arg ...string) { _matrix_dream(m, "") }},
|
||||||
UPGRADE: {Hand: func(m *ice.Message, arg ...string) {
|
UPGRADE: {Hand: func(m *ice.Message, arg ...string) { _matrix_cmd(m, "").Sleep3s(); m.ProcessRefresh() }},
|
||||||
_matrix_cmd(m, "").Sleep3s()
|
|
||||||
m.ProcessRefresh()
|
|
||||||
}},
|
|
||||||
INSTALL: {Hand: func(m *ice.Message, arg ...string) {
|
INSTALL: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if kit.IsIn(m.Cmdv(Space(m, m.Option(DOMAIN)), SPIDE, ice.DEV_IP, CLIENT_HOSTNAME), m.Cmd(tcp.HOST).Appendv(aaa.IP)...) {
|
if kit.IsIn(m.Cmdv(Space(m, m.Option(DOMAIN)), SPIDE, ice.DEV_IP, CLIENT_HOSTNAME), m.Cmd(tcp.HOST).Appendv(aaa.IP)...) {
|
||||||
m.Option(nfs.BINARY, S(m.Option(mdb.NAME)))
|
m.Option(nfs.BINARY, S(m.Option(mdb.NAME)))
|
||||||
@ -116,15 +113,14 @@ func init() {
|
|||||||
m.OptionDefault(nfs.BINARY, UserHost(m)+S(m.Option(mdb.NAME)))
|
m.OptionDefault(nfs.BINARY, UserHost(m)+S(m.Option(mdb.NAME)))
|
||||||
}
|
}
|
||||||
_matrix_dream(m, mdb.CREATE, kit.Simple(m.OptionSimple(mdb.ICONS, nfs.REPOS, nfs.BINARY))...)
|
_matrix_dream(m, mdb.CREATE, kit.Simple(m.OptionSimple(mdb.ICONS, nfs.REPOS, nfs.BINARY))...)
|
||||||
m.Cmd(SPACE, kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME)), MESSAGE, mdb.CREATE,
|
m.Cmd(SPACE, kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME)), MESSAGE, mdb.CREATE, mdb.TYPE, aaa.TECH, mdb.ICONS, nfs.USR_ICONS_VOLCANOS, TARGET, kit.Keys(nfs.FROM, m.Option(mdb.NAME)))
|
||||||
mdb.TYPE, aaa.TECH, mdb.ICONS, nfs.USR_ICONS_VOLCANOS, TARGET, kit.Keys(nfs.FROM, m.Option(mdb.NAME)))
|
m.Cmd(SPACE, m.Option(mdb.NAME), MESSAGE, mdb.CREATE, mdb.TYPE, aaa.TECH, mdb.ICONS, nfs.USR_ICONS_ICEBERGS, TARGET, kit.Keys(ice.OPS, m.Option(DOMAIN), m.Option(mdb.NAME)))
|
||||||
m.Cmd(SPACE, m.Option(mdb.NAME), MESSAGE, mdb.CREATE,
|
|
||||||
mdb.TYPE, aaa.TECH, mdb.ICONS, nfs.USR_ICONS_ICEBERGS, TARGET, kit.Keys(ice.OPS, m.Option(DOMAIN), m.Option(mdb.NAME)))
|
|
||||||
StreamPushRefreshConfirm(m, m.Trans("refresh for new space ", "刷新列表查看新空间 ")+kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME)))
|
StreamPushRefreshConfirm(m, m.Trans("refresh for new space ", "刷新列表查看新空间 ")+kit.Keys(m.Option(DOMAIN), m.Option(mdb.NAME)))
|
||||||
}},
|
}},
|
||||||
}, ctx.ConfAction(
|
}, ctx.ConfAction(
|
||||||
mdb.FIELD, "time,domain,status,type,name,text,icons,repos,binary,module,version,access",
|
mdb.FIELD, "time,domain,status,type,name,text,icons,repos,binary,module,version,access",
|
||||||
ctx.TOOLS, kit.Simple(SPIDE, VERSION, STATUS), ONLINE, ice.TRUE,
|
ctx.TOOLS, kit.Simple(SPIDE, VERSION, STATUS), ONLINE, ice.TRUE,
|
||||||
|
cli.TIMEOUT, "10s",
|
||||||
)), Hand: func(m *ice.Message, arg ...string) {
|
)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if kit.HasPrefixList(arg, ctx.ACTION) {
|
if kit.HasPrefixList(arg, ctx.ACTION) {
|
||||||
_matrix_action(m, arg[1], arg[2:]...)
|
_matrix_action(m, arg[1], arg[2:]...)
|
||||||
@ -133,7 +129,7 @@ func init() {
|
|||||||
GoToast(m, func(toast func(name string, count, total int)) []string {
|
GoToast(m, func(toast func(name string, count, total int)) []string {
|
||||||
field := kit.Split(mdb.Config(m, mdb.FIELD))
|
field := kit.Split(mdb.Config(m, mdb.FIELD))
|
||||||
space := m.CmdMap(SPACE, mdb.NAME)
|
space := m.CmdMap(SPACE, mdb.NAME)
|
||||||
m.Options("space.timeout", cli.TIME_3s, "dream.simple", ice.TRUE)
|
m.Options("space.timeout", mdb.Config(m, cli.TIMEOUT), "dream.simple", ice.TRUE)
|
||||||
list, icons, types := _matrix_list(m, "", MYSELF, ice.Maps{
|
list, icons, types := _matrix_list(m, "", MYSELF, ice.Maps{
|
||||||
mdb.TIME: ice.Info.Make.Time,
|
mdb.TIME: ice.Info.Make.Time,
|
||||||
mdb.ICONS: ice.SRC_MAIN_ICO,
|
mdb.ICONS: ice.SRC_MAIN_ICO,
|
||||||
|
@ -188,6 +188,7 @@ const (
|
|||||||
CODE_VIMER = "web.code.vimer"
|
CODE_VIMER = "web.code.vimer"
|
||||||
CODE_INNER = "web.code.inner"
|
CODE_INNER = "web.code.inner"
|
||||||
CODE_XTERM = "web.code.xterm"
|
CODE_XTERM = "web.code.xterm"
|
||||||
|
CODE_MOD = "web.code.mod"
|
||||||
WIKI_FEEL = "web.wiki.feel"
|
WIKI_FEEL = "web.wiki.feel"
|
||||||
WIKI_DRAW = "web.wiki.draw"
|
WIKI_DRAW = "web.wiki.draw"
|
||||||
WIKI_WORD = "web.wiki.word"
|
WIKI_WORD = "web.wiki.word"
|
||||||
|
@ -17,6 +17,9 @@ const (
|
|||||||
REMOTE_URL = "remoteURL"
|
REMOTE_URL = "remoteURL"
|
||||||
INIT = "init"
|
INIT = "init"
|
||||||
ADD = "add"
|
ADD = "add"
|
||||||
|
STATUS = "status"
|
||||||
|
DIFF = "diff"
|
||||||
|
SYNC = "sync"
|
||||||
)
|
)
|
||||||
const REPOS = nfs.REPOS
|
const REPOS = nfs.REPOS
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ func init() {
|
|||||||
m.Push(arg[0], "v0.0.1")
|
m.Push(arg[0], "v0.0.1")
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
"sync": {Help: "同步", Hand: func(m *ice.Message, arg ...string) {
|
SYNC: {Help: "同步", Hand: func(m *ice.Message, arg ...string) {
|
||||||
repos := map[string]string{}
|
repos := map[string]string{}
|
||||||
m.Cmds("web.code.git.repos").Table(func(value ice.Maps) { repos[strings.Split(value[web.ORIGIN], "://")[1]] = value[nfs.VERSION] })
|
m.Cmds(web.CODE_GIT_STATUS).Table(func(value ice.Maps) { repos[strings.Split(value[web.ORIGIN], "://")[1]] = value[nfs.VERSION] })
|
||||||
m.Cmd("web.code.mod", mdb.RENDER, MOD, ice.GO_MOD, nfs.PWD).Table(func(value ice.Maps) { repos[value[REQUIRE]] = value[VERSION] })
|
m.Cmd(web.CODE_MOD, mdb.RENDER, MOD, ice.GO_MOD, nfs.PWD).Table(func(value ice.Maps) { repos[value[REQUIRE]] = value[VERSION] })
|
||||||
res := m.Cmdx(nfs.CAT, path.Join(nfs.USR_LOCAL_WORK, m.Option(SPACE), ice.GO_MOD), func(ls []string, text string) string {
|
res := m.Cmdx(nfs.CAT, path.Join(nfs.USR_LOCAL_WORK, m.Option(SPACE), ice.GO_MOD), func(ls []string, text string) string {
|
||||||
if len(ls) > 1 {
|
if len(ls) > 1 {
|
||||||
if v, ok := repos[ls[0]]; ok {
|
if v, ok := repos[ls[0]]; ok && !strings.Contains(v, "-") {
|
||||||
m.Debug("what %v %v => %v", ls[0], ls[1], repos[ls[0]])
|
m.Debug("what %v %v => %v", ls[0], ls[1], v)
|
||||||
text = lex.TB + ls[0] + lex.SP + v
|
text = lex.TB + ls[0] + lex.SP + v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,23 +43,23 @@ func init() {
|
|||||||
m.Cmd(nfs.SAVE, path.Join(nfs.USR_LOCAL_WORK, m.Option(SPACE), ice.GO_MOD), res)
|
m.Cmd(nfs.SAVE, path.Join(nfs.USR_LOCAL_WORK, m.Option(SPACE), ice.GO_MOD), res)
|
||||||
m.Cmd(SPACE, m.Option(SPACE), cli.SYSTEM, GO, MOD, "tidy")
|
m.Cmd(SPACE, m.Option(SPACE), cli.SYSTEM, GO, MOD, "tidy")
|
||||||
}},
|
}},
|
||||||
"tag": {Name: "tag version", Hand: func(m *ice.Message, arg ...string) {
|
TAG: {Name: "tag version", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(SPACE, m.Option(SPACE), cli.SYSTEM, GIT, TAG, m.Option(VERSION))
|
m.Cmd(SPACE, m.Option(SPACE), cli.SYSTEM, GIT, TAG, m.Option(VERSION))
|
||||||
m.Cmd(SPACE, m.Option(SPACE), VIMER, COMPILE)
|
m.Cmd(SPACE, m.Option(SPACE), VIMER, COMPILE)
|
||||||
m.Sleep3s()
|
m.Sleep3s()
|
||||||
}},
|
}},
|
||||||
"xterm": {Hand: func(m *ice.Message, arg ...string) {
|
XTERM: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
web.ProcessPodCmd(m, m.Option(web.SPACE), m.ActionKey(), cli.SH, arg...)
|
web.ProcessPodCmd(m, m.Option(web.SPACE), m.ActionKey(), cli.SH, arg...)
|
||||||
}},
|
}},
|
||||||
"status": {Hand: func(m *ice.Message, arg ...string) {
|
STATUS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
web.ProcessPodCmd(m, m.Option(web.SPACE), m.ActionKey(), nil, arg...)
|
web.ProcessPodCmd(m, m.Option(web.SPACE), m.ActionKey(), nil, arg...)
|
||||||
}},
|
}},
|
||||||
}), Hand: func(m *ice.Message, arg ...string) {
|
}), Hand: func(m *ice.Message, arg ...string) {
|
||||||
repos := map[string]string{}
|
repos := map[string]string{}
|
||||||
list := map[string]map[string]string{}
|
list := map[string]map[string]string{}
|
||||||
list[ice.Info.Pathname] = map[string]string{}
|
list[ice.Info.Pathname] = map[string]string{}
|
||||||
m.Cmds("web.code.git.repos").Table(func(value ice.Maps) { repos[strings.Split(value[web.ORIGIN], "://")[1]] = value[nfs.VERSION] })
|
m.Cmds(web.CODE_GIT_REPOS).Table(func(value ice.Maps) { repos[strings.Split(value[web.ORIGIN], "://")[1]] = value[nfs.VERSION] })
|
||||||
m.Cmd("web.code.mod", mdb.RENDER, MOD, ice.GO_MOD, nfs.PWD).Table(func(value ice.Maps) {
|
m.Cmd(web.CODE_MOD, mdb.RENDER, MOD, ice.GO_MOD, nfs.PWD).Table(func(value ice.Maps) {
|
||||||
list[ice.Info.Pathname][value[REQUIRE]] = value[VERSION]
|
list[ice.Info.Pathname][value[REQUIRE]] = value[VERSION]
|
||||||
if value[REPLACE] == nfs.PWD {
|
if value[REPLACE] == nfs.PWD {
|
||||||
list[ice.Info.Pathname][MODULE] = value[REQUIRE]
|
list[ice.Info.Pathname][MODULE] = value[REQUIRE]
|
||||||
@ -70,7 +70,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
web.DreamEach(m, m.Option(mdb.NAME), "", func(name string) {
|
web.DreamEach(m, m.Option(mdb.NAME), "", func(name string) {
|
||||||
list[name] = map[string]string{}
|
list[name] = map[string]string{}
|
||||||
m.Cmd(web.SPACE, name, "web.code.mod", mdb.RENDER, MOD, ice.GO_MOD, nfs.PWD).Table(func(value ice.Maps) {
|
m.Cmd(web.SPACE, name, web.CODE_MOD, mdb.RENDER, MOD, ice.GO_MOD, nfs.PWD).Table(func(value ice.Maps) {
|
||||||
if value[REPLACE] == nfs.PWD {
|
if value[REPLACE] == nfs.PWD {
|
||||||
list[name][MODULE] = value[REQUIRE]
|
list[name][MODULE] = value[REQUIRE]
|
||||||
list[name][VERSION] = value[VERSION]
|
list[name][VERSION] = value[VERSION]
|
||||||
@ -78,50 +78,35 @@ func init() {
|
|||||||
list[name][value[REQUIRE]] = value[VERSION]
|
list[name][value[REQUIRE]] = value[VERSION]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
list[name]["diff"] = kit.ReplaceAll(m.Cmdx(web.SPACE, name, cli.SYSTEM, "git", "diff", "--shortstat"), " changed", "", "tions", "")
|
list[name][DIFF] = kit.ReplaceAll(m.Cmdx(web.SPACE, name, cli.SYSTEM, GIT, DIFF, "--shortstat"), " changed", "", "tions", "")
|
||||||
})
|
})
|
||||||
for space, v := range list {
|
for space, v := range list {
|
||||||
diff := false
|
button, status := []ice.Any{}, ""
|
||||||
m.Push(web.SPACE, space)
|
m.Push(web.SPACE, space).Push(MODULE, v[MODULE]).Push(VERSION, v[VERSION])
|
||||||
m.Push(MODULE, v[MODULE])
|
|
||||||
m.Push(VERSION, v[VERSION])
|
|
||||||
kit.For(repos, func(k, _v string) {
|
kit.For(repos, func(k, _v string) {
|
||||||
if kit.IsIn(k,
|
if kit.IsIn(k, "shylinux.com/x/websocket", "shylinux.com/x/go-qrcode") {
|
||||||
"shylinux.com/x/go-qrcode",
|
|
||||||
"shylinux.com/x/websocket",
|
|
||||||
) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if k == v[MODULE] || v[k] == "" {
|
if k == v[MODULE] || v[k] == "" {
|
||||||
m.Push(k, "")
|
m.Push(k, "")
|
||||||
} else if v[k] == _v {
|
} else if v[k] == _v {
|
||||||
m.Push(k, v[k])
|
m.Push(k, v[k])
|
||||||
|
} else if strings.Contains(_v, "-") {
|
||||||
|
m.Push(k, v[k]+" != "+_v)
|
||||||
|
status = html.NOTICE
|
||||||
} else {
|
} else {
|
||||||
m.Push(k, v[k]+" => "+_v)
|
m.Push(k, v[k]+" => "+_v)
|
||||||
diff = true
|
status = html.DANGER
|
||||||
|
button = append(button, SYNC)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
button, status := []ice.Any{}, ""
|
kit.If(list[space][DIFF] != "", func() { button = append(button, STATUS) })
|
||||||
if diff {
|
kit.If(strings.Contains(list[space][VERSION], "-"), func() { button = append(button, TAG) })
|
||||||
button, status = append(button, "sync"), html.DANGER
|
kit.If(len(button) > 0, func() { button = append(button, XTERM) })
|
||||||
}
|
m.Push(DIFF, list[space][DIFF]).Push(mdb.STATUS, status).PushButton(button...)
|
||||||
if list[space]["diff"] != "" {
|
|
||||||
button = append(button, "status")
|
|
||||||
}
|
|
||||||
if strings.Contains(list[space][VERSION], "-") {
|
|
||||||
button = append(button, "tag")
|
|
||||||
}
|
|
||||||
if len(button) > 0 {
|
|
||||||
button = append(button, "xterm")
|
|
||||||
}
|
|
||||||
m.Push("diff", list[space]["diff"]).Push(mdb.STATUS, status).PushButton(button...)
|
|
||||||
}
|
}
|
||||||
fields := []string{}
|
fields := []string{}
|
||||||
for _, k := range m.Appendv(ice.MSG_APPEND) {
|
kit.For(m.Appendv(ice.MSG_APPEND), func(k string) { kit.If(len(kit.TrimArg(m.Appendv(k)...)) > 0, func() { fields = append(fields, k) }) })
|
||||||
if len(kit.TrimArg(m.Appendv(k)...)) > 0 {
|
|
||||||
fields = append(fields, k)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m.Cut(fields...).Sort(web.SPACE, ice.STR_R)
|
m.Cut(fields...).Sort(web.SPACE, ice.STR_R)
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user