changeset 1728:647195199dc8

importschedule: now with display of cron and delete function
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 09 Jan 2019 12:39:20 +0100
parents 3adb834ed55e
children 74f7d4c531bc
files client/src/components/importschedule/Importschedule.vue client/src/components/importschedule/Importscheduledetail.vue
diffstat 2 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importschedule/Importschedule.vue	Wed Jan 09 12:07:27 2019 +0100
+++ b/client/src/components/importschedule/Importschedule.vue	Wed Jan 09 12:39:20 2019 +0100
@@ -46,7 +46,7 @@
                   <td>{{ schedule.id }}</td>
                   <td>{{ schedule.kind }}</td>
                   <td>{{ schedule.user }}</td>
-                  <td></td>
+                  <td>{{ schedule.cron }}</td>
                   <td>
                     <font-awesome-icon
                       v-if="schedule['send-email']"
@@ -162,13 +162,18 @@
       this.$store.commit("imports/setImportScheduleDetailVisible");
     },
     deleteSchedule(index) {
-      this.$store.dispatch("imports/deleteSchedule", index).catch(error => {
-        const { status, data } = error.response;
-        displayError({
-          title: this.$gettext("Backend Error"),
-          message: `${status}: ${data.message || data}`
+      this.$store
+        .dispatch("imports/deleteSchedule", index)
+        .then(() => {
+          this.getSchedules();
+        })
+        .catch(error => {
+          const { status, data } = error.response;
+          displayError({
+            title: this.$gettext("Backend Error"),
+            message: `${status}: ${data.message || data}`
+          });
         });
-      });
     }
   },
   computed: {
--- a/client/src/components/importschedule/Importscheduledetail.vue	Wed Jan 09 12:07:27 2019 +0100
+++ b/client/src/components/importschedule/Importscheduledetail.vue	Wed Jan 09 12:39:20 2019 +0100
@@ -530,6 +530,11 @@
     save() {
       let data = {};
       if (!this.import_) return;
+      let cron = this.cronString;
+      if (this.easyCron) {
+        if (this.simple === "weekly") cron = "0 0 * * 0";
+        if (this.simple === "monthly") cron = "0 0 1 * *";
+      }
       switch (this.import_) {
         case this.$options.IMPORTTYPES.BOTTLENECK:
           if (!this.validateBottleneckfields()) return;
@@ -539,6 +544,7 @@
           data["attributes"] = {
             insecure: this.insecure + ""
           };
+          if (cron) data["cron"] = cron;
           break;
         default:
           break;