1
0
forked from x/ContextOS

opt cli.missyou

This commit is contained in:
shaoying 2019-06-30 22:05:10 +08:00
parent 6e76f7377e
commit 6329a497ea
14 changed files with 2043 additions and 1986 deletions

View File

@ -578,6 +578,10 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
m.Cmdp(time.Second, []string{"go init"}, []string{"cli.system", "go", "get", m.Cmdp(time.Second, []string{"go init"}, []string{"cli.system", "go", "get",
"cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_path")}, list) "cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_path")}, list)
case "stat":
m.Cmd("nfs.dir", "src", "dir_deep", "dir_type", "file").CopyTo(m, "append")
m.Cmd("nfs.dir", "usr/librarys", "dir_deep", "dir_type", "file").CopyTo(m, "append")
m.Set("result").Table()
} }
return return
}}, }},
@ -745,8 +749,17 @@ var version = struct {
"missyou": &ctx.Command{Name: "missyou", Help: "服务升级", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { "missyou": &ctx.Command{Name: "missyou", Help: "服务升级", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
if len(arg) == 0 { if len(arg) == 0 {
m.Option("dir_root", "") m.Option("dir_root", "")
m.Cmd("nfs.dir", m.Conf("missyou", "path")).Table(func() { m.Cmd("nfs.dir", m.Conf("missyou", "path")).Table(func(value map[string]string) {
name := strings.TrimSuffix(value["filename"], "/")
m.Add("append", "create_time", value["time"])
m.Add("append", "you", name)
if m.Confs("nfs.node", name) {
m.Add("append", "status", "start")
} else {
m.Add("append", "status", "stop")
}
}) })
m.Table()
return return
} }
@ -755,20 +768,29 @@ var version = struct {
} }
if m.Confs("ssh.node", arg[0]) { if m.Confs("ssh.node", arg[0]) {
m.Echo(arg[0]) switch kit.Select("", arg, 1) {
case "stop":
m.Cmdy("ssh._route", arg[0], "context", "cli", "quit", 0)
default:
m.Echo(arg[0])
}
return return
} }
p := path.Join(m.Conf("missyou", "path"), arg[0]) p := path.Join(m.Conf("missyou", "path"), arg[0])
if s, e := os.Stat(p); e == nil && s.IsDir() { if _, e := os.Stat(p); e != nil {
m.Cmdy("cli.system", "node.sh", "create", p, "daemon", "cmd_daemon", "true") m.Cmd("nfs.copy", path.Join(p, "etc/local.shy"), "usr/missyou/job.shy")
return e m.Confm("missyou", "local", func(index string, local string) {
m.Cmd("nfs.git", "clone", local, path.Join(p, "usr/local", index))
})
} }
m.Cmdy("nfs.copy", path.Join(p, "etc/local.shy"), "usr/missyou/job.shy") m.Cmdy("cli.system", m.Conf("runtime", "boot.ctx_bin"), "daemon",
m.Confm("missyou", "local", func(index string, local string) { "cmd_dir", p,
m.Cmd("nfs.git", "clone", local, path.Join(p, "usr/local", index)) "cmd_env", "ctx_home", m.Conf("runtime", "boot.ctx_home"),
}) "cmd_env", "ctx_box", fmt.Sprintf("http://localhost%s", m.Conf("runtime", "boot.web_port")),
"cmd_daemon", "true",
)
return return
}}, }},
"quit": &ctx.Command{Name: "quit code", Help: "停止服务", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { "quit": &ctx.Command{Name: "quit code", Help: "停止服务", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {

View File

@ -4,5 +4,5 @@ var version = struct {
host string host string
self int self int
}{ }{
"2019-06-30 12:52:58", "com", 26, "2019-06-30 17:36:39", "com.mac", 30,
} }

View File

@ -360,16 +360,14 @@ func (m *Message) CallBack(sync bool, cb func(msg *Message) (sub *Message), arg
// m.Gos(m, func(m *Message) { // m.Gos(m, func(m *Message) {
m.Call(func(sub *Message) *Message { m.Call(func(sub *Message) *Message {
msg := cb(sub) msg := cb(sub)
m.Log("sync", m.Format("done", "result", "append"))
wait <- m wait <- m
return msg return msg
}, arg...) }, arg...)
// }) // })
m.Log("sync", m.Format("wait", "result", "append"))
select { select {
case <-time.After(kit.Duration(m.Conf("call_timeout"))): case <-time.After(kit.Duration(m.Conf("call_timeout"))):
m.Log("sync", m.Format("timeout", "result", "append")) m.Log("sync", m.Format("timeout", "detail", "option"))
case <-wait: case <-wait:
} }
return m return m

View File

@ -39,6 +39,7 @@ func (ctx *CTX) Begin(m *Message, arg ...string) Server {
} }
func (ctx *CTX) Start(m *Message, arg ...string) bool { func (ctx *CTX) Start(m *Message, arg ...string) bool {
m.Cmd("ctx._init") m.Cmd("ctx._init")
kit.Log("fuck", "what")
if m.Optionv("ps_target", Index); len(arg) == 0 { if m.Optionv("ps_target", Index); len(arg) == 0 {
m.Option("cli.modal", "active") m.Option("cli.modal", "active")
m.Option("log.disable", false) m.Option("log.disable", false)
@ -46,10 +47,12 @@ func (ctx *CTX) Start(m *Message, arg ...string) bool {
m.Cmd("log._init") m.Cmd("log._init")
m.Cmd("yac._init") m.Cmd("yac._init")
m.Cmd("gdb._init") m.Cmd("gdb._init")
m.Log("fuck", "what")
m.Cmd("cli.source", m.Conf("system", "script.init")).Cmd("cli.source", "stdio").Cmd("cli.source", m.Conf("system", "script.exit")) m.Cmd("cli.source", m.Conf("system", "script.init")).Cmd("cli.source", "stdio").Cmd("cli.source", m.Conf("system", "script.exit"))
} else { } else {
m.Option("cli.modal", "action") m.Option("cli.modal", "action")
m.Cmd("yac._init") m.Cmd("yac._init")
m.Log("fuck", "what")
for _, v := range m.Spawn().Cmd(arg).Meta["result"] { for _, v := range m.Spawn().Cmd(arg).Meta["result"] {
fmt.Printf("%s", v) fmt.Printf("%s", v)
} }

View File

@ -368,7 +368,6 @@ func (m *Message) Table(cbs ...interface{}) *Message {
row[k], wor = data, append(wor, data+strings.Repeat(space, width[k]-kit.Width(data, len(space)))) row[k], wor = data, append(wor, data+strings.Repeat(space, width[k]-kit.Width(data, len(space))))
} }
m.Log("fuck", "waht %v", row)
if !cb(row, wor, i) { if !cb(row, wor, i) {
break break
} }

View File

@ -99,7 +99,7 @@ func (gdb *GDB) Start(m *ctx.Message, arg ...string) bool {
action := m.Conf("signal", sig) action := m.Conf("signal", sig)
m.Log("signal", "%v: %v", action, sig) m.Log("signal", "%v: %v", action, sig)
switch action { switch action {
case "QUIT": case "QUIT", "INT":
m.Cmd("cli.quit", 0) m.Cmd("cli.quit", 0)
case "restart": case "restart":
m.Cmd("cli.quit", 1) m.Cmd("cli.quit", 1)
@ -143,7 +143,7 @@ var Index = &ctx.Context{Name: "gdb", Help: "调试中心",
"31": "upgrade", "31": "upgrade",
"1": "HUP", "1": "HUP",
// "2": "INT", "2": "INT",
// "9": "KILL", // "9": "KILL",
// "10": "BUS", // "10": "BUS",
// "11": "SEGV", // "11": "SEGV",

View File

@ -156,9 +156,9 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "missyou", "componet_type": "private", "componet_ctx": "cli", "componet_cmd": "missyou",
"componet_args": []interface{}{}, "inputs": []interface{}{ "componet_args": []interface{}{}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "action"}, map[string]interface{}{"type": "text", "name": "action"},
map[string]interface{}{"type": "button", "value": "行动"}, map[string]interface{}{"type": "button", "value": "行动", "action": "auto"},
}, },
"exports": []interface{}{"you", "filename"}, "exports": []interface{}{"you", "", "you"},
}, },
}, },
"favor": []interface{}{ "favor": []interface{}{
@ -166,9 +166,9 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "", "componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
"componet_type": "public", "componet_ctx": "ssh", "componet_cmd": "_route", "componet_type": "public", "componet_ctx": "ssh", "componet_cmd": "_route",
"componet_args": []interface{}{"$$", "context", "aaa", "clip"}, "inputs": []interface{}{ "componet_args": []interface{}{"$$", "context", "aaa", "clip"}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "you", "imports": "plugin_you"}, 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": "text", "name": "txt", "view": "long"},
map[string]interface{}{"type": "button", "value": "运行"}, map[string]interface{}{"type": "button", "value": "存储"},
}, },
}, },
map[string]interface{}{"componet_name": "qrcode", "componet_help": "生成二维码", map[string]interface{}{"componet_name": "qrcode", "componet_help": "生成二维码",
@ -176,6 +176,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_type": "public", "componet_ctx": "web.chat", "componet_cmd": "login", "componet_type": "public", "componet_ctx": "web.chat", "componet_cmd": "login",
"componet_args": []interface{}{"qrcode"}, "inputs": []interface{}{ "componet_args": []interface{}{"qrcode"}, "inputs": []interface{}{
map[string]interface{}{"label": "content", "type": "text", "name": "content"}, map[string]interface{}{"label": "content", "type": "text", "name": "content"},
map[string]interface{}{"type": "button", "value": "生成"},
}, },
}, },
map[string]interface{}{"componet_name": "salary", "componet_help": "计算工资", map[string]interface{}{"componet_name": "salary", "componet_help": "计算工资",
@ -212,17 +213,17 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route", "componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
"componet_args": []interface{}{"$$", "context", "ssh", "remote"}, "inputs": []interface{}{ "componet_args": []interface{}{"$$", "context", "ssh", "remote"}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "pod"}, map[string]interface{}{"type": "text", "name": "pod"},
map[string]interface{}{"type": "button", "value": "执行"}, map[string]interface{}{"type": "button", "value": "执行", "action": "auto"},
}, },
"exports": []interface{}{"pod", "key", "pod"}, "exports": []interface{}{"pod", "pod", "pod"},
}, },
map[string]interface{}{"componet_name": "ctx", "componet_help": "ctx", map[string]interface{}{"componet_name": "ctx", "componet_help": "ctx",
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "", "componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route", "componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
"componet_args": []interface{}{"$$", "context", "$$", "context"}, "inputs": []interface{}{ "componet_args": []interface{}{"$$", "context", "$$", "context"}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"}, 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"},
map[string]interface{}{"type": "button", "value": "模块"}, map[string]interface{}{"type": "button", "value": "查看"},
}, },
"exports": []interface{}{"ctx", "names"}, "exports": []interface{}{"ctx", "names"},
}, },
@ -240,8 +241,8 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "", "componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route", "componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
"componet_args": []interface{}{"$$", "context", "nfs", "dir"}, "inputs": []interface{}{ "componet_args": []interface{}{"$$", "context", "nfs", "dir"}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"}, map[string]interface{}{"type": "text", "name": "pod", "imports": []interface{}{"plugin_you", "plugin_pod"}},
map[string]interface{}{"type": "text", "name": "dir", "value": "", "view": "long", "imports": []interface{}{"plugin_dir", "plugin_you"}}, map[string]interface{}{"type": "text", "name": "dir", "value": "", "view": "long", "imports": []interface{}{"plugin_dir"}},
map[string]interface{}{"type": "button", "value": "查看"}, map[string]interface{}{"type": "button", "value": "查看"},
map[string]interface{}{"type": "button", "value": "回退", "click": "Back"}, map[string]interface{}{"type": "button", "value": "回退", "click": "Back"},
}, },
@ -340,7 +341,12 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
}}, }},
"_node": &ctx.Command{Name: "_node [init|create name type module|delete name]", Help: "节点", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { "_node": &ctx.Command{Name: "_node [init|create name type module|delete name]", Help: "节点", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
if len(arg) == 0 { if len(arg) == 0 {
m.Cmdy("ctx.config", "node", "format", "table", "fields", "type", "module", "create_time") m.Confm("ssh.node", func(key string, value map[string]interface{}) {
m.Add("append", "create_time", value["create_time"])
m.Add("append", "pod", key)
m.Add("append", "type", value["type"])
})
m.Sort("key").Table()
return return
} }
@ -672,6 +678,8 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
m.Confm("node", names[0], func(name string, node map[string]interface{}) { m.Confm("node", names[0], func(name string, node map[string]interface{}) {
if kit.Format(node["type"]) != "master" { if kit.Format(node["type"]) != "master" {
ps = append(ps, kit.Format(node["module"])) ps = append(ps, kit.Format(node["module"]))
} else {
ps = append(ps, "")
} }
}) })

View File

@ -140,7 +140,7 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
case "weixin": case "weixin":
m.Cmdy(".js_token") m.Cmdy(".js_token")
case "qrcode": case "qrcode":
m.Append("qrcode", arg[1]) m.Append("qrcode", kit.Select(m.Option("index_url"), arg, 1))
case "rename": case "rename":
default: default:
if m.Cmds("ssh.work", "share", arg[0]) { if m.Cmds("ssh.work", "share", arg[0]) {
@ -211,6 +211,7 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
"tool": map[string]interface{}{}, "tool": map[string]interface{}{},
}) })
m.Echo(h) m.Echo(h)
return
m.Option("username", m.Conf("runtime", "user.name")) m.Option("username", m.Conf("runtime", "user.name"))
m.Confm("flow", []string{h, "user"}, func(key string, value map[string]interface{}) { m.Confm("flow", []string{h, "user"}, func(key string, value map[string]interface{}) {

View File

@ -1,52 +1,52 @@
fieldset.Ocean div.create pre:hover { fieldset.Ocean div.create pre:hover {
background-color:red; background-color:red;
} }
fieldset.Ocean div.create pre:hover { fieldset.Ocean div.create pre:hover {
background-color:red; background-color:red;
} }
fieldset.River { fieldset.River {
float:left; float:left;
} }
fieldset.Target div.output div.item:hover { fieldset.Target div.output div.item:hover {
background-color:lightgreen; background-color:lightgreen;
} }
fieldset.Target>div.output>div.item { fieldset.Target>div.output>div.item {
padding-top:6px; padding-top:6px;
clear:both; clear:both;
} }
fieldset.Target>div.output>div.item>div.text { fieldset.Target>div.output>div.item>div.text {
padding:6px; padding:6px;
float:left; float:left;
} }
fieldset.Target>div.output>div.item>div.user { fieldset.Target>div.output>div.item>div.user {
border-right:solid 1px green; border-right:solid 1px green;
border-bottom:solid 1px green; border-bottom:solid 1px green;
float:left; float:left;
padding:6px; padding:6px;
} }
fieldset.Source div.output { fieldset.Source div.output {
padding:0; padding:0;
} }
fieldset.Action div.output div.item:hover { fieldset.Action div.output div.item:hover {
background-color:lightblue; background-color:lightblue;
} }
fieldset.Storm { fieldset.Storm {
float:right; float:right;
} }
fieldset.Steam table.device { fieldset.Steam table.device {
padding:10px; padding:10px;
border:solid 1px green; border:solid 1px green;
margin-left:10px; margin-left:10px;
float:left; float:left;
} }
fieldset.Steam div.output tr.select { fieldset.Steam div.output tr.select {
background-color:red; background-color:red;
} }
fieldset.Steam div.create { fieldset.Steam div.create {
/* clear:both; */ /* clear:both; */
} }
fieldset.Steam div.create pre:hover { fieldset.Steam div.create pre:hover {
background-color:red; background-color:red;
} }

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ ctx = context = {
for (var k in dataset) { for (var k in dataset) {
option[k] = dataset[k].split(",") option[k] = dataset[k].split(",")
} }
kit.Log(option) kit.Log(cmd)
this.GET("", option, function(msg) { this.GET("", option, function(msg) {
msg[0] && (msg = msg[0]) msg[0] && (msg = msg[0])
// msg && (msg.__proto__ = (page || {})) // msg && (msg.__proto__ = (page || {}))

View File

@ -23,7 +23,7 @@ fieldset>form.option div.hide {
display:none; display:none;
} }
fieldset>form.option div input.args { fieldset>form.option div input.args {
width:80px; width:100px;
} }
fieldset>form.option div.cmd input.args { fieldset>form.option div.cmd input.args {
color:white; color:white;
@ -81,7 +81,8 @@ fieldset>div.output table td {
} }
fieldset.toast { fieldset.toast {
background-color:#ffffff00; border:solid 2px red;
background-color:#ffffff;
position:absolute; position:absolute;
display:none; display:none;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff