1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-05-21 23:46:04 +08:00
parent af91084d59
commit c27d82e83e
3 changed files with 32 additions and 11 deletions

View File

@ -11,7 +11,11 @@ const FLOWS = "flows"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
FLOWS: {Name: "flows refresh", Help: "工作流", Icon: "Automator.png", Actions: ice.MergeActions(ice.Actions{ FLOWS: {Name: "flows refresh", Help: "工作流", Icon: "Automator.png", Actions: ice.MergeActions(ice.Actions{
mdb.INSERT: {Name: "insert name space index* args", Hand: func(m *ice.Message, arg ...string) { mdb.CREATE: {Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(mdb.INSERT, m.ShortKey(), "", mdb.HASH, m.OptionSimple(mdb.ZONE))
m.Cmd(FLOWS, mdb.INSERT, mdb.NAME, m.Option(mdb.ZONE))
}},
mdb.INSERT: {Name: "insert name space index args", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(mdb.INSERT, m.ShortKey(), kit.KeyHash(m.Option(mdb.ZONE)), mdb.HASH, m.OptionSimple(mdb.Config(m, mdb.FIELDS))) m.Cmdy(mdb.INSERT, m.ShortKey(), kit.KeyHash(m.Option(mdb.ZONE)), mdb.HASH, m.OptionSimple(mdb.Config(m, mdb.FIELDS)))
}}, }},
mdb.DELETE: {Hand: func(m *ice.Message, arg ...string) { mdb.DELETE: {Hand: func(m *ice.Message, arg ...string) {
@ -26,10 +30,9 @@ func init() {
} else { } else {
m.Fields(len(arg)-1, mdb.Config(m, mdb.FIELDS), mdb.DETAIL) m.Fields(len(arg)-1, mdb.Config(m, mdb.FIELDS), mdb.DETAIL)
m.Cmdy(mdb.SELECT, m.ShortKey(), kit.KeyHash(arg[0]), mdb.HASH, arg[1:]) m.Cmdy(mdb.SELECT, m.ShortKey(), kit.KeyHash(arg[0]), mdb.HASH, arg[1:])
m.PushAction(mdb.PLUGIN, mdb.DELETE) m.PushAction("addnext", "addto", mdb.RENAME, mdb.PLUGIN, mdb.DELETE)
} }
m.Display("") m.Display("").DisplayCSS("")
m.DisplayCSS("")
}}, }},
}) })
} }

View File

@ -14,6 +14,7 @@ Volcanos(chat.ONIMPORT, {
}) })
}) }, }) },
_content: function(can, msg, value) { _content: function(can, msg, value) {
can.onmotion.clear(can, can.ui.content)
can.onappend.plugin(can, {index: web.WIKI_DRAW, style: html.OUTPUT, display: "/plugin/local/wiki/draw.js", height: can.ui.content.offsetHeight, width: can.ui.content.offsetWidth}, function(sub) { can.onappend.plugin(can, {index: web.WIKI_DRAW, style: html.OUTPUT, display: "/plugin/local/wiki/draw.js", height: can.ui.content.offsetHeight, width: can.ui.content.offsetWidth}, function(sub) {
sub.run = function(event, cmds, cb) { cb(can.request(event)) } sub.run = function(event, cmds, cb) { cb(can.request(event)) }
sub.onexport.output = function() { value._content_plugin = sub, can.onimport._toolkit(can, msg, value) } sub.onexport.output = function() { value._content_plugin = sub, can.onimport._toolkit(can, msg, value) }
@ -31,7 +32,6 @@ Volcanos(chat.ONIMPORT, {
}, can.ui.content||can._output) }, can.ui.content||can._output)
}, },
_display: function(can, msg, value) { _display: function(can, msg, value) {
if (msg.Length() == 0) { return can.Update(can.request({target: can._legend}, {title: mdb.INSERT, zone: value.zone}), [ctx.ACTION, mdb.INSERT]) }
var list = {}; msg.Table(function(value) { list[value.hash] = value }) var list = {}; msg.Table(function(value) { list[value.hash] = value })
var root; can.core.Item(list, function(key, item) { if (!item.prev && !item.from) { return root = item } var root; can.core.Item(list, function(key, item) { if (!item.prev && !item.from) { return root = item }
try { if (item.prev) { list[item.prev].next = item } if (item.from) { list[item.from].to = item } } catch(e) { console.log(e) } try { if (item.prev) { list[item.prev].next = item } if (item.from) { list[item.from].to = item } } catch(e) { console.log(e) }
@ -137,7 +137,25 @@ Volcanos(chat.ONACTION, {
can.core.List(list, function(item, index) { if (item == can.db.current) { next = list[index+1] } }), can.db.current = next can.core.List(list, function(item, index) { if (item == can.db.current) { next = list[index+1] } }), can.db.current = next
} can.ondetail._select(event, can, can.db.current) } can.ondetail._select(event, can, can.db.current)
}, },
plugin: function(event, can, msg) { can.ondetail._select(event, can, can.db.list[msg.Option(mdb.HASH)]) },
addnext: function(event, can) { can.onaction._insert(event, can, "prev") },
addto: function(event, can) { can.onaction._insert(event, can, "from") },
rename: function(event, can) { can.onaction._modify(event, can, [mdb.NAME]) },
plugin: function(event, can) { can.onaction._modify(event, can, [ctx.INDEX, ctx.ARGS]) },
_insert: function(event, can, from) { var value = can.db.value, msg = can.request(event)
can.user.input(event, can, can.Conf("feature.insert"), function(data) {
can.run(can.request({}, data, kit.Dict(mdb.ZONE, value.zone, from, msg.Option(mdb.HASH))), [ctx.ACTION, mdb.INSERT], function() {
can.run(event, [value.zone], function(msg) { can.onimport._content(can, msg, value) })
})
})
},
_modify: function(event, can, list) { var value = can.db.value, msg = can.request(event)
can.user.input(event, can, list, function(args) {
can.run(can.request({}, {zone: value.zone, hash: msg.Option(mdb.HASH)}), [ctx.ACTION, mdb.MODIFY].concat(args), function() {
can.run(event, [value.zone], function(msg) { can.onimport._content(can, msg, value) })
})
})
},
}) })
Volcanos(chat.ONDETAIL, { Volcanos(chat.ONDETAIL, {
_select: function(event, can, item) { if (!item) { return can.onmotion.hidden(can, can.ui.profile) } _select: function(event, can, item) { if (!item) { return can.onmotion.hidden(can, can.ui.profile) }

View File

@ -225,7 +225,7 @@ func (s relay) List(m *ice.Message, arg ...string) *ice.Message {
m.Push(web.LINK, "").PushButton(s.Xterm, s.Pushbin, s.Install, s.Remove) m.Push(web.LINK, "").PushButton(s.Xterm, s.Pushbin, s.Install, s.Remove)
} else { } else {
m.Push(web.LINK, m.HostPort(value[tcp.HOST], value[web.PORTAL])) m.Push(web.LINK, m.HostPort(value[tcp.HOST], value[web.PORTAL]))
m.PushButton(s.Portal, s.Desktop, s.Dream, s.Admin, s.Open, s.Status, s.Vimer, s.Login, s.Pushkey, s.Spide, s.AdminCmd, s.Xterm, s.Pushbin, s.Upgrade, s.Remove) m.PushButton(s.Portal, s.Desktop, s.Admin, s.Open, s.Status, s.Vimer, s.Login, s.Pushkey, s.Spide, s.AdminCmd, s.Xterm, s.Pushbin, s.Upgrade, s.Remove)
kit.If(len(arg) > 0, func() { m.PushQRCode(cli.QRCODE, m.Append(web.LINK)) }) kit.If(len(arg) > 0, func() { m.PushQRCode(cli.QRCODE, m.Append(web.LINK)) })
} }
}) })