forked from x/ContextOS
fix nfs.Send len
This commit is contained in:
parent
e3cdc0f53e
commit
2af0963fd2
@ -241,7 +241,8 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
||||
}
|
||||
if name, e := os.Getwd(); e == nil {
|
||||
_, file := path.Split(kit.Select(name, os.Getenv("PWD")))
|
||||
m.Conf("runtime", "boot.pathname", file)
|
||||
ns := strings.Split(file, "\\")
|
||||
m.Conf("runtime", "boot.pathname", ns[len(ns)-1])
|
||||
m.Conf("runtime", "boot.ctx_path", name)
|
||||
}
|
||||
return
|
||||
@ -447,8 +448,10 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
||||
m.Gos(m, func(m *ctx.Message) {
|
||||
if e := cmd.Start(); e != nil {
|
||||
m.Echo("error: ").Echo("%s\n", e)
|
||||
m.Log("fuck", "%v", e)
|
||||
} else if e := cmd.Wait(); e != nil {
|
||||
m.Echo("error: ").Echo("%s\n", e)
|
||||
m.Log("fuck", "%v", e)
|
||||
}
|
||||
m.Conf("daemon", []string{h, "finish_time"}, time.Now().Format(m.Conf("time_format")))
|
||||
})
|
||||
@ -785,6 +788,15 @@ var version = struct {
|
||||
})
|
||||
}
|
||||
|
||||
m.Cmdy("cli.system", path.Join(m.Conf("runtime", "boot.ctx_home"), "bin/node.sh"), "create", arg[0],
|
||||
"cmd_env", "PATH", os.Getenv("path"),
|
||||
"cmd_dir", m.Conf("missyou", "path"),
|
||||
"cmd_env", "ctx_home", m.Conf("runtime", "boot.ctx_home"),
|
||||
"cmd_env", "ctx_ups", fmt.Sprintf("127.0.0.1%s", m.Conf("runtime", "boot.ssh_port")),
|
||||
"cmd_env", "ctx_box", fmt.Sprintf("http://127.0.0.1%s", m.Conf("runtime", "boot.web_port")),
|
||||
"cmd_daemon", "true",
|
||||
)
|
||||
return
|
||||
m.Cmdy("cli.system", m.Conf("runtime", "boot.ctx_bin"), "daemon",
|
||||
"cmd_dir", p,
|
||||
"cmd_env", "ctx_home", m.Conf("runtime", "boot.ctx_home"),
|
||||
|
@ -4,5 +4,5 @@ var version = struct {
|
||||
host string
|
||||
self int
|
||||
}{
|
||||
"2019-07-01 20:57:35", "ZYB-20190522USI", 62,
|
||||
"2019-07-02 17:07:03", "ZYB-20190522USI", 84,
|
||||
}
|
||||
|
@ -1408,6 +1408,9 @@ func Start(args ...string) bool {
|
||||
}
|
||||
|
||||
kit.DisableLog = true
|
||||
if len(args) > 0 && args[0] == "start" {
|
||||
args = args[1:]
|
||||
}
|
||||
if len(args) > 0 && args[0] == "daemon" {
|
||||
Pulse.Options("cli.modal", "daemon")
|
||||
Pulse.Options("daemon", true)
|
||||
|
@ -816,8 +816,24 @@ func (nfs *NFS) Send(meta string, arg ...interface{}) *NFS {
|
||||
|
||||
line := "\n"
|
||||
if meta != "" {
|
||||
if text, ok := arg[0].(string); ok && meta == "result" && len(text) > 1024 {
|
||||
text := arg[0].(string)
|
||||
for i := 0; i < len(text); i += 1024 {
|
||||
j := i + 1024
|
||||
if j >= len(text) {
|
||||
j = len(text)
|
||||
}
|
||||
line = fmt.Sprintf("%s: %s\n", url.QueryEscape(meta), url.QueryEscape(kit.Format(text[i:j])))
|
||||
n, e := fmt.Fprint(nfs.io, line)
|
||||
m.Assert(e)
|
||||
m.Capi("nwrite", n)
|
||||
m.Log("send", "%d [%s]", len(line), line)
|
||||
}
|
||||
return nfs
|
||||
} else {
|
||||
line = fmt.Sprintf("%s: %s\n", url.QueryEscape(meta), url.QueryEscape(kit.Format(arg[0])))
|
||||
}
|
||||
}
|
||||
|
||||
n, e := fmt.Fprint(nfs.io, line)
|
||||
m.Assert(e)
|
||||
|
@ -177,7 +177,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
||||
"componet_args": []interface{}{"$$", "context", "aaa", "clip"}, "inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "you", "imports": "plugin_you", "action": "auto"},
|
||||
map[string]interface{}{"type": "text", "name": "txt", "view": "long"},
|
||||
map[string]interface{}{"type": "button", "value": "存储"},
|
||||
map[string]interface{}{"type": "button", "value": "存储", "action": "auto"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"componet_name": "qrcode", "componet_help": "二维码",
|
||||
@ -232,7 +232,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
||||
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||
"componet_args": []interface{}{"$$", "context", "$$", "context"}, "inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod", "action": "auto"},
|
||||
map[string]interface{}{"type": "text", "name": "ctx", "value": "nfs", "imports": "plugin_ctx"},
|
||||
map[string]interface{}{"type": "text", "name": "ctx", "value": "nfs", "imports": "plugin_ctx", "action": "auto"},
|
||||
map[string]interface{}{"type": "button", "value": "查看"},
|
||||
},
|
||||
"exports": []interface{}{"ctx", "names"},
|
||||
|
@ -650,7 +650,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
|
||||
// 发送请求
|
||||
res, e := web.Client.Do(req)
|
||||
m.Log("info", "%s %s", req, e)
|
||||
if e != nil {
|
||||
m.Log("warn", "%v", e)
|
||||
return e
|
||||
|
@ -486,7 +486,7 @@ page = Page({
|
||||
init: function(page) {
|
||||
page.onlayout(null, page.conf.layout)
|
||||
page.action.Pane.Layout(ctx.Search("layout")? ctx.Search("layout"): kit.isMobile? "办公": "工作")
|
||||
page.footer.Pane.Order({"site": "", "ip": "", "text": "", ":":""}, kit.isMobile? ["site", "ip", "text"]: ["ip", "text", ":"], function(event, item, value) {})
|
||||
page.footer.Pane.Order({"ncmd": "", "text": "", ":":""}, kit.isMobile? ["ncmd", "text"]: ["ncmd", "text", ":"], function(event, item, value) {})
|
||||
page.header.Pane.Order({"logout": "logout", "user": ""}, ["logout", "user"], function(event, item, value) {
|
||||
switch (item) {
|
||||
case "title":
|
||||
|
@ -4,7 +4,7 @@ ctx = context = {
|
||||
for (var k in dataset) {
|
||||
option[k] = dataset[k].split(",")
|
||||
}
|
||||
kit.Log(cmd)
|
||||
kit.History.add("cmd", option)
|
||||
this.GET("", option, function(msg) {
|
||||
msg[0] && (msg = msg[0])
|
||||
// msg && (msg.__proto__ = (page || {}))
|
||||
|
@ -89,14 +89,18 @@ fieldset.toast {
|
||||
fieldset.toast>div.output {
|
||||
padding:0 10px;
|
||||
}
|
||||
fieldset.toast>div.output pre {
|
||||
fieldset.toast>div.output>div.title {
|
||||
font-size:12px;
|
||||
}
|
||||
fieldset.toast>div.output>div.content {
|
||||
word-break:break-word;
|
||||
white-space:pre-wrap;
|
||||
text-align:center;
|
||||
margin:0px;
|
||||
padding:2px;
|
||||
font-size:16px;
|
||||
}
|
||||
fieldset.toast>div.output div.tick {
|
||||
fieldset.toast>div.output>div.tick {
|
||||
font-size:12px;
|
||||
}
|
||||
fieldset.dialog {
|
||||
|
@ -108,14 +108,14 @@ function Page(page) {
|
||||
ontoast: function(text, title, duration) {
|
||||
var args = typeof text == "object"? text: {text: text, title: title, duration: duration}
|
||||
var toast = kit.ModifyView("fieldset.toast", {
|
||||
display: "block", dialog: [args.width||300, args.height||50], padding: 10,
|
||||
display: "block", dialog: [args.width||text.length*10+100, args.height||60], padding: 10,
|
||||
})
|
||||
if (!text) {
|
||||
toast.style.display = "none"
|
||||
return
|
||||
}
|
||||
|
||||
var list = [{text: [args.text||""]}]
|
||||
var list = [{text: [title||"", "div", "title"]}, {text: [args.text||"", "div", "content"]}]
|
||||
args.inputs && args.inputs.forEach(function(input) {
|
||||
if (typeof input == "string") {
|
||||
list.push({inner: input, type: "label", style: {"margin-right": "5px"}})
|
||||
@ -145,7 +145,7 @@ function Page(page) {
|
||||
})
|
||||
list.push({view: ["tick"], name: "tick"})
|
||||
|
||||
kit.ModifyNode(toast.querySelector("legend"), args.title||"tips")
|
||||
// kit.ModifyNode(toast.querySelector("legend"), args.title||"tips")
|
||||
var ui = kit.AppendChild(kit.ModifyNode(toast.querySelector("div.output"), ""), list)
|
||||
var tick = 1
|
||||
var begin = kit.time(0,"%H:%M:%S")
|
||||
@ -547,7 +547,6 @@ function Plugin(page, pane, field) {
|
||||
var output = field.querySelector("div.output")
|
||||
|
||||
var count = 0
|
||||
var wait = false
|
||||
var plugin = field.Script || {}; plugin.__proto__ = {
|
||||
__proto__: pane,
|
||||
Append: function(item, name) {
|
||||
@ -678,6 +677,7 @@ function Plugin(page, pane, field) {
|
||||
})
|
||||
},
|
||||
Runs: function(event, cb) {
|
||||
page.footer.Pane.State("ncmd", kit.History.get("cmd").length)
|
||||
var args = kit.Selector(option, ".args", function(item, index) {
|
||||
return item.value
|
||||
})
|
||||
@ -685,10 +685,10 @@ function Plugin(page, pane, field) {
|
||||
setTimeout(function() {
|
||||
show && page.ontoast(kit.Format(args||["running..."]), meta.name, -1)
|
||||
}, 1000)
|
||||
wait = true, event.Plugin = plugin, field.Run(event, args, function(msg) {
|
||||
event.Plugin = plugin, field.Run(event, args, function(msg) {
|
||||
show = false, page.ontoast("")
|
||||
plugin.ondaemon[display.deal||"table"](msg)
|
||||
wait = false, typeof cb == "function" && cb(msg)
|
||||
typeof cb == "function" && cb(msg)
|
||||
})
|
||||
},
|
||||
Delay: function(time, event, text) {
|
||||
|
@ -28,6 +28,8 @@ kit = toolkit = {
|
||||
console.log(arguments.length == 1? args[0]: args)
|
||||
return args
|
||||
},
|
||||
Delay: function(time, cb) {
|
||||
},
|
||||
|
||||
ModifyView: function(which, args) {
|
||||
var height = document.body.clientHeight-4
|
||||
|
Loading…
x
Reference in New Issue
Block a user