1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-12-08 11:59:58 +08:00
parent d9574b3225
commit a69a06dc5e
12 changed files with 22 additions and 13 deletions

View File

@ -272,7 +272,7 @@ func init() {
PushStats(m, kit.Keys(m.CommandKey(), mdb.TOTAL), msg.Length(), "")
}
}},
}, aaa.RoleAction(), StatsAction(), DreamAction(), mdb.ImportantHashAction(ctx.TOOLS, "web.space,web.route,web.code.git.search",
}, aaa.RoleAction(), StatsAction(), DreamAction(), mdb.ImportantHashAction(ctx.TOOLS, "web.route",
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template,restart")), Hand: func(m *ice.Message, arg ...string) {
if ice.Info.NodeType == WORKER {
return

View File

@ -155,14 +155,14 @@ func GoToast(m *ice.Message, title string, cb func(toast func(name string, count
kit.If(total == 0, func() { total = 1 })
Toast(m,
kit.Format("%s %s/%s", name, strings.TrimSuffix(kit.FmtSize(int64(count)), "B"), strings.TrimSuffix(kit.FmtSize(int64(total)), "B")),
kit.Format("%s %d%%", kit.Select(m.ActionKey(), title), count*100/total), kit.Select("1000", "30000", count < total), count*100/total,
kit.Format("%s %d%%", kit.Select(m.ActionKey(), title), count*100/total), "3000", count*100/total,
)
_total = total
}
if list := cb(toast); len(list) > 0 {
Toast(m, strings.Join(list, lex.NL), ice.FAILURE, "30s")
} else {
toast(ice.SUCCESS, _total, _total)
toast(kit.JoinWord(m.ActionKey(), ice.SUCCESS, "✅"), _total, _total)
}
return m
}

View File

@ -62,7 +62,7 @@ func _space_fork(m *ice.Message) {
}
}
args := kit.Simple(mdb.TYPE, kit.Select(WORKER, m.Option(mdb.TYPE)), mdb.NAME, name, mdb.TEXT, text, m.OptionSimple(nfs.MODULE, nfs.VERSION, cli.DAEMON))
args = append(args, aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME))
args = append(args, aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
args = append(args, aaa.UA, m.Option(ice.MSG_USERUA), aaa.IP, m.Option(ice.MSG_USERIP))
if c, e := websocket.Upgrade(m.W, m.R); !m.Warn(e) {
gdb.Go(m, func() {
@ -275,7 +275,7 @@ func init() {
}
}},
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
}, mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 500, mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text,usernick,username,ip,module,version", ctx.ACTION, OPEN, REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000)), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
}, mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 500, mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text,module,version,ip,usernick,username,userrole", ctx.ACTION, OPEN, REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000)), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
if len(arg) < 2 {
defer m.StatusTimeCount(kit.Dict(ice.MAIN, mdb.Config(m, ice.MAIN)))
m.Option(ice.MSG_USERWEB, tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB)))
@ -294,7 +294,7 @@ func init() {
}
m.PushButton(kit.Select(OPEN, LOGIN, value[mdb.TYPE] == LOGIN), mdb.REMOVE)
})
m.Sort("type,name,text")
m.Sort("type,name,text", kit.Simple(WEIXIN, PORTAL, WORKER, SERVER))
} else {
_space_send(m, arg[0], kit.Simple(kit.Split(arg[1]), arg[2:])...)
}

View File

@ -11,6 +11,7 @@ import (
"shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/toolkits/util/bench"
)
@ -64,8 +65,10 @@ const BENCH = "bench"
func init() {
Index.MergeCommands(ice.Commands{
BENCH: {Help: "压测", Actions: ice.MergeActions(ice.Actions{
mdb.CREATE: {Name: "create zone*=demo"},
mdb.INSERT: {Name: "insert zone*=demo type*=http,redis name=demo text*='http://localhost:9020/chat/cmd/web.chat.favor' nconn=10 nreqs=100"},
cli.START: {Hand: func(m *ice.Message, arg ...string) {
defer web.ToastProcess(m)()
switch m.Option(mdb.TYPE) {
case HTTP:
_bench_http(m, m.Option(mdb.TEXT))

View File

@ -111,6 +111,7 @@ func init() {
m.Cmdy(nfs.DIR, arg[0], "time,path,size,hash,link,action", ice.OptionFields(mdb.DETAIL))
web.PushImages(m, web.P(PUBLISH, arg[0]))
}
m.PushAction(nfs.TRASH)
}},
})
}

View File

@ -162,6 +162,7 @@ func init() {
}},
ice.APP: {Help: "本机", Hand: func(m *ice.Message, arg ...string) {
cli.OpenCmds(m, "cd "+kit.Path(""), "vim "+path.Join(arg[0], arg[1])+" +"+arg[2]).ProcessHold()
m.ProcessHold()
}},
COMPILE: {Help: "编译", Hand: func(m *ice.Message, arg ...string) {
if m.Option(nfs.PATH) != "" && nfs.ExistsFile(m, path.Join(m.Option(nfs.PATH), ice.MAKEFILE)) {

View File

@ -77,7 +77,7 @@ func init() {
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.WORKER, web.SERVER), func() { m.PushButton(kit.Dict(m.CommandKey(), "计划")) })
}},
}, aaa.RoleAction(), ctx.ConfAction(mdb.TOOLS, "todo,task,epic"), TASK), Hand: func(m *ice.Message, arg ...string) {
}, aaa.RoleAction(), ctx.ConfAction(mdb.TOOLS, "todo,epic"), TASK), Hand: func(m *ice.Message, arg ...string) {
begin_time, end_time := _plan_scope(m, kit.Slice(arg, 0, 2)...)
_plan_list(m, begin_time.Format(ice.MOD_TIME), end_time.Format(ice.MOD_TIME))
web.PushPodCmd(m, "", arg...)

View File

@ -25,7 +25,7 @@ const WORD = "word"
func init() {
Index.MergeCommands(ice.Commands{
WORD: {Name: "word path=src/main.shy@key auto favor play", Help: "上下文", Icon: "Books.png", Actions: ice.MergeActions(ice.Actions{
WORD: {Name: "word path=src/main.shy@key auto play favor", Help: "上下文", Icon: "Books.png", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
WordAlias(m, NAVMENU, TITLE, NAVMENU)
WordAlias(m, PREMENU, TITLE, PREMENU)

View File

@ -106,10 +106,10 @@ func _repos_each(m *ice.Message, title string, cb func(*git.Repository, ice.Maps
if msg.Length() == 0 {
return
}
web.GoToast(m, kit.Select(m.CommandKey()+lex.SP+m.ActionKey(), title), func(toast func(string, int, int)) (list []string) {
web.GoToast(m, kit.Select(m.CommandKey(), title), func(toast func(string, int, int)) (list []string) {
count, total := 0, msg.Length()
msg.Table(func(value ice.Maps) {
toast(value[REPOS], count, total)
toast(kit.JoinWord(m.ActionKey(), value[REPOS]), count, total)
if err := cb(_repos_open(m, value[REPOS]), value); err != nil && err != git.NoErrAlreadyUpToDate {
web.Toast(m, err.Error(), "error: "+value[REPOS], "", "3s").Sleep3s()
list = append(list, value[REPOS])

View File

@ -50,6 +50,9 @@ func init() {
defer web.ToastProcess(m)()
from, days, commit, adds, dels, rest := "", 0, 0, 0, 0, 0
TableGo(ReposList(m.Spawn()), func(value ice.Maps, lock *task.Lock) {
if kit.IsIn(value[REPOS], "websocket", "go-qrcode", "go-git", "icons", "geoarea") {
return
}
msg := m.Cmd("_sum", value[nfs.PATH], mdb.TOTAL, "10000")
defer lock.Lock()()
msg.Table(func(value ice.Maps) {

View File

@ -171,9 +171,9 @@ func (s relay) ForFlow(m *ice.Message) {
func (s relay) List(m *ice.Message, arg ...string) *ice.Message {
if s.Hash.List(m, arg...); len(arg) == 0 {
if m.Length() == 0 {
m.Action(s.Create, s.Compile, s.Publish, s.Pubkey)
m.Action(s.Compile, s.Publish, s.Pubkey, s.Create)
} else {
m.Action(s.Create, s.Compile, s.Publish, s.Pubkey, s.Upgrade, s.Version, s.Stats, s.ForEach, s.ForFlow)
m.Action(s.Compile, s.Publish, s.Pubkey, s.Create, s.Upgrade, s.Version, s.Stats, s.ForEach, s.ForFlow)
}
}
stats := map[string]int{}

View File

@ -60,7 +60,7 @@ func init() {
)
Index.MergeCommands(ice.Commands{
IDE: {Name: "ide hash auto", Help: "集成开发环境", Meta: Meta(), Actions: ice.MergeActions(ice.Actions{
code.AUTOGEN: {Name: "autogen projectname*=demo appid*='wxf4e5104d83476ed6' serve*='https://2021.shylinux.com'", Help: "生成", Hand: func(m *ice.Message, arg ...string) {
code.AUTOGEN: {Name: "autogen projectname*='终端工具链' appid*='wxf4e5104d83476ed6' serve*='https://2021.shylinux.com'", Help: "生成", Hand: func(m *ice.Message, arg ...string) {
const (
CONF_JS = "conf.js"
APP_JSON = "app.json"
@ -93,6 +93,7 @@ func init() {
kit.Value(app, PAGES, kit.AddUniq(kit.Simple(kit.Value(app, PAGES)), list...))
m.Cmd(nfs.SAVE, p+APP_JSON, kit.Formats(app))
IdeCli(m.Sleep3s(), cli.OPEN, "--project", kit.Path(mdb.Config(m, PROJECT, p)))
m.ProcessInner()
}},
aaa.LOGIN: {Help: "登录", Hand: func(m *ice.Message, arg ...string) {
p := nfs.TempName(m)