diff --git a/const.js b/const.js index f4a8f027..f161b1b4 100644 --- a/const.js +++ b/const.js @@ -66,6 +66,7 @@ var mdb = {FOREACH: "*", RANDOMS: "%", KEY: "key", VALUE: "value", STATUS: "status", EXPIRE: "expire", EXTRA: "extra", SHORT: "short", FIELD: "field", COUNT: "count", TOTAL: "total", INDEX: "index", LIMIT: "limit", DATA: "data", VIEW: "view", ORDER: "order", + ENABLE: "enable", DISABLE: "disable", INPUTS: "inputs", CREATE: "create", REMOVE: "remove", UPDATE: "update", INSERT: "insert", DELETE: "delete", MODIFY: "modify", SELECT: "select", PRUNES: "prunes", EXPORT: "export", IMPORT: "import", @@ -187,6 +188,7 @@ var cli = { BEGIN: "begin", END: "end", START: "start", RESTART: "restart", STOP: "stop", OPEN: "open", CLOSE: "close", REBOOT: "reboot", DELAY: "delay", + PLAY: "play", STEP: "step", QRCODE: "qrcode", COLOR: "color", BLACK: "black", WHITE: "white", BLUE: "blue", RED: "red", GRAY: "gray", CYAN: "cyan", GREEN: "green", PURPLE: "purple", YELLOW: "yellow", MAGENTA: "magenta", SILVER: "silver", ALICEBLUE: "aliceblue", TRANSPARENT: "transparent", LINUX: "linux", DARWIN: "darwin", WINDOWS: "windows", @@ -368,7 +370,7 @@ var icon = { save: "bi bi-floppy", trash: "bi bi-trash", push: "bi bi-cloud-upload", pull: "bi bi-cloud-download", upload: "bi bi-box-arrow-in-up", download: "bi bi-box-arrow-down", - record1: "bi bi-images", record2: "bi bi-record-circle", + record1: "bi bi-images", record2: "bi bi-record-circle", record: "bi bi-record-circle", full: "bi bi-arrows-fullscreen", open: "bi bi-box-arrow-up-right", search: "bi bi-search", favor: "bi bi-star", qrcode: "bi bi-qr-code", notifications: "bi bi-chat-right-text", @@ -384,6 +386,7 @@ var icon = { compile: "bi bi-tools", publish: "bi bi-send-check", version: "bi bi-tags", upgrade: "bi bi-rocket-takeoff", vimer: "bi bi-code-slash", repos: "bi bi-git", build: "bi bi-tools", tag: "bi bi-tags", xterm: "bi bi-terminal", cmds: "bi bi-terminal", + enable: "bi bi-toggle-off", disable: "bi bi-toggle-on", } var svg = { GROUP: "group", PID: "pid", GRID: "grid", diff --git a/frame.js b/frame.js index f99a944b..c414bab9 100644 --- a/frame.js +++ b/frame.js @@ -124,7 +124,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, Option: function(key, value) { value && (value = can.user.trans(sub, value, null, html.INPUT)); return can.page.SelectArgs(can, option, key, value)[0] }, Update: function(event, cmds, cb, silent) { event = event||{} - if (event.isTrusted && cmds && cmds.length > 0 && cmds[0] == ctx.ACTION) { can.onengine.signal(can, "onrecord", can.request({}, {cmds: [sub.ConfIndex()].concat(cmds||[])})) } + if (event.isTrusted && cmds && cmds.length > 0 && cmds[0] == ctx.ACTION) { + can.onengine.signal(can, "onrecord", can.request({}, {cmds: [sub.ConfSpace(), sub.ConfIndex()].concat(cmds||[])})) } sub.request(event, can.core.Value(sub, "sub.db._checkbox"))._caller(), sub.onappend._output0(sub, sub.Conf(), event||{}, cmds||sub.Input([], !silent), cb, silent); return true }, Focus: function() { can.page.SelectOne(can, option, html.INPUT_ARGS, function(target) { target.focus() }) }, @@ -441,7 +442,15 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { if (key == mdb.HASH && can.ConfIndex() == web.TOKEN) { _value = value.slice(0, 4)+"****" } if (key == web.TOKEN && value) { _value = value.slice(0, 4)+"****" } if (key == aaa.PASSWORD && value) { _value = "********" } + function onclick() { return false } + if (key == mdb.STATUS && value == mdb.DISABLE) { _value = `` + function onclick() { run(event, mdb.MODIFY, [mdb.STATUS, mdb.ENABLE]); return true } + } + if (key == mdb.STATUS && value == mdb.ENABLE) { _value = `` + function onclick() { run(event, mdb.MODIFY, [mdb.STATUS, mdb.DISABLE]); return true } + } return {text: [msg.IsDetail() && key == mdb.KEY? can.user.trans(can, _value, null, html.INPUT): can.user.trans(can, _value, null, html.VALUE), html.TD], onclick: function(event) { var target = event.target + if (onclick()) { return } if (key == cli.QRCODE && can.page.tagis(event.target, html.IMG)) { can.user.opens(event.target.title) } if (can.page.tagis(target, html.INPUT) && target.type == html.BUTTON) { can.requestAction(event, target.name) meta && meta[target.name]? can.user.input(event, can, meta[target.name], function(args) { run(event, target.name, args) }, data): run(event, target.name) diff --git a/index.css b/index.css index 6592db58..e73e3d43 100644 --- a/index.css +++ b/index.css @@ -93,6 +93,7 @@ table.content.full { width:100%; } body.mobile table.content.detail { word-break:break-all; white-space:unset; } table.content thead { position:sticky; top:2px; } table.content tr.disable { color:var(--disable-fg-color); } +table.content tr.danger { background-color:var(--danger-bg-color) !important; color:var(--danger-fg-color) !important; } table.content tr.offline { color:var(--disable-fg-color); } table.content tr.offline a { color:var(--disable-fg-color); } table.content th { font-family:var(--input-font-family); padding:var(--input-padding) 24px; box-shadow:var(--box-shadow); } @@ -265,6 +266,8 @@ body div.tabs { font-family:var(--code-font-family); } body div.path { font-family:var(--code-font-family); } body div.carte { font-family:var(--code-font-family); } /* icon */ +i.bi.bi-toggle-on { color:var(--notice-bg-color); } +i.bi.bi-toggle-on:hover { color:var(--notice-bg-color); } fieldset>legend>i { margin-right:var(--input-margin); } form.option>div.item.icon { position:relative; height:var(--action-height); overflow:hidden; } form.option>div.item.icon { font-size:var(--icon-font-size); padding:0 var(--input-padding); } diff --git a/panel/footer.js b/panel/footer.js index 4900c161..ab2b3e35 100644 --- a/panel/footer.js +++ b/panel/footer.js @@ -53,7 +53,8 @@ Volcanos(chat.ONACTION, {_init: function(can) {}, onremote: function(can, msg) { can.core.CallFunc(can.onimport.ncmd, {can: can, msg: msg}) }, onunload: function(can) { can._wss && can._wss.close() }, onrecord: function(can, msg) { - can.runAction(can.request(), nfs.SCRIPT, msg.cmds[0]) + var zone = can.misc.sessionStorage(can, "web.chat.script:zone") + zone && can.runAction(can.request(), nfs.SCRIPT, [zone].concat(msg.cmds[0])) }, onaction_cmd: function(can) { can.onappend.style(can, html.HIDE) }, oncommand_focus: function(can) { can.page.Select(can, can._output, ["div.cmd", html.INPUT], function(target) { can.onmotion.focus(can, target) }) }, diff --git a/proto.js b/proto.js index a5152b0d..6dc553c6 100644 --- a/proto.js +++ b/proto.js @@ -102,7 +102,7 @@ var Volcanos = shy({iceberg: "", volcano: "", frame: chat.FRAME_JS, _cache: {}, isAutoMode: function() { return can.Mode() == "" }, Mode: function(value) { return can.Conf(ice.MODE, value) }, ConfDefault: function(value) { can.core.Item(value, function(k, v) { can.Conf(k) || can.Conf(k, v) }) }, - ConfSpace: function() { return can.Conf(web.SPACE)||can.Conf("_space") }, + ConfSpace: function() { return can.Conf(web.SPACE)||can.Conf("_space")||"" }, ConfIndex: function() { return can.Conf("_command")||can.Conf(ctx.INDEX)||can.Conf("_index") }, ConfHeight: function(value) { return can.Conf(html.HEIGHT, value) }, ConfWidth: function(value) { return can.Conf(html.WIDTH, value) },