added ability to reset offsets

This commit is contained in:
sqshq 2019-03-16 20:54:24 -04:00
parent 78f0c0ed83
commit 4dd0ffc61d
3 changed files with 14 additions and 7 deletions

View File

@ -110,6 +110,7 @@ func (l *Layout) HandleConsoleEvent(e string) {
l.changeMode(ModeDefault)
}
case console.KeyEsc:
l.resetAlerts()
switch l.mode {
case ModeChartPinpoint:
selected.CommandChannel <- &data.Command{Type: runchart.CommandDisableSelection}
@ -273,3 +274,9 @@ func (l *Layout) Draw(buffer *ui.Buffer) {
l.statusbar.Draw(buffer)
l.menu.Draw(buffer)
}
func (l *Layout) resetAlerts() {
for _, c := range l.Components {
c.AlertChannel <- nil
}
}

View File

@ -8,7 +8,7 @@ runcharts:
h: 16
triggers:
- title: Latency threshold exceeded
condition: echo "$prev < 0.2 && $cur > 0.2" |bc -l
condition: echo "$prev < 0.3 && $cur > 0.3" |bc -l
actions:
terminal-bell: true
sound: true

View File

@ -24,16 +24,16 @@ type Flags struct {
func Load() (Config, Flags) {
//if len(os.Args) < 2 {
// println("Please specify config file location. See www.github.com/sqshq/sampler for the reference")
// os.Exit(0)
//}
if len(os.Args) < 2 {
println("Please specify config file location. See www.github.com/sqshq/sampler for the reference")
os.Exit(0)
}
cfg := readFile("config.yml")
cfg := readFile(os.Args[1])
cfg.validate()
cfg.setDefaults()
flg := Flags{ConfigFileName: "config.yml"}
flg := Flags{ConfigFileName: os.Args[1]}
return *cfg, flg
}