Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: navigation between services and tests. Fixes #285 #286

Merged
merged 2 commits into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions dubbo-admin-ui/src/components/ServiceSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@
<td>{{props.item.version}}</td>
<td>{{props.item.appName}}</td>
<td class="text-xs-center px-0" nowrap>
<v-btn
small
color='primary'
@click="toTestService(props.item)"
>
{{$t('test')}}
</v-btn>
<v-btn
small
color='primary'
Expand Down Expand Up @@ -276,6 +283,10 @@
this.$router.push({path: 'service', query: {filter: filter, pattern: pattern}})
}
})
},
toTestService (item) {
const service = item.service
this.$router.push(`/test/?service=${service}`)
}
},
mounted: function () {
Expand Down
58 changes: 53 additions & 5 deletions dubbo-admin-ui/src/components/test/ServiceTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,24 @@
<breadcrumb title="serviceTest" :items="breads"></breadcrumb>
</v-flex>
<v-flex xs12>
<search v-model="filter" label="Search by service name" :submit="search"></search>
<v-autocomplete
flat
hide-no-data
v-model="service"
:loading="loading"
:search-input.sync="filter"
:hint="$t('testModule.searchServiceHint')"
:items="services"
item-value="service"
item-text="service"
:label="$t('placeholders.searchService')"
persistent-hint
@keyup.enter="search"
clearable
></v-autocomplete>
</v-flex>
<v-flex xs12>
<h3>Methods</h3>
<h3>{{$t('methods')}}</h3>
</v-flex>
<v-flex xs12>
<v-data-table :headers="headers" :items="methods" hide-actions class="elevation-1">
Expand All @@ -40,7 +54,7 @@
>
<v-icon>edit</v-icon>
</v-btn>
<span>Try it</span>
<span>{{$t('test')}}</span>
</v-tooltip>
</td>
</template>
Expand Down Expand Up @@ -68,13 +82,16 @@
breads: [
{
text: 'serviceSearch',
href: ''
href: '/test'
}
],
headers: [
],
service: null,
methods: []
methods: [],
services: [],
searchKey: this.$route.query['service'] || '*',
loading: false
}
},
methods: {
Expand Down Expand Up @@ -138,6 +155,26 @@
this.showSnackbar('error', error.response.data.message)
})
},
searchServices () {
let filter = this.filter || ''
if (!filter.startsWith('*')) {
filter = '*' + filter
}
if (!filter.endsWith('*')) {
filter += '*'
}
const pattern = 'service'
this.loading = true
this.$axios.get('/service', {
params: {
pattern, filter
}
}).then(response => {
this.services = response.data
}).finally(() => {
this.loading = false
})
},
getHref (application, service, method) {
return `/#/testMethod?application=${application}&service=${service}&method=${method}`
}
Expand All @@ -150,10 +187,21 @@
watch: {
area () {
this.setHeaders()
},
filter () {
this.searchServices()
},
searchKey () {
this.search()
}
},
created () {
this.search()
}
}
</script>
<style>
.v-breadcrumbs {
padding-left: 0;
}
</style>
10 changes: 9 additions & 1 deletion dubbo-admin-ui/src/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,13 @@ export default {
success: 'SUCCESS',
fail: 'FAIL',
detail: 'Detail',
more: 'More'
more: 'More',
test: 'Test',
placeholders: {
searchService: 'Search by service name'
},
methods: 'Methods',
testModule: {
searchServiceHint: 'Service ID, org.apache.dubbo.demo.api.DemoService, * for fuzzy search, press Enter to search'
}
}
10 changes: 9 additions & 1 deletion dubbo-admin-ui/src/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,13 @@ export default {
success: ' 成功',
fail: '失败',
detail: '详情',
more: '更多'
more: '更多',
test: '测试',
placeholders: {
searchService: '通过服务名搜索服务'
},
methods: '方法列表',
testModule: {
searchServiceHint: '服务ID, org.apache.dubbo.demo.api.DemoService, 使用 * 进行模糊查找, 按回车键查询'
}
}