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) {
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 {
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")))
})
@ -434,6 +434,13 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
m.Table()
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())
}
})
@ -831,6 +838,9 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
m.Table()
}
case "restart":
m.Cmdy("cli.quit", "1")
case "plugin":
arg = arg[1:]
if len(arg) == 0 {
@ -1027,6 +1037,11 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
return
}},
"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 {
m.Option("dir_root", "")
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{
"daemon", "cmd_dir", p,
"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_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",
}
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)
} else {
m.Cmdy("cli.system", m.Conf("runtime", "boot.ctx_bin"), args)

View File

@ -4,5 +4,5 @@ var version = struct {
host string
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"))
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 "项目" "" "" \
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 \
button "执行" \
exports see name see
@ -11,7 +11,7 @@ end
fun compile "编译" "" "" \
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 \
button "编译"
@ -38,6 +38,7 @@ end
fun missyou "任务" "" "" \
private \
text "" imports plugin_see \
text "" view long \
button "行动" action auto \
exports you "" you
@ -66,7 +67,7 @@ end
fun cmd "命令" "" "" \
private \
text "" name pod imports plugin_pod view long \
text "" name pod imports plugin_pod \
text "nfs" name ctx imports plugin_ctx \
text "pwd" \
button "执行"
@ -76,7 +77,7 @@ end
fun dir "目录" "" "" \
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 \
button "查看" action auto \
button "回退" click Back \
@ -85,3 +86,13 @@ fun dir "目录" "" "" \
copy ssh._route _ nfs.dir _ time size line path
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
fun sys "命令行" "" "" \
public \
textarea "" view long \
button "运行" \
exports mac name
copy nfs.source system __
end
fun hello world "" "" \
public \
text "" \
textarea "" \
button "执行"
copy pwd

View File

@ -191,14 +191,14 @@ function Page(page) {
page.oncontrol && page.oncontrol(event, document.body, "control")
if (kit.isWindows && event.ctrlKey) {
event.stopPropagation()
event.preventDefault()
// event.stopPropagation()
// event.preventDefault()
}
}, document.body.onkeyup = function(event) {
if (kit.isWindows && event.ctrlKey) {
event.stopPropagation()
event.preventDefault()
// event.stopPropagation()
// event.preventDefault()
}
}, document.body.oncontextmenu = function(event) {
@ -473,7 +473,7 @@ function Page(page) {
},
Show: function() {
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")
}},
{"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
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"
case "text":
item.className = "args"