changeset 2980:a9b61290fcc2 unified_import

unified_imports: edit capabilities added
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 09 Apr 2019 16:23:26 +0200
parents 8f266dc8b4e3
children e47e440ab921
files client/src/components/importconfiguration/Import.vue client/src/components/importconfiguration/types/ScheduledImports.vue
diffstat 2 files changed, 40 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importconfiguration/Import.vue	Tue Apr 09 14:52:55 2019 +0200
+++ b/client/src/components/importconfiguration/Import.vue	Tue Apr 09 16:23:26 2019 +0200
@@ -135,7 +135,7 @@
       this.$store
         .dispatch("importschedule/loadSchedule", id)
         .then(() => {
-          this.$store.commit("importschedule/setImportScheduleDetailVisible");
+          this.$store.commit("importschedule/setEditMode");
         })
         .catch(error => {
           const { status, data } = error.response;
@@ -163,6 +163,44 @@
             message: `${status}: ${data.message || data}`
           });
         });
+    },
+    deleteSchedule(schedule) {
+      console.log(schedule);
+      this.$store.commit("application/popup", {
+        icon: "trash",
+        title: this.$gettext("Delete Import"),
+        content:
+          this.$gettext("Do you really want to delete the import with ID") +
+          `<b>${schedule.id}</b>` +
+          this.$gettext("of type") +
+          `<b>${schedule.kind.toUpperCase()}</b>?`,
+        confirm: {
+          label: this.$gettext("Delete"),
+          icon: "trash",
+          callback: () => {
+            this.$store
+              .dispatch("importschedule/deleteSchedule", schedule.id)
+              .then(() => {
+                this.getSchedules();
+                displayInfo({
+                  title: this.$gettext("Imports"),
+                  message: this.$gettext("Deleted import: #") + schedule.id
+                });
+              })
+              .catch(error => {
+                const { status, data } = error.response;
+                displayError({
+                  title: this.$gettext("Backend Error"),
+                  message: `${status}: ${data.message || data}`
+                });
+              });
+          }
+        },
+        cancel: {
+          label: this.$gettext("Cancel"),
+          icon: "times"
+        }
+      });
     }
   },
   computed: {
--- a/client/src/components/importconfiguration/types/ScheduledImports.vue	Tue Apr 09 14:52:55 2019 +0200
+++ b/client/src/components/importconfiguration/types/ScheduledImports.vue	Tue Apr 09 16:23:26 2019 +0200
@@ -892,7 +892,7 @@
     },
     closeDetailview() {
       this.$store.commit("importschedule/clearCurrentSchedule");
-      this.$store.commit("importschedule/setImportScheduleDetailInvisible");
+      this.$store.commit("importschedule/setListMode");
     }
   },
   IMPORTTYPES: IMPORTTYPES,