forked from x/icebergs
add some
This commit is contained in:
parent
df88fbf2b8
commit
dc9dd86bba
@ -40,7 +40,7 @@ func DisplayStoryForm(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||
}
|
||||
}
|
||||
}
|
||||
kit.For(args, func(v string) { m.Push("", v, kit.Split("type,name,value,values,need,action")) })
|
||||
kit.For(args, func(v ice.Map) { m.Push("", v, kit.Split("type,name,value,values,need,action")) })
|
||||
return DisplayStory(m, "form")
|
||||
}
|
||||
func DisplayStoryJSON(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||
|
@ -44,7 +44,8 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
if file == "" {
|
||||
return
|
||||
}
|
||||
bio := m.Confv(FILE, kit.Keys(file, FILE)).(*bufio.Writer)
|
||||
conf := m.Confv(FILE, file)
|
||||
bio := kit.Value(conf, FILE).(*bufio.Writer)
|
||||
if bio == nil {
|
||||
return
|
||||
}
|
||||
@ -59,10 +60,7 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
func (f *Frame) Close(m *ice.Message, arg ...string) {
|
||||
ice.Info.Log = nil
|
||||
close(f.p)
|
||||
}
|
||||
func (f *Frame) Close(m *ice.Message, arg ...string) { ice.Info.Log = nil; close(f.p) }
|
||||
|
||||
const (
|
||||
PREFIX = "prefix"
|
||||
@ -112,10 +110,7 @@ var Index = &ice.Context{Name: LOG, Help: "日志模块", Configs: ice.Configs{
|
||||
|
||||
func init() { ice.Index.Register(Index, &Frame{}, TAIL) }
|
||||
|
||||
func init() {
|
||||
ice.Info.Traceid = "short"
|
||||
ice.Pulse.Option(ice.LOG_TRACEID, Traceid())
|
||||
}
|
||||
func init() { ice.Info.Traceid = "short"; ice.Pulse.Option(ice.LOG_TRACEID, Traceid()) }
|
||||
|
||||
var _trace_count int64
|
||||
|
||||
@ -133,8 +128,6 @@ func Traceid() (traceid string) {
|
||||
ls = ls[:0]
|
||||
}
|
||||
})
|
||||
kit.If(len(ls) > 0, func() {
|
||||
ls = append(ls, kit.Format(atomic.AddInt64(&_trace_count, 1)))
|
||||
})
|
||||
kit.If(len(ls) > 0, func() { ls = append(ls, kit.Format(atomic.AddInt64(&_trace_count, 1))) })
|
||||
return strings.Join(ls, "-")
|
||||
}
|
||||
|
@ -285,12 +285,16 @@ func init() {
|
||||
if p := path.Join(ice.SRC_TEMPLATE, m.PrefixKey(), path.Join(arg...)); nfs.Exists(m, p) {
|
||||
return p + kit.Select("", nfs.PS, len(arg) == 0)
|
||||
} else {
|
||||
return m.FileURI(path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), path.Join(arg...)))
|
||||
m.Debug("what %v", p)
|
||||
what := kit.MergeURL2(UserHost(m)+ctx.GetCmdFile(m, m.PrefixKey()), path.Join(arg...))
|
||||
m.Debug("what %v", what)
|
||||
return what
|
||||
// return path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), path.Join(arg...)) + kit.Select("", nfs.PS, len(arg) == 0)
|
||||
}
|
||||
}
|
||||
nfs.TemplateText = func(m *ice.Message, p string) string {
|
||||
if p := kit.Select(nfs.TemplatePath(m, path.Base(p)), m.Option("_template")); kit.HasPrefix(p, "/require/", ice.HTTP) {
|
||||
m.Debug("what %v", p)
|
||||
return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, p)
|
||||
} else {
|
||||
return m.Cmdx(nfs.CAT, p)
|
||||
|
6
info.go
6
info.go
@ -318,9 +318,13 @@ func (m *Message) FileURI(dir string) string {
|
||||
} else if kit.HasPrefix(dir, PS, HTTP) {
|
||||
return dir
|
||||
}
|
||||
m.Debug("what %v", m.Option(MSG_USERPOD))
|
||||
if strings.HasPrefix(dir, USR_VOLCANOS) {
|
||||
return strings.TrimPrefix(dir, USR)
|
||||
} else {
|
||||
return kit.MergeURL(path.Join(PS, REQUIRE, dir), POD, m.Option(MSG_USERPOD))
|
||||
m.Debug("what %v", m.Option(MSG_USERPOD))
|
||||
what := kit.MergeURL(path.Join(PS, REQUIRE, dir), POD, m.Option(MSG_USERPOD))
|
||||
m.Debug("what %v", what)
|
||||
return what
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ func (m *Message) EchoDownload(arg ...string) *Message {
|
||||
}
|
||||
func (m *Message) Display(file string, arg ...Any) *Message {
|
||||
file = m.resource(file)
|
||||
m.Option(MSG_DISPLAY, m.MergeLink(kit.Select(kit.ExtChange(file, JS), file, strings.Contains(file, QS)), arg...))
|
||||
m.Option(MSG_DISPLAY, kit.MergeURL(kit.ExtChange(file, JS), arg...))
|
||||
return m
|
||||
}
|
||||
func (m *Message) Resource(file string) string { return m.resource(file) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user