瀏覽代碼

improve net stop

pull/13/head
Jonathan Cobb 4 年之前
父節點
當前提交
5ece6028d5
共有 2 個檔案被更改,包括 18 行新增13 行删除
  1. +5
    -2
      src/_store/networks.module.js
  2. +13
    -11
      src/account/NetworkPage.vue

+ 5
- 2
src/_store/networks.module.js 查看文件

@@ -90,7 +90,7 @@ const actions = {
commit('stopNetworkRequest', networkId);
networkService.stopNetwork(userId, networkId, messages, errors)
.then(
network => commit('stopNetworkSuccess', network),
ok => commit('stopNetworkSuccess', {networkId, ok}),
error => commit('stopNetworkFailure', { networkId, error: error.toString() })
);
},
@@ -204,8 +204,11 @@ const mutations = {
stopNetworkRequest(state, id) {
state.loading.stopping = true;
},
stopNetworkSuccess(state, id) {
stopNetworkSuccess(state, { networkId, ok }) {
state.loading.stopping = false;
if (state.network && state.network.uuid && state.network.uuid === networkId) {
state.network.state = 'stopping';
}
},
stopNetworkFailure(state, { id, error }) {
state.loading.stopping = false;


+ 13
- 11
src/account/NetworkPage.vue 查看文件

@@ -168,20 +168,22 @@
this.refresher = setInterval(() => this.refreshStatus(user.uuid), 5000);
},
stopNet () {
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
});
if (this.networkUuid === null) {
alert(this.messages.network_action_stop_not_ready);
} else {
if (confirm(this.messages.confirmation_network_action_stop)) {
this.errors.clear();
this.stopNetwork({
userId: this.user.uuid,
networkId: this.networkUuid,
messages: this.messages,
errors: this.errors
});
}
}
},
deleteNet () {
const vue = this;
if (confirm(vue.messages.confirmation_network_action_delete)) {
if (confirm(this.messages.confirmation_network_action_delete)) {
this.errors.clear();
this.deleteNetwork({
userId: this.user.uuid,


Loading…
取消
儲存