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-11 22:52:16 +08:00
parent 37a6493f73
commit 2ae305dc4b
4 changed files with 23 additions and 9 deletions

View File

@ -4,5 +4,5 @@ var version = struct {
host string host string
self int self int
}{ }{
"2019-07-10 05:27:50", "ZYB-20190522USI.ubuntu", 136, "2019-07-11 17:29:33", "ZYB-20190522USI", 137,
} }

View File

@ -127,10 +127,10 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
m.Echo(arg[1]) m.Echo(arg[1])
return return
}}, }},
"redis": &ctx.Command{Name: "redis conn address [protocol]", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { "redis": &ctx.Command{Name: "redis open address [protocol]", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
if mdb, ok := m.Target().Server.(*MDB); m.Assert(ok) { if mdb, ok := m.Target().Server.(*MDB); m.Assert(ok) {
switch arg[0] { switch arg[0] {
case "conn": case "open":
mdb.conn, e = redis.Dial("tcp", m.Cap("redis", arg[1]), redis.DialKeepAlive(time.Second*10)) mdb.conn, e = redis.Dial("tcp", m.Cap("redis", arg[1]), redis.DialKeepAlive(time.Second*10))
default: default:
if mdb.conn == nil { if mdb.conn == nil {

View File

@ -100,12 +100,23 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "", "componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route", "componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
"componet_args": []interface{}{"$$", "context", "mdb", "redis"}, "inputs": []interface{}{ "componet_args": []interface{}{"$$", "context", "mdb", "redis"}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "pod", "value": "redis"}, map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{"get", "del", "hgetall"}}, map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{"get", "del", "hgetall"}},
map[string]interface{}{"type": "text", "name": "cmd", "value": "test", "view": "long"}, map[string]interface{}{"type": "text", "name": "cmd", "value": "test", "view": "long"},
map[string]interface{}{"type": "button", "value": "执行"}, map[string]interface{}{"type": "button", "value": "执行"},
}, },
}, },
map[string]interface{}{"componet_name": "mysql", "componet_help": "存储",
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
"componet_args": []interface{}{"$$", "context", "$$", "show"}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
map[string]interface{}{"type": "text", "name": "ctx", "value": "db1"},
map[string]interface{}{"type": "text", "name": "cmd", "value": "tblStudentLesson0", "imports": "plugin_db_table", "action": "auto"},
map[string]interface{}{"type": "button", "value": "查看 "},
},
"exports": []interface{}{"db_table", "Tables"},
},
}, },
"context": []interface{}{ "context": []interface{}{
map[string]interface{}{"componet_name": "runtime", "componet_help": "系统", map[string]interface{}{"componet_name": "runtime", "componet_help": "系统",
@ -157,7 +168,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "", "componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
"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", "view": "long"},
map[string]interface{}{"type": "button", "value": "行动", "action": "auto"}, map[string]interface{}{"type": "button", "value": "行动", "action": "auto"},
}, },
"exports": []interface{}{"you", "", "you"}, "exports": []interface{}{"you", "", "you"},
@ -243,7 +254,7 @@ 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", "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", "view": "long"},
map[string]interface{}{"type": "button", "value": "执行", "action": "auto"}, map[string]interface{}{"type": "button", "value": "执行", "action": "auto"},
}, },
"exports": []interface{}{"pod", "", "pod"}, "exports": []interface{}{"pod", "", "pod"},

View File

@ -1083,13 +1083,16 @@ function Canvas(plugin, output, width, height, space, msg) {
ticket: { ticket: {
draw: function() { draw: function() {
what.drawAxies().drawXLabel(step) what.drawAxies().drawXLabel(step)
if (keys.length < 3) {
return
}
canvas.beginPath() canvas.beginPath()
var sum = 0, total = 0 var sum = 0, total = 0
for (var i = 0; i < nrow; i++) { for (var i = 0; i < nrow; i++) {
sum += data[keys[1]][i] sum += data[keys[1]][i]
sum > total && (total = sum) sum > total && (total = sum)
sum -= data[keys[2]||keys[1]][i] sum -= data[keys[2]][i]
} }
if (!data["sum"]) { if (!data["sum"]) {
var sum = 0, max = 0, min = 0, end = 0 var sum = 0, max = 0, min = 0, end = 0
@ -1100,8 +1103,8 @@ function Canvas(plugin, output, width, height, space, msg) {
data["end"] = [] data["end"] = []
for (var i = 0; i < nrow; i++) { for (var i = 0; i < nrow; i++) {
max = sum + data[keys[1]][i] max = sum + data[keys[1]][i]
min = sum - data[keys[2||keys[1]]][i] min = sum - data[keys[2]][i]
end = sum + data[keys[1]][i] - data[keys[2]||keys[1]][i] end = sum + data[keys[1]][i] - data[keys[2]][i]
data["sum"].push(sum) data["sum"].push(sum)
data["max"].push(max) data["max"].push(max)
data["min"].push(min) data["min"].push(min)