You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by mi...@apache.org on 2019/01/28 06:41:26 UTC
[incubator-dubbo-ops] branch service-test updated: handle service
test error
This is an automated email from the ASF dual-hosted git repository.
min pushed a commit to branch service-test
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.git
The following commit(s) were added to refs/heads/service-test by this push:
new cd3a227 handle service test error
cd3a227 is described below
commit cd3a22725951fca35775aad02d6ee9caab29b2f3
Author: nzomkxia <z8...@gmail.com>
AuthorDate: Mon Jan 28 14:41:39 2019 +0800
handle service test error
---
.../admin/controller/ServiceTestController.java | 6 ++++-
.../src/components/test/TestMethod.vue | 29 ++++++++++++++++------
dubbo-admin-frontend/src/lang/en.js | 6 ++++-
dubbo-admin-frontend/src/lang/zh.js | 6 ++++-
4 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/ServiceTestController.java b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/ServiceTestController.java
index a07299d..47921ed 100644
--- a/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/ServiceTestController.java
+++ b/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/ServiceTestController.java
@@ -34,7 +34,11 @@ public class ServiceTestController {
@RequestMapping(method = RequestMethod.POST)
public Object test(@PathVariable String env, @RequestBody ServiceTestDTO serviceTestDTO) {
- return genericService.invoke(serviceTestDTO.getService(), serviceTestDTO.getMethod(), serviceTestDTO.getParameterTypes(), serviceTestDTO.getParams());
+ try {
+ return genericService.invoke(serviceTestDTO.getService(), serviceTestDTO.getMethod(), serviceTestDTO.getParameterTypes(), serviceTestDTO.getParams());
+ } catch (Exception e) {
+ throw e;
+ }
}
@RequestMapping(value = "/method", method = RequestMethod.GET)
diff --git a/dubbo-admin-frontend/src/components/test/TestMethod.vue b/dubbo-admin-frontend/src/components/test/TestMethod.vue
index 0d1d589..68cd252 100644
--- a/dubbo-admin-frontend/src/components/test/TestMethod.vue
+++ b/dubbo-admin-frontend/src/components/test/TestMethod.vue
@@ -29,13 +29,16 @@
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
- <v-btn id="execute" mt-0 color="primary" @click="executeMethod()">EXECUTE</v-btn>
+ <v-btn id="execute" mt-0 color="primary" @click="executeMethod()">{{$t('execute')}}</v-btn>
</v-card-actions>
</v-card>
</v-flex>
<v-flex class="test-result" lg12 xl6>
<v-card>
- <v-card-title class="headline">Result</v-card-title>
+ <v-card-title class="headline">{{$t('result') }}
+ <span class="green--text" v-if="success===true">{{ $t('success')}}</span>
+ <span class="red--text" v-if="success===false">{{ $t('fail')}}</span>
+ </v-card-title>
<v-card-text>
<json-editor v-model="result" name="Result" readonly></json-editor>
</v-card-text>
@@ -48,15 +51,19 @@
<script>
import JsonEditor from '@/components/public/JsonEditor'
import Breadcrumb from '@/components/public/Breadcrumb'
+ import axios from 'axios'
export default {
name: 'TestMethod',
components: {
JsonEditor,
- Breadcrumb
+ Breadcrumb,
+ axios
},
data () {
return {
+ baseURL: '/api/dev',
+ success: null,
breads: [
{
text: 'serviceSearch',
@@ -87,11 +94,17 @@
parameterTypes: this.method.parameterTypes,
params: this.method.json
}
- this.$axios.post('/test', serviceTestDTO).then(response => {
- if (response.status === 200) {
- this.result = response.data
- }
- })
+ axios.post(this.baseURL + '/test', serviceTestDTO)
+ .then(response => {
+ if (response && response.status === 200) {
+ this.success = true
+ this.result = response.data
+ }
+ })
+ .catch(error => {
+ this.success = false
+ this.result = error.response.data
+ })
}
},
mounted () {
diff --git a/dubbo-admin-frontend/src/lang/en.js b/dubbo-admin-frontend/src/lang/en.js
index 364dae8..74a0aa7 100644
--- a/dubbo-admin-frontend/src/lang/en.js
+++ b/dubbo-admin-frontend/src/lang/en.js
@@ -124,5 +124,9 @@ export default {
warnDeleteConfig: ' Are you sure to Delete Dubbo Config: ',
configNameHint: "Application name the config belongs to, use 'global'(without quotes) for global config",
configContent: 'Config Content',
- testMethod: 'Test Method'
+ testMethod: 'Test Method',
+ execute: 'EXECUTE',
+ result: 'Result: ',
+ success: 'SUCCESS',
+ fail: 'FAIL'
}
diff --git a/dubbo-admin-frontend/src/lang/zh.js b/dubbo-admin-frontend/src/lang/zh.js
index 26332ec..2ade04b 100644
--- a/dubbo-admin-frontend/src/lang/zh.js
+++ b/dubbo-admin-frontend/src/lang/zh.js
@@ -124,5 +124,9 @@ export default {
warnDeleteConfig: ' 是否要删除Dubbo配置: ',
configNameHint: '配置所属的应用名, global 表示全局配置',
configContent: '配置内容',
- testMethod: '测试方法'
+ testMethod: '测试方法',
+ execute: '执行',
+ result: '结果: ',
+ success: ' 成功',
+ fail: '失败'
}