Web UI: Avoid polling on /api/entrypoints
This commit is contained in:
parent
9ef4f47ba0
commit
433c848c8d
1 changed files with 12 additions and 11 deletions
|
@ -144,8 +144,8 @@ export default {
|
||||||
loadingOverview: true,
|
loadingOverview: true,
|
||||||
timeOutEntryGetAll: null,
|
timeOutEntryGetAll: null,
|
||||||
timeOutOverviewAll: null,
|
timeOutOverviewAll: null,
|
||||||
intervalRefreshAll: null,
|
intervalRefresh: null,
|
||||||
intervalRefreshAllTime: 5000
|
intervalRefreshTime: 5000
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -167,10 +167,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('entrypoints', { entryGetAll: 'getAll' }),
|
...mapActions('entrypoints', { entryGetAll: 'getAll' }),
|
||||||
...mapActions('core', { getOverview: 'getOverview' }),
|
...mapActions('core', { getOverview: 'getOverview' }),
|
||||||
refreshAll () {
|
fetchEntries () {
|
||||||
this.onGetAll()
|
|
||||||
},
|
|
||||||
onGetAll () {
|
|
||||||
this.entryGetAll()
|
this.entryGetAll()
|
||||||
.then(body => {
|
.then(body => {
|
||||||
console.log('Success -> dashboard/entrypoints', body)
|
console.log('Success -> dashboard/entrypoints', body)
|
||||||
|
@ -182,6 +179,8 @@ export default {
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log('Error -> dashboard/entrypoints', error)
|
console.log('Error -> dashboard/entrypoints', error)
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
fetchOverview () {
|
||||||
this.getOverview()
|
this.getOverview()
|
||||||
.then(body => {
|
.then(body => {
|
||||||
console.log('Success -> dashboard/overview', body)
|
console.log('Success -> dashboard/overview', body)
|
||||||
|
@ -193,16 +192,18 @@ export default {
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log('Error -> dashboard/overview', error)
|
console.log('Error -> dashboard/overview', error)
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
fetchAll () {
|
||||||
|
this.fetchEntries()
|
||||||
|
this.fetchOverview()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.refreshAll()
|
this.fetchAll()
|
||||||
this.intervalRefreshAll = setInterval(() => {
|
this.intervalRefresh = setInterval(this.fetchOverview, this.intervalRefreshTime)
|
||||||
this.refreshAll()
|
|
||||||
}, this.intervalRefreshAllTime)
|
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
clearInterval(this.intervalRefreshAll)
|
clearInterval(this.intervalRefresh)
|
||||||
clearTimeout(this.timeOutEntryGetAll)
|
clearTimeout(this.timeOutEntryGetAll)
|
||||||
clearTimeout(this.timeOutOverviewAll)
|
clearTimeout(this.timeOutOverviewAll)
|
||||||
this.$store.commit('entrypoints/getAllClear')
|
this.$store.commit('entrypoints/getAllClear')
|
||||||
|
|
Loading…
Reference in a new issue