1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-03 20:07:01 +08:00
This commit is contained in:
shaoying 2022-10-16 08:20:02 +08:00
parent 47a1dc4cdd
commit 1aec5bd434
4 changed files with 13 additions and 15 deletions

View File

@ -196,6 +196,9 @@ func ZoneInsert(m *ice.Message, arg ...Any) {
if len(args) == 0 { if len(args) == 0 {
args = m.OptionSimple(ZoneShort(m), m.Config(FIELD)) args = m.OptionSimple(ZoneShort(m), m.Config(FIELD))
} }
if len(args)%2 == 1 {
args = args[:len(args)-1]
}
for i := len(args) - 2; i >= 0; i -= 2 { for i := len(args) - 2; i >= 0; i -= 2 {
if args[i+1] == "" { if args[i+1] == "" {
args = args[:i] args = args[:i]

View File

@ -38,7 +38,7 @@ func _plan_scope(m *ice.Message, tz int, arg ...string) (begin_time, end_time ti
return begin_time, end_time return begin_time, end_time
} }
func _plan_list(m *ice.Message, begin_time, end_time time.Time) *ice.Message { func _plan_list(m *ice.Message, begin_time, end_time time.Time) *ice.Message {
m.Option(mdb.CACHE_LIMIT, "100") m.Option(mdb.CACHE_LIMIT, "-1")
m.OptionFields("begin_time,close_time,zone,id,level,status,score,type,name,text,pod,extra") m.OptionFields("begin_time,close_time,zone,id,level,status,score,type,name,text,pod,extra")
m.Cmd(mdb.SELECT, m.Prefix(TASK), "", mdb.ZONE, mdb.FOREACH, func(key string, fields []string, value, val ice.Map) { m.Cmd(mdb.SELECT, m.Prefix(TASK), "", mdb.ZONE, mdb.FOREACH, func(key string, fields []string, value, val ice.Map) {
begin, _ := time.ParseInLocation(ice.MOD_TIME, kit.Format(value[BEGIN_TIME]), time.Local) begin, _ := time.ParseInLocation(ice.MOD_TIME, kit.Format(value[BEGIN_TIME]), time.Local)
@ -63,12 +63,13 @@ const PLAN = "plan"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
PLAN: {Name: "plan scale=week,day,week,month,year,long begin_time@date list", Help: "计划", Actions: ice.MergeActions(ice.Actions{ PLAN: {Name: "plan scale=week,day,week,month,year,long begin_time@date list", Help: "计划", Actions: ice.MergeActions(ice.Actions{
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) { mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TODO, mdb.INPUTS, arg) }},
m.Cmdy(TODO, mdb.INPUTS, arg) mdb.INSERT: {Name: "insert zone type=once,step,week name text begin_time@date close_time@date", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
}}, m.Cmdy(TASK, mdb.INSERT, arg)
mdb.PLUGIN: {Name: "plugin extra.index extra.args", Help: "插件", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(TASK, mdb.MODIFY, arg)
}}, }},
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.MODIFY, arg) }},
mdb.EXPORT: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.EXPORT) }},
mdb.IMPORT: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.IMPORT) }},
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) { ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
m.Option(ice.POD, m.Option("task.pod")) m.Option(ice.POD, m.Option("task.pod"))
if m.Option("task.pod", ""); ctx.PodCmd(m, m.PrefixKey(), ice.RUN, arg) { if m.Option("task.pod", ""); ctx.PodCmd(m, m.PrefixKey(), ice.RUN, arg) {
@ -76,11 +77,6 @@ func init() {
} }
m.Cmdy(m.CmdAppend(TASK, arg[0], arg[1], ctx.INDEX), arg[2:]) m.Cmdy(m.CmdAppend(TASK, arg[0], arg[1], ctx.INDEX), arg[2:])
}}, }},
mdb.INSERT: {Name: "insert zone type=once,step,week name text begin_time@date close_time@date", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(TASK, mdb.INSERT, arg)
}},
mdb.EXPORT: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.EXPORT) }},
mdb.IMPORT: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.IMPORT) }},
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) { }, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
if len(arg) > 0 && arg[0] == ctx.ACTION { if len(arg) > 0 && arg[0] == ctx.ACTION {
m.Cmdy(TASK, arg) m.Cmdy(TASK, arg)

View File

@ -72,7 +72,7 @@ func init() {
m.PushButton(_task_action(m, value[STATUS])) m.PushButton(_task_action(m, value[STATUS]))
status[value[mdb.STATUS]]++ status[value[mdb.STATUS]]++
}) })
m.Status(status) m.StatusTimeCount(status)
} }
}}, }},
}) })

View File

@ -14,12 +14,11 @@ func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
TODO: {Name: "todo hash list create export import", Help: "待办", Actions: ice.MergeActions(ice.Actions{ TODO: {Name: "todo hash list create export import", Help: "待办", Actions: ice.MergeActions(ice.Actions{
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) { mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
mdb.HashInputs(m, arg) mdb.HashInputs(m, arg).Cmdy(TASK, mdb.INPUTS, arg)
// m.Cmdy(TASK, mdb.INPUTS, arg)
}}, }},
mdb.CREATE: {Name: "create zone name text", Help: "创建"}, mdb.CREATE: {Name: "create zone name text", Help: "创建"},
cli.START: {Name: "start type=once,step,week", Help: "启动", Hand: func(m *ice.Message, arg ...string) { cli.START: {Name: "start type=once,step,week", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(TASK, mdb.INSERT, m.OptionSimple("zone,type,name,text"), BEGIN_TIME, m.Time()) m.Cmd(TASK, mdb.INSERT, m.OptionSimple("zone,type,name,text"))
mdb.HashRemove(m, m.OptionSimple(mdb.HASH)) mdb.HashRemove(m, m.OptionSimple(mdb.HASH))
}}, }},
}, mdb.HashAction(mdb.FIELD, "time,hash,zone,name,text")), Hand: func(m *ice.Message, arg ...string) { }, mdb.HashAction(mdb.FIELD, "time,hash,zone,name,text")), Hand: func(m *ice.Message, arg ...string) {