changeset 2449:0c9121abf120

staging: reload button clears filtering
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 01 Mar 2019 13:51:09 +0100
parents 8044e379d8ee
children 7677a2850a2d ae1987c5beb3
files client/src/components/importoverview/ImportOverview.vue client/src/components/importoverview/importlogs/Logs.vue
diffstat 2 files changed, 40 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importoverview/ImportOverview.vue	Fri Mar 01 13:21:18 2019 +0100
+++ b/client/src/components/importoverview/ImportOverview.vue	Fri Mar 01 13:51:09 2019 +0100
@@ -7,10 +7,10 @@
     />
     <div class="d-flex flex-row w-100 justify-content-end">
       <button
-        class="btn btn-sm btn-dark align-self-start mt-3 mr-3"
+        class="btn btn-sm btn-outline-info align-self-start mt-3 mr-3"
         @click="refresh"
       >
-        <translate>Refresh</translate>
+        <font-awesome-icon icon="redo"></font-awesome-icon>
       </button>
     </div>
     <div class="d-flex flex-row w-100 border-bottom">
@@ -55,7 +55,7 @@
           icon="angle-down"
           fixed-width
         ></font-awesome-icon>
-        <Logs v-if="logsVisible"></Logs>
+        <Logs v-if="logsVisible" :reload="reload"></Logs>
         <div v-else>
           <h6>
             <small><translate>Logs</translate></small>
@@ -85,6 +85,11 @@
 
 export default {
   name: "importoverview",
+  data() {
+    return {
+      reload: false
+    };
+  },
   components: {
     Staging: () => import("./staging/Staging.vue"),
     Logs: () => import("./importlogs/Logs.vue")
@@ -100,22 +105,30 @@
       this.$store.commit("imports/setLogsVisibility", !this.logsVisible);
     },
     refresh() {
+      this.reload = true;
       this.loadImportQueue();
       this.loadLogs();
     },
     loadImportQueue() {
-      this.$store.dispatch("imports/getStaging").catch(error => {
-        const { status, data } = error.response;
-        displayError({
-          title: "Backend Error",
-          message: `${status}: ${data.message || data}`
+      this.$store
+        .dispatch("imports/getStaging")
+        .then(() => {
+          this.reload = false;
+        })
+        .catch(error => {
+          const { status, data } = error.response;
+          displayError({
+            title: "Backend Error",
+            message: `${status}: ${data.message || data}`
+          });
         });
-      });
     },
     loadLogs() {
       this.$store
         .dispatch("imports/getImports")
-        .then(() => {})
+        .then(() => {
+          this.reload = false;
+        })
         .catch(error => {
           const { status, data } = error.response;
           displayError({
--- a/client/src/components/importoverview/importlogs/Logs.vue	Fri Mar 01 13:21:18 2019 +0100
+++ b/client/src/components/importoverview/importlogs/Logs.vue	Fri Mar 01 13:51:09 2019 +0100
@@ -51,6 +51,7 @@
   components: {
     LogDetail: () => import("./LogDetail.vue")
   },
+  props: ["reload"],
   data() {
     return {
       loading: false,
@@ -67,7 +68,7 @@
       return {
         btn: true,
         "btn-sm": true,
-        "btn-light": !this.pending,
+        "btn-outline-info": !this.pending,
         "btn-info": this.pending
       };
     },
@@ -75,7 +76,7 @@
       return {
         btn: true,
         "btn-sm": true,
-        "btn-light": !this.failed,
+        "btn-outline-info": !this.failed,
         "btn-info": this.failed
       };
     },
@@ -83,7 +84,7 @@
       return {
         btn: true,
         "btn-sm": true,
-        "btn-light": !this.declined,
+        "btn-outline-info": !this.declined,
         "btn-info": this.declined
       };
     },
@@ -91,7 +92,7 @@
       return {
         btn: true,
         "btn-sm": true,
-        "btn-light": !this.accepted,
+        "btn-outline-info": !this.accepted,
         "btn-info": this.accepted
       };
     },
@@ -99,11 +100,22 @@
       return {
         btn: true,
         "btn-sm": true,
-        "btn-light": !this.warning,
+        "btn-outline-info": !this.warning,
         "btn-info": this.warning
       };
     }
   },
+  watch: {
+    reload() {
+      if (!this.reload) return;
+      this.warning = false;
+      this.successful = false;
+      this.failed = false;
+      this.pending = false;
+      this.accepted = false;
+      this.declined = false;
+    }
+  },
   methods: {
     setFilter(name) {
       if (this.loading) return;