diff --git a/src/_store/account.module.js b/src/_store/account.module.js index 485716e..1dec598 100644 --- a/src/_store/account.module.js +++ b/src/_store/account.module.js @@ -112,16 +112,11 @@ const actions = { error => commit('logoutFailure', error) ); }, - restore({ dispatch, commit }, { shortKey, longKey, password, systemConfigs, messages, errors }) { - commit('restoreRequest'); + restore({ commit }, { shortKey, longKey, password, systemConfigs, messages, errors }) { + commit('restoreRequest', systemConfigs); userService.restore(shortKey, longKey, password, messages, errors) - .then( - ok => { - commit('restoreSuccess'); - systemConfigs.awaitingRestore = false; - }, - error => commit('restoreFailure', error) - ); + .then(ok => commit('restoreSuccess', systemConfigs), + error => commit('restoreFailure', systemConfigs, error)); }, forgotPassword({ commit }, {username, messages, errors}) { commit('forgotPasswordRequest'); @@ -305,14 +300,17 @@ const mutations = { console.log('logout failed: '+JSON.stringify(error)); }, - restoreRequest(state) { + restoreRequest(state, systemConfigs) { state.status = Object.assign({}, state.status, {restoring: true}); + systemConfigs.restoreInProgress = true; }, - restoreSuccess(state) { + restoreSuccess(state, systemConfigs) { state.status = Object.assign({}, state.status, {restoring: false}); + systemConfigs.awaitingRestore = false; }, - restoreFailure(state, error) { + restoreFailure(state, systemConfigs, error) { state.status = Object.assign({}, state.status, {restoring: false}); + systemConfigs.restoreInProgress = false; console.log('restore failed: ' + JSON.stringify(error)); }, diff --git a/src/_store/networks.module.js b/src/_store/networks.module.js index a6df403..98f7664 100644 --- a/src/_store/networks.module.js +++ b/src/_store/networks.module.js @@ -110,7 +110,7 @@ const actions = { .then(r => dispatch('getBackups', { userId: userId, networkId: networkId, messages: messages, errors: errors })); -}, + }, restoreNetwork({ commit }, { userId, networkId, messages, errors }) { commit('restoreNetworkRequest', networkId); @@ -155,7 +155,9 @@ const actions = { keys => commit('retrieveNetworkKeysSuccess', keys), error => commit('retrieveNetworkKeysFailure', error) ); - } + }, + + resetRestoreKey({ commit }) { commit('resetRestoreKey'); } }; const mutations = { @@ -265,6 +267,9 @@ const mutations = { state.loading.restoring = false; state.error = error; }, + resetRestoreKey(state) { + state.restoreKey = null; + }, deleteNetworkRequest(state, id) { state.loading.deleting = true; diff --git a/src/_store/system.module.js b/src/_store/system.module.js index 874607b..61bd092 100644 --- a/src/_store/system.module.js +++ b/src/_store/system.module.js @@ -22,6 +22,7 @@ const state = { promoCodePolicy: null, requireSendMetrics: null, awaitingRestore: false, + restoreInProgress: false, support: {}, securityLevels: null, jarVersion: null, diff --git a/src/account/NetworkPage.vue b/src/account/NetworkPage.vue index e0b2e66..22d7d4a 100644 --- a/src/account/NetworkPage.vue +++ b/src/account/NetworkPage.vue @@ -226,7 +226,7 @@ ...mapActions('networks', [ 'getNetworkById', 'deleteNetwork', 'getStatusesByNetworkId', 'getNodesByNetworkId', 'stopNetwork', 'queueBackup', 'restoreNetwork', 'deleteNetwork', 'requestNetworkKeys', - 'retrieveNetworkKeys', 'getBackups' + 'retrieveNetworkKeys', 'getBackups', 'resetRestoreKey' ]), ...mapActions('system', ['getAppLinks']), refreshStatus (userId) { @@ -276,7 +276,7 @@ messages: this.messages, errors: this.errors }); - clearRefresherInterval(this.refresher); + this.clearRefresherInterval(this.refresher); this.stopRefresher = setInterval(() => this.stopRefreshStatus(this.user.uuid), 5000); } } @@ -341,7 +341,7 @@ beforeDestroy () { this.clearRefresherInterval(this.refresher); this.clearRefresherInterval(this.stopRefresher); - this.restoreKey = null; + this.resetRestoreKey(); }, watch: { network (net) { diff --git a/src/auth/RestorePage.vue b/src/auth/RestorePage.vue index 485a054..038baa0 100644 --- a/src/auth/RestorePage.vue +++ b/src/auth/RestorePage.vue @@ -5,7 +5,7 @@
-
+
{{ messages.message_restore_not_applicable }}
{{ messages.message_back_to_root }}