# HG changeset patch # User Sascha Wilde # Date 1572020738 -7200 # Node ID ca6a5f722471300378597e749c9e19a85c602964 # Parent 9a4f5f3194191271c3f364f47290c221dc52f182 Added Description method to most imports. Only for imports where information relevant to the administrator is relevant. diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/bn.go --- a/pkg/imports/bn.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/bn.go Fri Oct 25 18:25:38 2019 +0200 @@ -159,6 +159,14 @@ )` ) +func (bn *Bottleneck) Description() (string, error) { + + var descs []string + + descs = append(descs, bn.URL) + return strings.Join(descs, "|"), nil +} + type bnJobCreator struct{} func init() { diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/dma.go --- a/pkg/imports/dma.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/dma.go Fri Oct 25 18:25:38 2019 +0200 @@ -20,6 +20,7 @@ "errors" "fmt" "io" + "strings" "time" "gemma.intevation.de/gemma/pkg/wfs" @@ -41,6 +42,15 @@ Password string `json:"password,omitempty"` } +func (dma *DistanceMarksAshore) Description() (string, error) { + + var descs []string + + descs = append(descs, dma.URL) + descs = append(descs, dma.FeatureType) + return strings.Join(descs, "|"), nil +} + // DMAJobKind is the import queue type identifier. const DMAJobKind JobKind = "dma" diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/dmv.go --- a/pkg/imports/dmv.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/dmv.go Fri Oct 25 18:25:38 2019 +0200 @@ -17,6 +17,7 @@ "context" "database/sql" "errors" + "strings" "time" "gemma.intevation.de/gemma/pkg/models" @@ -36,6 +37,14 @@ Insecure bool `json:"insecure"` } +func (dmv *DistanceMarksVirtual) Description() (string, error) { + + var descs []string + + descs = append(descs, dmv.URL) + return strings.Join(descs, "|"), nil +} + // DMVJobKind is the import queue type identifier. const DMVJobKind JobKind = "dmv" diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/dsr.go --- a/pkg/imports/dsr.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/dsr.go Fri Oct 25 18:25:38 2019 +0200 @@ -18,7 +18,9 @@ "context" "database/sql" "errors" + "strings" + "gemma.intevation.de/gemma/pkg/common" "gemma.intevation.de/gemma/pkg/models" ) @@ -28,6 +30,15 @@ Date models.Date `json:"date-info"` } +func (dsr *DeleteSoundingResult) Description() (string, error) { + + var descs []string + + descs = append(descs, dsr.BottleneckId) + descs = append(descs, dsr.Date.Format(common.DateFormat)) + return strings.Join(descs, "|"), nil +} + // DSRJobKind is the import queue type identifier. const DSRJobKind JobKind = "dsr" diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/fa.go --- a/pkg/imports/fa.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/fa.go Fri Oct 25 18:25:38 2019 +0200 @@ -21,6 +21,7 @@ "errors" "fmt" "sort" + "strings" "time" "github.com/jackc/pgx/pgtype" @@ -160,6 +161,14 @@ )ON CONFLICT ON CONSTRAINT fa_reference_values_pkey DO NOTHING` ) +func (fa *FairwayAvailability) Description() (string, error) { + + var descs []string + + descs = append(descs, fa.URL) + return strings.Join(descs, "|"), nil +} + type faJobCreator struct{} func init() { diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/fd.go --- a/pkg/imports/fd.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/fd.go Fri Oct 25 18:25:38 2019 +0200 @@ -19,6 +19,7 @@ "encoding/json" "fmt" "io" + "strings" "time" "gemma.intevation.de/gemma/pkg/common" @@ -46,6 +47,16 @@ Password string `json:"password,omitempty"` } +func (fd *FairwayDimension) Description() (string, error) { + + var descs []string + + descs = append(descs, fd.URL) + descs = append(descs, fd.FeatureType) + descs = append(descs, fmt.Sprintf("LOS%d", fd.LOS)) + return strings.Join(descs, "|"), nil +} + type fdTime struct{ time.Time } var guessFDTime = common.TimeParser([]string{ diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/gm.go --- a/pkg/imports/gm.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/gm.go Fri Oct 25 18:25:38 2019 +0200 @@ -40,6 +40,14 @@ Insecure bool `json:"insecure"` } +func (gm *GaugeMeasurement) Description() (string, error) { + + var descs []string + + descs = append(descs, gm.URL) + return strings.Join(descs, "|"), nil +} + // GMJobKind is the import queue type identifier. const GMJobKind JobKind = "gm" diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/sec.go --- a/pkg/imports/sec.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/sec.go Fri Oct 25 18:25:38 2019 +0200 @@ -16,6 +16,7 @@ import ( "context" "database/sql" + "strings" "time" "gemma.intevation.de/gemma/pkg/models" @@ -33,6 +34,17 @@ Date models.Date `json:"date-info"` } +func (sec *Section) Description() (string, error) { + + var descs []string + + descs = append(descs, sec.Name) + descs = append(descs, sec.ObjNam) + descs = append(descs, sec.From.String()) + descs = append(descs, sec.To.String()) + return strings.Join(descs, "|"), nil +} + // SECJobKind is the import queue type identifier. const SECJobKind JobKind = "sec" diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/wa.go --- a/pkg/imports/wa.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/wa.go Fri Oct 25 18:25:38 2019 +0200 @@ -22,6 +22,7 @@ "fmt" "io" "strconv" + "strings" "time" "gemma.intevation.de/gemma/pkg/pgxutils" @@ -45,6 +46,15 @@ Password string `json:"password,omitempty"` } +func (wa *WaterwayArea) Description() (string, error) { + + var descs []string + + descs = append(descs, wa.URL) + descs = append(descs, wa.FeatureType) + return strings.Join(descs, "|"), nil +} + // WAJobKind is the import queue type identifier. const WAJobKind JobKind = "wa" diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/wg.go --- a/pkg/imports/wg.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/wg.go Fri Oct 25 18:25:38 2019 +0200 @@ -17,6 +17,7 @@ import ( "context" "database/sql" + "strings" "time" "github.com/jackc/pgx/pgtype" @@ -40,6 +41,14 @@ Insecure bool `json:"insecure"` } +func (wg *WaterwayGauge) Description() (string, error) { + + var descs []string + + descs = append(descs, wg.URL) + return strings.Join(descs, "|"), nil +} + // WGJobKind is the unique name of this import job type. const WGJobKind JobKind = "wg" diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/wp.go --- a/pkg/imports/wp.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/wp.go Fri Oct 25 18:25:38 2019 +0200 @@ -59,6 +59,15 @@ Password string `json:"password,omitempty"` } +func (wp *WaterwayProfiles) Description() (string, error) { + + var descs []string + + descs = append(descs, wp.URL) + descs = append(descs, wp.FeatureType) + return strings.Join(descs, "|"), nil +} + // WPJobKind is the unique name of this import job type. const WPJobKind JobKind = "wp" diff -r 9a4f5f319419 -r ca6a5f722471 pkg/imports/wx.go --- a/pkg/imports/wx.go Fri Oct 25 17:48:33 2019 +0200 +++ b/pkg/imports/wx.go Fri Oct 25 18:25:38 2019 +0200 @@ -21,6 +21,7 @@ "errors" "fmt" "io" + "strings" "time" "gemma.intevation.de/gemma/pkg/pgxutils" @@ -44,6 +45,15 @@ Password string `json:"password,omitempty"` } +func (wx *WaterwayAxis) Description() (string, error) { + + var descs []string + + descs = append(descs, wx.URL) + descs = append(descs, wx.FeatureType) + return strings.Join(descs, "|"), nil +} + // WXJobKind is the import queue type identifier. const WXJobKind JobKind = "wx"