forked from x/icebergs
add some
This commit is contained in:
parent
bacfa95eed
commit
b71cf092a2
@ -274,7 +274,7 @@ func HashSelect(m *ice.Message, arg ...string) *ice.Message {
|
||||
m.Options(ice.TABLE_CHECKBOX, Config(m, html.CHECKBOX))
|
||||
return m.Action(CREATE, PRUNES)
|
||||
}
|
||||
return sortByField(m, HashField(m))
|
||||
return sortByField(m, HashField(m), arg...)
|
||||
}
|
||||
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"))
|
||||
@ -386,12 +386,16 @@ 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) })
|
||||
return miss.Rich(path.Join(prefix, kit.Keys(chain)), cache, data)
|
||||
}
|
||||
func sortByField(m *ice.Message, fields string) *ice.Message {
|
||||
func sortByField(m *ice.Message, fields string, arg ...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])
|
||||
if key == HASH {
|
||||
m.Push(key, kit.Select(value[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]) })
|
||||
|
@ -35,6 +35,7 @@ func _mdb_select(m *ice.Message, cb Any, key string, value Map, fields []string,
|
||||
cb(kit.ToMaps(value))
|
||||
case string, []string, []Any, nil:
|
||||
if m.FieldsIsDetail() {
|
||||
// m.Push(ice.FIELDS_DETAIL, value, nil, kit.Dict(HASH, key))
|
||||
m.Push(ice.FIELDS_DETAIL, value)
|
||||
} else {
|
||||
m.Push(key, value, fields, val)
|
||||
@ -125,6 +126,7 @@ const (
|
||||
OFFEND = "offend"
|
||||
OFFSET = "offset"
|
||||
RANDOM = "random"
|
||||
WEIGHT = "weight"
|
||||
SUBKEY = "mdb.sub"
|
||||
|
||||
ACTION = "action"
|
||||
|
@ -29,6 +29,8 @@ func _space_qrcode(m *ice.Message, dev string) {
|
||||
}
|
||||
func _space_dial(m *ice.Message, dev, name string, arg ...string) {
|
||||
origin := m.Cmdv(SPIDE, dev, CLIENT_ORIGIN)
|
||||
m.Info("what %v", origin)
|
||||
m.Info("what %v", m.Cmd(SPIDE, dev).FormatMeta())
|
||||
u := kit.ParseURL(kit.MergeURL2(strings.Replace(origin, HTTP, "ws", 1), PP(SPACE), mdb.TYPE, ice.Info.NodeType, mdb.NAME, name, mdb.NAME, "", mdb.ICONS, mdb.Config(m, mdb.ICONS),
|
||||
mdb.TIME, ice.Info.Make.Time, nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(), cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH, arg))
|
||||
args := kit.SimpleKV("type,name,host,port", u.Scheme, dev, u.Hostname(), kit.Select(kit.Select(tcp.PORT_443, tcp.PORT_80, u.Scheme == "ws"), u.Port()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user