diff --git a/base/cli/runtime.go b/base/cli/runtime.go index 674c57c5..194b2c08 100644 --- a/base/cli/runtime.go +++ b/base/cli/runtime.go @@ -282,7 +282,8 @@ func ParseMake(str string) []string { res := kit.UnMarshal(str) data := kit.Value(res, MAKE) return kit.Simple( - mdb.TIME, kit.Format(kit.Value(res, kit.Keys(BOOT, mdb.TIME))), + // mdb.TIME, kit.Format(kit.Value(res, kit.Keys(BOOT, mdb.TIME))), + mdb.TIME, kit.Format(kit.Value(data, mdb.TIME)), ice.SPACE, kit.Format(kit.Value(res, kit.Keys(NODE, mdb.NAME))), nfs.MODULE, kit.Format(kit.Value(data, nfs.MODULE)), nfs.VERSION, kit.Join(kit.TrimArg(kit.Simple( diff --git a/base/web/matrix.css b/base/web/matrix.css index bae40fff..e38d2852 100644 --- a/base/web/matrix.css +++ b/base/web/matrix.css @@ -1,18 +1,26 @@ fieldset.web.matrix>div.output>table.content thead { z-index:2; } fieldset.web.matrix>div.output>table.content th { font-family:unset; padding:var(--table-padding); } fieldset.web.matrix>div.output>table.content th i { padding:var(--input-padding); position:unset; display:unset; } +fieldset.web.matrix>div.output>table.content th i:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); } fieldset.web.matrix>div.output>table.content td:hover { color:unset; } -fieldset.web.matrix>div.output>table.content div.item { display:flex; align-items:center; } +fieldset.web.matrix>div.output>table.content div.item { display:flex; align-items:center; cursor:default; } fieldset.web.matrix>div.output>table.content div.item:hover { background-color:unset; color:unset; } fieldset.web.matrix>div.output>table.content div.item img { height:var(--header-height); width:var(--header-height); margin-right:var(--input-margin); } fieldset.web.matrix>div.output>table.content div.item div.title { text-align:left; } fieldset.web.matrix>div.output>table.content div.item div.title:hover { background-color:unset; } +fieldset.web.matrix>div.output>table.content div.item div.title span:hover { background-color:var(--hover-bg-color); } fieldset.web.matrix>div.output>table.content div.item div.status i { font-size:var(--status-font-size); padding:0; } +fieldset.web.matrix>div.output>table.content div.item div.status div.item:hover { background-color:var(--hover-bg-color); } fieldset.web.matrix>div.output>table.content div.item div.action { overflow:hidden; } fieldset.web.matrix>div.output>table.content div.item div.action input.icons { display:none; } -fieldset.web.matrix>div.output>table.content div.item.danger div.status { color:var(--danger-bg-color); } -fieldset.web.matrix>div.output>table.content div.item.danger div.status i { color:var(--danger-bg-color); } +fieldset.web.matrix>div.output>table.content div.item.danger div.status { background-color:var(--danger-bg-color); color:var(--danger-fg-color); } +fieldset.web.matrix>div.output>table.content div.item.danger div.status div.item { background-color:var(--danger-bg-color); color:var(--danger-fg-color); } +fieldset.web.matrix>div.output>table.content div.item.danger div.status i { background-color:var(--danger-bg-color); color:var(--danger-fg-color); } +fieldset.web.matrix>div.output>table.content div.item.danger div.status span { background-color:var(--danger-bg-color); color:var(--danger-fg-color); } +// fieldset.web.matrix>div.output>table.content div.item.danger div.status i { color:var(--danger-bg-color); } +// fieldset.web.matrix>div.output>table.content div.item.danger div.status span { color:var(--danger-bg-color); } fieldset.web.matrix>div.output>table.content tr:not(:hover) div.item div.action { visibility:hidden; } body:not(.mobile) fieldset.web.matrix>div.output>table.content th:first-child { position:sticky; left:2px; z-index:2; } body:not(.mobile) fieldset.web.matrix>div.output>table.content td:first-child { background-color:var(--plugin-bg-color); position:sticky; left:2px; z-index:1; } +body:not(.mobile) fieldset.web.matrix>div.output>table.content tr.danger td:first-child { background-color:transparent; } diff --git a/base/web/matrix.go b/base/web/matrix.go index 94c57ee8..e20a40cd 100644 --- a/base/web/matrix.go +++ b/base/web/matrix.go @@ -1,6 +1,8 @@ package web import ( + "strings" + ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/ctx" @@ -11,10 +13,11 @@ import ( func _matrix_list(m *ice.Message, domain string) (server []string) { fields := kit.Split(mdb.Config(m, mdb.FIELD)) - button := []ice.Any{PORTAL, DESKTOP, ADMIN, VIMER, XTERM, OPEN, kit.Select(UPGRADE, COMPILE, domain == "")} + button := []ice.Any{PORTAL, ADMIN, DESKTOP, kit.Select(UPGRADE, COMPILE, domain == ""), WORD, STATUS, VIMER, XTERM, cli.RUNTIME, OPEN} value := kit.Dict(cli.ParseMake(m.Cmdx(Space(m, domain), cli.RUNTIME))) value[mdb.TYPE], value[mdb.ICONS] = SERVER, kit.Select(nfs.USR_ICONS_ICEBERGS, ice.SRC_MAIN_ICO, domain == "") value[DOMAIN] = kit.Select(ice.CONTEXTS, domain) + // value[mdb.TIME] = value[cli.COMPILE_TIME] m.PushRecord(value, fields...).PushButton(button...) m.Cmd(Space(m, domain), DREAM, ice.Maps{"space.timeout": "3s", "dream.simple": ice.TRUE}).Table(func(value ice.Maps) { switch value[mdb.TYPE] { @@ -53,7 +56,9 @@ const MATRIX = "matrix" func init() { Index.MergeCommands(ice.Commands{ - MATRIX: {Name: "matrix list", Help: "空间矩阵", Actions: ice.MergeActions(ice.Actions{ + MATRIX: {Name: "matrix list", Help: "空间矩阵", Meta: kit.Dict(ice.CTX_TRANS, kit.Dict( + WORD, "文档", STATUS, "源码", VIMER, "编程", cli.RUNTIME, "环境", + )), Actions: ice.MergeActions(ice.Actions{ INSTALL: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(Space(m, m.Option(DOMAIN)), DREAM, ctx.ACTION, mdb.CREATE, m.OptionSimple(mdb.NAME, mdb.ICONS, nfs.REPOS), nfs.BINARY, UserHost(m)+S(m.Option(mdb.NAME))) m.Cmd(Space(m, m.Option(DOMAIN)), DREAM, ctx.ACTION, cli.START, m.OptionSimple(mdb.NAME)) @@ -70,6 +75,16 @@ func init() { }) return nil }).Sort("name,domain", "str_r", "str_r").Display("") + m.RewriteAppend(func(value, key string, index int) string { + if key == mdb.ICONS && m.Appendv(DOMAIN)[index] != ice.CONTEXTS { + if strings.HasPrefix(value, "/require/") { + value = kit.MergeURL(strings.Split(value, "?")[0], ice.POD, kit.Keys( + m.Appendv(DOMAIN)[index], m.Appendv(mdb.NAME)[index], + )) + } + } + return value + }) }}, }) } diff --git a/base/web/matrix.js b/base/web/matrix.js index 4c8fffcc..d11c198d 100644 --- a/base/web/matrix.js +++ b/base/web/matrix.js @@ -4,23 +4,23 @@ Volcanos(chat.ONIMPORT, { var ui = can.page.Append(can, can._output, [{view: [wiki.CONTENT, html.TABLE], list: [{type: html.THEAD, list: [{type: html.TR, list: can.core.Item(domain, function(domain) { var item = list[ice.CONTEXTS][domain] return {type: html.TH, list: [{view: [html.ITEM], list: [{img: can.misc.Resource(can, item.icons||nfs.USR_ICONS_ICEBERGS)}, - {view: wiki.TITLE, list: [{text: item.domain}, can.onappend.label(can, item, {version: icon.version, compile: icon.compile}), can.onappend.buttons(can, item)]}, + {view: wiki.TITLE, list: [{text: item.domain}, can.onappend.label(can, item, {version: icon.version, time: icon.compile}), can.onappend.buttons(can, item)]}, ]}]} }) }]}, {type: html.TBODY}] }]) can.core.Item(list, function(name, value) { var i = 0; if (name == ice.CONTEXTS) { return } - can.page.Append(can, ui.tbody, [{type: html.TR, list: can.core.Item(domain, function(domain) { i++ + var tr = can.page.Append(can, ui.tbody, [{type: html.TR, list: can.core.Item(domain, function(domain) { i++ var item = value[domain]||{} return {type: html.TD, list: [{view: [[html.ITEM, can.core.Value(list, can.core.Keys(name, domain, nfs.VERSION)) != can.core.Value(list, can.core.Keys(name, ice.CONTEXTS, nfs.VERSION))? "danger": ""]], list: item.name? [ {img: can.misc.Resource(can, item.icons||nfs.USR_ICONS_VOLCANOS)}, {view: wiki.TITLE, list: [{text: item.name}, can.onappend.label(can, item, {version: icon.version, time: icon.compile, time: icon.compile}), can.onappend.buttons(can, item)]}, ]: [ {view: html.ACTION, _init: function(target) { var worker = list[name][ice.CONTEXTS], server = list[ice.CONTEXTS][domain] - can.onappend.input(can, {type: html.BUTTON, name: code.INSTALL, onclick: function(event) { + worker && can.onappend.input(can, {type: html.BUTTON, name: code.INSTALL, onclick: function(event) { can.Update(can.request(event, {name: name, domain: domain, port: server.port}, worker), [ctx.ACTION, code.INSTALL]) }}, "", target) }}, ]}]} - }) }]) + }) }])._target; list[name][ice.CONTEXTS] || can.onappend.style(can, "danger", tr) }), can.onmotion.delay(can, function() { can.Status(mdb.COUNT, can.core.Item(list).length+"x"+can.core.Item(domain).length) }) }, }, [""]) diff --git a/base/web/render.go b/base/web/render.go index 2855bcc8..1c871941 100644 --- a/base/web/render.go +++ b/base/web/render.go @@ -150,6 +150,7 @@ func RenderVersion(m *ice.Message) string { const ( CHAT = "chat" + WORD = "word" GRANT = "grant" VIMER = "vimer" XTERM = "xterm"