diff --git a/src/app/rule/Dns.vue b/src/app/rule/Dns.vue index f3f492a0de92323a45f75002a99157d923838424..49bc3c42ddf30eef01ea664f72a91eb141352bb7 100644 --- a/src/app/rule/Dns.vue +++ b/src/app/rule/Dns.vue @@ -293,10 +293,10 @@ export default { data.appDnsRule = data.appDnsRule.filter(rule => rule.dnsRuleId !== this.dnsRule.dnsRuleId) } data.appDnsRule.push(this.dnsRule) - appRuleMgr.addConfigRules(this.type, sessionStorage.getItem('instanceId'), data).then(res => { - if (res.data) { + appRuleMgr.addConfigRules(this.type, sessionStorage.getItem('instanceId'), data).then(result => { + if (result.data) { this.appRule.appDnsRule.push(this.dnsRule) - this.handleResponse(res) + this.handleResponse(result) this.loading = true this.timer = setTimeout(() => { this.getAppRules() }, 3000) } diff --git a/src/app/rule/Traffic.vue b/src/app/rule/Traffic.vue index ead58556bd862aac7f68e103f4342bb8e1b8498f..414130f14a1688917442c9b50cb131f167215f75 100644 --- a/src/app/rule/Traffic.vue +++ b/src/app/rule/Traffic.vue @@ -182,20 +182,7 @@ export default { appRuleMgr.getConfigRules(sessionStorage.getItem('instanceId')).then(res => { if (res.data) { this.appName = res.data.appName - res.data.appTrafficRule.forEach(val => { - val.trafficFilter.forEach(item => { - item.srcAddress = this.changeAToS(item.srcAddress) - item.srcPort = this.changeAToS(item.srcPort) - item.dstAddress = this.changeAToS(item.dstAddress) - item.dstPort = this.changeAToS(item.dstPort) - item.protocol = this.changeAToS(item.protocol) - item.srcTunnelAddress = this.changeAToS(item.srcTunnelAddress) - item.dstTunnelAddress = this.changeAToS(item.dstTunnelAddress) - item.srcTunnelPort = this.changeAToS(item.srcTunnelPort) - item.dstTunnelPort = this.changeAToS(item.dstTunnelPort) - item.tag = this.changeAToS(item.tag) - }) - }) + this.changeTrafficDataType(res.data.appTrafficRule) this.trafficRuleTableData = res.data.appTrafficRule } }) @@ -276,25 +263,28 @@ export default { }, reloadTableData () { this.getAppRules() + }, + changeTrafficDataType (trafficArr) { + trafficArr.forEach(val => { + val.trafficFilter.forEach(item => { + item.srcAddress = this.changeAToS(item.srcAddress) + item.srcPort = this.changeAToS(item.srcPort) + item.dstAddress = this.changeAToS(item.dstAddress) + item.dstPort = this.changeAToS(item.dstPort) + item.protocol = this.changeAToS(item.protocol) + item.srcTunnelAddress = this.changeAToS(item.srcTunnelAddress) + item.dstTunnelAddress = this.changeAToS(item.dstTunnelAddress) + item.srcTunnelPort = this.changeAToS(item.srcTunnelPort) + item.dstTunnelPort = this.changeAToS(item.dstTunnelPort) + item.tag = this.changeAToS(item.tag) + }) + }) } }, mounted () { this.appName = this.appRule.appName let _tempData = JSON.parse(JSON.stringify(this.appRule.appTrafficRule)) - _tempData.forEach(val => { - val.trafficFilter.forEach(item => { - item.srcAddress = this.changeAToS(item.srcAddress) - item.srcPort = this.changeAToS(item.srcPort) - item.dstAddress = this.changeAToS(item.dstAddress) - item.dstPort = this.changeAToS(item.dstPort) - item.protocol = this.changeAToS(item.protocol) - item.srcTunnelAddress = this.changeAToS(item.srcTunnelAddress) - item.dstTunnelAddress = this.changeAToS(item.dstTunnelAddress) - item.srcTunnelPort = this.changeAToS(item.srcTunnelPort) - item.dstTunnelPort = this.changeAToS(item.dstTunnelPort) - item.tag = this.changeAToS(item.tag) - }) - }) + this.changeTrafficDataType(_tempData) this.trafficRuleTableData = _tempData }, beforeDestroy () { diff --git a/src/locales/cn.js b/src/locales/cn.js index 66b1c2f5579e737a9a1fb32195da839320b5309c..fa0d343957a1011e5d2d3ae38dbb2cd103246bde 100644 --- a/src/locales/cn.js +++ b/src/locales/cn.js @@ -820,6 +820,11 @@ const cn = { pauseSuccess: '实例暂停成功', pauseFail: '实例暂停失败', operatorSuccess: '操作成功', + resumeSuccess: '恢复实例成功', + suspendSuccess: '挂起实例成功', + unpauseSuccess: '取消暂停实例成功', + stopSuccess: '实例关闭成功', + startSuccess: '实例重建成功', operatorFail: '操作失败', hardRebootVM: '硬重启实例', softRebootVM: '软重启实例', diff --git a/src/locales/en.js b/src/locales/en.js index 6b7296e7b454c730730ee9bce687f0fc77aa02aa..8a13f2e82e3c25641c45d58b0dde8f5e1c28751e 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -821,6 +821,11 @@ const en = { pauseSuccess: 'The instance was suspended successfully', pauseFail: 'Failed to suspend instance', operatorSuccess: 'Successful operation', + resumeSuccess: 'The instance is resumed successfully', + suspendSuccess: 'The instance is suspended successfully', + unpauseSuccess: 'The instance is unpaused successfully', + stopSuccess: 'The instance is stoped successfully', + startSuccess: 'The instance is started successfully', operatorFail: 'Failed operation', hardRebootVM: 'Hard reboot the instance', softRebootVM: 'Soft reboot instance', diff --git a/src/resource/manager/VMManager.vue b/src/resource/manager/VMManager.vue index 3b4e34c65efab5c1f9f6b0ac7a0b3e0c57a9ac16..db8f8e549e540b9888340b1388f3af2e42827713 100644 --- a/src/resource/manager/VMManager.vue +++ b/src/resource/manager/VMManager.vue @@ -363,9 +363,7 @@ export default { } resController.operateVM(_hostIp, row.id, _param).then(res => { this.$message.success(this.$t('resourceMgr.pauseSuccess')) - setTimeout(() => { - this.getTableData() - }, 5000) + this.lazyLoadingTableData() }).catch(() => { this.$message.error(this.$t('resourceMgr.pauseFail')) }) @@ -376,10 +374,8 @@ export default { action: 'unpause' } resController.operateVM(_hostIp, row.id, _param).then(res => { - this.$message.success(this.$t('resourceMgr.operatorSuccess')) - setTimeout(() => { - this.getTableData() - }, 5000) + this.$message.success(this.$t('resourceMgr.unpauseSuccess')) + this.lazyLoadingTableData() }).catch(() => { this.$message.error(this.$t('resourceMgr.operatorFail')) }) @@ -390,10 +386,8 @@ export default { action: 'suspend' } resController.operateVM(_hostIp, row.id, _param).then(res => { - this.$message.success(this.$t('resourceMgr.operatorSuccess')) - setTimeout(() => { - this.getTableData() - }, 5000) + this.$message.success(this.$t('resourceMgr.suspendSuccess')) + this.lazyLoadingTableData() }).catch(() => { this.$message.error(this.$t('resourceMgr.operatorFail')) }) @@ -404,10 +398,8 @@ export default { action: 'resume' } resController.operateVM(_hostIp, row.id, _param).then(res => { - this.$message.success(this.$t('resourceMgr.operatorSuccess')) - setTimeout(() => { - this.getTableData() - }, 5000) + this.$message.success(this.$t('resourceMgr.resumeSuccess')) + this.lazyLoadingTableData() }).catch(() => { this.$message.error(this.$t('resourceMgr.operatorFail')) }) @@ -418,10 +410,8 @@ export default { action: 'stop' } resController.operateVM(_hostIp, row.id, _param).then(res => { - this.$message.success(this.$t('resourceMgr.operatorSuccess')) - setTimeout(() => { - this.getTableData() - }, 5000) + this.$message.success(this.$t('resourceMgr.stopSuccess')) + this.lazyLoadingTableData() }).catch(() => { this.$message.error(this.$t('resourceMgr.operatorFail')) }) @@ -432,10 +422,8 @@ export default { action: 'start' } resController.operateVM(_hostIp, row.id, _param).then(res => { - this.$message.success(this.$t('resourceMgr.operatorSuccess')) - setTimeout(() => { - this.getTableData() - }, 5000) + this.$message.success(this.$t('resourceMgr.startSuccess')) + this.lazyLoadingTableData() }).catch(() => { this.$message.error(this.$t('resourceMgr.operatorFail')) }) @@ -451,6 +439,11 @@ export default { console.log('open control error:' + error) }) }, + lazyLoadingTableData () { + setTimeout(() => { + this.getTableData() + }, 5000) + }, filterTableData (val, key) { let _hostIp = sessionStorage.getItem('hostIp') this.dataLoading = true