Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Widgets/Status.vue
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | export default { | ||||
} | } | ||||
// Update status process info every 5,6,7,8,9,... seconds | // Update status process info every 5,6,7,8,9,... seconds | ||||
clearTimeout(window.infoRequest) | clearTimeout(window.infoRequest) | ||||
if ((!this.refresh || this.waiting > 0) && (!info || !info.isReady)) { | if ((!this.refresh || this.waiting > 0) && (!info || !info.isReady)) { | ||||
window.infoRequest = setTimeout(() => { | window.infoRequest = setTimeout(() => { | ||||
delete window.infoRequest | delete window.infoRequest | ||||
// Stop updates after user logged out | // Stop updates after user logged out | ||||
if (!this.$store.state.isLoggedIn) { | if (!this.$root.authInfo) { | ||||
return; | return; | ||||
} | } | ||||
axios.get(this.getUrl()) | axios.get(this.getUrl()) | ||||
.then(response => { | .then(response => { | ||||
this.parseStatusInfo(response.data) | this.parseStatusInfo(response.data) | ||||
this.emitEvent(response.data) | this.emitEvent(response.data) | ||||
}) | }) | ||||
Show All 38 Lines | export default { | ||||
delete data.message | delete data.message | ||||
this.$emit('status-update', data) | this.$emit('status-update', data) | ||||
}, | }, | ||||
getUrl() { | getUrl() { | ||||
let scope = this.scope | let scope = this.scope | ||||
let id = this.$route.params[scope] | let id = this.$route.params[scope] | ||||
if (scope == 'dashboard') { | if (scope == 'dashboard') { | ||||
id = this.$store.state.authInfo.id | id = this.$root.authInfo.id | ||||
scope = 'user' | scope = 'user' | ||||
} else if (scope =='distlist') { | } else if (scope =='distlist') { | ||||
id = this.$route.params.list | id = this.$route.params.list | ||||
scope = 'group' | scope = 'group' | ||||
} else if (scope == 'shared-folder') { | } else if (scope == 'shared-folder') { | ||||
id = this.$route.params.folder | id = this.$route.params.folder | ||||
} | } | ||||
return '/api/v4/' + scope + 's/' + id + '/status' | return '/api/v4/' + scope + 's/' + id + '/status' | ||||
}, | }, | ||||
scopeLabel() { | scopeLabel() { | ||||
return this.scope == 'dashboard' ? 'account' : this.scope | return this.scope == 'dashboard' ? 'account' : this.scope | ||||
} | } | ||||
} | } | ||||
} | } | ||||
</script> | </script> |