From 8a14f0dc332af185e4e53fccafb92f3b5a6e5198 Mon Sep 17 00:00:00 2001 From: shylinux Date: Thu, 13 May 2021 10:11:52 +0800 Subject: [PATCH] opt bash --- frame.js | 34 +++++++++++++++++++++++----------- page/index.css | 1 + plugin/table.js | 10 ++++++++++ 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/frame.js b/frame.js index 3ffd82bb..4c82418c 100644 --- a/frame.js +++ b/frame.js @@ -33,7 +33,7 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta, remote: function(event, can, msg, panel, cmds, cb) { delete(msg._handle), delete(msg._toast) if (panel.onengine.engine(event, can, msg, panel, cmds, cb)) { return } - can.misc.Runs(event, can, {names: panel._name, daemon: can._daemon}, cmds, cb) + can.misc.Runs(event, can, {names: panel._name, daemon: can._daemon+"."+msg._daemon}, cmds, cb) panel.run(event, ["search", "Footer.onimport.ncmd"]) }, engine: function(event, can, msg, panel, cmds, cb) { return false }, listen: shy("事件回调", {}, [], function(can, name, cb) { @@ -141,6 +141,9 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta, ]}, }}, "operate": {name: "运维群", storm: { + "ctx": {name: "模块 ctx", index: [ + "context", "command", "config", + ]}, "cli": {name: "系统 cli", index: [ "system", "daemon", "python", "output", "runtime", "process", @@ -149,19 +152,16 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta, "route", "serve", "space", "dream", "spide", "share", "cache", "story", ]}, - "ssh": {name: "脚本 ssh", index: [ - "aaa.totp", "web.code.tmux.session", - "connect", "session", "service", "channel", - ]}, - "nfs": {name: "文件 nfs", index: [ - "nfs.cat", "nfs.dir", "nfs.tail", "nfs.trash", - ]}, - "aaa": {name: "权限 aaa", index: [ "user", "sess", "role", "totp", ]}, - "ctx": {name: "模块 ctx", index: [ - "context", "command", "config", + + "nfs": {name: "文件 nfs", index: [ + "nfs.cat", "nfs.dir", "nfs.tail", "nfs.trash", + ]}, + "ssh": {name: "脚本 ssh", index: [ + "aaa.totp", "web.code.tmux.session", + "connect", "session", "service", "channel", ]}, }}, }, @@ -182,10 +182,18 @@ Volcanos("ondaemon", {help: "解析引擎", list: [], _init: function(can) { } }) }, + _list: [{}], toast: function(can, msg, arg) { arg[0] = can can._toast && can._toast.Close() can._toast = can.core.CallFunc(can.user.toast, arg) }, + grow: function(can, msg, arg) { + var sub = can.ondaemon._list[msg.Option("_target")] + if (!sub._outputs || !sub._outputs.length) { return } + + var out = sub._outputs[sub._outputs.length-1] + out.onimport._grow(out, arg.join("")) + }, pwd: function(can, msg, arg) { can.base.Log(msg) can._daemon = arg[0] @@ -323,6 +331,9 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta, return can.onaction[cmds[1]](event, can, cmds[1]) } + can._daemon == undefined && (can._daemon = can.ondaemon._list.push(can)-1) + msg._daemon = msg._daemon||can._daemon + var feature = can.Conf("feature") var input = msg.Option("_handle") != "true" && cmds && cmds[0] == "action" && feature && feature[cmds[1]]; if (input) { can.user.input(event, can, input, function(ev, button, data, list) { @@ -496,6 +507,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta, return can.run(event, ["action", target.name], function(msg) { can.run() }, true) } }) + code && code.scrollBy(0, 10000) return code }, diff --git a/page/index.css b/page/index.css index 9c03a588..8e2a2085 100644 --- a/page/index.css +++ b/page/index.css @@ -194,6 +194,7 @@ div.code { text-align:left; white-space:pre; overflow:auto; clear:both; + max-height:400px; } div.story { text-align:left; diff --git a/plugin/table.js b/plugin/table.js index 5a8ebc24..24a0c1aa 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -113,6 +113,16 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, }, data: {"className": "args"}}, ]} }, + _grow: function(can, str) { + if (can.page.Select(can, can._output, "div.code", function(div) { + can.page.Append(can, div, [{text: [str]}]) + div.scrollBy(0, 10000) + return true + }).length == 0) { + can.onappend.board(can, str) + } + // can.onmotion.story(can, can._output) + }, }) Volcanos("onaction", {help: "控件交互", list: []}) Volcanos("onexport", {help: "导出数据", list: []})