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) l.changeMode(ModeDefault)
} }
case console.KeyEsc: case console.KeyEsc:
l.resetAlerts()
switch l.mode { switch l.mode {
case ModeChartPinpoint: case ModeChartPinpoint:
selected.CommandChannel <- &data.Command{Type: runchart.CommandDisableSelection} selected.CommandChannel <- &data.Command{Type: runchart.CommandDisableSelection}
@ -273,3 +274,9 @@ func (l *Layout) Draw(buffer *ui.Buffer) {
l.statusbar.Draw(buffer) l.statusbar.Draw(buffer)
l.menu.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 h: 16
triggers: triggers:
- title: Latency threshold exceeded - 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: actions:
terminal-bell: true terminal-bell: true
sound: true sound: true

View File

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