Commit a6a91882 authored by Joel Collins's avatar Joel Collins
Browse files

Added version mismatch warning

parent ee91e118
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -122,6 +122,26 @@ export default {
      this.$store.dispatch('firstConnect')
      .then (() => {
        console.log("Connected!")
        this.checkServerVersion()
      })
      .catch(error => {
        this.modalError(error) // Let mixin handle error
      })
    },

    checkServerVersion: function () {
      this.$store.dispatch('updateState')
      .then (() => {
        console.log(this.$store.state.apiState.version)
        var serverVersion = this.$store.state.apiState.version
        var serverVersionMajor = serverVersion.substring(0, 3)
        console.log(serverVersionMajor)
        var clientVersion = process.env.PACKAGE_VERSION
        var clientVersionMajor = clientVersion.substring(0, 3)
        console.log(clientVersionMajor)
        if (serverVersionMajor != clientVersionMajor) {
          this.modalDialog("Version mismatch", "Client and microscope versions do not match. Consider updating your microscope software. Some functionality may currently be broken.", status='warning')
        }
      })
      .catch(error => {
        this.modalError(error) // Let mixin handle error