Clear acknowledged errors server-side as well (fixes #128)

This commit is contained in:
Jakob Borg
2014-04-16 16:30:49 +02:00
parent 622568c327
commit a98d75edaa
3 changed files with 9 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ func startGUI(cfg GUIConfiguration, m *Model) {
router.Post("/rest/restart", restPostRestart)
router.Post("/rest/reset", restPostReset)
router.Post("/rest/error", restPostError)
router.Post("/rest/error/clear", restClearErrors)
go func() {
mr := martini.New()
@@ -191,6 +192,12 @@ func restPostError(req *http.Request) {
showGuiError(string(bs))
}
func restClearErrors() {
guiErrorsMut.Lock()
guiErrors = nil
guiErrorsMut.Unlock()
}
func showGuiError(err string) {
guiErrorsMut.Lock()
guiErrors = append(guiErrors, guiError{time.Now(), err})