changeset 4212:b0bb1b624678 stylesconfig

merge default into stylesconfig
author Fadi Abbud <fadi.abbud@intevation.de>
date Thu, 15 Aug 2019 16:58:39 +0200
parents d08247127c21 (current diff) 5d7ce7f926eb (diff)
children 36ee7e621133
files
diffstat 9 files changed, 33 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/sections/Sections.vue	Thu Aug 15 16:55:58 2019 +0200
+++ b/client/src/components/sections/Sections.vue	Thu Aug 15 16:58:39 2019 +0200
@@ -192,40 +192,18 @@
         });
     },
     deleteSection(section) {
-      this.$store.commit("application/popup", {
-        icon: "trash",
-        title: this.$gettext("Delete Section"),
-        content:
-          this.$gettext("Do you really want to delete this section:") +
-          `<br>
-        <b>${section.properties.name}, ${
-            section.properties.source_organization
-          } (${section.properties.countries})</b>`,
-        confirm: {
-          label: this.$gettext("Delete"),
-          icon: "trash",
-          callback: () => {
-            HTTP.post("/imports/dsec",
-              {
-                id: section.id.split(".")[1]*1
-              },
-              {
-                headers: { "X-Gemma-Auth": localStorage.getItem("token") }
-              }
-            )
-              .then(response => {
-
-                displayInfo({
-                  title: this.$gettext("Staging Area"),
-                  message: this.$gettext("Deleting ") + section.properties.objnam
-                });
-              })
-          }
+      HTTP.post("/imports/dsec",
+        {
+          id: section.id.split(".")[1]*1
         },
-        cancel: {
-          label: this.$gettext("Cancel"),
-          icon: "times"
+        {
+          headers: { "X-Gemma-Auth": localStorage.getItem("token") }
         }
+      ).then(() => {
+        displayInfo({
+          title: this.$gettext("Staging Area"),
+          message: this.$gettext("Deleting ") + section.properties.objnam
+        });
       });
     },
     moveMapToSection(section) {
--- a/pkg/controllers/importqueue.go	Thu Aug 15 16:55:58 2019 +0200
+++ b/pkg/controllers/importqueue.go	Thu Aug 15 16:58:39 2019 +0200
@@ -48,6 +48,8 @@
   signer,
   summary IS NOT NULL AS has_summary,
   EXISTS(SELECT 1 FROM import.import_logs
+    WHERE kind = 'error'::log_type and import_id = imports.id) AS has_errors,
+  EXISTS(SELECT 1 FROM import.import_logs
     WHERE kind = 'warn'::log_type and import_id = imports.id) AS has_warnings
 FROM import.imports
 WHERE
@@ -93,7 +95,7 @@
 	cond := func(format string, args ...interface{}) {
 		term := &filterTerm{format: format, args: args}
 		l = append(l, term)
-		a = append(l, term)
+		a = append(a, term)
 		b = append(b, term)
 	}
 
@@ -155,6 +157,12 @@
                  WHERE kind = 'warn'::log_type and import_id = imports.id)`)
 	}
 
+	switch errors := strings.ToLower(req.FormValue("errors")); errors {
+	case "1", "t", "true":
+		cond(` EXISTS(SELECT 1 FROM import.import_logs
+                 WHERE kind = 'error'::log_type and import_id = imports.id)`)
+	}
+
 	fl := &filledStmt{}
 	fa := &filledStmt{}
 	fb := &filledStmt{}
@@ -273,6 +281,7 @@
 			&it.User,
 			&signer,
 			&it.Summary,
+			&it.Errors,
 			&it.Warnings,
 		); err != nil {
 			return
--- a/pkg/imports/bn.go	Thu Aug 15 16:55:58 2019 +0200
+++ b/pkg/imports/bn.go	Thu Aug 15 16:58:39 2019 +0200
@@ -397,7 +397,7 @@
 		if t, ok := fromTo[fromKey]; ok {
 			tfrom.Set(t)
 		} else {
-			feedback.Warn("Missing start date")
+			feedback.Error("Missing start date")
 			return nil
 		}
 
@@ -568,7 +568,7 @@
 		}
 		return nil
 	}); err != nil {
-		feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+		feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 		return nil
 	}
 
--- a/pkg/imports/fd.go	Thu Aug 15 16:55:58 2019 +0200
+++ b/pkg/imports/fd.go	Thu Aug 15 16:58:39 2019 +0200
@@ -311,7 +311,7 @@
 					// ignore -> filtered by responsibility_areas
 					continue features
 				case err != nil:
-					feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+					feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 					continue features
 				}
 				// Store for potential later removal.
--- a/pkg/imports/gm.go	Thu Aug 15 16:55:58 2019 +0200
+++ b/pkg/imports/gm.go	Thu Aug 15 16:58:39 2019 +0200
@@ -444,7 +444,7 @@
 					case err == sql.ErrNoRows:
 						// thats expected, nothing to do
 					case err != nil:
-						feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+						feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 					default:
 						newP++
 					}
@@ -475,7 +475,7 @@
 					case err == sql.ErrNoRows:
 						// thats expected, nothing to do
 					case err != nil:
-						feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+						feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 					default:
 						newM++
 					}
--- a/pkg/imports/wa.go	Thu Aug 15 16:55:58 2019 +0200
+++ b/pkg/imports/wa.go	Thu Aug 15 16:58:39 2019 +0200
@@ -247,7 +247,7 @@
 					outside++
 					// ignore -> filtered by responsibility_areas
 				case err != nil:
-					feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+					feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 				default:
 					features++
 				}
--- a/pkg/imports/wg.go	Thu Aug 15 16:55:58 2019 +0200
+++ b/pkg/imports/wg.go	Thu Aug 15 16:58:39 2019 +0200
@@ -329,7 +329,7 @@
 			).Scan(&isNew)
 			switch {
 			case err != nil:
-				feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+				feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 				if err2 := tx.Rollback(); err2 != nil {
 					return nil, err2
 				}
@@ -354,7 +354,7 @@
 					source,
 					time.Time(*dr.Lastupdate),
 				); err != nil {
-					feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+					feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 					if err2 := tx.Rollback(); err2 != nil {
 						return nil, err2
 					}
@@ -391,7 +391,7 @@
 					unchanged++
 					continue
 				case err2 != nil:
-					feedback.Warn(pgxutils.ReadableError{Err: err2}.Error())
+					feedback.Error(pgxutils.ReadableError{Err: err2}.Error())
 					if err3 := tx.Rollback(); err3 != nil {
 						return nil, err3
 					}
@@ -438,7 +438,7 @@
 				code.String(),
 				&validity,
 			); err != nil {
-				feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+				feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 				if err2 := tx.Rollback(); err2 != nil {
 					return nil, err2
 				}
@@ -486,7 +486,7 @@
 					string(**wl.level),
 					int64(**wl.value),
 				); err != nil {
-					feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+					feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 					tx.Rollback()
 					continue
 				}
--- a/pkg/imports/wx.go	Thu Aug 15 16:55:58 2019 +0200
+++ b/pkg/imports/wx.go	Thu Aug 15 16:58:39 2019 +0200
@@ -321,7 +321,7 @@
 		// ignore -> filtered by responsibility_areas
 		return nil
 	case err != nil:
-		feedback.Warn(pgxutils.ReadableError{Err: err}.Error())
+		feedback.Error(pgxutils.ReadableError{Err: err}.Error())
 	default:
 		*features++
 	}
--- a/pkg/models/import.go	Thu Aug 15 16:55:58 2019 +0200
+++ b/pkg/models/import.go	Thu Aug 15 16:58:39 2019 +0200
@@ -32,6 +32,7 @@
 		User     string     `json:"user"`
 		Signer   string     `json:"signer,omitempty"`
 		Summary  bool       `json:"summary,omitempty"`
+		Errors   bool       `json:"errors,omitempty"`
 		Warnings bool       `json:"warnings,omitempty"`
 	}