changeset 2316:bc43cd047ead

importqueue: warnings filter implemented
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 18 Feb 2019 16:41:09 +0100
parents bd8ecc90ccf4
children 8a8680e70d2e
files client/src/components/importqueue/Importqueue.vue
diffstat 1 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importqueue/Importqueue.vue	Mon Feb 18 16:19:00 2019 +0100
+++ b/client/src/components/importqueue/Importqueue.vue	Mon Feb 18 16:41:09 2019 +0100
@@ -40,6 +40,9 @@
                 <button @click="setFilter('accepted')" :class="acceptedStyle">
                   <translate>Accepted</translate>
                 </button>
+                <button @click="setFilter('warning')" :class="warningStyle">
+                  <translate>Warning</translate>
+                </button>
               </div>
             </div>
             <div class="text-left d-flex flex-row border-bottom entries">
@@ -118,7 +121,8 @@
       failed: false,
       pending: false,
       rejected: false,
-      accepted: false
+      accepted: false,
+      warning: false
     };
   },
   mounted() {
@@ -128,8 +132,13 @@
     setFilter(name) {
       this[name] = !this[name];
       const allSet =
-        this.failed && this.pending && this.accepted && this.rejected;
+        this.failed &&
+        this.pending &&
+        this.accepted &&
+        this.rejected &&
+        this.warning;
       if (allSet) {
+        this.warning = false;
         this.successful = false;
         this.failed = false;
         this.pending = false;
@@ -191,7 +200,13 @@
           });
         })
         .filter(y => {
-          if (!this.failed && !this.pending && !this.accepted && !this.rejected)
+          if (
+            !this.failed &&
+            !this.pending &&
+            !this.accepted &&
+            !this.rejected &&
+            !this.warning
+          )
             return true;
           let filterCriteria = [];
           if (this.failed) filterCriteria.push("failed");
@@ -201,6 +216,7 @@
           const result = filterCriteria.map(selectedState => {
             return y.state === selectedState;
           });
+          if (this.warning) return result.some(x => x) || y.warnings;
           return result.some(x => x);
         });
       return filtered;
@@ -232,6 +248,13 @@
         "btn-light": !this.accepted,
         "btn-dark": this.accepted
       };
+    },
+    warningStyle() {
+      return {
+        btn: true,
+        "btn-light": !this.warning,
+        "btn-dark": this.warning
+      };
     }
   }
 };