소스 검색

Load backups only when needed for netwrok in restoring state

pull/8/head
Kristijan Mitrovic 4 년 전
부모
커밋
19d15a9528
2개의 변경된 파일18개의 추가작업 그리고 13개의 파일을 삭제
  1. +1
    -8
      src/_store/networks.module.js
  2. +17
    -5
      src/account/NetworkPage.vue

+ 1
- 8
src/_store/networks.module.js 파일 보기

@@ -48,14 +48,7 @@ const actions = {
commit('getNetworkByIdRequest');
networkService.getNetworkById(userId, networkId, messages, errors)
.then(network => commit('getNetworkByIdSuccess', network),
error => commit('getNetworkByIdFailure', error))
.then(() => {
if (state.network.state != 'starting' || state.backups === null) {
dispatch('getBackups',
{ userId: userId, networkId: networkId,
messages: messages, errors: errors });
}
});
error => commit('getNetworkByIdFailure', error));
},

addPlanAndStartNetwork({ commit }, {userId, accountPlan, cloud, region, messages, errors}) {


+ 17
- 5
src/account/NetworkPage.vue 파일 보기

@@ -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);
}
}
},


불러오는 중...
취소
저장