1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-06-27 02:17:31 +08:00
This commit is contained in:
shaoying 2019-08-22 21:06:56 +08:00
parent e825aa20b5
commit 04be739f22
6 changed files with 54 additions and 16 deletions

View File

@ -343,9 +343,9 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
// 执行命令 // 执行命令
m.Gos(m, func(m *ctx.Message) { m.Gos(m, func(m *ctx.Message) {
if e := cmd.Start(); e != nil { if e := cmd.Start(); e != nil {
m.Echo("error: ").Echo("%s\n", e) m.Log("warn", "%v", e).Echo("error: ").Echo("%s\n", e)
} else if e := cmd.Wait(); e != nil { } else if e := cmd.Wait(); e != nil {
m.Echo("error: ").Echo("%s\n", e) m.Log("warn", "%v", e).Echo("error: ").Echo("%s\n", e)
} }
m.Conf("daemon", []string{h, "finish_time"}, time.Now().Format(m.Conf("time", "format"))) m.Conf("daemon", []string{h, "finish_time"}, time.Now().Format(m.Conf("time", "format")))
}) })
@ -434,6 +434,13 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
m.Table() m.Table()
default: default:
var data interface{}
if json.Unmarshal(out.Bytes(), &data) == nil {
if b, e := json.MarshalIndent(data, "", " "); e == nil {
m.Echo(string(b))
break
}
}
m.Echo(out.String()) m.Echo(out.String())
} }
}) })
@ -831,6 +838,9 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
m.Table() m.Table()
} }
case "restart":
m.Cmdy("cli.quit", "1")
case "plugin": case "plugin":
arg = arg[1:] arg = arg[1:]
if len(arg) == 0 { if len(arg) == 0 {
@ -1027,6 +1037,11 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
return return
}}, }},
"missyou": &ctx.Command{Name: "missyou [name [stop]]", Help: "任务管理", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { "missyou": &ctx.Command{Name: "missyou [name [stop]]", Help: "任务管理", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
topic := "hello"
if len(arg) > 0 && (arg[0] == "" || m.Cmds("nfs.path", path.Join(m.Conf("cli.project", "plugin.path"), arg[0]))) {
topic, arg = arg[0], arg[1:]
}
if len(arg) == 0 { if len(arg) == 0 {
m.Option("dir_root", "") m.Option("dir_root", "")
m.Cmd("nfs.dir", m.Conf("missyou", "path"), "time", "name").Table(func(value map[string]string) { m.Cmd("nfs.dir", m.Conf("missyou", "path"), "time", "name").Table(func(value map[string]string) {
@ -1067,13 +1082,13 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
args := []string{ args := []string{
"daemon", "cmd_dir", p, "daemon", "cmd_dir", p,
"cmd_env", "PATH", os.Getenv("PATH"), "cmd_env", "PATH", os.Getenv("PATH"),
"cmd_env", "ctx_type", kit.Select("hello", arg, 1), "cmd_env", "ctx_type", kit.Select(topic, arg, 1),
"cmd_env", "ctx_home", m.Conf("runtime", "boot.ctx_home"), "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_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_env", "ctx_box", fmt.Sprintf("http://127.0.0.1%s", m.Conf("runtime", "boot.web_port")),
"cmd_daemon", "true", "cmd_daemon", "true",
} }
if m.Conf("runtime", "host.GOOS") == "windows" { if m.Assert(os.MkdirAll(p, 0666)); m.Conf("runtime", "host.GOOS") == "windows" {
m.Cmdy("cli.system", path.Join(m.Conf("runtime", "boot.ctx_home"), "bin/node.sh"), "start", args) m.Cmdy("cli.system", path.Join(m.Conf("runtime", "boot.ctx_home"), "bin/node.sh"), "start", args)
} else { } else {
m.Cmdy("cli.system", m.Conf("runtime", "boot.ctx_bin"), args) m.Cmdy("cli.system", m.Conf("runtime", "boot.ctx_bin"), args)

View File

@ -4,5 +4,5 @@ var version = struct {
host string host string
self int self int
}{ }{
"2019-08-22 09:22:24", "mac", 412, "2019-08-22 17:02:38", "ZYB-20190522USI", 415,
} }

View File

@ -959,6 +959,9 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
m.Log("time", "exec: %v", m.Format("cost")) m.Log("time", "exec: %v", m.Format("cost"))
return return
}}, }},
"relay": &ctx.Command{Name: "relay address", Help: "网络连接", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
return
}},
}, },
} }

View File

@ -1,7 +1,7 @@
fun project "项目" "" "" \ fun project "项目" "" "" \
private \ private \
select "" values plugin values submit values review values trend values stat values init \ select "" values plugin values submit values review values trend values stat values init action auto \
text "" imports plugin_see action auto \ text "" imports plugin_see action auto \
button "执行" \ button "执行" \
exports see name see exports see name see
@ -11,7 +11,7 @@ end
fun compile "编译" "" "" \ fun compile "编译" "" "" \
private \ private \
select "" values plugin values windows values darwin values linux values self values all \ select "" values plugin values restart values windows values darwin values linux values self values all \
text "" name see imports plugin_see \ text "" name see imports plugin_see \
button "编译" button "编译"
@ -38,6 +38,7 @@ end
fun missyou "任务" "" "" \ fun missyou "任务" "" "" \
private \ private \
text "" imports plugin_see \
text "" view long \ text "" view long \
button "行动" action auto \ button "行动" action auto \
exports you "" you exports you "" you
@ -66,7 +67,7 @@ end
fun cmd "命令" "" "" \ fun cmd "命令" "" "" \
private \ private \
text "" name pod imports plugin_pod view long \ text "" name pod imports plugin_pod \
text "nfs" name ctx imports plugin_ctx \ text "nfs" name ctx imports plugin_ctx \
text "pwd" \ text "pwd" \
button "执行" button "执行"
@ -76,7 +77,7 @@ end
fun dir "目录" "" "" \ fun dir "目录" "" "" \
private \ private \
text "" name pod imports plugin_pod action auto view long \ text "" name pod imports plugin_pod action auto \
text "usr/script" name dir imports plugin_dir action auto view long \ text "usr/script" name dir imports plugin_dir action auto view long \
button "查看" action auto \ button "查看" action auto \
button "回退" click Back \ button "回退" click Back \
@ -85,3 +86,13 @@ fun dir "目录" "" "" \
copy ssh._route _ nfs.dir _ time size line path copy ssh._route _ nfs.dir _ time size line path
end end
fun git "版本" "" "" \
private \
text "" name pod imports plugin_pod action auto \
select "" values diff values status commit values values log values init action auto \
text "" name txt action auto \
button "查看" action auto
copy ssh._route _ nfs.git __
end

View File

@ -62,9 +62,18 @@ fun macro "脚本宏" "" "macro.js" \
end end
fun sys "命令行" "" "" \
public \
textarea "" view long \
button "运行" \
exports mac name
copy nfs.source system __
end
fun hello world "" "" \ fun hello world "" "" \
public \ public \
text "" \ textarea "" \
button "执行" button "执行"
copy pwd copy pwd

View File

@ -191,14 +191,14 @@ function Page(page) {
page.oncontrol && page.oncontrol(event, document.body, "control") page.oncontrol && page.oncontrol(event, document.body, "control")
if (kit.isWindows && event.ctrlKey) { if (kit.isWindows && event.ctrlKey) {
event.stopPropagation() // event.stopPropagation()
event.preventDefault() // event.preventDefault()
} }
}, document.body.onkeyup = function(event) { }, document.body.onkeyup = function(event) {
if (kit.isWindows && event.ctrlKey) { if (kit.isWindows && event.ctrlKey) {
event.stopPropagation() // event.stopPropagation()
event.preventDefault() // event.preventDefault()
} }
}, document.body.oncontextmenu = function(event) { }, document.body.oncontextmenu = function(event) {
@ -473,7 +473,7 @@ function Page(page) {
}, },
Show: function() { Show: function() {
output.innerHTML = "", kit.AppendChild(output, [ output.innerHTML = "", kit.AppendChild(output, [
{"view": ["title", "div", "shycontext"], click: function(event) { {"view": ["title", "div", "github.com/shylinux/context"], click: function(event) {
cb(event, "title", "shycontext") cb(event, "title", "shycontext")
}}, }},
{"view": ["state"], list: list.map(function(item) {return {text: [state[item], "div"], click: function(event) { {"view": ["state"], list: list.map(function(item) {return {text: [state[item], "div"], click: function(event) {
@ -717,7 +717,7 @@ function Plugin(page, pane, field, run) {
}) })
break break
case "textarea": case "textarea":
input.type = "textarea", item.style = "height:300px;"+"width:"+(option.clientWidth-20)+"px" input.type = "textarea", item.style = "height:100px;"+"width:"+(pane.target.clientWidth-30)+"px"
item.className = "args" item.className = "args"
case "text": case "text":
item.className = "args" item.className = "args"