forked from x/ContextOS
add ssh.tool.remote
This commit is contained in:
parent
fb56a62351
commit
de04fa3bee
@ -666,7 +666,10 @@ func (m *Message) Cmd(args ...interface{}) *Message {
|
|||||||
msg := m
|
msg := m
|
||||||
if strings.Contains(key, ":") {
|
if strings.Contains(key, ":") {
|
||||||
ps := strings.Split(key, ":")
|
ps := strings.Split(key, ":")
|
||||||
msg, key, arg = msg.Sess("ssh"), "_route", append([]string{"sync", ps[0], ps[1]}, arg...)
|
if ps[0] == "_" {
|
||||||
|
ps[0], arg = arg[0], arg[1:]
|
||||||
|
}
|
||||||
|
msg, key, arg = m.Sess("ssh"), "_route", append([]string{"sync", ps[0], ps[1]}, arg...)
|
||||||
defer func() { m.Copy(msg, "append").Copy(msg, "result") }()
|
defer func() { m.Copy(msg, "append").Copy(msg, "result") }()
|
||||||
m.Hand = true
|
m.Hand = true
|
||||||
|
|
||||||
|
@ -334,7 +334,14 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prefix := []string{}
|
||||||
msg := m.Find(kit.Format(tool["ctx"]))
|
msg := m.Find(kit.Format(tool["ctx"]))
|
||||||
|
if strings.Contains(kit.Format(tool["ctx"]), ":") {
|
||||||
|
ps := strings.Split(kit.Format(tool["ctx"]), ":")
|
||||||
|
prefix = append(prefix, "_route", ps[0], "context", "find", ps[1])
|
||||||
|
msg = m.Sess("ssh")
|
||||||
|
}
|
||||||
|
|
||||||
if option, ok := tool["options"].(map[string]interface{}); ok {
|
if option, ok := tool["options"].(map[string]interface{}); ok {
|
||||||
for k, v := range option {
|
for k, v := range option {
|
||||||
msg.Option(k, v)
|
msg.Option(k, v)
|
||||||
@ -345,6 +352,9 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
msg.Option("storm", arg[1])
|
msg.Option("storm", arg[1])
|
||||||
|
|
||||||
arg = arg[4:]
|
arg = arg[4:]
|
||||||
|
if len(prefix) > 0 && prefix[1] == "_" {
|
||||||
|
prefix[1], arg = arg[0], arg[1:]
|
||||||
|
}
|
||||||
args := []string{}
|
args := []string{}
|
||||||
for _, v := range kit.Trans(tool["args"]) {
|
for _, v := range kit.Trans(tool["args"]) {
|
||||||
if strings.HasPrefix(v, "__") {
|
if strings.HasPrefix(v, "__") {
|
||||||
@ -361,7 +371,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
args = append(args, msg.Parse(v))
|
args = append(args, msg.Parse(v))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg.Cmd(tool["cmd"], args, arg)
|
msg.Cmd(prefix, tool["cmd"], args, arg)
|
||||||
msg.CopyTo(m)
|
msg.CopyTo(m)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -555,7 +565,8 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
m.Cmdy("ssh.data", "save", arg[1])
|
m.Cmdy("ssh.data", "save", arg[1])
|
||||||
|
|
||||||
case "update":
|
case "update":
|
||||||
index := kit.Int(arg[2]) - 1 - m.Confi("flow", []string{m.Option("river"), "data", arg[1], "meta", "offset"})
|
offset := m.Confi("flow", []string{m.Option("river"), "data", arg[1], "meta", "offset"})
|
||||||
|
index := kit.Int(arg[2]) - 1 - offset
|
||||||
table, prefix, arg := arg[1], "", arg[3:]
|
table, prefix, arg := arg[1], "", arg[3:]
|
||||||
if index >= 0 {
|
if index >= 0 {
|
||||||
if arg[0] == "extra" {
|
if arg[0] == "extra" {
|
||||||
@ -565,7 +576,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
m.Confv("flow", []string{m.Option("river"), "data", table, "list", kit.Format(index), prefix + arg[i]}, arg[i+1])
|
m.Confv("flow", []string{m.Option("river"), "data", table, "list", kit.Format(index), prefix + arg[i]}, arg[i+1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.Cmdy("ssh.data", "show", table, index+1)
|
m.Cmdy("ssh.data", "show", table, index+1+offset)
|
||||||
|
|
||||||
case "import":
|
case "import":
|
||||||
if len(arg) < 3 {
|
if len(arg) < 3 {
|
||||||
|
@ -228,7 +228,7 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
m.Set("append")
|
m.Set("append")
|
||||||
case "file":
|
case "file":
|
||||||
// 文件列表
|
// 文件列表
|
||||||
m.Cmd("ssh._route", arg[1], "ssh.data", "show", arg[2]).Table(func(index int, value map[string]string) {
|
m.Cmd("ssh.data", "show", arg[1:]).Table(func(index int, value map[string]string) {
|
||||||
m.Push("id", value["id"])
|
m.Push("id", value["id"])
|
||||||
m.Push("kind", value["kind"])
|
m.Push("kind", value["kind"])
|
||||||
m.Push("name", value["name"])
|
m.Push("name", value["name"])
|
||||||
@ -250,14 +250,10 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
|
|
||||||
case "list":
|
case "list":
|
||||||
if len(arg) > 2 && arg[2] == "modify" {
|
if len(arg) > 2 && arg[2] == "modify" {
|
||||||
m.Cmdy("ssh._route", m.Option("dream"), "ssh.data", "update", m.Option("favor"), arg[1], arg[3], arg[4])
|
m.Cmdy("ssh.data", "update", m.Option("favor"), arg[1], arg[3], arg[4])
|
||||||
arg = []string{"list", m.Option("dream"), m.Option("favor")}
|
arg = []string{"list", m.Option("dream"), m.Option("favor")}
|
||||||
}
|
}
|
||||||
if len(arg) > 1 {
|
m.Cmdy("ssh.data", "show", arg[1:])
|
||||||
m.Cmdy("ssh._route", arg[1], "ssh.data", "show", arg[2:])
|
|
||||||
break
|
|
||||||
}
|
|
||||||
m.Cmdy("ssh.data", "show")
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
@ -17,7 +17,6 @@ var Index = &ctx.Context{Name: "team", Help: "团队中心",
|
|||||||
if len(arg) > 2 && arg[1] != "" {
|
if len(arg) > 2 && arg[1] != "" {
|
||||||
switch arg[2] {
|
switch arg[2] {
|
||||||
case "prepare", "action", "cancel", "finish":
|
case "prepare", "action", "cancel", "finish":
|
||||||
prefix := []string{"ssh._route", m.Option("dream"), "ssh.data", "update"}
|
|
||||||
time := "close_time"
|
time := "close_time"
|
||||||
switch arg[2] {
|
switch arg[2] {
|
||||||
case "prepare", "action":
|
case "prepare", "action":
|
||||||
@ -29,7 +28,7 @@ var Index = &ctx.Context{Name: "team", Help: "团队中心",
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新任务
|
// 更新任务
|
||||||
m.Cmd(prefix, m.Option("table"), arg[1], "status", arg[2], time, m.Time())
|
m.Cmd("ssh.data", "update", m.Option("table"), arg[1], "status", arg[2], time, m.Time())
|
||||||
arg = []string{arg[0], m.Option("table")}
|
arg = []string{arg[0], m.Option("table")}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,6 +51,7 @@ var Index = &ctx.Context{Name: "team", Help: "团队中心",
|
|||||||
m.Cmdy("ssh.data", "insert", arg[1], "level", arg[2], "class", arg[3],
|
m.Cmdy("ssh.data", "insert", arg[1], "level", arg[2], "class", arg[3],
|
||||||
"status", arg[4], "begin_time", arg[5], "close_time", arg[6],
|
"status", arg[4], "begin_time", arg[5], "close_time", arg[6],
|
||||||
"target", arg[7], "detail", arg[8], arg[9:])
|
"target", arg[7], "detail", arg[8], arg[9:])
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
arg = []string{arg[1]}
|
arg = []string{arg[1]}
|
||||||
|
@ -14,7 +14,7 @@ fun date "每一天" "index.js" "index.css" protected \
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
kit progress "任务进度" public "ssh._route" _ "web.team.task" progress \
|
kit progress "任务进度" public "_:web.team.task" progress \
|
||||||
text "" name dream imports plugin_you \
|
text "" name dream imports plugin_you \
|
||||||
text "task" name table \
|
text "task" name table \
|
||||||
text "30" name limit \
|
text "30" name limit \
|
||||||
@ -22,7 +22,7 @@ kit progress "任务进度" public "ssh._route" _ "web.team.task" progress \
|
|||||||
feature detail action finish cancel prepare \
|
feature detail action finish cancel prepare \
|
||||||
button "查看" action auto
|
button "查看" action auto
|
||||||
|
|
||||||
kit create "创建任务" public "ssh._route" _ "web.team.task" create \
|
kit create "创建任务" public "_:web.team.task" create \
|
||||||
text "" name dream imports plugin_you \
|
text "" name dream imports plugin_you \
|
||||||
text "task" name table \
|
text "task" name table \
|
||||||
select "3" name level values 1 values 2 values 3 values 4 values 5 \
|
select "3" name level values 1 values 2 values 3 values 4 values 5 \
|
||||||
@ -34,7 +34,7 @@ kit create "创建任务" public "ssh._route" _ "web.team.task" create \
|
|||||||
textarea "" name detail half "4" \
|
textarea "" name detail half "4" \
|
||||||
button "添加" before br
|
button "添加" before br
|
||||||
|
|
||||||
kit select "查看任务" public "ssh._route" _ "web.team.task" \
|
kit select "查看任务" public "_:web.team.task" \
|
||||||
text "" name dream imports plugin_you \
|
text "" name dream imports plugin_you \
|
||||||
text "task" name table imports pluing_table \
|
text "task" name table imports pluing_table \
|
||||||
text "" name index imports plugin_task_id action auto \
|
text "" name index imports plugin_task_id action auto \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
kit tips "便签" private "web.code.favor" list \
|
kit tips "便签" private "_:web.code.favor" list \
|
||||||
text "" name dream imports plugin_you action auto \
|
text "" name dream imports plugin_you action auto \
|
||||||
text "tip" name favor imports plugin_vim_favor action auto \
|
text "tip" name favor imports plugin_vim_favor action auto \
|
||||||
text "" name index imports plugin_tip_id view tiny action auto \
|
text "" name index imports plugin_tip_id view tiny action auto \
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
kit file "文件" private "web.code.favor" file \
|
kit file "文件" private "_:web.code.favor" file \
|
||||||
text "" name dream imports plugin_you action auto \
|
text "" name dream imports plugin_you action auto \
|
||||||
text "file" name type \
|
text "file" name type \
|
||||||
button "查看" action auto
|
button "查看" action auto
|
||||||
|
|
||||||
kit taps "便签" private "web.code.favor" list \
|
kit taps "便签" private "_:web.code.favor" list \
|
||||||
text "" name dream imports plugin_you action auto \
|
text "" name dream imports plugin_you action auto \
|
||||||
text "tap" name favor imports plugin_zsh_favor action auto \
|
text "tap" name favor imports plugin_zsh_favor action auto \
|
||||||
text "" name index imports plugin_tap_id view tiny action auto \
|
text "" name index imports plugin_tap_id view tiny action auto \
|
||||||
|
@ -1493,31 +1493,40 @@ function Output(plugin, type, msg, cb, target, option) {
|
|||||||
kit.Selector(option, ".args", function(item) {
|
kit.Selector(option, ".args", function(item) {
|
||||||
msg.Option(item.name, item.value)
|
msg.Option(item.name, item.value)
|
||||||
})
|
})
|
||||||
item == "修改"? (text = kit.AppendChilds(td, [{type: "input", value: text, style: {width: td.clientWidth+"px"}, data: {onkeydown: function(event) {
|
var cmd = []
|
||||||
if (event.key == "Enter") {
|
option.dream && cmd.push(option.dream.value)
|
||||||
var id = ""
|
if (item == "修改") {
|
||||||
for (var i = 0; i < exports.length-1; i += 3) {
|
text = kit.AppendChilds(td, [{type: "input", value: text, style: {width: td.clientWidth+"px"}, data: {onkeydown: function(event) {
|
||||||
id = (id || line[exports[i+1]] || "").trim()
|
if (event.key == "Enter") {
|
||||||
}
|
var id = ""
|
||||||
|
for (var i = 0; i < exports.length-1; i += 3) {
|
||||||
|
id = (id || line[exports[i+1]] || "").trim()
|
||||||
|
}
|
||||||
|
|
||||||
var msg = plugin.Event(event)
|
var msg = plugin.Event(event)
|
||||||
kit.Selector(option, ".args", function(item) {
|
kit.Selector(option, ".args", function(item) {
|
||||||
msg.Option(item.name, item.value)
|
msg.Option(item.name, item.value)
|
||||||
})
|
})
|
||||||
if (name == "value") {
|
if (name == "value") {
|
||||||
name = line.key
|
name = line.key
|
||||||
id = option.index.value
|
id = option.index.value
|
||||||
|
}
|
||||||
|
cmd.push(id, meta[item], name, event.target.value)
|
||||||
|
plugin.Run(event, cmd, function(msg) {
|
||||||
|
td.innerHTML = event.target.value
|
||||||
|
plugin.ontoast("修改成功")
|
||||||
|
}, true)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
plugin.Run(event, [id, meta[item], name, event.target.value], function(msg) {
|
}}}]).input, text.focus(), text.setSelectionRange(0, -1)
|
||||||
td.innerHTML = event.target.value
|
} else if (output[meta[item]]) {
|
||||||
plugin.ontoast("修改成功")
|
output[meta[item]](event)
|
||||||
}, true)
|
} else {
|
||||||
return
|
cmd.push(td.dataset.id||(line[exports[1]]||"").trim(), meta[item]||item)
|
||||||
}
|
plugin.Run(event, cmd, function(msg) {
|
||||||
}}}]).input, text.focus(), text.setSelectionRange(0, -1)): output[meta[item]]? output[meta[item]](event): plugin.Run(event, [td.dataset.id||(line[exports[1]]||"").trim(), meta[item]||item], function(msg) {
|
console.log(msg)
|
||||||
console.log(msg)
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user