1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
shaoying 2019-07-03 22:25:34 +08:00
parent 1d42a86a2a
commit 61df707fe5
6 changed files with 69 additions and 35 deletions

View File

@ -707,8 +707,16 @@ var version = struct {
return
}
if len(arg) > 1 && arg[0] == "script" {
m.Cmdy("web.get", "dev", fmt.Sprintf("publish/%s", arg[1]),
"upgrade", arg[0], "save", path.Join("usr/script", arg[1]))
miss := ""
if len(arg) > 2 {
miss, arg = arg[1], arg[2:]
} else {
arg = arg[1:]
}
for _, v := range arg {
m.Cmdy("web.get", "dev", fmt.Sprintf("publish/%s", v),
"upgrade", "script", "missyou", miss, "save", path.Join("usr/script", v))
}
return
}

View File

@ -4,5 +4,5 @@ var version = struct {
host string
self int
}{
"2019-07-02 23:37:53", "com", 92,
"2019-07-03 21:36:06", "ZYB-20190522USI", 103,
}

View File

@ -69,20 +69,28 @@ func dir(m *ctx.Message, name string, level int, deep bool, dir_type string, tri
} else {
m.Add("append", "type", "file")
}
case "full":
m.Add("append", "full", path.Join(back, name, f.Name()))
case "path":
m.Add("append", "path", path.Join(back, name, f.Name())[trip:])
case "tree":
if level == 0 {
m.Add("append", "tree", f.Name())
} else {
m.Add("append", "tree", strings.Repeat("| ", level-1)+"|-"+f.Name())
}
case "filename":
if f.IsDir() {
m.Add("append", "filename", f.Name()+"/")
} else {
case "full":
if f.IsDir() {
m.Add("append", "full", path.Join(back, name, f.Name())+"/")
} else {
m.Add("append", "full", path.Join(back, name, f.Name()))
}
case "path":
if f.IsDir() {
m.Add("append", "path", path.Join(back, name, f.Name())[trip:]+"/")
} else {
m.Add("append", "path", path.Join(back, name, f.Name())[trip:])
}
case "tree":
if level == 0 {
m.Add("append", "tree", f.Name())
} else {
m.Add("append", "tree", strings.Repeat("| ", level-1)+"|-"+f.Name())
}
case "filename":
if f.IsDir() {
m.Add("append", "filename", f.Name()+"/")
} else {
m.Add("append", "filename", f.Name())
}
case "size":

View File

@ -261,14 +261,14 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
map[string]interface{}{"componet_name": "dir", "componet_help": "目录",
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
"componet_args": []interface{}{"$$", "context", "nfs", "dir"}, "inputs": []interface{}{
"componet_args": []interface{}{"$$", "context", "nfs", "dir", "$$", "time", "size", "line", "path"}, "inputs": []interface{}{
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"}},
map[string]interface{}{"type": "button", "value": "查看"},
map[string]interface{}{"type": "text", "name": "dir", "value": "", "view": "long", "imports": "plugin_dir", "action": "auto"},
map[string]interface{}{"type": "button", "value": "查看", "action": "auto"},
map[string]interface{}{"type": "button", "value": "回退", "click": "Back"},
},
"display": map[string]interface{}{"hide_result": true},
"exports": []interface{}{"dir", "filename", "dir"},
"exports": []interface{}{"dir", "", "dir"},
"dir_root": []interface{}{"/"},
},
map[string]interface{}{"componet_name": "commit", "componet_help": "提交",
@ -277,7 +277,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_args": []interface{}{}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "dir", "imports": "plugin_dir", "view": "long"},
map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{
"commit", "add", "checkout",
"add", "commit", "checkout", "merge", "push", "init",
}},
map[string]interface{}{"type": "text", "name": "commit", "view": "long"},
map[string]interface{}{"type": "button", "value": "执行"},
@ -289,7 +289,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_args": []interface{}{}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "dir", "view": "long", "imports": "plugin_dir"},
map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{
"branch", "status", "diff", "log", "update", "push", "init",
"branch", "status", "diff", "log", "update",
}},
map[string]interface{}{"type": "button", "value": "执行"},
},

View File

@ -1126,7 +1126,11 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
}
p := ""
if m.Option("upgrade") == "script" {
p = m.Cmdx("nfs.path", path.Join("usr/script", key))
if m.Options("missyou") {
p = m.Cmdx("nfs.path", path.Join(m.Conf("missyou", "path"), m.Option("missyou"), "usr/script", key))
} else {
p = m.Cmdx("nfs.path", path.Join("usr/script", key))
}
}
key = strings.Replace(key, ".", "_", -1)
if p == "" {

View File

@ -550,7 +550,7 @@ function Plugin(page, pane, field) {
var plugin = field.Script || {}; plugin.__proto__ = {
__proto__: pane,
Append: function(item, name) {
name = name || item.name
name = item.name || ""
item.onfocus = function(event) {
page.pane = pane.Field, page.plugin = field, page.input = event.target
@ -633,9 +633,9 @@ function Plugin(page, pane, field) {
var ui = kit.AppendChild(option, [{view: [item.view||""], list: [{type: "label", inner: item.label||""}, input]}])
var action = ui[name] || {}
action.History = [""], action.Goto = function(value) {
action.History = [""], action.Goto = function(value, cb) {
action.History.push(action.value = value)
plugin.Check(action)
plugin.Check(action, cb)
return value
}, action.Back = function() {
action.History.pop(), action.History.length > 0 && action.Goto(action.History.pop())
@ -677,9 +677,9 @@ function Plugin(page, pane, field) {
})
return pane.View(field.parentNode, "plugin", field.Meta, [], field.Run).field.Plugin
},
Check: function(target) {
Check: function(target, cb) {
option.querySelectorAll(".args").forEach(function(item, index, list) {
item == target && (index == list.length-1? plugin.Runs(event): page.plugin == field && list[index+1].focus())
item == target && (index == list.length-1? plugin.Runs(event, cb): page.plugin == field && list[index+1].focus())
})
},
Runs: function(event, cb) {
@ -709,6 +709,7 @@ function Plugin(page, pane, field) {
output.innerHTML = ""
},
ondaemon: {
void: function(msg) {},
table: function(msg) {
output.innerHTML = ""
if (display.map) {
@ -717,9 +718,9 @@ function Plugin(page, pane, field) {
}
output.innerHTML = ""
!display.hide_append && msg.append && kit.OrderTable(kit.AppendTable(kit.AppendChild(output, "table"), ctx.Table(msg), msg.append), exports[1], function(event, value, name, line) {
if (line["latitude"]) {
page.openLocation(line.latitude, line.longitude, line.location)
}
// if (line["latitude"]) {
// page.openLocation(line.latitude, line.longitude, line.location)
// }
page.Sync("plugin_"+exports[0]).set(plugin.onexport[exports[2]||""](value, name, line))
});
(display.show_result || !msg.append) && msg.result && kit.AppendChild(output, [{view: ["code", "div", msg.Results()]}])
@ -744,10 +745,23 @@ function Plugin(page, pane, field) {
}
return line.pod
},
dir: function(value, name) {
if (value.endsWith("/")) {
return option[exports[0]] + value
dir: function(value, name, line) {
if (name != "path") {
value = line.path
}
if (value.endsWith("/")) {
option.dir.Goto(value)
return value
}
var deal = display.deal
var back = option.dir.value
display.deal = "void"
option.dir.value = value
plugin.Runs(window.event, function() {
display.deal = deal
option.dir.value = back
})
},
},