From 1c9b74c2b955b05ad252a70aec65e07ea9c62198 Mon Sep 17 00:00:00 2001 From: shaoying Date: Tue, 2 Jun 2020 17:19:27 +0800 Subject: [PATCH] add some --- base/web/route.go | 2 +- base/web/share.go | 7 +++++++ core/chat/action.go | 20 ++++++++++++-------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/base/web/route.go b/base/web/route.go index 4f8dc829..b3be9d20 100644 --- a/base/web/route.go +++ b/base/web/route.go @@ -71,7 +71,7 @@ func init() { m.Push(kit.MDB_NAME, val[kit.MDB_NAME]) } }) - if m.W != nil { + if m.W != nil && len(arg) < 2 { m.Table(func(index int, value map[string]string, field []string) { m.Push("link", Format("a", kit.MergeURL(m.Option(ice.MSG_USERWEB), "pod", value["name"]), value["name"])) }) diff --git a/base/web/share.go b/base/web/share.go index cfa7713c..6316e11f 100644 --- a/base/web/share.go +++ b/base/web/share.go @@ -69,6 +69,12 @@ func _share_create(m *ice.Message, kind, name, text string, arg ...string) { func _share_local(m *ice.Message, arg ...string) { p := path.Join(arg...) + if m.Option("pod") != "" { + m.Cmdy(ice.WEB_SPACE, m.Option("pod"), "nfs.cat", p) + m.Render(ice.RENDER_RESULT) + return + } + switch ls := strings.Split(p, "/"); ls[0] { case "etc", "var": return @@ -109,6 +115,7 @@ func _share_action_redirect(m *ice.Message, value map[string]interface{}, share "title", kit.Format(value["name"]), "river", kit.Value(value, "extra.river"), "storm", kit.Value(value, "extra.storm"), + "pod", kit.Value(value, "extra.tool.0.pod"), kit.UnMarshal(kit.Format(kit.Value(value, "extra.tool.0.value"))), ) return true diff --git a/core/chat/action.go b/core/chat/action.go index c2a3fa2e..8d4787fc 100644 --- a/core/chat/action.go +++ b/core/chat/action.go @@ -6,13 +6,18 @@ import ( ) func _action_share_create(m *ice.Message, arg ...string) { + m.Debug("info %v", arg) if m.Option("index") != "" { - arg = append(arg, "tool.0.pod", m.Option("node")) - arg = append(arg, "tool.0.ctx", m.Option("group")) - arg = append(arg, "tool.0.cmd", m.Option("index")) - arg = append(arg, "tool.0.args", m.Option("args")) - arg = append(arg, "tool.0.value", m.Option("value")) - arg = append(arg, "tool.0.single", "yes") + m.Debug("info %v", arg) + m.Cmdy(ice.WEB_SHARE, ice.TYPE_ACTION, m.Option("name"), m.Option("text"), + "tool.0.pod", kit.Select(m.Option("pod"), m.Option("node")), + "tool.0.ctx", m.Option("group"), + "tool.0.cmd", m.Option("index"), + "tool.0.args", m.Option("args"), + "tool.0.value", m.Option("value"), + "tool.0.single", "yes", + ) + return } else { m.Option(ice.MSG_RIVER, arg[5]) m.Option(ice.MSG_STORM, arg[7]) @@ -23,7 +28,6 @@ func _action_share_create(m *ice.Message, arg ...string) { arg = append(arg, kit.Format("tool.%d.args", index), value["args"]) }) } - m.Cmdy(ice.WEB_SHARE, ice.TYPE_ACTION, m.Option("name"), arg[2], arg[3], arg[4:]) } func _action_share_select(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Richs(ice.WEB_SHARE, nil, m.Option("share"), func(key string, value map[string]interface{}) { @@ -52,7 +56,7 @@ func _action_share_update(m *ice.Message, c *ice.Context, cmd string, arg ...str m.Richs(ice.WEB_SHARE, nil, m.Option("share"), func(key string, value map[string]interface{}) { kit.Fetch(kit.Value(value, kit.Keys("extra.tool", arg[2])), func(value map[string]interface{}) { - cmds := kit.Simple(m.Space(value["pod"]), kit.Keys(value["ctx"], value["cmd"]), arg[3:]) + cmds := kit.Simple(kit.Keys(value["ctx"], value["cmd"]), arg[3:]) m.Cmdy(_action_proxy(m), cmds).Option("cmds", cmds) }) })