forked from x/icebergs
add some
This commit is contained in:
parent
1542a364eb
commit
c2a1e36bda
@ -39,10 +39,14 @@ func init() {
|
||||
func init() { ice.Info.Template = Template }
|
||||
|
||||
func Template(m *ice.Message, p string, data ...ice.Any) string {
|
||||
if len(data) == 0 {
|
||||
return kit.Renders(TemplateText(m, p), m)
|
||||
text := TemplateText(m, p)
|
||||
if text == "" {
|
||||
return ""
|
||||
}
|
||||
return kit.Renders(TemplateText(m, p), data[0])
|
||||
if len(data) == 0 {
|
||||
return kit.Renders(text, m)
|
||||
}
|
||||
return kit.Renders(text, data[0])
|
||||
}
|
||||
|
||||
var TemplateText = func(m *ice.Message, p string) string {
|
||||
|
@ -475,6 +475,10 @@ func init() {
|
||||
if ice.Info.NodeType != WORKER {
|
||||
_dream_list(m, simple)
|
||||
_dream_list_icon(m)
|
||||
if m.Length() == 0 {
|
||||
m.EchoInfoButton(m.Trans("please create new dream", "请创建新空间"), mdb.CREATE).Action(mdb.CREATE)
|
||||
return
|
||||
}
|
||||
}
|
||||
if !m.IsCliUA() && aaa.IsTechOrRoot(m) {
|
||||
_dream_list_more(m, simple)
|
||||
|
@ -14,12 +14,9 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
func _matrix_list(m *ice.Message, domain, typ string, meta ice.Maps, fields ...string) (server, icons, types []string) {
|
||||
value := kit.Dict(cli.ParseMake(m.Cmdx(Space(m, domain), cli.RUNTIME)))
|
||||
func _matrix_list(m *ice.Message, domain, typ string, value ice.Maps, fields ...string) (server, icons, types []string) {
|
||||
value[DOMAIN], value[mdb.TYPE] = domain, typ
|
||||
kit.For(meta, func(k, v string) { value[k] = v })
|
||||
|
||||
istech, isdebug := typ == SERVER || kit.IsIn(meta[aaa.ACCESS], aaa.TECH, aaa.ROOT), m.IsDebug()
|
||||
istech, isdebug := typ == SERVER || kit.IsIn(value[aaa.ACCESS], aaa.TECH, aaa.ROOT), m.IsDebug()
|
||||
compile := kit.Select("", kit.Select(COMPILE, UPGRADE, typ == SERVER), istech)
|
||||
vimer := kit.Select("", VIMER, istech && isdebug)
|
||||
|
||||
@ -137,17 +134,27 @@ func init() {
|
||||
space := m.CmdMap(SPACE, mdb.NAME)
|
||||
m.Options("space.timeout", cli.TIME_3s, "dream.simple", ice.TRUE)
|
||||
list, icons, types := _matrix_list(m, "", MYSELF, ice.Maps{
|
||||
mdb.ICONS: ice.SRC_MAIN_ICO, aaa.ACCESS: m.Option(ice.MSG_USERROLE),
|
||||
mdb.TIME: ice.Info.Make.Time,
|
||||
mdb.ICONS: ice.SRC_MAIN_ICO,
|
||||
nfs.MODULE: ice.Info.Make.Module,
|
||||
nfs.VERSION: ice.Info.Make.Versions(),
|
||||
aaa.ACCESS: m.Option(ice.MSG_USERROLE),
|
||||
}, field...)
|
||||
kit.For(list, func(domain string, index int, total int) {
|
||||
toast(domain, index, total)
|
||||
_matrix_list(m, domain, types[index], ice.Maps{
|
||||
mdb.ICONS: icons[index], aaa.ACCESS: kit.Format(kit.Value(space[domain], aaa.USERROLE)),
|
||||
mdb.TIME: space[domain][mdb.TIME],
|
||||
mdb.ICONS: icons[index],
|
||||
nfs.MODULE: space[domain][nfs.MODULE],
|
||||
nfs.VERSION: space[domain][nfs.VERSION],
|
||||
aaa.ACCESS: kit.Format(kit.Value(space[domain], aaa.USERROLE)),
|
||||
}, field...)
|
||||
})
|
||||
m.RewriteAppend(func(value, key string, index int) string {
|
||||
if key == mdb.ICONS && strings.HasPrefix(value, nfs.REQUIRE) && m.Appendv(DOMAIN)[index] != "" {
|
||||
value = kit.MergeURL(strings.Split(value, "?")[0], ice.POD, kit.Keys(m.Appendv(DOMAIN)[index], m.Appendv(mdb.NAME)[index]))
|
||||
if key == mdb.ICONS && strings.HasPrefix(value, nfs.REQUIRE) {
|
||||
if domain := m.Appendv(DOMAIN)[index]; domain != "" {
|
||||
value = kit.MergeURL2(space[domain][mdb.TEXT], value, ice.POD, m.Appendv(mdb.NAME)[index])
|
||||
}
|
||||
}
|
||||
return value
|
||||
})
|
||||
|
@ -19,7 +19,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
},
|
||||
void: function(can, name, domain, list) { var worker = list[name][""], server = list[""][domain]
|
||||
return {view: html.ACTION, _init: function(target) {
|
||||
worker && can.onappend.input(can, {type: html.BUTTON, name: code.INSTALL, onclick: function(event) {
|
||||
worker && server.type != web.ORIGIN && can.onappend.input(can, {type: html.BUTTON, name: code.INSTALL, onclick: function(event) {
|
||||
can.Update(can.request(event, {name: name, domain: domain}, worker), [ctx.ACTION, code.INSTALL])
|
||||
}}, "", target)
|
||||
}}
|
||||
|
@ -100,7 +100,6 @@ func _space_fork(m *ice.Message) {
|
||||
defer gdb.EventDeferEvent(m, SPACE_OPEN, args)(SPACE_CLOSE, args)
|
||||
m.Go(func() {
|
||||
m.Cmd(SPACE, name, cli.PWD, name, kit.Dict(
|
||||
ice.MSG_USERROLE, aaa.TECH, ice.MSG_USERNAME, ice.Info.Make.Username,
|
||||
mdb.TIME, ice.Info.Make.Time, nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(),
|
||||
AGENT, "Go-http-client", cli.SYSTEM, runtime.GOOS))
|
||||
m.Cmd(SPACE).Table(func(value ice.Maps) {
|
||||
|
@ -399,6 +399,8 @@ func init() {
|
||||
nfs.TemplateText = func(m *ice.Message, p string) string {
|
||||
if p := kit.Select(nfs.TemplatePath(m, path.Base(p)), m.Option("_template")); kit.HasPrefix(p, "/require/", ice.HTTP) {
|
||||
return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, p)
|
||||
} else if p == "" {
|
||||
return ""
|
||||
} else {
|
||||
return m.Cmdx(nfs.CAT, p)
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"shylinux.com/x/icebergs/base/lex"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -15,7 +16,17 @@ const ICON = "icon"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ICON: {Help: "图标", Actions: ctx.ConfAction(nfs.PATH, "bootstrap-icons/font/bootstrap-icons.css"), Hand: func(m *ice.Message, arg ...string) {
|
||||
ICON: {Help: "图标", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.For([]string{
|
||||
"bootstrap-icons/font/fonts/bootstrap-icons.woff2",
|
||||
"bootstrap-icons/font/bootstrap-icons.css",
|
||||
}, func(p string) {
|
||||
// m.Cmd(WEBPACK, mdb.INSERT, p)
|
||||
m.Cmd(web.BINPACK, mdb.INSERT, nfs.USR_MODULES+p)
|
||||
})
|
||||
}},
|
||||
}, ctx.ConfAction(nfs.PATH, "bootstrap-icons/font/bootstrap-icons.css")), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(lex.SPLIT, nfs.USR_MODULES+mdb.Config(m, nfs.PATH), kit.Dict(lex.SPLIT_SPACE, " {:;}"), func(text string, ls []string) {
|
||||
if len(ls) > 2 && ls[2] == nfs.CONTENT {
|
||||
name := "bi " + strings.TrimPrefix(ls[0], nfs.PT)
|
||||
|
@ -18,6 +18,9 @@ const DESKTOP = "desktop"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.BINPACK, mdb.INSERT, nfs.USR_ICONS)
|
||||
}},
|
||||
ice.CTX_OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmd(DESKTOP).Length() == 0 {
|
||||
DeskAppend(m, "Books.png", web.WIKI_WORD)
|
||||
|
@ -75,6 +75,15 @@ func init() {
|
||||
m.Cmd("", mdb.CREATE, mdb.TYPE, shell)
|
||||
m.Cmd("", mdb.CREATE, mdb.TYPE, "/bin/ish")
|
||||
})
|
||||
kit.For([]string{
|
||||
"xterm/lib/xterm.js",
|
||||
"xterm/css/xterm.css",
|
||||
"xterm-addon-fit/lib/xterm-addon-fit.js",
|
||||
"xterm-addon-web-links/lib/xterm-addon-web-links.js",
|
||||
}, func(p string) {
|
||||
m.Cmd(WEBPACK, mdb.INSERT, p)
|
||||
m.Cmd(BINPACK, mdb.INSERT, nfs.USR_MODULES+p)
|
||||
})
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.IsSearchPreview(m, arg) || kit.HasPrefixList(arg, SHELL) {
|
||||
|
@ -183,7 +183,7 @@ func init() {
|
||||
})
|
||||
})
|
||||
}},
|
||||
}, web.DreamAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,message"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, web.DreamAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,message", ice.CMD, GIT), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||
m.Push(nfs.SIZE, kit.Split(m.Cmdx(cli.SYSTEM, "du", "-sh", path.Join(ice.USR_LOCAL_REPOS, value[REPOS])))[0])
|
||||
|
Loading…
x
Reference in New Issue
Block a user