forked from x/volcanos
add river.node
This commit is contained in:
parent
c555786eca
commit
de1adc50a0
@ -37,8 +37,9 @@ var user = Volcanos("user", {help: "用户模块",
|
|||||||
{text: ["", "div", "duration"]},
|
{text: ["", "div", "duration"]},
|
||||||
]}])
|
]}])
|
||||||
|
|
||||||
can.Timer({value: 1000, length: (meta.duration||3000)/1000}, function(event, interval, index) {
|
can.Timer({value: 100, length: (meta.duration||1000)/100}, function(event, interval, index) {
|
||||||
if (index > 2) { ui.duration.innerHTML = index+"s..." }
|
console.log(index, interval)
|
||||||
|
if (index > 20) { ui.duration.innerHTML = (index/10)+"s..." }
|
||||||
}, function() { can.page.Remove(can, ui.first) })
|
}, function() { can.page.Remove(can, ui.first) })
|
||||||
|
|
||||||
ui.Close = function() { can.page.Remove(can, ui.first) }
|
ui.Close = function() { can.page.Remove(can, ui.first) }
|
||||||
|
@ -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) {
|
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.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)
|
typeof cb == "function" && cb(msg)
|
||||||
}, silent)
|
}, silent)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ Volcanos("onaction", {help: "控件交互", list: ["创建", "刷新"], _init: f
|
|||||||
can.user.Search(can, {"river": can.Conf("river")})
|
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)
|
can.onexport._init(can, msg, list, cb, target)
|
||||||
},
|
},
|
||||||
"添加工具": function(event, can, value) {
|
"添加工具": function(event, can, value) {
|
||||||
@ -80,13 +80,25 @@ Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加用户
|
|||||||
return true
|
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) {
|
"添加用户": function(event, can, river, button) {
|
||||||
can.run(event, ["search", "Search.onimport.select", "user", "", ""], function(list) {
|
can.run(event, ["search", "Search.onimport.select", "user", "", ""], function(list) {
|
||||||
var args = []; can.core.List(list, function(item) {
|
var args = []; can.core.List(list, function(item) {
|
||||||
args = args.concat([item[5]])
|
args = args.concat([item[5]])
|
||||||
})
|
})
|
||||||
can.run(event, [can.Conf("river"), "action", "user"].concat(args), function(msg) {
|
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")})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb, target) { target.innerHTML = ""
|
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) }
|
if (can.Conf("height") < 600) { can.Conf("height", 600) }
|
||||||
can.onimport._share(can); var width = can.Conf("width"), height = can.Conf("height")
|
can.onimport._share(can); var width = can.Conf("width"), height = can.Conf("height")
|
||||||
// can.page.Modify(can, target, {style: {"max-height": height-160+"px"}})
|
// 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: "profile"},
|
||||||
|
|
||||||
{view: "holdon", list: [
|
{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) {
|
{view: ["editor", "textarea"], onkeydown: function(event) {
|
||||||
@ -573,6 +579,9 @@ Volcanos("onaction", {help: "控件交互", list: [
|
|||||||
}, true)
|
}, true)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"关闭": function(event, can, msg) {
|
||||||
|
can.page.Remove(can, can._target.parentNode)
|
||||||
|
},
|
||||||
"串行": function(event, can, msg) {
|
"串行": function(event, can, msg) {
|
||||||
can.core.Next(can.page.Select(can, can._action, "div.file", function(item) {
|
can.core.Next(can.page.Select(can, can._action, "div.file", function(item) {
|
||||||
return item.innerHTML
|
return item.innerHTML
|
||||||
|
@ -84,29 +84,46 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", "清空", ["view",
|
|||||||
can.width = x+name.length*20
|
can.width = x+name.length*20
|
||||||
}
|
}
|
||||||
tree.view.onclick = function(event) {
|
tree.view.onclick = function(event) {
|
||||||
if (!name.endsWith("/")) {
|
if (name.endsWith("/") || tree.tags) {
|
||||||
if (!tree.tags) { tree.tags = true
|
sub.svg.innerHTML = ""
|
||||||
console.log(tree)
|
tree.hide = !tree.hide
|
||||||
can.run(event, [can.Option("path"), tree.file], function(msg) {
|
can.onaction["横向"](event, can)
|
||||||
msg.Table(function(value) {
|
return
|
||||||
tree.list.push({name: value.name, last: tree, list: []})
|
|
||||||
})
|
|
||||||
|
|
||||||
sub.svg.innerHTML = ""
|
|
||||||
tree.hide = !tree.hide
|
|
||||||
can.onaction["横向"](event, can)
|
|
||||||
}, true)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub.svg.innerHTML = ""
|
if (tree.name.endsWith("go") ||
|
||||||
tree.hide = !tree.hide
|
tree.name.endsWith("c") ||
|
||||||
can.onaction["横向"](event, can)
|
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}
|
sub.svg.innerHTML = ""
|
||||||
event.stopPropagation()
|
tree.hide = !tree.hide
|
||||||
event.preventDefault()
|
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) {
|
tree.view.onmouseenter = function(event) {
|
||||||
can.page.Remove(can, can.pos)
|
can.page.Remove(can, can.pos)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user