1
0
forked from x/icebergs

add pie.go

This commit is contained in:
shylinux 2021-11-17 10:48:37 +08:00
parent f622b9ff32
commit f0b3a57395
5 changed files with 25 additions and 2 deletions

View File

@ -86,6 +86,8 @@ func init() {
}, Commands: map[string]*ice.Command{ }, Commands: map[string]*ice.Command{
web.WEB_LOGIN: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { web.WEB_LOGIN: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
switch arg[0] { switch arg[0] {
case "/pod/":
return // 免登录
case "/header": case "/header":
switch kit.Select("", arg, 1) { switch kit.Select("", arg, 1) {
case AGENT, CHECK, aaa.LOGIN: case AGENT, CHECK, aaa.LOGIN:

View File

@ -20,6 +20,11 @@ func init() {
nfs.SAVE: {Name: "save type file path", Help: "保存", Hand: func(m *ice.Message, arg ...string) { nfs.SAVE: {Name: "save type file path", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(nfs.SAVE, path.Join(m.Option(kit.MDB_PATH), m.Option(kit.MDB_FILE))) m.Cmdy(nfs.SAVE, path.Join(m.Option(kit.MDB_PATH), m.Option(kit.MDB_FILE)))
}}, }},
ice.RUN: {Name: "run", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(cli.SYSTEM, GO, ice.RUN, path.Join(kit.Slice(arg, 0, 2)...))
m.Set(ice.MSG_APPEND)
m.ProcessInner()
}},
mdb.ENGINE: {Name: "engine", Help: "运行", Hand: func(m *ice.Message, arg ...string) { mdb.ENGINE: {Name: "engine", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
if m.Cmdy(mdb.ENGINE, arg); len(m.Resultv()) > 0 || m.Length() > 0 { if m.Cmdy(mdb.ENGINE, arg); len(m.Resultv()) > 0 || m.Length() > 0 {
return return

View File

@ -118,7 +118,7 @@ func Run(arg ...string) string {
if Pulse.Cmdy(arg); Pulse.Result() == "" { if Pulse.Cmdy(arg); Pulse.Result() == "" {
Pulse.Table() Pulse.Table()
} }
Pulse.Sleep("10ms") Pulse.Sleep30ms()
} }
return Pulse.Result() return Pulse.Result()

View File

@ -78,6 +78,10 @@ func (m *Message) Split(str string, field string, sp string, nl string) *Message
return m return m
} }
func (m *Message) Display(plugin string) *Message {
m.Option(MSG_DISPLAY, Display0(2, plugin)["display"])
return m
}
func (m *Message) FieldsIsDetail() bool { func (m *Message) FieldsIsDetail() bool {
if m.OptionFields() == "detail" { if m.OptionFields() == "detail" {
return true return true

View File

@ -25,7 +25,19 @@ func init() {
), ),
)}, )},
}, Commands: map[string]*ice.Command{ }, Commands: map[string]*ice.Command{
TOTAL: {Name: "total name auto", Help: "统计量", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { TOTAL: {Name: "total name auto pie", Help: "统计量", Action: map[string]*ice.Action{
"pie": {Name: "pie", Help: "饼图", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(TOTAL).Table(func(index int, value map[string]string, head []string) {
if value["name"] == "total" {
return
}
m.Push("name", value["name"])
m.Push("value", value["rest"])
})
m.Display("/plugin/story/pie.js")
m.StatusTimeCount("name", "total", "value", "1")
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) > 0 { // 提交详情 if len(arg) > 0 { // 提交详情
m.Cmd(REPOS, ice.OptionFields("name,path")).Table(func(index int, value map[string]string, head []string) { m.Cmd(REPOS, ice.OptionFields("name,path")).Table(func(index int, value map[string]string, head []string) {
if value[kit.MDB_NAME] == arg[0] { if value[kit.MDB_NAME] == arg[0] {