changeset 4798:ca6a5f722471

Added Description method to most imports. Only for imports where information relevant to the administrator is relevant.
author Sascha Wilde <wilde@intevation.de>
date Fri, 25 Oct 2019 18:25:38 +0200
parents 9a4f5f319419
children f32d086b5dbf
files pkg/imports/bn.go pkg/imports/dma.go pkg/imports/dmv.go pkg/imports/dsr.go pkg/imports/fa.go pkg/imports/fd.go pkg/imports/gm.go pkg/imports/sec.go pkg/imports/wa.go pkg/imports/wg.go pkg/imports/wp.go pkg/imports/wx.go
diffstat 12 files changed, 116 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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() {
--- 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"
 
--- 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"
 
--- 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"
 
--- 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() {
--- 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{
--- 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"
 
--- 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"
 
--- 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"
 
--- 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"
 
--- 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"
 
--- 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"