From 2bc74d4d36f5320bb535db972a43fd46cd45a93b Mon Sep 17 00:00:00 2001
From: Jannik Schönartz
Date: Thu, 7 May 2020 22:03:26 +0000
Subject: [webapp/external-backends] Remove step 3 from stepper & eslint fixes

---
 webapp/src/components/BackendModuleEdit.vue | 84 +++--------------------------
 1 file changed, 6 insertions(+), 78 deletions(-)

(limited to 'webapp/src/components/BackendModuleEdit.vue')

diff --git a/webapp/src/components/BackendModuleEdit.vue b/webapp/src/components/BackendModuleEdit.vue
index 0b235da..b6fcfd5 100644
--- a/webapp/src/components/BackendModuleEdit.vue
+++ b/webapp/src/components/BackendModuleEdit.vue
@@ -7,13 +7,7 @@
     "backendEmptyError": "This field can not be empty.",
     "backendType": "Backend type",
     "backendtypeEmptyError": "Please choose a backend type.",
-    "backendSaved": "Backend was successfully saved.",
-    "stepperOptional": "optional",
-    "pending": "pending",
-    "progress": "in progress ...",
-    "success": "success",
-    "error": "error",
-    "testConnection": "Test connection"
+    "backendSaved": "Backend was successfully saved."
   },
   "de": {
     "inputCredentials": "Anmeldedaten",
@@ -22,13 +16,7 @@
     "backendEmptyError": "Dieses Feld darf nicht leer sein.",
     "backendType": "Backend Typ",
     "backendtypeEmptyError": "Bitte wähle einen Backendtyp aus.",
-    "backendSaved": "Backend wurde erfolgreich gespeichert.",
-    "stepperOptional": "Optional",
-    "pending": "nicht getestet",
-    "progress": "test läuft ...",
-    "success": "erfolgreich",
-    "error": "Fehler",
-    "testConnection": "Verbindung überprüfen"
+    "backendSaved": "Backend wurde erfolgreich gespeichert."
   }
 }
 </i18n>
@@ -57,13 +45,6 @@
               step="2"
               :editable="stepCompleted >= 2"
             >{{ $t('inputCredentials') }}</v-stepper-step>
-            <v-divider></v-divider>
-            <v-stepper-step
-              :complete="stepCompleted >= 3"
-              step="3"
-              :editable="stepCompleted >= 3"
-            >{{ $t('testConnection') }}<small>{{ $t('stepperOptional') }}</small>
-            </v-stepper-step>
           </v-stepper-header>
         </v-stepper>
       </v-card-title>
@@ -91,25 +72,6 @@
                 ></v-text-field>
                 <backend-module-edit-dynamic-fields :elements="elements"/>
               </v-stepper-content>
-              <v-stepper-content step="3">
-                <v-container>
-                <v-layout align-center justify-center column>
-                <v-btn
-                  fab
-                  dark
-                  icon
-                  :loading="loading"
-                  :disabled="loading"
-                  @click.stop="checkConnection"
-                  large
-                >
-                  <v-icon x-large color="primary">cached</v-icon>
-                </v-btn>
-                  <div class="display-1">{{ $t('Status') }}: <strong :class="statusColor">{{ statusLabel }}</strong></div>
-                  <div class="display-1">{{ $t('Status') }}: <strong :class="statusColor">TODO: REMOVE</strong></div>
-                </v-layout>
-                </v-container>
-              </v-stepper-content>
             </v-stepper-items>
           </v-stepper>
         </v-form>
@@ -119,8 +81,7 @@
         <v-flex xl10 offset-xl2 lg12 text-right>
           <v-btn text @click.native="$store.commit('backends/setEdit', false)">{{ $t('cancel') }}</v-btn>
           <v-btn color="primary" v-show="step == 1" @click.native="completeStepOne()">{{ $t('continue') }}</v-btn>
-          <v-btn color="primary" v-show="step == 2" @click.native="completeStepTwo()">{{ $t('continue') }}</v-btn>
-          <v-btn type="submit" @click="submit" v-show="step == 3" class="primary" raised>{{ backendId ? $t('save') : $t('create') }}</v-btn>
+          <v-btn type="submit" @click.native="completeStepTwo()" @click="submit" v-show="step == 2" class="primary" raised>{{ backendId ? $t('save') : $t('create') }}</v-btn>
         </v-flex>
       </v-card-actions>
     </v-card>
@@ -145,10 +106,7 @@ export default {
       backendType: '',
       backendName: '',
       elements: [],
-      loadData: false,
-      loading: false,
-      statusColor: 'primary--text',
-      statusLabel: this.$t('pending')
+      loadData: false
     }
   },
   methods: {
@@ -206,38 +164,10 @@ export default {
     completeStepTwo () {
       // Error handling
       if (this.backendName !== '') {
-        this.step = 3
         this.stepCompleted = Math.max(2, this.stepCompleted)
       } else {
         this.$refs.form.validate()
       }
-    },
-    checkConnection () {
-      // Start the loading animation and reset the label colors.
-      this.loading = true
-      this.statusColor = 'primary--text'
-      this.statusLabel = this.$t('progress')
-
-      // Test the credential connection.
-      this.$http.post('/api/backends/0/connection', {
-        name: this.backendName,
-        type: this.backendType,
-        credentials: JSON.stringify(this.credentials),
-        headers: {
-          'Cache-Control': 'no-cache'
-        }
-      }).then(response => {
-        if (response.data.success) {
-          this.statusColor = 'success--text'
-          this.statusLabel = this.$t('success')
-        } else {
-          this.statusColor = 'error--text'
-          this.statusLabel = this.$t('error')
-          this.$snackbar({ color: 'error', text: response.data.error })
-        }
-        // End the loading animation.
-        this.loading = false
-      })
     }
   },
   computed: {
@@ -252,14 +182,12 @@ export default {
     edit: function (value) {
       if (value) {
         this.loadBackendTypes()
-        this.statusColor = 'primary--text'
-        this.statusLabel = this.$t('pending')
-        this.$refs.form.reset()
+        if (this.$refs.form) this.$refs.form.reset()
         this.elements = []
         if (this.backendId !== 0) {
           this.loadBackend(this.backendId)
           this.step = 2
-          this.stepCompleted = 3
+          this.stepCompleted = 2
         } else {
           this.backendName = ''
           this.backendType = ''
-- 
cgit v1.2.3-55-g7522

