forked from x/ContextOS
add bench.quick
Change-Id: I2a92a3ecc530c2aa60bf08e0d549601f5ff5fa47
This commit is contained in:
parent
6c8439711e
commit
f7bf81abb8
6
Makefile
6
Makefile
@ -23,9 +23,9 @@ install_all: install
|
|||||||
run:
|
run:
|
||||||
etc/bootstrap.sh
|
etc/bootstrap.sh
|
||||||
shy:
|
shy:
|
||||||
cp -r src/ ~/shycontext/
|
cp -r src/contexts ~/context/src/
|
||||||
cp -r usr/template/ ~/shycontext/usr/
|
cp -r usr/template ~/context/usr/
|
||||||
cp -r usr/librarys/ ~/shycontext/usr/
|
cp -r usr/librarys/ ~/context/usr/
|
||||||
|
|
||||||
tar:
|
tar:
|
||||||
[ -e tar ] || mkdir tar
|
[ -e tar ] || mkdir tar
|
||||||
|
@ -609,7 +609,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Sess("nfs").Cmd("path", arg[0]).Results(0) {
|
if m.Sess("nfs").Cmd("path", arg[0]).Results(0) && arg[0] != "bench" {
|
||||||
m.Start(fmt.Sprintf("shell%d", m.Capi("nshell", 1)), "shell", arg...)
|
m.Start(fmt.Sprintf("shell%d", m.Capi("nshell", 1)), "shell", arg...)
|
||||||
if len(arg) < 2 || arg[1] != "async" {
|
if len(arg) < 2 || arg[1] != "async" {
|
||||||
m.Wait()
|
m.Wait()
|
||||||
@ -624,7 +624,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
// "source_ctx": m.Option("current_ctx"),
|
// "source_ctx": m.Option("current_ctx"),
|
||||||
// "source_cmd": strings.Join(arg, " "),
|
// "source_cmd": strings.Join(arg, " "),
|
||||||
// })
|
// })
|
||||||
//
|
//
|
||||||
if m.Options("current_ctx") {
|
if m.Options("current_ctx") {
|
||||||
args := []string{"context", m.Option("current_ctx")}
|
args := []string{"context", m.Option("current_ctx")}
|
||||||
arg = append(args, arg...)
|
arg = append(args, arg...)
|
||||||
|
@ -227,7 +227,7 @@ func (web *WEB) Begin(m *ctx.Message, arg ...string) ctx.Server {
|
|||||||
|
|
||||||
web.ServeMux = http.NewServeMux()
|
web.ServeMux = http.NewServeMux()
|
||||||
web.Template = template.New("render").Funcs(ctx.CGI)
|
web.Template = template.New("render").Funcs(ctx.CGI)
|
||||||
template.Must(web.Template.ParseGlob(path.Join(m.Conf("template_dir"), m.Conf("template_sub"), "/*.tmpl")))
|
web.Template.ParseGlob(path.Join(m.Conf("template_dir"), m.Conf("template_sub"), "/*.tmpl"))
|
||||||
return web
|
return web
|
||||||
}
|
}
|
||||||
func (web *WEB) Start(m *ctx.Message, arg ...string) bool {
|
func (web *WEB) Start(m *ctx.Message, arg ...string) bool {
|
||||||
@ -356,6 +356,9 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
"base": []interface{}{"key", "share", "comment", "creator", "create_time", "modify_time", "commands"},
|
"base": []interface{}{"key", "share", "comment", "creator", "create_time", "modify_time", "commands"},
|
||||||
"link": []interface{}{"share", "comment", "creator", "link"},
|
"link": []interface{}{"share", "comment", "creator", "link"},
|
||||||
}, Help: "工作流"},
|
}, Help: "工作流"},
|
||||||
|
"docker_view": &ctx.Config{Name: "docker_view", Value: map[string]interface{}{
|
||||||
|
"top": 200, "left": 10, "width": 480, "height": 320,
|
||||||
|
}, Help: "工作流"},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ctx.Command{
|
Commands: map[string]*ctx.Command{
|
||||||
"client": &ctx.Command{Name: "client address [output [editor]]", Help: "添加浏览器配置, address: 默认地址, output: 输出路径, editor: 编辑器", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
"client": &ctx.Command{Name: "client address [output [editor]]", Help: "添加浏览器配置, address: 默认地址, output: 输出路径, editor: 编辑器", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||||
|
@ -4,15 +4,37 @@ var code = {
|
|||||||
inputs: [],
|
inputs: [],
|
||||||
ninput: 0,
|
ninput: 0,
|
||||||
|
|
||||||
|
quick_txt: false,
|
||||||
|
ntext: 1,
|
||||||
|
|
||||||
ncommand: 1,
|
ncommand: 1,
|
||||||
show_result: true,
|
show_result: true,
|
||||||
show_height: "30px",
|
show_height: "30px",
|
||||||
hide_height: "14px",
|
hide_height: "14px",
|
||||||
scroll_x: 50,
|
scroll_x: 50,
|
||||||
scroll_y: 50,
|
scroll_y: 50,
|
||||||
|
current_cmd: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_to_clipboard(text) {
|
function save_clipboard(item) {
|
||||||
|
var txt = []
|
||||||
|
var li = item.parentElement.children
|
||||||
|
for (var i = 0; i < li.length; i++) {
|
||||||
|
if (li[i].dataset["text"]) {
|
||||||
|
txt.push(li[i].dataset["text"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context.GET("", {
|
||||||
|
"componet_bench": context.Search("bench"),
|
||||||
|
"componet_group": "index",
|
||||||
|
"componet_name": "command",
|
||||||
|
"cmd": "bench "+context.Search("bench")+".clipstack"+" '"+JSON.stringify(txt)+"'"
|
||||||
|
}, function(msg) {
|
||||||
|
alert("保存成功")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function copy_to_clipboard(text, skip_docker) {
|
||||||
var clipboard = modify_node(".clipboard", {"value": text})
|
var clipboard = modify_node(".clipboard", {"value": text})
|
||||||
clipboard.select()
|
clipboard.select()
|
||||||
document.execCommand("copy")
|
document.execCommand("copy")
|
||||||
@ -21,6 +43,31 @@ function copy_to_clipboard(text) {
|
|||||||
var clipstack = document.querySelector("#clipstack")
|
var clipstack = document.querySelector("#clipstack")
|
||||||
insert_child(clipstack, "option").value = text
|
insert_child(clipstack, "option").value = text
|
||||||
clipstack.childElementCount > 3 && clipstack.removeChild(clipstack.lastElementChild)
|
clipstack.childElementCount > 3 && clipstack.removeChild(clipstack.lastElementChild)
|
||||||
|
|
||||||
|
if (skip_docker) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var txt = document.querySelector("div.workflow>ul>li>ul.txt")
|
||||||
|
var target = append_child(txt, "li", {
|
||||||
|
"innerText": format_date(new Date())+" "+(code.ntext++)+": "+text,
|
||||||
|
"dataset": {
|
||||||
|
"text": text,
|
||||||
|
"action": "copy_txt",
|
||||||
|
},
|
||||||
|
"onclick": function(event) {
|
||||||
|
if (event.altKey) {
|
||||||
|
target.parentElement.removeChild(target)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (event.shiftKey) {
|
||||||
|
var cmd = document.querySelector("form.option.command"+code.current_cmd+" input[name=cmd]")
|
||||||
|
cmd && (cmd.value += " "+text)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
copy_to_clipboard(text, true)
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
function add_keymap(input) {
|
function add_keymap(input) {
|
||||||
if (code.ninput < code.keymap.length && input.style.display != "none") {
|
if (code.ninput < code.keymap.length && input.style.display != "none") {
|
||||||
@ -52,7 +99,7 @@ function add_sort(append, field, cb) {
|
|||||||
var has = document.querySelector("td.clip")
|
var has = document.querySelector("td.clip")
|
||||||
has && (has.className = "")
|
has && (has.className = "")
|
||||||
target.className = "clip"
|
target.className = "clip"
|
||||||
copy_to_clipboard(target.innerText)
|
copy_to_clipboard(target.innerText, !event.shiftKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +134,18 @@ function del_command(target) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function shrink_command_result() {
|
||||||
|
code.show_result = !code.show_result
|
||||||
|
document.querySelectorAll("form.option input[name=cmd]").forEach(function(input) {
|
||||||
|
for (var command = input; command.tagName != "FIELDSET"; command = command.parentElement) {}
|
||||||
|
var append = command.querySelector("table.append")
|
||||||
|
var result = command.querySelector("code.result pre")
|
||||||
|
// append.style.display = (code.show_result||!append.querySelector("tr"))? "": "none"
|
||||||
|
result.style.height = (code.show_result||result.innerText=="")? "": code.show_height
|
||||||
|
})
|
||||||
|
}
|
||||||
function add_command(init) {
|
function add_command(init) {
|
||||||
|
var order = code.ncommand
|
||||||
var name = "command"+code.ncommand++
|
var name = "command"+code.ncommand++
|
||||||
|
|
||||||
var fieldset = append_child(document.querySelector("body"), "fieldset")
|
var fieldset = append_child(document.querySelector("body"), "fieldset")
|
||||||
@ -100,14 +158,15 @@ function add_command(init) {
|
|||||||
"componet_name": "command",
|
"componet_name": "command",
|
||||||
"componet_bench": context.Search("bench"),
|
"componet_bench": context.Search("bench"),
|
||||||
"componet_name_alias": name,
|
"componet_name_alias": name,
|
||||||
"componet_name_order": code.ncommand-1,
|
"componet_name_order": order,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
append_child(option, "input", {"style": {"display": "none"}})
|
append_child(option, "input", {"style": {"display": "none"}})
|
||||||
add_keymap(append_child(option, "input", {
|
add_keymap(append_child(option, "input", {
|
||||||
"name": "cmd", "className": "cmd",
|
"name": "cmd", "className": "cmd",
|
||||||
"onkeyup": function(event){onaction(event, "input")}
|
"onkeyup": function(event) {onaction(event, "input")},
|
||||||
|
"onfocus": function(event) {code.current_cmd=order}
|
||||||
})).focus()
|
})).focus()
|
||||||
|
|
||||||
add_sort(append_child(fieldset, "table", {"className": "append "+name}))
|
add_sort(append_child(fieldset, "table", {"className": "append "+name}))
|
||||||
@ -119,14 +178,12 @@ function add_command(init) {
|
|||||||
|
|
||||||
var cmds = document.querySelector("div.workflow ul.cmd")
|
var cmds = document.querySelector("div.workflow ul.cmd")
|
||||||
var cmd = append_child(cmds, "li", {
|
var cmd = append_child(cmds, "li", {
|
||||||
"innertText": code.ncommand+": ",
|
"innertText": order+": ",
|
||||||
"className": name,
|
"className": name,
|
||||||
"dataset": {
|
"dataset": {
|
||||||
"cmd": code.ncommand-1,
|
"cmd": order,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
init_docker()
|
|
||||||
return fieldset
|
return fieldset
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,8 +198,7 @@ function send_command(form, cb) {
|
|||||||
|
|
||||||
var order = (data["componet_name_order"]||"")
|
var order = (data["componet_name_order"]||"")
|
||||||
var cmd = document.querySelector("div.workflow>ul>li>ul>li.command"+order)
|
var cmd = document.querySelector("div.workflow>ul>li>ul>li.command"+order)
|
||||||
var now = new Date()
|
cmd && (cmd.innerText = format_date(new Date())+" "+order+": "+data["cmd"])
|
||||||
cmd && (cmd.innerText = now.getFullYear()+"-"+(now.getMonth()+1)+"-"+now.getDay()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+" : "+order+" "+data["cmd"])
|
|
||||||
|
|
||||||
context.GET("", data, function(msg) {
|
context.GET("", data, function(msg) {
|
||||||
msg = msg[0]
|
msg = msg[0]
|
||||||
@ -350,14 +406,19 @@ function onaction(event, action, arg) {
|
|||||||
add_command()
|
add_command()
|
||||||
break
|
break
|
||||||
case "z":
|
case "z":
|
||||||
code.show_result = !code.show_result
|
shrink_command_result()
|
||||||
document.querySelectorAll("form.option input[name=cmd]").forEach(function(input) {
|
break
|
||||||
for (var command = input; command.tagName != "FIELDSET"; command = command.parentElement) {}
|
case "s":
|
||||||
var append = command.querySelector("table.append")
|
save_clipboard(document.querySelector("div.workflow>ul>li>ul.txt>li[data-action=save_txt"))
|
||||||
var result = command.querySelector("code.result pre")
|
break
|
||||||
// append.style.display = (code.show_result||!append.querySelector("tr"))? "": "none"
|
case "y":
|
||||||
result.style.height = (code.show_result||result.innerText=="")? "": code.show_height
|
copy_to_clipboard(prompt("text"))
|
||||||
})
|
break
|
||||||
|
case "r":
|
||||||
|
location.reload()
|
||||||
|
break
|
||||||
|
case "t":
|
||||||
|
location.search = ""
|
||||||
break
|
break
|
||||||
case "0":
|
case "0":
|
||||||
document.querySelector("form.option.command input[name=cmd]").focus()
|
document.querySelector("form.option.command input[name=cmd]").focus()
|
||||||
@ -401,11 +462,12 @@ function onaction(event, action, arg) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var command = target; command.tagName != "FIELDSET"; command = command.parentElement) {}
|
||||||
|
var option = command.querySelector("form.option")
|
||||||
|
var append = command.querySelector("table.append")
|
||||||
|
var result = command.querySelector("code.result pre")
|
||||||
|
|
||||||
if (event.ctrlKey) {
|
if (event.ctrlKey) {
|
||||||
for (var command = target; command.tagName != "FIELDSET"; command = command.parentElement) {}
|
|
||||||
var option = command.querySelector("form.option")
|
|
||||||
var append = command.querySelector("table.append")
|
|
||||||
var result = command.querySelector("code.result pre")
|
|
||||||
// yt
|
// yt
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "1":
|
case "1":
|
||||||
@ -417,11 +479,16 @@ function onaction(event, action, arg) {
|
|||||||
case "7":
|
case "7":
|
||||||
case "8":
|
case "8":
|
||||||
case "9":
|
case "9":
|
||||||
var item = document.querySelectorAll("table.append.command"+(parseInt(option.dataset.componet_name_order)-1)+" td")
|
if (code.quick_txt) {
|
||||||
if (event.shiftKey) {
|
var item = document.querySelectorAll("div.workflow>ul>li>ul.txt>li[data-text]")
|
||||||
var item = document.querySelectorAll("table.append.command1 td")
|
target.value += item[parseInt(event.key)-1].dataset["text"]
|
||||||
|
} else {
|
||||||
|
var item = document.querySelectorAll("table.append.command"+(parseInt(option.dataset.componet_name_order)-1)+" td")
|
||||||
|
if (event.shiftKey) {
|
||||||
|
var item = document.querySelectorAll("table.append.command1 td")
|
||||||
|
}
|
||||||
|
target.value += item[parseInt(event.key)-1].innerText
|
||||||
}
|
}
|
||||||
target.value += item[parseInt(event.key)-1].innerText
|
|
||||||
break
|
break
|
||||||
case "0":
|
case "0":
|
||||||
var pre_pre = document.querySelector("code.result.command"+(parseInt(option.dataset.componet_name_order)-1)+" pre")
|
var pre_pre = document.querySelector("code.result.command"+(parseInt(option.dataset.componet_name_order)-1)+" pre")
|
||||||
@ -731,8 +798,8 @@ function init_bench() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init_docker() {
|
function init_docker() {
|
||||||
|
// 移动
|
||||||
document.querySelectorAll("div.workflow").forEach(function(item) {
|
document.querySelectorAll("div.workflow").forEach(function(item) {
|
||||||
what = item
|
|
||||||
var moving = false
|
var moving = false
|
||||||
item.onclick = function(event) {
|
item.onclick = function(event) {
|
||||||
if (event.target != item) {
|
if (event.target != item) {
|
||||||
@ -747,39 +814,95 @@ function init_docker() {
|
|||||||
if (moving) {
|
if (moving) {
|
||||||
item.style.left = (item.offsetLeft+event.movementX)+"px"
|
item.style.left = (item.offsetLeft+event.movementX)+"px"
|
||||||
item.style.top = (item.offsetTop+event.movementY)+"px"
|
item.style.top = (item.offsetTop+event.movementY)+"px"
|
||||||
|
context.Cookie("docker_left", item.style.left)
|
||||||
|
context.Cookie("docker_top", item.style.top)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
item.style.left = context.Cookie("docker_left")
|
||||||
|
item.style.top = context.Cookie("docker_top")
|
||||||
})
|
})
|
||||||
|
// 固定
|
||||||
document.querySelectorAll("div.workflow>span").forEach(function(item) {
|
document.querySelectorAll("div.workflow>div").forEach(function(item) {
|
||||||
item.onclick = function(event) {
|
item.onclick = function(event) {
|
||||||
item.dataset["hide"] = !right(item.dataset["hide"])
|
item.dataset["show"] = !right(item.dataset["show"])
|
||||||
item.parentElement.className = right(item.dataset["hide"])? "workflow min": "workflow"
|
item.parentElement.className = right(item.dataset["show"])? "workflow max": "workflow"
|
||||||
|
context.Cookie("docker_class", item.parentElement.className)
|
||||||
|
}
|
||||||
|
if (context.Cookie("docker_class")) {
|
||||||
|
item.parentElement.className = context.Cookie("docker_class")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// 折叠
|
||||||
document.querySelectorAll("ul.docker>li>span").forEach(function(item) {
|
document.querySelectorAll("ul.docker>li>span").forEach(function(item) {
|
||||||
item.onclick = function(event) {
|
item.onclick = function(event) {
|
||||||
item.dataset["hide"] = !right(item.dataset["hide"])
|
item.dataset["hide"] = !right(item.dataset["hide"])
|
||||||
item.nextElementSibling.style.display = right(item.dataset["hide"])? "none": ""
|
item.nextElementSibling.style.display = right(item.dataset["hide"])? "none": ""
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var txt = bench.clipstack
|
||||||
|
if (txt) {
|
||||||
|
text = JSON.parse(txt)
|
||||||
|
for (var i = 0; i < text.length; i++) {
|
||||||
|
copy_to_clipboard(text[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 事件
|
||||||
document.querySelectorAll("ul.docker>li>ul>li").forEach(function(item) {
|
document.querySelectorAll("ul.docker>li>ul>li").forEach(function(item) {
|
||||||
item.onclick = function(event) {
|
item.onclick = function(event) {
|
||||||
|
var target = event.target
|
||||||
var data = item.dataset
|
var data = item.dataset
|
||||||
switch (data["action"]) {
|
switch (data["action"]) {
|
||||||
case "create_fly":
|
case "quick_txt":
|
||||||
location.search = ""
|
code.quick_txt = !code.quick_txt
|
||||||
|
target.className= code.quick_txt? "quick": ""
|
||||||
|
break
|
||||||
|
case "copy_txt":
|
||||||
|
if (event.altKey) {
|
||||||
|
target.parentElement.removeChild(target)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (event.shiftKey) {
|
||||||
|
var cmd = document.querySelector("form.option.command"+code.current_cmd+" input[name=cmd]")
|
||||||
|
cmd && (cmd.value += " "+text)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
copy_to_clipboard(data["text"], true)
|
||||||
|
break
|
||||||
|
case "save_txt":
|
||||||
|
save_clipboard(item)
|
||||||
|
return
|
||||||
|
case "create_txt":
|
||||||
|
copy_to_clipboard(prompt("text"))
|
||||||
|
return
|
||||||
|
case "shrink_cmd":
|
||||||
|
shrink_command_result()
|
||||||
return
|
return
|
||||||
case "create_cmd":
|
case "create_cmd":
|
||||||
add_command()
|
add_command()
|
||||||
return
|
return
|
||||||
|
case "refresh_fly":
|
||||||
|
location.reload()
|
||||||
|
return
|
||||||
|
case "create_fly":
|
||||||
|
location.search = ""
|
||||||
|
return
|
||||||
|
case "rename_fly":
|
||||||
|
context.GET("", {
|
||||||
|
"componet_bench": context.Search("bench"),
|
||||||
|
"componet_group": "index",
|
||||||
|
"componet_name": "command",
|
||||||
|
"cmd": "bench "+context.Search("bench")+".comment"+" "+prompt("name"),
|
||||||
|
})
|
||||||
|
location.reload()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if (data["key"] && context.Search("bench") != data["key"]) {
|
if (data["key"] && context.Search("bench") != data["key"]) {
|
||||||
context.Search("bench", data["key"])
|
context.Search("bench", data["key"])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var cmd = document.querySelector("form.option.command"+data["cmd"]+" input[name=cmd]")
|
var cmd = document.querySelector("form.option.command"+data["cmd"]+" input[name=cmd]")
|
||||||
cmd.focus()
|
cmd && cmd.focus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,6 @@ function insert_button(which, value, callback) {
|
|||||||
"type": "button", "value": value, "onclick": callback,
|
"type": "button", "value": value, "onclick": callback,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function right(arg) {
|
function right(arg) {
|
||||||
if (arg == "true") {
|
if (arg == "true") {
|
||||||
return true
|
return true
|
||||||
@ -187,3 +186,28 @@ function right(arg) {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function format_date(arg) {
|
||||||
|
var date = arg.getDate()
|
||||||
|
if (date < 10) {
|
||||||
|
date = "0"+date
|
||||||
|
}
|
||||||
|
var month = arg.getMonth()+1
|
||||||
|
if (month < 10) {
|
||||||
|
month = "0"+month
|
||||||
|
}
|
||||||
|
var hour = arg.getHours()
|
||||||
|
if (hour < 10) {
|
||||||
|
hour = "0"+hour
|
||||||
|
}
|
||||||
|
var minute = arg.getMinutes()
|
||||||
|
if (minute < 10) {
|
||||||
|
minute = "0"+minute
|
||||||
|
}
|
||||||
|
var second = arg.getSeconds()
|
||||||
|
if (second < 10) {
|
||||||
|
second = "0"+second
|
||||||
|
}
|
||||||
|
return arg.getFullYear()+"-"+month+"-"+date+" "+hour+":"+minute+":"+second
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -22,30 +22,35 @@
|
|||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
div.workflow {
|
div.workflow {
|
||||||
|
font-size:14px;
|
||||||
|
font-family:monospace;
|
||||||
position:fixed;
|
position:fixed;
|
||||||
background-color:red;
|
background-color:#498bb1a8;
|
||||||
top:200px;
|
border:solid 3px red;
|
||||||
left:20px;
|
color:#e6dd37;
|
||||||
width:40px;
|
top:{{conf . "docker_view" "top"}}px;
|
||||||
|
left:{{conf . "docker_view" "left"}}px;
|
||||||
|
width:60px;
|
||||||
height:20px;
|
height:20px;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
div.workflow:hover {
|
div.workflow:hover, div.workflow.min:hover {
|
||||||
width:480px;
|
width:{{conf . "docker_view" "width"}}px;
|
||||||
height:200px;
|
height:{{conf . "docker_view" "height"}}px;
|
||||||
overflow:scroll;
|
overflow:scroll;
|
||||||
}
|
}
|
||||||
div.workflow.min {
|
div.workflow.max {
|
||||||
width:40px;
|
width:{{conf . "docker_view" "width"}}px;
|
||||||
height:20px;
|
height:{{conf . "docker_view" "height"}}px;
|
||||||
}
|
}
|
||||||
div.workflow ul.docker ul li {
|
div.workflow ul.docker ul li.quick {
|
||||||
|
background-color:red;
|
||||||
}
|
}
|
||||||
div.workflow ul.docker ul li:hover {
|
div.workflow ul.docker ul li:hover {
|
||||||
background-color:green;
|
background-color:red;
|
||||||
}
|
}
|
||||||
div.workflow ul.docker li span:hover {
|
div.workflow ul.docker li span:hover {
|
||||||
background-color:green;
|
background-color:red;
|
||||||
}
|
}
|
||||||
form.option div {
|
form.option div {
|
||||||
float:left;
|
float:left;
|
||||||
@ -155,27 +160,41 @@
|
|||||||
|
|
||||||
{{define "docker"}}
|
{{define "docker"}}
|
||||||
{{$key := option . "bench"}}
|
{{$key := option . "bench"}}
|
||||||
|
{{$username := option . "username"|option}}
|
||||||
{{$bench := conf . "bench" $key}}
|
{{$bench := conf . "bench" $key}}
|
||||||
<script>var workflow = {{conf . "bench"}}</script>
|
<script>var workflow = {{conf . "bench"}}</script>
|
||||||
<div class="workflow">
|
<div class="workflow">
|
||||||
<span>flow</span>
|
<div> bench</div>
|
||||||
<ul class="docker">
|
<ul class="docker">
|
||||||
<li><span>工作流</span>
|
<li><span>粘贴板</span>
|
||||||
<ul class="fly">
|
<ul class="txt">
|
||||||
<li data-action="create_fly">+ 创建工作流</li>
|
<li data-action="save_txt">+ 保存粘贴板(Ctrl+S)</li>
|
||||||
{{range $key, $item := conf . "bench"}}
|
<li data-action="create_txt">+ 添加粘贴板(Ctrl+Y)</li>
|
||||||
<li data-key="{{$key}}">{{index $item "modify_time"}} {{index $item "comment"}}({{index $item "creator"}})</li>
|
<li data-action="quick_txt">+ 快捷粘贴板</li>
|
||||||
{{end}}
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><span>命令行</span>
|
<li><span>命令行</span>
|
||||||
<ul class="cmd">
|
<ul class="cmd">
|
||||||
<li data-action="create_cmd">+ 创建命令行</li>
|
<li data-action="shrink_cmd">+ 折叠命令行(Ctrl+Z)</li>
|
||||||
|
<li data-action="create_cmd">+ 添加命令行(Ctrl+M)</li>
|
||||||
{{range $index, $cmd := index $bench "commands"}}
|
{{range $index, $cmd := index $bench "commands"}}
|
||||||
<li class="command{{$index}}" data-cmd="{{$index}}">{{index $cmd "now"|option}} {{$index}}: {{index $cmd "cmd"|option}}</li>
|
<li class="command{{$index}}" data-cmd="{{$index}}">{{index $cmd "now"|option}} {{$index}}: {{index $cmd "cmd"|option}}</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><span>工作流</span>
|
||||||
|
<ul class="fly">
|
||||||
|
<li data-action="refresh_fly">+ 刷新工作流(Ctrl+R)</li>
|
||||||
|
<li data-action="create_fly">+ 添加工作流(Ctrl+T)</li>
|
||||||
|
{{range $key, $item := conf . "bench"}}
|
||||||
|
{{$creator := index $item "creator"}}
|
||||||
|
{{if eq $creator $username}}
|
||||||
|
<li data-key="{{$key}}">{{index $item "modify_time"}} {{index $item "comment"}}({{index $item "creator"}})</li>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
<li data-action="rename_fly">+ 命名工作流</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -273,3 +292,4 @@
|
|||||||
<script src="/librarys/code.js"></script>
|
<script src="/librarys/code.js"></script>
|
||||||
</body>
|
</body>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user