Mercurial > gemma
diff pkg/controllers/importqueue.go @ 1355:b0ebb77f4ab0
Return nice JSON result if import was accepted or declined.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 26 Nov 2018 15:52:30 +0100 |
parents | 89d013d55ec9 |
children | 3ff916e853d4 |
line wrap: on
line diff
--- a/pkg/controllers/importqueue.go Mon Nov 26 15:21:34 2018 +0100 +++ b/pkg/controllers/importqueue.go Mon Nov 26 15:52:30 2018 +0100 @@ -391,6 +391,17 @@ return } - err = tx.Commit() + if err = tx.Commit(); err != nil { + return + } + + result := struct { + Message string `json:"message"` + }{ + Message: fmt.Sprintf("Import #%d successfully changed to state '%s'.", + id, state), + } + + jr = JSONResult{Result: &result} return }