changeset 3013:30222bcbfec9

import_configuration: add email option to onetime imports
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 11 Apr 2019 14:37:13 +0200
parents 802fcb50c484
children 5a3ac4d3dbbb
files client/src/components/importconfiguration/types/ApprovedGaugeMeasurement.vue client/src/components/importconfiguration/types/Soundingresults.vue client/src/components/importconfiguration/types/WaterwayProfiles.vue
diffstat 3 files changed, 96 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importconfiguration/types/ApprovedGaugeMeasurement.vue	Thu Apr 11 14:11:29 2019 +0200
+++ b/client/src/components/importconfiguration/types/ApprovedGaugeMeasurement.vue	Thu Apr 11 14:37:13 2019 +0200
@@ -1,22 +1,44 @@
 <template>
   <div>
-    <div class="d-flex flex-column text-left w-25">
-      <label class="text-nowrap" for="originator">
-        <small class="text-muted"
-          >{{ $options.ORIGINATOR }} / {{ $options.FROM }}</small
-        >
-      </label>
-      <input
-        type="text"
-        v-model="originator"
-        class="form-control"
-        id="originator"
-      />
-      <span class="text-left text-danger">
-        <small v-if="!originator">
-          <translate>Please enter an originator</translate>
-        </small>
-      </span>
+    <div class="d-flex flex-row">
+      <div :key="1" class="flex-column mr-4">
+        <div class="flex-row text-left">
+          <small class="text-muted">
+            <translate>Email Notification</translate>
+          </small>
+        </div>
+        <div class="flex-flex-row text-left">
+          <toggle-button
+            v-model="eMailNotification"
+            class="mt-2"
+            :speed="100"
+            :labels="{
+              checked: this.$options.on,
+              unchecked: this.$options.off
+            }"
+            :width="60"
+            :height="30"
+          />
+        </div>
+      </div>
+      <div class="d-flex flex-column text-left w-25">
+        <label class="text-nowrap" for="originator">
+          <small class="text-muted"
+            >{{ $options.ORIGINATOR }} / {{ $options.FROM }}</small
+          >
+        </label>
+        <input
+          type="text"
+          v-model="originator"
+          class="form-control"
+          id="originator"
+        />
+        <span class="text-left text-danger">
+          <small v-if="!originator">
+            <translate>Please enter an originator</translate>
+          </small>
+        </span>
+      </div>
     </div>
     <div class="mt-4 flex-column w-100">
       <div class="custom-file">
@@ -74,7 +96,8 @@
       disableUploadButton: false,
       uploadLabel: this.$gettext("choose file to upload"),
       uploadFile: null,
-      originator: "viadonau"
+      originator: "viadonau",
+      eMailNotification: false
     };
   },
   computed: {
@@ -100,6 +123,9 @@
       let formData = new FormData();
       formData.append("agm", this.uploadFile);
       formData.append("originator", this.originator);
+      if (this.eMailNotification) {
+        formData.append("send-email", this.eMailNotification);
+      }
       HTTP.post("/imports/agm", formData, {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),
--- a/client/src/components/importconfiguration/types/Soundingresults.vue	Thu Apr 11 14:11:29 2019 +0200
+++ b/client/src/components/importconfiguration/types/Soundingresults.vue	Thu Apr 11 14:37:13 2019 +0200
@@ -89,7 +89,27 @@
     </div>
     <div class="mt-3">
       <div v-if="uploadState" class="input-group">
-        <div class="custom-file">
+        <div :key="1" class="flex-column mr-4">
+          <div class="flex-row text-left">
+            <small class="text-muted">
+              <translate>Email Notification</translate>
+            </small>
+          </div>
+          <div class="flex-flex-row text-left">
+            <toggle-button
+              v-model="eMailNotification"
+              class="mt-2"
+              :speed="100"
+              :labels="{
+                checked: this.$options.on,
+                unchecked: this.$options.off
+              }"
+              :width="60"
+              :height="30"
+            />
+          </div>
+        </div>
+        <div class="custom-file mt-4">
           <input
             accept=".zip"
             type="file"
@@ -169,7 +189,8 @@
       uploadFile: null,
       disableUpload: false,
       token: null,
-      messages: []
+      messages: [],
+      eMailNotification: false
     };
   },
   methods: {
@@ -186,6 +207,7 @@
       this.uploadFile = null;
       this.disableUpload = false;
       this.token = null;
+      this.eMailNotification = false;
       this.messages = [];
     },
     fileSelected(e) {
@@ -215,6 +237,9 @@
     upload() {
       let formData = new FormData();
       formData.append("soundingresult", this.uploadFile);
+      if (this.eMailNotification) {
+        formData.append("send-email", this.eMailNotification);
+      }
       HTTP.post("/imports/sr-upload", formData, {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),
--- a/client/src/components/importconfiguration/types/WaterwayProfiles.vue	Thu Apr 11 14:11:29 2019 +0200
+++ b/client/src/components/importconfiguration/types/WaterwayProfiles.vue	Thu Apr 11 14:37:13 2019 +0200
@@ -1,6 +1,26 @@
 <template>
   <div>
     <div class="mb-4">
+      <div :key="1" class="flex-column mr-4">
+        <div class="flex-row text-left">
+          <small class="text-muted">
+            <translate>Email Notification</translate>
+          </small>
+        </div>
+        <div class="flex-flex-row text-left">
+          <toggle-button
+            v-model="eMailNotification"
+            class="mt-2"
+            :speed="100"
+            :labels="{
+              checked: this.$options.on,
+              unchecked: this.$options.off
+            }"
+            :width="60"
+            :height="30"
+          />
+        </div>
+      </div>
       <div class="d-flex flex-row">
         <div class="flex-column w-100">
           <div class="flex-row text-left">
@@ -111,7 +131,8 @@
       featureType: "ws-wamos:ienc_wtwprf",
       disableUploadButton: false,
       uploadLabel: this.$gettext("choose file to upload"),
-      uploadFile: null
+      uploadFile: null,
+      eMailNotification: false
     };
   },
   computed: {
@@ -140,6 +161,9 @@
       formData.append("url", this.url);
       formData.append("feature-type", this.featureType);
       formData.append("sort-by", this.sortBy);
+      if (this.eMailNotification) {
+        formData.append("send-email", this.eMailNotification);
+      }
       HTTP.post("/imports/wp", formData, {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),