diff --git a/lib/base.js b/lib/base.js index ef6efb76..59a7551d 100644 --- a/lib/base.js +++ b/lib/base.js @@ -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 diff --git a/page/index.js b/page/index.js index 6d620caa..b5c5c256 100644 --- a/page/index.js +++ b/page/index.js @@ -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", diff --git a/plugin/story/spide.js b/plugin/story/spide.js index f6e62f61..b31d991c 100644 --- a/plugin/story/spide.js +++ b/plugin/story/spide.js @@ -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 }