forked from x/icebergs
add some
This commit is contained in:
parent
df4575cf2e
commit
e1a891fdc0
@ -279,20 +279,7 @@ func HashSelect(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
m.Options(ice.TABLE_CHECKBOX, Config(m, html.CHECKBOX))
|
m.Options(ice.TABLE_CHECKBOX, Config(m, html.CHECKBOX))
|
||||||
return m.Action(CREATE, PRUNES)
|
return m.Action(CREATE, PRUNES)
|
||||||
}
|
}
|
||||||
m.Table(func(value ice.Maps) {
|
return sortByField(m, HashField(m))
|
||||||
m.SetAppend().OptionFields(ice.FIELDS_DETAIL)
|
|
||||||
kit.For(kit.Split(HashField(m)), func(key string) {
|
|
||||||
key = strings.TrimSuffix(key, "*")
|
|
||||||
if key == HASH {
|
|
||||||
m.Push(key, arg[0])
|
|
||||||
} else {
|
|
||||||
m.Push(key, value[key])
|
|
||||||
}
|
|
||||||
delete(value, key)
|
|
||||||
})
|
|
||||||
kit.For(kit.SortedKey(value), func(k string) { m.Push(k, value[k]) })
|
|
||||||
})
|
|
||||||
return m
|
|
||||||
}
|
}
|
||||||
func HashPrunes(m *ice.Message, cb func(Map) bool) *ice.Message {
|
func HashPrunes(m *ice.Message, cb func(Map) bool) *ice.Message {
|
||||||
expire := kit.Select(m.Time("-"+kit.Select(DAYS, Config(m, EXPIRE))), m.Option("before"))
|
expire := kit.Select(m.Time("-"+kit.Select(DAYS, Config(m, EXPIRE))), m.Option("before"))
|
||||||
@ -404,3 +391,14 @@ func Rich(m *ice.Message, prefix string, chain Any, data Any) string {
|
|||||||
kit.If(cache == nil, func() { cache = kit.Data(); m.Confv(prefix, chain, cache) })
|
kit.If(cache == nil, func() { cache = kit.Data(); m.Confv(prefix, chain, cache) })
|
||||||
return miss.Rich(path.Join(prefix, kit.Keys(chain)), cache, data)
|
return miss.Rich(path.Join(prefix, kit.Keys(chain)), cache, data)
|
||||||
}
|
}
|
||||||
|
func sortByField(m *ice.Message, fields string) *ice.Message {
|
||||||
|
return m.Table(func(value ice.Maps) {
|
||||||
|
m.SetAppend().OptionFields(ice.FIELDS_DETAIL)
|
||||||
|
kit.For(kit.Split(fields), func(key string) {
|
||||||
|
key = strings.TrimSuffix(key, "*")
|
||||||
|
m.Push(key, value[key])
|
||||||
|
delete(value, key)
|
||||||
|
})
|
||||||
|
kit.For(kit.SortedKey(value), func(k string) { m.Push(k, value[k]) })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -248,6 +248,8 @@ func ZoneSelect(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
m.Sort(ZoneShort(m)).PushAction(Config(m, ACTION), REMOVE).Action(CREATE)
|
m.Sort(ZoneShort(m)).PushAction(Config(m, ACTION), REMOVE).Action(CREATE)
|
||||||
} else if len(arg) == 1 {
|
} else if len(arg) == 1 {
|
||||||
m.Action(INSERT).StatusTimeCountTotal(_zone_meta(m, m.PrefixKey(), kit.Keys(HASH, HashSelectField(m, arg[0], HASH)), COUNT), "step", "0")
|
m.Action(INSERT).StatusTimeCountTotal(_zone_meta(m, m.PrefixKey(), kit.Keys(HASH, HashSelectField(m, arg[0], HASH)), COUNT), "step", "0")
|
||||||
|
} else {
|
||||||
|
sortByField(m, ZoneField(m))
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,10 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func AdminCmd(m *ice.Message, cmd string, arg ...string) string {
|
func AdminCmd(m *ice.Message, cmd string, arg ...ice.Any) string {
|
||||||
if ice.Info.NodeType == WORKER {
|
if ice.Info.NodeType == WORKER {
|
||||||
return m.Cmdx(SPACE, ice.OPS, cmd, arg)
|
return m.Cmdx(append([]ice.Any{SPACE, ice.OPS, cmd}, arg...)...)
|
||||||
} else {
|
} else {
|
||||||
return m.Cmdx(cmd, arg)
|
return m.Cmdx(append([]ice.Any{cmd}, arg...)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,5 +256,6 @@ func (m *Message) resource(file string) string {
|
|||||||
p = strings.Split(p, "/pkg/mod/")[1]
|
p = strings.Split(p, "/pkg/mod/")[1]
|
||||||
}
|
}
|
||||||
kit.If(file == "", func() { p = kit.ExtChange(p, JS) }, func() { p = path.Join(path.Dir(p), file) })
|
kit.If(file == "", func() { p = kit.ExtChange(p, JS) }, func() { p = path.Join(path.Dir(p), file) })
|
||||||
return m.MergeLink("/require/"+p, POD, m.Option(MSG_USERPOD))
|
return "/require/" + p
|
||||||
|
// return m.MergeLink("/require/"+p, POD, m.Option(MSG_USERPOD))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user