1
0
forked from x/volcanos

add river.node

This commit is contained in:
shylinux 2020-07-30 09:20:56 +08:00
parent c555786eca
commit de1adc50a0
5 changed files with 65 additions and 26 deletions

View File

@ -37,8 +37,9 @@ var user = Volcanos("user", {help: "用户模块",
{text: ["", "div", "duration"]},
]}])
can.Timer({value: 1000, length: (meta.duration||3000)/1000}, function(event, interval, index) {
if (index > 2) { ui.duration.innerHTML = index+"s..." }
can.Timer({value: 100, length: (meta.duration||1000)/100}, function(event, interval, index) {
console.log(index, interval)
if (index > 20) { ui.duration.innerHTML = (index/10)+"s..." }
}, function() { can.page.Remove(can, ui.first) })
ui.Close = function() { can.page.Remove(can, ui.first) }

View File

@ -37,7 +37,7 @@ Volcanos("onexport", {help: "导出数据", list: [], _init: function(can, msg,
// 插件回调
return can.run(event, can.onengine[cmds[0]]? cmds: [river, storm, value.action].concat(cmds), function(msg) {
can.run(msg._event, ["search", "Footer.onaction.ncmd"]);
can.user.toast(can, "执行成功", value.name, 2000);
can.user.toast(can, "执行成功", value.name, 1000);
typeof cb == "function" && cb(msg)
}, silent)
}

View File

@ -55,7 +55,7 @@ Volcanos("onaction", {help: "控件交互", list: ["创建", "刷新"], _init: f
can.user.Search(can, {"river": can.Conf("river")})
},
})
Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加用户", "重命名", "共享", "删除"], _init: function(can, msg, list, cb, target) {
Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加设备", "添加用户", "重命名", "共享", "删除"], _init: function(can, msg, list, cb, target) {
can.onexport._init(can, msg, list, cb, target)
},
"添加工具": function(event, can, value) {
@ -80,13 +80,25 @@ Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加用户
return true
})
},
"添加设备": function(event, can, value) {
can.run(event, ["search", "Search.onimport.select", "space", "", ""], function(list) {
var args = []; can.core.List(list, function(item) {
args = args.concat([item[4]])
})
var toast = can.user.toast(can, "执行中...", "添加设备", 100000)
can.run(event, [can.Conf("river"), "action", "node"].concat(args), function(msg) {
toast.Close(), can.user.toast(can, "执行完成...", "添加设备", 1000)
// can.user.Search(can, {"river": can.Conf("river")})
})
})
},
"添加用户": function(event, can, river, button) {
can.run(event, ["search", "Search.onimport.select", "user", "", ""], function(list) {
var args = []; can.core.List(list, function(item) {
args = args.concat([item[5]])
})
can.run(event, [can.Conf("river"), "action", "user"].concat(args), function(msg) {
can.user.Search(can, {"river": can.Conf("river")})
// can.user.Search(can, {"river": can.Conf("river")})
})
})
},

View File

@ -1,4 +1,9 @@
Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb, target) { target.innerHTML = ""
var feature = can.Conf("feature")
can.onaction.list = feature.action || can.onaction.list
can.Conf("height", feature.height || can.Conf("height"))
can.Conf("width", feature.width || can.Conf("width"))
if (can.Conf("height") < 600) { can.Conf("height", 600) }
can.onimport._share(can); var width = can.Conf("width"), height = can.Conf("height")
// can.page.Modify(can, target, {style: {"max-height": height-160+"px"}})
@ -8,7 +13,8 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
{view: "profile"},
{view: "holdon", list: [
{view: "preview"}, {view: "content", style: {"max-width": can.Conf("width")-160+"px"}},
{view: "preview"},
{view: "content", style: {"max-width": can.Conf("width")-(feature.width?0:120)+"px"}},
]},
{view: ["editor", "textarea"], onkeydown: function(event) {
@ -573,6 +579,9 @@ Volcanos("onaction", {help: "控件交互", list: [
}, true)
},
"关闭": function(event, can, msg) {
can.page.Remove(can, can._target.parentNode)
},
"串行": function(event, can, msg) {
can.core.Next(can.page.Select(can, can._action, "div.file", function(item) {
return item.innerHTML

View File

@ -84,29 +84,46 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", "清空", ["view",
can.width = x+name.length*20
}
tree.view.onclick = function(event) {
if (!name.endsWith("/")) {
if (!tree.tags) { tree.tags = true
console.log(tree)
can.run(event, [can.Option("path"), tree.file], function(msg) {
msg.Table(function(value) {
tree.list.push({name: value.name, last: tree, list: []})
})
sub.svg.innerHTML = ""
tree.hide = !tree.hide
can.onaction["横向"](event, can)
}, true)
return
}
if (name.endsWith("/") || tree.tags) {
sub.svg.innerHTML = ""
tree.hide = !tree.hide
can.onaction["横向"](event, can)
return
}
sub.svg.innerHTML = ""
tree.hide = !tree.hide
can.onaction["横向"](event, can)
if (tree.name.endsWith("go") ||
tree.name.endsWith("c") ||
tree.name.endsWith("h")) {
can.run(event, [can.Option("path"), tree.file], function(msg) {
msg.Table(function(value) { tree.tags = true
tree.list.push({type: "tags", file: value.file, line: value.line, name: value.name, last: tree, list: []})
})
if (!event) {return}
event.stopPropagation()
event.preventDefault()
sub.svg.innerHTML = ""
tree.hide = !tree.hide
can.onaction["横向"](event, can)
}, true)
return
}
tree.inner = can.onappend._init(can, {name: "inner", help: "源码", inputs: [
{type: "text", name: "path", value: can.Option("path")},
{type: "text", name: "file", value: tree.file},
{type: "text", name: "line", value: tree.line},
{type: "button", name: "查看", value: "auto"},
], index: "web.code.inner", feature: {
display: "/plugin/local/code/inner.js", style: "editor", width: 800, height: 600,
action: ["关闭"],
}}, Volcanos.meta.libs.concat(["/plugin/state.js"]), function(sub) {
sub.run = function(event, cmds, cb, silent) {
can.run(event, ["inner"].concat(cmds), cb, true)
}
}, document.body)
can.page.Modify(can, tree.inner._target, {style: {position: "fixed",
left: event.x-(event.x>600? 400: 100),
top: event.y-(event.y>600? 400: 0),
}})
}
tree.view.onmouseenter = function(event) {
can.page.Remove(can, can.pos)