From 5bf579ddc56fa9dbdd550c3812c0c343c43114f3 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 9 Jul 2020 16:07:05 +0200 Subject: [PATCH 1/6] Fix indent --- src/_store/networks.module.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_store/networks.module.js b/src/_store/networks.module.js index a6df403..61b5782 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); -- 2.17.1 From 82d59a511bb23438f59d7c396b3aff4be7f7376e Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 9 Jul 2020 16:07:51 +0200 Subject: [PATCH 2/6] Use additional config flag for restoring in progress --- src/_store/account.module.js | 6 +++++- src/_store/system.module.js | 1 + src/auth/RestorePage.vue | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/_store/account.module.js b/src/_store/account.module.js index 485716e..632558e 100644 --- a/src/_store/account.module.js +++ b/src/_store/account.module.js @@ -114,13 +114,17 @@ const actions = { }, restore({ dispatch, commit }, { shortKey, longKey, password, systemConfigs, messages, errors }) { commit('restoreRequest'); + systemConfigs.restoringInProgress = true; userService.restore(shortKey, longKey, password, messages, errors) .then( ok => { commit('restoreSuccess'); systemConfigs.awaitingRestore = false; }, - error => commit('restoreFailure', error) + error => { + commit('restoreFailure', error); + systemConfigs.restoringInProgress = false; + } ); }, forgotPassword({ commit }, {username, messages, errors}) { diff --git a/src/_store/system.module.js b/src/_store/system.module.js index b8e12f9..d48892d 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, + restoringInProgress: false, support: {}, securityLevels: null }, diff --git a/src/auth/RestorePage.vue b/src/auth/RestorePage.vue index 485a054..b9efe9f 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 }}
-- 2.17.1 From 4e16330ca94567e89534ae0759f0efe8ce2ee98a Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 9 Jul 2020 16:08:21 +0200 Subject: [PATCH 3/6] Fix referencing of this' clearRefresherInterval method --- src/account/NetworkPage.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/account/NetworkPage.vue b/src/account/NetworkPage.vue index 3a03e2b..7e4116a 100644 --- a/src/account/NetworkPage.vue +++ b/src/account/NetworkPage.vue @@ -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); } } -- 2.17.1 From 38af7d4ed0f733e35f8a743a65331984c377d758 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 9 Jul 2020 16:08:48 +0200 Subject: [PATCH 4/6] Reset restore key on network page destroy --- src/_store/networks.module.js | 7 ++++++- src/account/NetworkPage.vue | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/_store/networks.module.js b/src/_store/networks.module.js index 61b5782..98f7664 100644 --- a/src/_store/networks.module.js +++ b/src/_store/networks.module.js @@ -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/account/NetworkPage.vue b/src/account/NetworkPage.vue index 7e4116a..03b0fa8 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) { @@ -341,7 +341,7 @@ beforeDestroy () { this.clearRefresherInterval(this.refresher); this.clearRefresherInterval(this.stopRefresher); - this.restoreKey = null; + this.resetRestoreKey(); }, watch: { network (net) { -- 2.17.1 From 7510215806c4805702188ead32dafce556c26a82 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Fri, 10 Jul 2020 09:43:53 +0200 Subject: [PATCH 5/6] Move code to mutation methods --- src/_store/account.module.js | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/_store/account.module.js b/src/_store/account.module.js index 632558e..677f97f 100644 --- a/src/_store/account.module.js +++ b/src/_store/account.module.js @@ -112,20 +112,11 @@ const actions = { error => commit('logoutFailure', error) ); }, - restore({ dispatch, commit }, { shortKey, longKey, password, systemConfigs, messages, errors }) { - commit('restoreRequest'); - systemConfigs.restoringInProgress = true; + 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); - systemConfigs.restoringInProgress = false; - } - ); + .then(ok => commit('restoreSuccess', systemConfigs), + error => commit('restoreFailure', systemConfigs, error)); }, forgotPassword({ commit }, {username, messages, errors}) { commit('forgotPasswordRequest'); @@ -309,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.restoringInProgress = 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.restoringInProgress = false; console.log('restore failed: ' + JSON.stringify(error)); }, -- 2.17.1 From 9dc962290999b5105549ed0d495152288f0d8281 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Fri, 10 Jul 2020 09:52:07 +0200 Subject: [PATCH 6/6] Rename restoreInProgress flag --- src/_store/account.module.js | 4 ++-- src/_store/system.module.js | 2 +- src/auth/RestorePage.vue | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/_store/account.module.js b/src/_store/account.module.js index 677f97f..1dec598 100644 --- a/src/_store/account.module.js +++ b/src/_store/account.module.js @@ -302,7 +302,7 @@ const mutations = { restoreRequest(state, systemConfigs) { state.status = Object.assign({}, state.status, {restoring: true}); - systemConfigs.restoringInProgress = true; + systemConfigs.restoreInProgress = true; }, restoreSuccess(state, systemConfigs) { state.status = Object.assign({}, state.status, {restoring: false}); @@ -310,7 +310,7 @@ const mutations = { }, restoreFailure(state, systemConfigs, error) { state.status = Object.assign({}, state.status, {restoring: false}); - systemConfigs.restoringInProgress = false; + systemConfigs.restoreInProgress = false; console.log('restore failed: ' + JSON.stringify(error)); }, diff --git a/src/_store/system.module.js b/src/_store/system.module.js index e3a5fef..61bd092 100644 --- a/src/_store/system.module.js +++ b/src/_store/system.module.js @@ -22,7 +22,7 @@ const state = { promoCodePolicy: null, requireSendMetrics: null, awaitingRestore: false, - restoringInProgress: false, + restoreInProgress: false, support: {}, securityLevels: null, jarVersion: null, diff --git a/src/auth/RestorePage.vue b/src/auth/RestorePage.vue index b9efe9f..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 }}
-- 2.17.1