1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-26 01:04:06 +08:00
This commit is contained in:
harveyshao 2021-11-29 17:36:52 +08:00
parent b746f10c4e
commit 44de6ad232
3 changed files with 12 additions and 6 deletions

View File

@ -118,6 +118,12 @@ Volcanos("base", {help: "数据类型",
endWith: function(str, end) {
return str.lastIndexOf(end) + end.length == str.length
},
trimPrefix: function(str, pre) {
if (str.indexOf(pre) == -1) {
return str
}
return str.slice(pre.length)
},
trimSuffix: function(str, end) {
if (str.indexOf(end) == -1) {
return str

View File

@ -102,7 +102,7 @@ Volcanos({name: "chat", panels: [
}},
profile: {name: "测试群", storm: {
release: {name: "发布 release", index: [
"web.code.publish", "web.code.compile", "web.code.autogen",
"web.code.publish", "web.code.compile", "web.code.autogen", "web.code.git.server",
]},
research: {name: "测试 research", index: [
"web.code.favor", "web.code.bench", "web.code.pprof",
@ -111,7 +111,7 @@ Volcanos({name: "chat", panels: [
}},
operate: {name: "运维群", storm: {
aaa: {name: "权限 aaa", index: [
"user", "sess", "role", "totp",
"user", "sess", "totp",
]},
web: {name: "应用 web", index: [
"spide", "route", "share", "dream",

View File

@ -3,10 +3,10 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
if (msg.Option("branch")) { return can.onappend.table(can, msg) }
can._args = can.base.Copy({root: "root", field: nfs.PATH, split: ice.PS}, can.base.ParseURL(can._display))
can.dir_root = msg.Option(nfs.DIR_ROOT)||can._args.root||""
can._tree = can.onimport._tree(can, msg.Table(), can._args.field, can._args.split)
if (!can._tree[""]) { return }
can.dir_root = msg.Option(nfs.DIR_ROOT)||can._args.root
can._tree[""].name = can.dir_root.split(ice.PS).slice(-2)[0]
can._tree[""].name = can._args.root||can.dir_root.split(ice.PS).slice(-2)[0]
can.size = 30, can.margin = 30
can.require(["/plugin/local/wiki/draw.js", "/plugin/local/wiki/draw/path.js"], function() {
@ -18,8 +18,8 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
},
_tree: function(can, list, field, split) {
var node = {}; can.core.List(list, function(item) {
item[field] && can.core.List(item[field].split(split), function(value, index, array) {
var node = {}; can.core.List(list, function(item) { if (!item[field]) { return }
can.core.List(can.base.trimPrefix(item[field], can.dir_root+can._args.split).split(split), function(value, index, array) {
var last = array.slice(0, index).join(split)||"", name = array.slice(0, index+1).join(split)
if (!value || node[name]) { return }