diff --git a/src/_store/networks.module.js b/src/_store/networks.module.js index 0a9d91a..dc83766 100644 --- a/src/_store/networks.module.js +++ b/src/_store/networks.module.js @@ -20,7 +20,7 @@ const state = { newNodeNotification: null, networkStatuses: [], networkNodes: null, - deletedNetwork: null, + deletedNetworkUuid: null, networkKeysRequested: null, networkKeys: null }; @@ -99,7 +99,7 @@ const actions = { commit('deleteNetworkRequest', networkId); networkService.deleteNetwork(userId, networkId, messages, errors) .then( - network => commit('deleteNetworkSuccess', network), + plan => commit('deleteNetworkSuccess', plan), error => commit('deleteNetworkFailure', { networkId, error: error.toString() }) ); }, @@ -215,13 +215,14 @@ const mutations = { deleteNetworkRequest(state, id) { state.loading.deleting = true; }, - deleteNetworkSuccess(state, deletedNet) { + deleteNetworkSuccess(state, deletedPlan) { state.loading.deleting = false; + const deletedNet = deletedPlan.deletedNetwork; // remove deleted network from state if (state.networks) { - state.networks = state.networks.filter(network => (network.uuid !== deletedNet.uuid && network.name !== deletedNet.name)) + state.networks = state.networks.filter(network => network.uuid !== deletedNet) } - state.deletedNetwork = deletedNet; + state.deletedNetworkUuid = deletedNet; }, deleteNetworkFailure(state, { net, error }) { state.loading.deleting = false; diff --git a/src/account/NetworkPage.vue b/src/account/NetworkPage.vue index 8091810..d463c51 100644 --- a/src/account/NetworkPage.vue +++ b/src/account/NetworkPage.vue @@ -40,36 +40,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{messages.link_network_action_stop_description}}
-

-
+
{{messages.link_network_action_delete_description}}
@@ -143,6 +111,7 @@ return { user: util.currentUser(), networkId: this.$route.params.id, + networkUuid: null, stats: null, refresher: null, restoreKeyCode: null, @@ -153,7 +122,7 @@ computed: { ...mapState('networks', [ 'network', 'newNodeNotification', 'networkStatuses', 'networkNodes', 'networkKeysRequested', - 'deletedNetwork', 'networkKeys', 'loading' + 'deletedNetworkUuid', 'networkKeys', 'loading' ]), ...mapState('system', ['messages', 'configs', 'appLinks']), showSetupHelp () { @@ -199,22 +168,28 @@ this.refresher = setInterval(() => this.refreshStatus(user.uuid), 5000); }, stopNet () { - this.errors.clear(); - this.stopNetwork({ - userId: this.user.uuid, - networkId: this.networkId, - messages: this.messages, - errors: this.errors - }); + const vue = this; + if (confirm(vue.messages.confirmation_network_action_stop)) { + this.errors.clear(); + this.stopNetwork({ + userId: this.user.uuid, + networkId: this.networkId, + messages: this.messages, + errors: this.errors + }); + } }, deleteNet () { - this.errors.clear(); - this.deleteNetwork({ - userId: this.user.uuid, - networkId: this.networkId, - messages: this.messages, - errors: this.errors - }); + const vue = this; + if (confirm(vue.messages.confirmation_network_action_delete)) { + this.errors.clear(); + this.deleteNetwork({ + userId: this.user.uuid, + networkId: this.networkId, + messages: this.messages, + errors: this.errors + }); + } }, requestRestoreKey () { this.errors.clear(); @@ -256,6 +231,7 @@ if (net.uuid === 'Not Found') { this.$router.replace({path: '/bubbles'}); } + this.networkUuid = net.uuid; } }, networkNodes (nodes) { @@ -276,8 +252,8 @@ clearInterval(this.refresher); } }, - deletedNetwork (network) { - if (network && (network.name === this.networkId || network.uuid === this.networkId)) { + deletedNetworkUuid (uuid) { + if (uuid && this.networkUuid && (uuid === this.networkUuid)) { this.$router.replace({path: '/bubbles'}); } } diff --git a/src/app/App.vue b/src/app/App.vue index 78ca0cc..d4030e2 100644 --- a/src/app/App.vue +++ b/src/app/App.vue @@ -3,7 +3,7 @@
- +

{{messages.label_menu_dashboard}}