Mercurial > gemma
changeset 2045:10a1e139d2e8 unify_imports
Imports: Re-enabled running configured imports.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 25 Jan 2019 18:01:35 +0100 |
parents | ea0b62b7656b |
children | 725884a4c89a |
files | pkg/controllers/importconfig.go pkg/imports/config.go |
diffstat | 2 files changed, 21 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/importconfig.go Fri Jan 25 17:54:02 2019 +0100 +++ b/pkg/controllers/importconfig.go Fri Jan 25 18:01:35 2019 +0100 @@ -16,6 +16,11 @@ import ( "database/sql" "net/http" + "strconv" + + "github.com/gorilla/mux" + + "gemma.intevation.de/gemma/pkg/imports" ) const ( @@ -74,28 +79,25 @@ conn *sql.Conn, ) (jr JSONResult, err error) { - /* + id, _ := strconv.ParseInt(mux.Vars(req)["id"], 10, 64) - id, _ := strconv.ParseInt(mux.Vars(req)["id"], 10, 64) + ctx := req.Context() - ctx := req.Context() - - var jobID int64 - if jobID, err = imports.RunConfiguredImportContext(ctx, conn, id); err != nil { - return - } + var jobID int64 + if jobID, err = imports.RunConfiguredImportContext(ctx, conn, id); err != nil { + return + } - var result = struct { - ID int64 `json:"id"` - }{ - ID: jobID, - } + var result = struct { + ID int64 `json:"id"` + }{ + ID: jobID, + } - jr = JSONResult{ - Code: http.StatusCreated, - Result: &result, - } - */ + jr = JSONResult{ + Code: http.StatusCreated, + Result: &result, + } return }
--- a/pkg/imports/config.go Fri Jan 25 17:54:02 2019 +0100 +++ b/pkg/imports/config.go Fri Jan 25 18:01:35 2019 +0100 @@ -36,7 +36,7 @@ ImportConfigOut struct { ID int64 `json:"id"` Kind ImportKind `json:"kind"` - Config interface{} `json:"config"` + Config interface{} `json:"config,omitempty"` } PersistentConfig struct {