1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-05-26 11:27:48 +08:00
parent 120e65bb92
commit 3f945f963a
11 changed files with 71 additions and 61 deletions

View File

@ -291,7 +291,7 @@ func HashSelect(m *ice.Message, arg ...string) *ice.Message {
kit.If(kit.Select(Config(m, SHORT), Config(m, SORT)), func(sort string) { kit.If(sort != UNIQ, func() { m.Sort(sort) }) })
if m.PushAction(Config(m, ACTION), REMOVE); !m.FieldsIsDetail() {
m.Options(ice.TABLE_CHECKBOX, Config(m, html.CHECKBOX))
return m.Action(CREATE, PRUNES)
return m.Action(CREATE)
}
return sortByField(m, HashField(m), arg...)
}

View File

@ -294,7 +294,7 @@ func AutoConfig(arg ...Any) *ice.Action {
}
add := func(list []string) (inputs []Any) {
kit.For(list, func(k string) {
kit.If(!kit.IsIn(k, TIME, HASH, COUNT, ID), func() {
kit.If(!kit.IsIn(k, TIME, HASH, COUNT, ID, ENABLE, DISABLE), func() {
inputs = append(inputs, k+kit.Select("", FOREACH, strings.Contains(s, k)))
})
})

View File

@ -219,6 +219,13 @@ func init() {
DREAM: {Name: "dream refresh", Help: "梦想家", Icon: "Launchpad.png", Role: aaa.VOID, Meta: kit.Dict(
ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict(WORKER, "空间", SERVER, "门户", ORIGIN, "主机")),
), Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
AddPortalProduct(m, "空间", `
比虚拟机和容器更加轻量每个空间都是一个完整的系统拥有各种软件与独立的环境
空间内所有的软件配置数据以源码库形式保存每个空间都可以随时启动停止上传下载分享
每个空间都自带软件开发工具也可以随时编程添加新的功能
`, 200.0)
}},
html.BUTTON: {Hand: func(m *ice.Message, arg ...string) {
mdb.Config(m, html.BUTTON, kit.Join(arg))
}},

22
base/web/product.go Normal file
View File

@ -0,0 +1,22 @@
package web
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
kit "shylinux.com/x/toolkits"
)
const PRODUCT = "product"
func init() {
Index.MergeCommands(ice.Commands{
PRODUCT: {Name: "product refresh", Help: "产品展示", Actions: mdb.HashAction(mdb.SHORT, "index", mdb.FIELD, "time,name,text,order,disable,index,args"), Hand: func(m *ice.Message, arg ...string) {
mdb.HashSelect(m, arg...).SortInt(mdb.ORDER)
}},
})
}
func AddPortalProduct(m *ice.Message, name, text string, order float64, arg ...string) {
m.Cmd("web.product", mdb.CREATE, mdb.NAME, name, mdb.TEXT, text, mdb.ORDER, order, ctx.INDEX, m.PrefixKey(), ctx.ARGS, kit.Format(arg))
}

View File

@ -18,6 +18,12 @@ const STORE = "store"
func init() {
Index.MergeCommands(ice.Commands{
STORE: {Name: "store refresh", Help: "商店", Icon: "App Store.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
AddPortalProduct(m, "商店", `
每个用户都可以将自己的空间列表以系统商店的方式分享给其它用户
同样的每个用户也可以添加任意多个商店直接将空间下载到本机使用
`, 300.0)
}},
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(SPIDE, mdb.INPUTS, arg) }},
mdb.CREATE: {Name: "create origin* name icons", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("origin,name,icons"), mdb.TYPE, nfs.REPOS)

View File

@ -15,7 +15,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_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)
@ -40,6 +42,12 @@ func init() {
Notify(m, "usr/icons/Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
}},
DESKTOP: {Help: "桌面", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
web.AddPortalProduct(m, "桌面", `
一款网页版的电脑桌面打开网页即可随时随地的使用各种软件
无论这些软件是运行在本机还是远程还是任何虚拟的空间无论是内存还是磁盘
`, 100.0)
}},
// web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcessIframe(m, arg...) }},
// web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, "", arg, arg...) }},
}, web.DreamTablesAction(), PodCmdAction(), CmdHashAction(ctx.INDEX), mdb.ExportHashAction())},

View File

@ -75,6 +75,12 @@ const INNER = "inner"
func init() {
Index.MergeCommands(ice.Commands{
INNER: {Name: "inner path=src/ file=main.go line=1 auto", Help: "源代码", Role: aaa.VOID, Actions: ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
web.AddPortalProduct(m, "编辑器", `
一款网页版的编辑器打开网页即可随时随地的编程
无论这些代码是保存在本机还是远程还是任何虚拟的空间无论是内存还是磁盘
`, 400.0)
}},
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) {
if m.Cmdy(mdb.PLUGIN, arg); m.Result() == "" {
m.Cmdy(mdb.PLUGIN, m.Option(lex.PARSE, strings.ToLower(kit.Split(path.Base(arg[1]), nfs.PT)[0])), arg[1:])

View File

@ -70,6 +70,10 @@ func init() {
Index.MergeCommands(ice.Commands{
XTERM: {Name: "xterm refresh", Help: "终端", Icon: "Terminal.png", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
web.AddPortalProduct(m, "命令行", `
一款网页版的命令行打开网页即可随时随地的敲命令
无论这些命令是运行在本机还是远程还是任何虚拟的空间无论是内存还是磁盘
`, 500.0)
kit.For([]string{
"xterm/lib/xterm.js",
"xterm/css/xterm.css",

View File

@ -37,17 +37,20 @@ fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.inner.output di
--code-function:cyan; --code-constant:silver; --code-string:silver;
--code-package:silver; --code-datatype:silver; --code-object:silver;
}
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { border-left:var(--box-notice3); }
// body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { border:var(--box-border); }
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { box-shadow:var(--th-box-shadow); border:0; border-left:var(--box-notice3); }
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell]:hover { box-shadow:var(--notice-box-shadow); }
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { background-color:var(--code-bg-color); color:var(--code-fg-color); padding:var(--button-padding); margin-top:var(--button-margin); }
fieldset.web.wiki.portal>div.output>div.layout>div.main table.content div.story[data-type=spark][data-name=shell] { margin-top:unset; }
fieldset.web.wiki.portal.home>div.output>div.layout>div.main p { white-space:pre-wrap; text-align:center; }
fieldset.web.wiki.portal.home>div.output>div.layout>div.main p:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); }
body.dark fieldset.web.wiki.portal>div.output>div.layout { background-color:var(--plugin-bg-color); --code-bg-color:var(--output-bg-color); }
body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:hover { background-color:var(--plugin-bg-color); }
body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.select { background-color:var(--plugin-bg-color); }
body.dark fieldset.web.wiki.portal>div.output>div.layout { background-color:var(--plugin-bg-color); --code-bg-color:var(--output-bg-color); }
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset:not(.macos) { border:var(--plugin-border); }
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.output>div.output { border-radius:var(--plugin-radius); }
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { border-left:var(--box-notice3); }
// body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { border:var(--box-border); }
body.white fieldset.web.wiki.portal>div.output>div.header { color:silver; }
body.light fieldset.web.wiki.portal>div.output>div.header { color:white; }
body.light fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { --hover-fg-color:black; }
@ -57,8 +60,6 @@ body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.nav { height:400p
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main { height:unset; }
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column { padding:10px 0 !important; }
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset { width:fit-content; }
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset:not(.macos) { border:var(--plugin-border); }
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.output>div.output { border-radius:var(--plugin-radius); }
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset>div.action { display:none; }
body.mobile fieldset.web.wiki.portal.cmd>div.output>div.header div.story[data-name=navmenu] div.item { line-height:calc(var(--portal-header-height) - 2 * var(--legend-padding)); }
body.mobile fieldset.web.wiki.portal.home>div.output>div.layout>div.main p { white-space:normal; text-align:center; padding:var(--button-padding); }

View File

@ -2,64 +2,14 @@ package wiki
import (
"path"
"strings"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/lex"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
)
func _portal_commands(m *ice.Message, arg ...string) {
const (
MAIN = "main"
BASE = "base"
CORE = "core"
MISC = "misc"
)
help := map[string]string{}
list := map[string][]string{}
m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) {
if p := kit.ExtChange(cmd.FileLine(), nfs.SHY); nfs.Exists(m, p) {
help[strings.TrimPrefix(m.PrefixKey(), "web.")] = p
}
if strings.Contains(cmd.FileLine(), ice.Info.Make.Module) || strings.HasPrefix(cmd.FileLine(), ice.Info.Make.Path+nfs.SRC) {
list[MAIN] = append(list[MAIN], m.PrefixKey())
} else if strings.Contains(cmd.FileLine(), nfs.PS+ice.ICEBERGS) {
for _, mod := range []string{BASE, CORE, MISC} {
if strings.Contains(cmd.FileLine(), nfs.PS+mod) {
list[mod] = append(list[mod], m.PrefixKey())
}
}
}
})
text := []string{"navmenu `"}
for _, mod := range []string{BASE, CORE, MISC} {
text = append(text, kit.Format("%s %s/", map[string]string{MAIN: "业务模块", BASE: "基础模块", CORE: "核心模块", MISC: "其它模块"}[mod], mod))
last := "ice"
for _, cmd := range list[mod] {
kit.If(mod != BASE, func() { cmd = strings.TrimPrefix(cmd, "web.") })
if !strings.HasPrefix(cmd, last) {
last = strings.Split(cmd, nfs.PT)[0]
if p := path.Join(nfs.USR_LEARNING_PORTAL, path.Join(arg...), mod, last); nfs.Exists(m, p) {
text = append(text, kit.Format(" %s %s/", last, last))
}
}
cmd = strings.TrimPrefix(cmd, last+nfs.PT)
if p := path.Join(nfs.USR_LEARNING_PORTAL, path.Join(arg...), mod, last, strings.Replace(cmd, nfs.PT, nfs.PS, -1)+".shy"); nfs.Exists(m, p) {
text = append(text, kit.Format(" %s %s.shy", cmd, cmd))
} else if p, ok := help[last+nfs.PT+cmd]; ok {
text = append(text, kit.Format(" %s %s", cmd, kit.TrimPrefix(m.FileURI(p), nfs.P, nfs.REQUIRE)))
}
}
}
text = append(text, "`")
m.Cmd(nfs.SAVE, path.Join(nfs.USR_LEARNING_PORTAL, path.Join(arg...), INDEX_SHY), strings.Join(text, lex.NL))
}
const (
INDEX_SHY = "index.shy"
HEADER = "header"
@ -77,17 +27,15 @@ func init() {
ctx.Run(m, arg...)
m.Cmd(nfs.SAVE, p, ice.Maps{nfs.CONTENT: m.FormatsMeta(nil), nfs.DIR_ROOT: ""})
} else {
m.Option(ice.MSG_USERROLE, aaa.TECH)
// m.Option(ice.MSG_USERROLE, aaa.TECH)
m.Copy(m.Spawn([]byte(m.Cmdx(nfs.CAT, p))))
}
}},
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcessIframe(m, arg...) }},
}, web.ServeCmdAction(), web.DreamTablesAction()), Hand: func(m *ice.Message, arg ...string) {
if m.Push(HEADER, m.Cmdx(WORD, _portal_path(m, INDEX_SHY))); len(arg) > 0 {
kit.If(path.Join(arg...) == "commands", func() { _portal_commands(m, arg...) })
m.Push(NAV, m.Cmdx(WORD, _portal_path(m, path.Join(arg...), INDEX_SHY)))
}
web.Count(m, "", path.Join(arg...))
m.Display("")
}},
})

View File

@ -138,6 +138,14 @@ open http://localhost:9020
m.Cmdy(STYLE, END)
}
func _spark_product(m *ice.Message, arg ...string) {
if len(arg) == 0 {
m.Cmd("web.product").Table(func(value ice.Maps) {
if value[mdb.DISABLE] != ice.FALSE {
_spark_product(m, value[ctx.INDEX], value[mdb.NAME], value[mdb.TEXT])
}
})
return
}
m.Cmdy(SPARK, TITLE, arg[1]).Cmdy(SPARK, arg[2])
m.Cmdy(FIELD, arg[1], arg[0], arg[3:])
}