@@ -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)); | |||
}, | |||
@@ -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; | |||
@@ -22,6 +22,7 @@ const state = { | |||
promoCodePolicy: null, | |||
requireSendMetrics: null, | |||
awaitingRestore: false, | |||
restoreInProgress: false, | |||
support: {}, | |||
securityLevels: null, | |||
jarVersion: null, | |||
@@ -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) { | |||
@@ -5,7 +5,7 @@ | |||
<div v-if="!configs"><img :src="loadingImgSrc" /></div> | |||
<div v-else-if="!configs.awaitingRestore" class="alert alert-info"> | |||
<div v-else-if="configs.restoreInProgress" class="alert alert-info"> | |||
{{ messages.message_restore_not_applicable }}<hr/> | |||
<a href="/">{{ messages.message_back_to_root }}</a> | |||
</div> | |||