feat: bind esc to close view (#48)
parent
8b85b8e89b
commit
060b112eb3
|
@ -51,7 +51,7 @@ type ConfigUI struct {
|
|||
|
||||
// Should be in main app
|
||||
LogPath string `json:"log_path"`
|
||||
LogLevel int `json:"log_level"`
|
||||
LogLevel klog.Llevel `json:"log_level"`
|
||||
|
||||
TmplFS embed.FS `json:"-"`
|
||||
tmpl *engine.Engine
|
||||
|
@ -177,20 +177,16 @@ func (cui *ConfigUI) setLog() {
|
|||
}
|
||||
cui.log.SetErrOutput(cui.f)
|
||||
cui.log.SetOutput(cui.f)
|
||||
cui.log.Reload()
|
||||
if cui.ksrv_log != nil {
|
||||
cui.ksrv_log.SetErrOutput(cui.f)
|
||||
cui.ksrv_log.SetOutput(cui.f)
|
||||
cui.ksrv_log.Reload()
|
||||
}
|
||||
} else {
|
||||
cui.log.SetErrOutput(os.Stderr)
|
||||
cui.log.SetOutput(os.Stderr)
|
||||
cui.log.Reload()
|
||||
if cui.ksrv_log != nil {
|
||||
cui.ksrv_log.SetErrOutput(os.Stderr)
|
||||
cui.ksrv_log.SetOutput(os.Stderr)
|
||||
cui.ksrv_log.Reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
6
go.mod
6
go.mod
|
@ -3,11 +3,11 @@ module kumoly.io/tools/configui
|
|||
go 1.17
|
||||
|
||||
require (
|
||||
kumoly.io/lib/klog v0.1.10
|
||||
kumoly.io/lib/ksrv v0.1.5-0.20211104040031-77be1d6ae358
|
||||
kumoly.io/lib/klog v0.0.5
|
||||
kumoly.io/lib/ksrv v0.0.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
|
||||
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b // indirect
|
||||
)
|
||||
|
|
17
go.sum
17
go.sum
|
@ -1,12 +1,11 @@
|
|||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
kumoly.io/lib/klog v0.1.9 h1:rS9PPqfyBIIfeQlPSuMv+7StGPiFVuAdp04HDwwDY3E=
|
||||
kumoly.io/lib/klog v0.1.9/go.mod h1:Snm+c1xRrh/RbXsxQf7UGYbAJGPcIa6bEEN+CmzJh7M=
|
||||
kumoly.io/lib/klog v0.1.10 h1:GJxwcsUct8nF3oHtsJPTIlPKTUeB/+7jsbgh3bMvKMc=
|
||||
kumoly.io/lib/klog v0.1.10/go.mod h1:Snm+c1xRrh/RbXsxQf7UGYbAJGPcIa6bEEN+CmzJh7M=
|
||||
kumoly.io/lib/ksrv v0.1.4 h1:8zbslRwdNWHw5Wm1PiyDLr6Mu4xxjz0FTW4u8dZ6ZeI=
|
||||
kumoly.io/lib/ksrv v0.1.4/go.mod h1:eKfhJR5mOqlQZAy5EUI+Avfxirx2/nNW79r+Ki2C18k=
|
||||
kumoly.io/lib/ksrv v0.1.5-0.20211104040031-77be1d6ae358 h1:cVm0fUXzLYZBmhTJf0MRLBt35jLhjodadI8uUh4RNEg=
|
||||
kumoly.io/lib/ksrv v0.1.5-0.20211104040031-77be1d6ae358/go.mod h1:Tux6CApi3sYGRM5prDPN2+aw3gKz1Tdf5CU6XFSFxbQ=
|
||||
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b h1:1VkfZQv42XQlA/jchYumAnv1UPo6RgF9rJFkTgZIxO4=
|
||||
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
kumoly.io/lib/klog v0.0.4 h1:Ev9G/zvLt/C8Q1yWfYoUcXVJWgPMjpqHPat2WKyOPIM=
|
||||
kumoly.io/lib/klog v0.0.4/go.mod h1:Snm+c1xRrh/RbXsxQf7UGYbAJGPcIa6bEEN+CmzJh7M=
|
||||
kumoly.io/lib/klog v0.0.5 h1:8Z2FYpW01gxt2gbRJNag8f8KSsfd1pRleQTPJvoR8Zc=
|
||||
kumoly.io/lib/klog v0.0.5/go.mod h1:Snm+c1xRrh/RbXsxQf7UGYbAJGPcIa6bEEN+CmzJh7M=
|
||||
kumoly.io/lib/ksrv v0.0.1 h1:JfWwJ9GeiTtDfGoeG7YxJwsckralbhsLKEPLQb20Uzo=
|
||||
kumoly.io/lib/ksrv v0.0.1/go.mod h1:ykHXeAPjNvA5jEZo5rp32edzkugLf0e+2pspct3FOFQ=
|
||||
|
|
|
@ -112,6 +112,14 @@ function setResult(){
|
|||
result_editor.setOptions({
|
||||
maxLines: 1000
|
||||
});
|
||||
{{if not .ResultBellow}}
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === "Escape"){
|
||||
let el = document.getElementById('result_view')
|
||||
el.classList.remove('is-active')
|
||||
}
|
||||
})
|
||||
{{end}}
|
||||
}
|
||||
|
||||
// starting point
|
||||
|
|
Loading…
Reference in New Issue