add data connection error
This commit is contained in:
parent
b80bba3d3d
commit
710eadc49b
3 changed files with 38 additions and 11 deletions
|
@ -2,6 +2,11 @@
|
||||||
<v-app>
|
<v-app>
|
||||||
<MyNav :user="user" :site_info="site_info" />
|
<MyNav :user="user" :site_info="site_info" />
|
||||||
<v-main class="ma-4">
|
<v-main class="ma-4">
|
||||||
|
<v-banner v-if="!site_info.backend_connected"
|
||||||
|
icon="mdi-exclamation"
|
||||||
|
color="error"
|
||||||
|
text="Cannot connect to the data service. Please contact support." >
|
||||||
|
</v-banner>
|
||||||
<router-view :site_info="site_info" :user_info="user_info"></router-view>
|
<router-view :site_info="site_info" :user_info="user_info"></router-view>
|
||||||
</v-main>
|
</v-main>
|
||||||
</v-app>
|
</v-app>
|
||||||
|
@ -19,8 +24,9 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
site_info: {
|
site_info: {
|
||||||
name: "Loading...",
|
name: "",
|
||||||
features: {}
|
features: {},
|
||||||
|
backend_connected: false
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
first_name: "",
|
first_name: "",
|
||||||
|
@ -67,10 +73,21 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
async getSiteInfo() {
|
async getSiteInfo() {
|
||||||
|
console.log("Trying to get site Info...")
|
||||||
axios
|
axios
|
||||||
.get(this.$api_url + "/info")
|
.get(this.$api_url + "/info")
|
||||||
.then(response => {this.site_info = response.data})
|
.then(response => {
|
||||||
.catch(error => (console.log(error)))
|
this.site_info = response.data
|
||||||
|
this.site_info.backend_connected = true
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.site_info.name = "Error getting data connection"
|
||||||
|
this.site_info.backend_connected = false
|
||||||
|
console.log(error)
|
||||||
|
setTimeout(() => {
|
||||||
|
this.getSiteInfo()
|
||||||
|
},5000)
|
||||||
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
async getUserInfo() {
|
async getUserInfo() {
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default{
|
||||||
} else {
|
} else {
|
||||||
this.items = []
|
this.items = []
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
user_items() {
|
user_items() {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
id="login-box"
|
id="login-box"
|
||||||
title="Welcome!"
|
title="Welcome!"
|
||||||
subtitle="Please Log In">
|
subtitle="Please Log In">
|
||||||
<v-form>
|
<v-form :disabled="!my_site_info.backend_connected">
|
||||||
<v-responsive class="mx-auto" max-width="475">
|
<v-responsive class="mx-auto" max-width="475">
|
||||||
<v-text-field label="Username"
|
<v-text-field label="Username"
|
||||||
@keyup.enter="submitLogin"
|
@keyup.enter="submitLogin"
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
@keyup.enter="submitLogin"
|
@keyup.enter="submitLogin"
|
||||||
v-model="user.password" clearable
|
v-model="user.password" clearable
|
||||||
type="password"></v-text-field>
|
type="password"></v-text-field>
|
||||||
<v-btn color="blue" :loading="logging_in" @click="submitLogin">Login</v-btn>
|
<v-btn :disabled="!my_site_info.backend_connected" color="blue" :loading="logging_in" @click="submitLogin">Login</v-btn>
|
||||||
<v-banner v-if="show_error" color="error" icon="mdi-exclamation-thick" theme="dark">
|
<v-banner v-if="show_error" color="error" icon="mdi-exclamation-thick" theme="dark">
|
||||||
<v-banner-text>{{ error_message }}</v-banner-text>
|
<v-banner-text>{{ error_message }}</v-banner-text>
|
||||||
</v-banner>
|
</v-banner>
|
||||||
|
@ -27,9 +27,13 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
props: {
|
||||||
|
site_info: {}
|
||||||
|
},
|
||||||
name: 'LoginPage',
|
name: 'LoginPage',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
my_site_info: this.site_info,
|
||||||
user: {
|
user: {
|
||||||
email: "",
|
email: "",
|
||||||
password: ""
|
password: ""
|
||||||
|
@ -40,6 +44,12 @@ export default {
|
||||||
logging_in: false
|
logging_in: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
'site_info.backend_connected'(new_val) {
|
||||||
|
console.log(new_val)
|
||||||
|
this.my_site_info.backend_connected = new_val
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submitLogin() {
|
submitLogin() {
|
||||||
this.error_message = ""
|
this.error_message = ""
|
||||||
|
|
Loading…
Reference in a new issue