1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-02-02 22:26:57 +08:00
parent df4575cf2e
commit e1a891fdc0
4 changed files with 19 additions and 18 deletions

View File

@ -279,20 +279,7 @@ func HashSelect(m *ice.Message, arg ...string) *ice.Message {
m.Options(ice.TABLE_CHECKBOX, Config(m, html.CHECKBOX))
return m.Action(CREATE, PRUNES)
}
m.Table(func(value ice.Maps) {
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
return sortByField(m, HashField(m))
}
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"))
@ -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) })
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]) })
})
}

View File

@ -248,6 +248,8 @@ func ZoneSelect(m *ice.Message, arg ...string) *ice.Message {
m.Sort(ZoneShort(m)).PushAction(Config(m, ACTION), REMOVE).Action(CREATE)
} 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")
} else {
sortByField(m, ZoneField(m))
}
return m
}

View File

@ -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 {
return m.Cmdx(SPACE, ice.OPS, cmd, arg)
return m.Cmdx(append([]ice.Any{SPACE, ice.OPS, cmd}, arg...)...)
} else {
return m.Cmdx(cmd, arg)
return m.Cmdx(append([]ice.Any{cmd}, arg...)...)
}
}

View File

@ -256,5 +256,6 @@ func (m *Message) resource(file string) string {
p = strings.Split(p, "/pkg/mod/")[1]
}
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))
}