1
0
forked from x/ContextOS

opt plugin

This commit is contained in:
shaoying 2019-10-29 12:39:30 +08:00
parent c0dc093c4f
commit df5f129209
10 changed files with 60 additions and 39 deletions

View File

@ -7,5 +7,5 @@ var version = struct {
self int
}{
[]string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"},
`2019-10-28 17:53:02`, `centos`, 651,
`2019-10-29 11:24:50`, `mac`, 665,
}

View File

@ -29,8 +29,9 @@ func (ctx *CTX) Begin(m *Message, arg ...string) Server {
m.Option("table.limit", 30)
m.Option("table.offset", 0)
m.Option("table.format", "object")
m.Optionv("ctx.form", map[string]int{
"table.limit": 1, "table.offset": 1,
"table.limit": 1, "table.offset": 1, "table.format": 1,
})
m.root = m

View File

@ -242,6 +242,10 @@ func (m *Message) Result(arg ...interface{}) string {
}
func (m *Message) Push(str string, arg ...interface{}) *Message {
switch m.Option("table.format") {
case "table":
return m.Add("append", "key", str).Add("append", "value", arg...)
}
return m.Add("append", str, arg...)
}
func (m *Message) Sort(key string, arg ...string) *Message {

View File

@ -56,9 +56,17 @@ kit dir "目录" private "ssh._route" _ "nfs.dir" _ time size line path \
feature display editor \
exports dir "" dir
kit git "版本" private "ssh._route" _ "nfs.git" __ \
text "" name pod imports plugin_pod action auto \
select "" values status values diff commit values values log values init action auto \
text "" name txt action auto \
button "查看"
fun wss "推送" private \
text "" name wss imports plugin_wss \
text "" name cmd view long \
button "推送" \
button "返回" cb Last \
exports wss key
if $2 == ""
copy web.wss
else
copy web.wss _ sync
end
end

View File

@ -101,23 +101,3 @@ fun media "娱乐" private \
end
end
fun wss "推送" private \
text "" name wss imports plugin_wss \
text "" name cmd view long \
button "推送" \
button "返回" cb Last \
exports wss key
if $2 == ""
copy web.wss
else
copy web.wss _ sync
end
end
kit pos "位置" private \
button "查看" cb getLocation \
button "显示" cb openLocation \
text "0.0062" name x \
text "0.0014" name y \
text "当前位置" name pos \

View File

@ -1,4 +1,4 @@
fieldset.item.mind div.output table td {
fieldset.item.mind.xls div.output table td {
text-align:center;
min-width:16px;
height:16px;

View File

@ -8,9 +8,31 @@ kit xls "表格" "index.js" "index.css" private context find "web.wiki" xls \
kit dir "目录" private "ssh._route" _ "nfs.dir" _ time size line path \
text "" name pod imports plugin_pod action auto \
text "usr/script" name dir imports plugin_dir action auto view long \
text "usr/local/redis-5.0.5/src" name dir imports plugin_dir action auto view long \
button "浏览" action auto \
button "返回" cb Last \
feature display editor \
exports dir "" dir
kit grep "搜索" public "nfs.grep" search _ _ "-rn" "--color" cmd_parse cut 3 ":" "file line word" \
text "" name txt imports plugin_editor_word \
text "usr/local/redis-5.0.5" name dir view long \
button "搜索" \
exports dir file "" editor_file file "" editor_index line ""
fun mark "标签" public \
text "mark" name table \
text "" name file imports plugin_editor_file view long \
text "" name index imports plugin_editor_index view tiny \
text "" name word imports plugin_editor_word \
text "" name mark view long \
button "操作" \
exports dir file "" editor_index index "" editor_word word
if $5 == ""
copy skip ssh.data show _
else
copy ssh.data insert _ file _ index _ word _ mark _
end
end

View File

@ -1,21 +1,21 @@
fun buffer "粘贴板" private \
text "0" name index imports plugin_tmux_bindex action auto \
text "" name index imports plugin_tmux_bindex action auto \
text "" name txt view long \
button "查看" action auto \
button "返回" cb Last \
exports tmux_bindex cur
let index = $1
if $1 == ""
copy cli.system tmux "list-buffer" cmd_parse cut 3 ":" "cur bytes text"
copy skip cli.system tmux "list-buffer" cmd_parse cut 3 ":" "cur bytes text"
return
end
if $2 == ""
copy cli.system tmux "show-buffer" "-b"
return
if $2 != ""
copy cli.system tmux "set-buffer" "-b"
end
copy cli.system tmux "set-buffer" "-b"
return $(cli.system tmux "show-buffer" "-b" $index)
end
fun clip "剪切板" public \
@ -59,7 +59,7 @@ kit save "导出" private "ssh.data" export \
kit load "导入" private "ssh.data" import \
text "love" name table imports plugin_table \
text "" name file \
text "list.csv" name file \
button "导入"
kit push "上传" private "web./download/" \
@ -67,3 +67,9 @@ kit push "上传" private "web./download/" \
button "上传" cb upload \
button "查看"
kit git "版本" private "ssh._route" _ "nfs.git" __ \
text "" name pod imports plugin_pod action auto \
select "" values status values diff commit values values log values init action auto \
text "" name txt action auto \
button "查看"

View File

@ -159,9 +159,7 @@ ctx = context = (function(kit) {var ctx = {__proto__: kit,
}),
WSS: shy("响应后端", {order: 0, wssid: ""}, function(cb, onerror, onclose, onopen) {var meta = arguments.callee.meta
var s = new WebSocket(location.protocol.replace("http", "ws")+"//"+location.host+"/wss?wssid="+meta.wssid)
s.onopen = function(event) {kit.Tip("wss open"), ctx.Event(event, {}, {name: [document.title, "wss", "open"]})}
s.onerror = function(event) {kit.Log("wss", "error", event), kit._call(onerror, [event])}
s.onclose = function(event) {kit.Tip("wss close"), kit.Log("wss", "close"), kit._call(onclose, [event])}
s.onerror = onerror, s.onclose = onclose, s.onopen = onopen
s.onmessage = function(event) {var order = ++meta.order
try {
var msg = JSON.parse(event.data||'{}')

View File

@ -359,10 +359,12 @@ function Page(page) {
page.socket.close()
}), onclose || (function() {
page.toast.Pane.Show("WSS Close")
delete(page.socket), setTimeout(function() {
page.WSS(cb, onerror, onclose)
}, 1000)
}), onopen || (function() {
page.toast.Pane.Show("WSS Open")
})))
},