forked from x/icebergs
add some
This commit is contained in:
parent
2db2f39649
commit
73731c898a
@ -156,7 +156,7 @@ func GoToast(m *ice.Message, title string, cb func(toast func(name string, count
|
|||||||
icon := Icons[ice.PROCESS]
|
icon := Icons[ice.PROCESS]
|
||||||
toast := func(name string, count, total int) {
|
toast := func(name string, count, total int) {
|
||||||
kit.If(total == 0, func() { total = 1 })
|
kit.If(total == 0, func() { total = 1 })
|
||||||
Toast(m, kit.Format("%s %s %s/%s", icon, kit.JoinWord(m.ActionKey(), name), strings.TrimSuffix(kit.FmtSize(int64(count)), "B"), strings.TrimSuffix(kit.FmtSize(int64(total)), "B")),
|
Toast(m, kit.Format("%s %s %s/%s", icon, kit.JoinWord(kit.Select(m.ActionKey(), m.Option(ice.MSG_TITLE)), name), strings.TrimSuffix(kit.FmtSize(int64(count)), "B"), strings.TrimSuffix(kit.FmtSize(int64(total)), "B")),
|
||||||
"", m.OptionDefault(ice.TOAST_DURATION, "30s"), count*100/total)
|
"", m.OptionDefault(ice.TOAST_DURATION, "30s"), count*100/total)
|
||||||
_total = total
|
_total = total
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,13 @@ Volcanos(chat.ONACTION, {
|
|||||||
disable: function(event, can, msg) { can.runAction(event, mdb.MODIFY, [mdb.STATUS, mdb.DISABLE]) },
|
disable: function(event, can, msg) { can.runAction(event, mdb.MODIFY, [mdb.STATUS, mdb.DISABLE]) },
|
||||||
stop: function(event, can, msg) { can.misc.sessionStorage(can, SCRIPT_ZONE, ""), can.Update(event) },
|
stop: function(event, can, msg) { can.misc.sessionStorage(can, SCRIPT_ZONE, ""), can.Update(event) },
|
||||||
play: function(event, can) { can.core.Next(can._msg.Table(), function(value, next, index) {
|
play: function(event, can) { can.core.Next(can._msg.Table(), function(value, next, index) {
|
||||||
can.user.toastProcess(can, `${value.index} ${value.play} ${index} / ${can._msg.Length()}`)
|
can.Status(cli.STEP, index), can.user.toastProcess(can, `${value.index} ${value.play} ${index} / ${can._msg.Length()}`)
|
||||||
can.Status(cli.STEP, value.index)
|
|
||||||
var tr = can.page.Select(can, can._output, html.TR)[1]; can.onmotion.select(can, tr.parentNode, html.TR, index)
|
var tr = can.page.Select(can, can._output, html.TR)[1]; can.onmotion.select(can, tr.parentNode, html.TR, index)
|
||||||
value.status == mdb.DISABLE? next(): can.onaction.preview({}, can, can.request({}, value), next)
|
value.status == mdb.DISABLE? next(): can.onaction.preview({}, can, can.request({}, value), next)
|
||||||
}, function() { can.user.toastSuccess(can) }) },
|
}, function() { can.user.toastSuccess(can) }) },
|
||||||
preview: function(event, can, msg, next) {
|
preview: function(event, can, msg, next) {
|
||||||
can.onappend.plugin(can, {space: msg.Option(web.SPACE), index: msg.Option(ctx.INDEX)}, function(sub) { var done = false
|
can.onappend.plugin(can, {space: msg.Option(web.SPACE), index: msg.Option(ctx.INDEX)}, function(sub) { var done = false
|
||||||
function action(skip) { sub.Update(can.request({}, {_handle: ice.TRUE}), [ctx.ACTION, msg.Option(cli.PLAY)], function(msg) {
|
function action(skip) { sub.Update(sub.request({}, {_handle: ice.TRUE}), [ctx.ACTION, msg.Option(cli.PLAY)], function(msg) {
|
||||||
sub.onimport._process(sub, msg) || msg.Length() == 0 && msg.Result() == "" || can.onappend._output(sub, msg), next && next() }) }
|
sub.onimport._process(sub, msg) || msg.Length() == 0 && msg.Result() == "" || can.onappend._output(sub, msg), next && next() }) }
|
||||||
can.onmotion.delay(can, function() { if (done || sub._auto) { return } done = true, action() }, 300)
|
can.onmotion.delay(can, function() { if (done || sub._auto) { return } done = true, action() }, 300)
|
||||||
sub.onexport.output = function() { if (done) { return } done = true, action(true)
|
sub.onexport.output = function() { if (done) { return } done = true, action(true)
|
||||||
|
@ -293,6 +293,7 @@ func (s relay) Install(m *ice.Message, arg ...string) {
|
|||||||
s.Modify(m, kit.Simple(m.OptionSimple(MACHINE, web.DREAM))...)
|
s.Modify(m, kit.Simple(m.OptionSimple(MACHINE, web.DREAM))...)
|
||||||
}
|
}
|
||||||
func (s relay) Upgrade(m *ice.Message, arg ...string) {
|
func (s relay) Upgrade(m *ice.Message, arg ...string) {
|
||||||
|
m.Option(ice.MSG_TITLE, m.ActionKey())
|
||||||
if len(arg) == 0 && (m.Option(MACHINE) == "" || strings.Contains(m.Option(MACHINE), ",")) {
|
if len(arg) == 0 && (m.Option(MACHINE) == "" || strings.Contains(m.Option(MACHINE), ",")) {
|
||||||
s.foreach(m, func(msg *ice.Message, cmd []string) {
|
s.foreach(m, func(msg *ice.Message, cmd []string) {
|
||||||
ssh.PushShell(msg.Message, strings.Split(msg.Template(UPGRADE_SH), lex.NL), func(res string) {
|
ssh.PushShell(msg.Message, strings.Split(msg.Template(UPGRADE_SH), lex.NL), func(res string) {
|
||||||
@ -304,6 +305,7 @@ func (s relay) Upgrade(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (s relay) Version(m *ice.Message, arg ...string) {
|
func (s relay) Version(m *ice.Message, arg ...string) {
|
||||||
|
m.Option(ice.MSG_TITLE, m.ActionKey())
|
||||||
s.foreach(m, func(msg *ice.Message, cmd []string) {
|
s.foreach(m, func(msg *ice.Message, cmd []string) {
|
||||||
ssh.PushShell(msg.Message, strings.Split(msg.Template(VERSION_SH), lex.NL), func(res string) {
|
ssh.PushShell(msg.Message, strings.Split(msg.Template(VERSION_SH), lex.NL), func(res string) {
|
||||||
web.PushNoticeGrow(m.Options(ctx.DISPLAY, web.PLUGIN_XTERM).Message, res)
|
web.PushNoticeGrow(m.Options(ctx.DISPLAY, web.PLUGIN_XTERM).Message, res)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user