mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 17:18:05 +08:00
opt some
This commit is contained in:
parent
422e209dc3
commit
df6c21da07
@ -88,6 +88,14 @@ func init() {
|
||||
|
||||
var Upload = func(*ice.Message) []string { return nil }
|
||||
|
||||
func CmdInputs(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case INDEX:
|
||||
m.Cmdy(COMMAND, mdb.SEARCH, COMMAND, ice.OptionFields(INDEX))
|
||||
case ARGS:
|
||||
m.Cmdy(m.Option(INDEX))
|
||||
}
|
||||
}
|
||||
func PodCmd(m *ice.Message, arg ...ice.Any) bool {
|
||||
Upload(m)
|
||||
if pod := m.Option(ice.POD); pod != "" {
|
||||
|
@ -17,13 +17,16 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
JS: {Name: "js path auto", Help: "前端", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
ProcessXterm(m, "node", kit.Format(`require("./usr/volcanos/proto.js"), require("./usr/volcanos/publish/client/nodejs/proto.js"), Volcanos.meta._main("%s")`, path.Join(ice.PS, arg[2], arg[1])))
|
||||
ProcessXterm(m, "node", kit.Format(`require("./usr/volcanos/proto.js"), require("./usr/volcanos/publish/client/nodejs/proto.js"), Volcanos.meta._main("%s")`, path.Join(nfs.PS, arg[2], arg[1])))
|
||||
}},
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[2] == ice.USR_VOLCANOS {
|
||||
if strings.HasPrefix(arg[1], ice.PLUGIN_LOCAL) {
|
||||
ctx.ProcessCommand(m, kit.Select(ice.CAN_PLUGIN, "web."+strings.Replace(kit.TrimExt(strings.TrimPrefix(arg[1], ice.PLUGIN_LOCAL), JS), ice.PS, ice.PT, -1)), kit.Simple())
|
||||
m.Debug("what %v %v", arg[1], ice.PLUGIN_LOCAL)
|
||||
if strings.HasPrefix(arg[1], "plugin/local/") {
|
||||
ctx.ProcessCommand(m, kit.Select(ice.CAN_PLUGIN, "web."+strings.Replace(strings.TrimSuffix(strings.TrimPrefix(arg[1], "plugin/local/"), nfs.PT+JS), nfs.PS, nfs.PT, -1)), kit.Simple())
|
||||
m.Debug("what %v", m.FormatMeta())
|
||||
}
|
||||
m.Debug("what %v", m.FormatMeta())
|
||||
} else {
|
||||
ctx.DisplayBase(m, require(arg[2], arg[1]))
|
||||
ctx.ProcessCommand(m, kit.Select(ice.CAN_PLUGIN, ctx.GetFileCmd(kit.ExtChange(path.Join(arg[2], arg[1]), GO))), kit.Simple())
|
||||
|
@ -14,22 +14,16 @@ const EPIC = "epic"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
EPIC: {Name: "epic hash list", Help: "史记", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create time zone name"}, mdb.MODIFY: {Name: "modify time zone name"},
|
||||
EPIC: {Name: "epic hash list create", Help: "史记", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create time@date zone name"}, mdb.MODIFY: {Name: "modify time zone name"},
|
||||
}, mdb.HashAction(mdb.FIELD, "time,hash,zone,name")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||
if span := kit.Time(m.Time()) - kit.Time(value[mdb.TIME]); span > 0 {
|
||||
m.Push(mdb.TEXT, kit.Format(`已经 <span style="font-size:24px;color:red">%v</span> 天<br>距 %s<br>`,
|
||||
int(time.Duration(span)/time.Hour/24), kit.Split(value[mdb.TIME])[0],
|
||||
))
|
||||
m.Push(mdb.TEXT, kit.Format(`已经 <span style="font-size:24px;color:red">%v</span> 天<br>距 %s<br>`, int(time.Duration(span)/time.Hour/24), kit.Split(value[mdb.TIME])[0]))
|
||||
} else {
|
||||
m.Push(mdb.TEXT, kit.Format(`还有 <span style="font-size:24px;color:green">%v</span> 天<br>距 %s<br>`,
|
||||
-int(time.Duration(span)/time.Hour/24)+1, kit.Split(value[mdb.TIME])[0],
|
||||
))
|
||||
m.Push(mdb.TEXT, kit.Format(`还有 <span style="font-size:24px;color:green">%v</span> 天<br>距 %s<br>`, -int(time.Duration(span)/time.Hour/24)+1, kit.Split(value[mdb.TIME])[0]))
|
||||
}
|
||||
}).PushAction(mdb.MODIFY, mdb.REMOVE); len(arg) == 0 || arg[0] == "" {
|
||||
m.Sort(mdb.TIME).Action(mdb.CREATE, mdb.EXPORT, mdb.IMPORT)
|
||||
}
|
||||
}).PushAction(mdb.MODIFY, mdb.REMOVE)
|
||||
web.PushPodCmd(m, "", arg...)
|
||||
ctx.DisplayTableCard(m)
|
||||
}},
|
||||
|
@ -32,8 +32,7 @@ func _plan_scope(m *ice.Message, arg ...string) (begin_time, end_time time.Time)
|
||||
return begin_time, end_time
|
||||
}
|
||||
func _plan_list(m *ice.Message, begin_time, end_time string) {
|
||||
m.Option(mdb.CACHE_LIMIT, "-1")
|
||||
m.OptionFields("begin_time,close_time,zone,id,level,status,score,type,name,text,pod,extra")
|
||||
m.Options(mdb.CACHE_LIMIT, "-1").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) {
|
||||
if begin_time <= kit.Format(value[BEGIN_TIME]) && kit.Format(value[BEGIN_TIME]) < end_time {
|
||||
m.Push(key, value, fields, val).PushButton(_task_action(m, value[STATUS], mdb.PLUGIN))
|
||||
@ -76,8 +75,8 @@ func init() {
|
||||
begin_time, end_time := _plan_scope(m, kit.Slice(arg, 0, 2)...)
|
||||
_plan_list(m, begin_time.Format(ice.MOD_TIME), end_time.Format(ice.MOD_TIME))
|
||||
web.PushPodCmd(m, "", arg...)
|
||||
ctx.Toolkit(m, TODO, TASK, EPIC)
|
||||
ctx.DisplayLocal(m, "")
|
||||
ctx.Toolkit(m, TODO, TASK, EPIC)
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
package team
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
@ -30,18 +33,18 @@ func _task_modify(m *ice.Message, field, value string, arg ...string) {
|
||||
mdb.ZoneModify(m, field, value, arg)
|
||||
}
|
||||
|
||||
const ( // type
|
||||
const (
|
||||
ONCE = "once"
|
||||
STEP = "step"
|
||||
// WEEK = "week"
|
||||
)
|
||||
const ( // status
|
||||
const (
|
||||
PREPARE = "prepare"
|
||||
PROCESS = "process"
|
||||
CANCEL = "cancel"
|
||||
FINISH = "finish"
|
||||
)
|
||||
const ( // key
|
||||
const (
|
||||
BEGIN_TIME = "begin_time"
|
||||
CLOSE_TIME = "close_time"
|
||||
|
||||
@ -57,16 +60,20 @@ const TASK = "task"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
TASK: {Name: "task zone id auto insert export import", Help: "任务", Actions: ice.MergeActions(ice.Actions{
|
||||
TASK: {Name: "task zone id auto insert", Help: "任务", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
switch arg[0] = strings.TrimPrefix(arg[0], "extra."); arg[0] {
|
||||
case mdb.STATUS:
|
||||
m.Push(arg[0], PREPARE, PROCESS, CANCEL, FINISH)
|
||||
case LEVEL, SCORE:
|
||||
m.Push(arg[0], "1", "2", "3", "4", "5")
|
||||
case mdb.TYPE:
|
||||
m.Push(arg[0], ONCE, STEP, WEEK)
|
||||
case ctx.INDEX, ctx.ARGS:
|
||||
m.Option(ctx.INDEX, m.Option("extra.index"))
|
||||
ctx.CmdInputs(m, arg...)
|
||||
default:
|
||||
m.Debug("what %v", arg)
|
||||
mdb.ZoneInputs(m, arg)
|
||||
}
|
||||
}},
|
||||
@ -74,17 +81,14 @@ func init() {
|
||||
mdb.ZoneInsert(m, arg[:2], BEGIN_TIME, m.Time(), STATUS, PREPARE, LEVEL, 3, SCORE, 3, arg[2:])
|
||||
}},
|
||||
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, arg[0], arg[1], arg[2:]...) }},
|
||||
CANCEL: {Name: "cancal", Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, CANCEL) }},
|
||||
BEGIN: {Name: "begin", Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, PROCESS) }},
|
||||
END: {Name: "end", Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, FINISH) }},
|
||||
CANCEL: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, CANCEL) }},
|
||||
BEGIN: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, PROCESS) }},
|
||||
END: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, FINISH) }},
|
||||
}, mdb.ZoneAction(mdb.FIELD, "begin_time,close_time,id,status,level,score,type,name,text")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.ZoneSelect(m, arg...); len(arg) > 0 && arg[0] != "" {
|
||||
status := map[string]int{}
|
||||
m.Table(func(value ice.Maps) {
|
||||
m.PushButton(_task_action(m, value[STATUS]))
|
||||
status[value[mdb.STATUS]]++
|
||||
})
|
||||
m.StatusTimeCount(status)
|
||||
m.Table(func(value ice.Maps) { m.PushButton(_task_action(m, value[STATUS])) })
|
||||
m.Table(func(value ice.Maps) { status[value[mdb.STATUS]]++ }).StatusTimeCount(status)
|
||||
}
|
||||
}},
|
||||
})
|
||||
|
@ -12,16 +12,14 @@ const TODO = "todo"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
TODO: {Name: "todo hash list", Help: "待办", Actions: ice.MergeActions(ice.Actions{
|
||||
TODO: {Name: "todo hash list create", Help: "待办", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { mdb.HashInputs(m, arg).Cmdy(TASK, mdb.INPUTS, arg) }},
|
||||
cli.START: {Name: "start type=once,step,week", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(TASK, mdb.INSERT, m.OptionSimple("zone,type,name,text"))
|
||||
mdb.HashRemove(m, m.OptionSimple(mdb.HASH))
|
||||
}},
|
||||
}, mdb.HashAction(mdb.FIELD, "time,hash,zone,name,text")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...).PushAction(cli.START, mdb.REMOVE); len(arg) == 0 || arg[0] == "" {
|
||||
m.Action(mdb.CREATE, mdb.EXPORT, mdb.IMPORT)
|
||||
}
|
||||
mdb.HashSelect(m, arg...).PushAction(cli.START, mdb.REMOVE)
|
||||
web.PushPodCmd(m, "", arg...)
|
||||
ctx.DisplayTableCard(m)
|
||||
}},
|
||||
|
Loading…
x
Reference in New Issue
Block a user