|
|
@@ -278,7 +278,7 @@ |
|
|
|
...mapActions('networks', [ |
|
|
|
'getNetworkById', 'deleteNetwork', 'getStatusesByNetworkId', 'getNodesByNetworkId', |
|
|
|
'stopNetwork', 'queueBackup', 'restoreNetwork', 'deleteNetwork', 'requestNetworkKeys', |
|
|
|
'retrieveNetworkKeys' |
|
|
|
'retrieveNetworkKeys', 'getBackups' |
|
|
|
]), |
|
|
|
...mapActions('system', ['getAppLinks']), |
|
|
|
refreshStatus (userId) { |
|
|
@@ -296,11 +296,23 @@ |
|
|
|
messages: this.messages, |
|
|
|
errors: this.errors |
|
|
|
}); |
|
|
|
if (this.backups === null || this.refresher === null) { |
|
|
|
// note about the second part of the condition above: if refreshes is turned on, then fetch backups |
|
|
|
// from BE only once |
|
|
|
this.getBackups({ userId: userId, networkId: this.networkId, |
|
|
|
messages: this.messages, errors: this.errors }); |
|
|
|
} |
|
|
|
}, |
|
|
|
startStatusRefresher (user) { |
|
|
|
// todo: separate refresher for network -- after "stop" we should refresh the status to show it is stopped |
|
|
|
this.refresher = setInterval(() => this.refreshStatus(user.uuid), 5000); |
|
|
|
}, |
|
|
|
stopStatusRefresher () { |
|
|
|
if (this.refresher !== null) { |
|
|
|
clearInterval(this.refresher); |
|
|
|
this.refresher = null; |
|
|
|
} |
|
|
|
}, |
|
|
|
stopNet () { |
|
|
|
this.errors.clear(); |
|
|
|
this.stopNetwork({ |
|
|
@@ -366,13 +378,13 @@ |
|
|
|
this.getAppLinks(user.locale); |
|
|
|
}, |
|
|
|
beforeDestroy () { |
|
|
|
clearInterval(this.refresher); |
|
|
|
stopStatusRefresher(this.refresher); |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
network (net) { |
|
|
|
if (net) { |
|
|
|
if (net.state === 'running' || net.state === 'stopped' || net.state === 'error_stopping' || net.uuid === 'Not Found') { |
|
|
|
clearInterval(this.refresher); |
|
|
|
stopStatusRefresher(this.refresher); |
|
|
|
} |
|
|
|
if (net.uuid === 'Not Found') { |
|
|
|
this.$router.replace({path: '/bubbles'}); |
|
|
@@ -393,10 +405,10 @@ |
|
|
|
} |
|
|
|
if (latestStats !== null) { |
|
|
|
this.stats = latestStats; |
|
|
|
if (this.stats.percent === 100) clearInterval(this.refresher); |
|
|
|
if (this.stats.percent === 100) stopStatusRefresher(this.refresher); |
|
|
|
} else { |
|
|
|
// status not found for our network |
|
|
|
clearInterval(this.refresher); |
|
|
|
stopStatusRefresher(this.refresher); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|