Commit 12c72980 authored by Joel Collins's avatar Joel Collins
Browse files

Moved UI error handling to mixin

parent 55e527c2
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -175,7 +175,6 @@

<script>
import axios from 'axios'
import UIkit from 'uikit';

// Export main app
export default {
@@ -279,7 +278,7 @@ export default {
          this.$root.$emit('globalUpdateCaptureList')
        })
        .catch(error => {
          this.$store.dispatch('handleHTTPError', error);  // Let store handle error
          this.modalError(error) // Let mixin handle error
        })
    },

@@ -291,10 +290,10 @@ export default {
          return this.$store.dispatch('pollTask', [response.data.id, 3600, 5])
        })
        .then(() => {
          UIkit.notification({message: "Finished scan.", status: 'success'})
          this.modalNotify("Finished scan.")
        })
        .catch(error => {
          this.$store.dispatch('handleHTTPError', error);  // Let store handle error
          this.modalError(error)
        })
        .finally(() => {
          this.isScanning = false
+6 −0
Original line number Diff line number Diff line
@@ -126,6 +126,12 @@ export default {
      ]);
      // Try to get config and state JSON from the newly submitted host
      this.$store.dispatch('firstConnect')
      .then (() => {
        console.log("Connected!")
      })
      .catch(error => {
        this.modalError(error) // Let mixin handle error
      })
    },

    setLocalMode: function (state) {
+8 −11
Original line number Diff line number Diff line
@@ -105,15 +105,14 @@ export default {
      console.log(this.newtag);
      this.newTagRequest(this.newtag);
      this.newtag = "";
      UIkit.modal(event.target.parentNode).hide();
      UIkit.modal(event.target.parentNode).hide();  // TODO: Remove somehow
    },

    delCaptureConfirm: function(tag_string) {
      var context = this
      UIkit.modal.confirm('Permanantly delete capture?').then(function() {
      this.modalConfirm('Permanantly delete capture?')
      .then(function() {
        context.delCaptureRequest()
      }, function () {
        console.log('Rejected.')
      });
    },

@@ -125,7 +124,7 @@ export default {
        this.$root.$emit('globalUpdateCaptureList')
      })
      .catch(error => {
        this.$store.dispatch('handleHTTPError', error);  // Let store handle error
        this.modalError(error) // Let mixin handle error
      })
    },

@@ -137,16 +136,14 @@ export default {
        this.getTagRequest()
      })
      .catch(error => {
        this.$store.dispatch('handleHTTPError', error);  // Let store handle error
        this.modalError(error) // Let mixin handle error
      })
    },

    delTagConfirm: function(tag_string) {
      var context = this;
      UIkit.modal.confirm(`Remove tag '${tag_string}'?`).then(function() {
      this.modalConfirm(`Remove tag '${tag_string}'?`).then(function() {
        context.delTagRequest(tag_string)
      }, function () {
        console.log('Rejected.')
      });
    },

@@ -159,7 +156,7 @@ export default {
        this.getTagRequest()
      })
      .catch(error => {
        this.$store.dispatch('handleHTTPError', error);  // Let store handle error
        this.modalError(error) // Let mixin handle error
      })
    },

@@ -170,7 +167,7 @@ export default {
        this.tags = response.data.metadata.tags
      })
      .catch(error => {
        this.$store.dispatch('handleHTTPError', error);  // Let store handle error
        this.modalError(error) // Let mixin handle error
      })
    },

+0 −1
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@
</template>

<script>
import UIkit from 'uikit';
import axios from 'axios'

// Export main app
+1 −1
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ export default {
        this.captureList = response.data;  // Update boxes from response
      })
      .catch(error => {
        this.$store.dispatch('handleHTTPError', error);  // Let store handle error
        this.modalError(error) // Let mixin handle error
      })
    },

Loading