Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Dashboard.vue
<template> | <template> | ||||
<div class="container" dusk="dashboard-component"> | <div v-if="!$root.isLoading" class="container" dusk="dashboard-component"> | ||||
<div v-if="!$root.isLoading" id="status-box" class="card"> | <div v-if="!isReady" id="status-box" class="card"> | ||||
<div class="card-body"> | <div class="card-body"> | ||||
<div class="card-title">Status</div> | <div class="card-title">Account status: <span class="text-danger">Not ready</span></div> | ||||
<div class="card-text"> | <div class="card-text"> | ||||
<ul style="list-style: none; padding: 0;"> | <p>The process to create your account have not been completed yet. | ||||
Some features may be disabled or readonly.</p> | |||||
<ul class="status-list"> | |||||
bohlender: "have not" should be "has not" ? | |||||
Done Inline ActionsI'll fix that machniak: I'll fix that | |||||
<li v-for="item in statusProcess" :key="item.label"> | <li v-for="item in statusProcess" :key="item.label"> | ||||
Not Done Inline Actionsin the end we might only want to display the things that have not happened yet. bohlender: in the end we might only want to display the things that have not happened yet.
let's do this… | |||||
Done Inline ActionsI think it's better visually to display all. It looks nicer when the unchecked boxes change live. machniak: I think it's better visually to display all. It looks nicer when the unchecked boxes change… | |||||
<span v-if="item.state">✓</span><span v-else>○</span> | <svg-icon :icon="['far', item.state ? 'check-square' : 'square']" | ||||
:class="item.state ? 'text-success' : 'text-muted'" | |||||
></svg-icon> | |||||
<router-link v-if="item.link" :to="{ path: item.link }">{{ item.title }}</router-link> | <router-link v-if="item.link" :to="{ path: item.link }">{{ item.title }}</router-link> | ||||
<span v-if="!item.link">{{ item.title }}</span> | <span v-if="!item.link">{{ item.title }}</span> | ||||
</li> | </li> | ||||
</ul> | </ul> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div id="dashboard-nav"> | <div id="dashboard-nav"> | ||||
Show All 13 Lines | <div v-if="!$root.isLoading" class="container" dusk="dashboard-component"> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
export default { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
isReady: true, | |||||
statusProcess: [], | statusProcess: [], | ||||
request: null, | request: null, | ||||
balance: 0 | balance: 0 | ||||
} | } | ||||
}, | }, | ||||
mounted() { | mounted() { | ||||
const authInfo = this.$store.state.isLoggedIn ? this.$store.state.authInfo : null | const authInfo = this.$store.state.isLoggedIn ? this.$store.state.authInfo : null | ||||
clearTimeout(window.infoRequest) | |||||
if (authInfo) { | if (authInfo) { | ||||
this.parseStatusInfo(authInfo.statusInfo) | this.parseStatusInfo(authInfo.statusInfo) | ||||
this.getBalance(authInfo) | this.getBalance(authInfo) | ||||
} else { | } else { | ||||
this.$root.startLoading() | this.$root.startLoading() | ||||
axios.get('/api/auth/info') | axios.get('/api/auth/info') | ||||
.then(response => { | .then(response => { | ||||
this.$store.state.authInfo = response.data | this.$store.state.authInfo = response.data | ||||
this.parseStatusInfo(response.data.statusInfo) | this.parseStatusInfo(response.data.statusInfo) | ||||
this.getBalance(response.data) | this.getBalance(response.data) | ||||
this.$root.stopLoading() | this.$root.stopLoading() | ||||
}) | }) | ||||
.catch(this.$root.errorHandler) | .catch(this.$root.errorHandler) | ||||
} | } | ||||
}, | }, | ||||
methods: { | methods: { | ||||
// Displays account status information | // Displays account status information | ||||
parseStatusInfo(info) { | parseStatusInfo(info) { | ||||
this.statusProcess = info.process | this.statusProcess = info.process | ||||
this.isReady = info.isReady | |||||
// Update status process info every 10 seconds | // Update status process info every 10 seconds | ||||
// FIXME: This probably should have some limit, or the interval | // FIXME: This probably should have some limit, or the interval | ||||
// should grow (well, until it could be done with websocket notifications) | // should grow (well, until it could be done with websocket notifications) | ||||
if (info.status != 'active') { | if (!info.isReady && !window.infoRequest) { | ||||
window.infoRequest = setTimeout(() => { | window.infoRequest = setTimeout(() => { | ||||
delete window.infoRequest | |||||
// Stop updates after user logged out | // Stop updates after user logged out | ||||
if (!this.$store.state.isLoggedIn) { | if (!this.$store.state.isLoggedIn) { | ||||
return; | return; | ||||
} | } | ||||
axios.get('/api/auth/info') | axios.get('/api/auth/info') | ||||
.then(response => { | .then(response => { | ||||
this.$store.state.authInfo = response.data | this.$store.state.authInfo = response.data | ||||
Show All 18 Lines |
"have not" should be "has not" ?