forked from x/icebergs
opt island
This commit is contained in:
parent
a12a4836b9
commit
ef97bf61ca
@ -128,6 +128,9 @@ func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title
|
|||||||
var Icons = map[string]string{ice.PROCESS: "🕑", ice.FAILURE: "❌", ice.SUCCESS: "✅"}
|
var Icons = map[string]string{ice.PROCESS: "🕑", ice.FAILURE: "❌", ice.SUCCESS: "✅"}
|
||||||
|
|
||||||
func toastContent(m *ice.Message, state string, arg ...ice.Any) string {
|
func toastContent(m *ice.Message, state string, arg ...ice.Any) string {
|
||||||
|
if len(arg) > 0 {
|
||||||
|
return kit.JoinWord(kit.Simple(Icons[state], arg)...)
|
||||||
|
}
|
||||||
return kit.JoinWord(kit.Simple(Icons[state], m.ActionKey(), state, arg)...)
|
return kit.JoinWord(kit.Simple(Icons[state], m.ActionKey(), state, arg)...)
|
||||||
}
|
}
|
||||||
func ToastSuccess(m *ice.Message, arg ...ice.Any) {
|
func ToastSuccess(m *ice.Message, arg ...ice.Any) {
|
||||||
@ -137,7 +140,7 @@ func ToastFailure(m *ice.Message, arg ...ice.Any) {
|
|||||||
Toast(m, toastContent(m, ice.FAILURE, arg...), "", m.OptionDefault(ice.TOAST_DURATION, "3s")).Sleep(m.OptionDefault(ice.TOAST_DURATION, "3s"))
|
Toast(m, toastContent(m, ice.FAILURE, arg...), "", m.OptionDefault(ice.TOAST_DURATION, "3s")).Sleep(m.OptionDefault(ice.TOAST_DURATION, "3s"))
|
||||||
}
|
}
|
||||||
func ToastProcess(m *ice.Message, arg ...ice.Any) func() {
|
func ToastProcess(m *ice.Message, arg ...ice.Any) func() {
|
||||||
Toast(m, toastContent(m, ice.PROCESS, arg...), "", "30s")
|
Toast(m, toastContent(m, ice.PROCESS, arg...), "", "180s")
|
||||||
return func() { Toast(m, toastContent(m, ice.SUCCESS, arg...), "", "1s") }
|
return func() { Toast(m, toastContent(m, ice.SUCCESS, arg...), "", "1s") }
|
||||||
}
|
}
|
||||||
func GoToast(m *ice.Message, title string, cb func(toast func(name string, count, total int)) []string) *ice.Message {
|
func GoToast(m *ice.Message, title string, cb func(toast func(name string, count, total int)) []string) *ice.Message {
|
||||||
|
@ -119,6 +119,7 @@ func _space_fork(m *ice.Message) {
|
|||||||
m.Cmd(SPACE, value[mdb.NAME], gdb.EVENT, gdb.HAPPEN, gdb.EVENT, OPS_SERVER_OPEN, args, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
m.Cmd(SPACE, value[mdb.NAME], gdb.EVENT, gdb.HAPPEN, gdb.EVENT, OPS_SERVER_OPEN, args, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
m.Cmd(gdb.EVENT, gdb.HAPPEN, gdb.EVENT, OPS_SERVER_OPEN, args)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_space_handle(m, false, name, c)
|
_space_handle(m, false, name, c)
|
||||||
|
1
misc.go
1
misc.go
@ -80,6 +80,7 @@ func (m *Message) PushDetail(value Any, arg ...string) *Message {
|
|||||||
case string:
|
case string:
|
||||||
value = kit.UnMarshal(v)
|
value = kit.UnMarshal(v)
|
||||||
}
|
}
|
||||||
|
m.OptionFields("detail")
|
||||||
return m.Push(FIELDS_DETAIL, value, kit.Split(kit.Join(arg)))
|
return m.Push(FIELDS_DETAIL, value, kit.Split(kit.Join(arg)))
|
||||||
}
|
}
|
||||||
func (m *Message) RenameOption(from, to string) *Message {
|
func (m *Message) RenameOption(from, to string) *Message {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user