提交 177eee1e 编写于 作者: M min 提交者: Ian Luo

search style change & routing rule page (#95)

* add restController

* controller

* add adminLTE

* update

* add routing rule page

* reconstruction

* update readme and configuration

* change file name to satisfy travis ci

* change title to dubbo ops

* relocation restful controller

* remove author & add license

* import specific class instead of *

* add ASF License & change theme

* change model name & serviceDetail page

* change search style & update routing rule page

* update

* add routing rule page

* update readme and configuration

* change model name & serviceDetail page

* search style change & routing rule page

* delete useless file
上级 99938ac9
...@@ -29,6 +29,7 @@ import org.apache.dubbo.admin.registry.common.route.ParseUtils; ...@@ -29,6 +29,7 @@ import org.apache.dubbo.admin.registry.common.route.ParseUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.18.0", "axios": "^0.18.0",
"codemirror": "^5.39.2",
"vue": "^2.5.2", "vue": "^2.5.2",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
"vuetify": "^1.0.0", "vuetify": "^1.0.0",
......
...@@ -17,59 +17,75 @@ ...@@ -17,59 +17,75 @@
<template> <template>
<v-container grid-list-xl fluid > <v-container grid-list-xl fluid >
<!--<v-layout row wrap>--> <div>
<v-layout row wrap> <v-layout row wrap>
<!--<v-layout row>--> <v-flex xs12 class="justify-space-between">
<v-flex lg10 sm12 xs12> <v-form>
<v-text-field <v-layout row wrap>
flat <v-flex xs11>
v-model="filter" <v-text-field label="Search dubbo service"
/> v-model="filter"></v-text-field>
</v-flex> </v-flex>
<v-flex lg1 sm6 xs6
class="pl-0 ml-0 pr-0 mr-0" <v-flex xs1>
> <v-btn @click="submit" color="primary" >Search</v-btn>
<v-select </v-flex>
:items="dropdown_font" </v-layout>
v-model="pattern" </v-form>
></v-select> </v-flex>
</v-flex> </v-layout>
<v-flex lg1 xm6 xs6 <v-toolbar flat color="white">
class="pb-0 mb-0 pl-0 ml-0 mt-2" <v-toolbar-title>Search Result</v-toolbar-title>
> <v-spacer></v-spacer>
<v-btn <v-btn outline color="primary" @click.stop="dialog = true" class="mb-2">CREATE</v-btn>
@click="search(filter, pattern, true)" </v-toolbar>
color="primary">
search
</v-btn>
</v-flex>
</v-layout>
<v-layout justify-space-between row>
<v-flex lg10>
<h3>Search Result</h3>
</v-flex>
<v-flex xs2>
<v-btn @click.stop="dialog = true">create Rule</v-btn>
</v-flex>
</v-layout>
<v-flex lg12>
<v-data-table <v-data-table
class="elevation-1"
:headers="headers" :headers="headers"
:items="result" :items="routingRules"
hide-actions
class="elevation-1"
> >
<template slot="items" slot-scope="props"> <template slot="items" slot-scope="props">
<td>{{props.item.service}}</td> <td>{{ props.item.rule }}</td>
<td>{{props.item.group}}</td> <td class="text-xs-left">{{ props.item.service }}</td>
<td>{{props.item.application}}</td> <td class="text-xs-left">{{ props.item.priority }}</td>
<td>Details</td> <td class="text-xs-left">{{ props.item.status }}</td>
<td class="justify-center px-0">
<v-icon
small
class="mr-2"
@click="deleteItem(props.item)"
>
visibility
</v-icon>
<v-icon
small
class="mr-2"
@click="editItem(props.item)"
>
edit
</v-icon>
<v-icon
small
class="mr-2"
@click="editItem(props.item)"
>
block
</v-icon>
<v-icon
small
@click="deleteItem(props.item)"
>
delete
</v-icon>
</td>
</template> </template>
</v-data-table> </v-data-table>
</v-flex> </div>
<v-dialog v-model="dialog" width="450px" persistent > <v-dialog v-model="dialog" width="450px" persistent >
<v-card> <v-card>
<v-card-title class="justify-center"> <v-card-title class="justify-center">
<span class="headline">Creat new Routing rule</span> <span class="headline">Create new Routing rule</span>
</v-card-title> </v-card-title>
<v-card-text > <v-card-text >
<v-textarea <v-textarea
...@@ -92,34 +108,21 @@ ...@@ -92,34 +108,21 @@
</template> </template>
<script> <script>
export default { export default {
props: {
result: {
type: Array,
default: () => [
{
service: 'com.alibaba.dubbo.com',
group: 'dubbo',
application: 'demo-provider'
},
{
service: 'com.alibaba.sample',
group: 'dubbo',
application: 'demo-provider'
},
{
service: 'com.taobao.core.engine',
group: 'dubbo',
application: 'demo-provider'
}
]
}
},
data: () => ({ data: () => ({
dropdown_font: [ 'Service', 'App', 'IP' ], dropdown_font: [ 'Service', 'App', 'IP' ],
pattern: 'Service', pattern: 'Service',
filter: '', filter: '',
dialog: false, dialog: false,
selected: [],
routingRules: [
{
id: 0,
rule: 'test',
service: 'com.alibaba.dubbo.com',
priority: 0,
status: 'enabled'
}
],
placeholder: 'dataId: serviceKey + CONFIGURATORS\n' + placeholder: 'dataId: serviceKey + CONFIGURATORS\n' +
'\n' + '\n' +
'%yaml 1.2\n' + '%yaml 1.2\n' +
...@@ -161,18 +164,23 @@ ...@@ -161,18 +164,23 @@
'...\n', '...\n',
headers: [ headers: [
{ {
text: 'Service', text: 'Rule Name',
value: 'rule',
class: 'font-weight-black'
},
{
text: 'Service Name',
value: 'service', value: 'service',
class: 'font-weight-black' class: 'font-weight-black'
}, },
{ {
text: 'Group', text: 'Priority',
value: 'group', value: 'priority',
class: 'font-weight-black' class: 'font-weight-black'
}, },
{ {
text: 'Application', text: 'Status',
value: 'application', value: 'status',
class: 'font-weight-black' class: 'font-weight-black'
}, },
{ {
...@@ -183,8 +191,18 @@ ...@@ -183,8 +191,18 @@
] ]
}), }),
methods: { methods: {
click: function () { submit () {
console.log('aaa') console.log('submit')
},
toggleAll () {
if (this.selected.length) this.selected = []
else this.selected = this.routingRules.slice()
},
enable: function (status) {
if (status === 'enabled') {
return 'disable'
}
return 'enable'
}, },
setHeight: function () { setHeight: function () {
this.height = window.innerHeight * 0.65 this.height = window.innerHeight * 0.65
...@@ -197,3 +215,9 @@ ...@@ -197,3 +215,9 @@
} }
</script> </script>
<style scoped>
div.btn__content {
padding: 0;
}
</style>
...@@ -106,30 +106,6 @@ ...@@ -106,30 +106,6 @@
import {AXIOS} from './http-common' import {AXIOS} from './http-common'
export default { export default {
props: {
metadata: {
type: Array,
default: () =>
[
{
method: 'toString',
parameter: 'java.lang.String',
returnType: 'void'
},
{
method: 'queryBatch',
parameter: 'com.taobao.tc.domain.query.QueryBizOrderDO',
returnType: 'com.taobao.tc.domain.result.BatchQueryBizOrderResultDO'
},
{
method: 'isShowCheckcode',
parameter: 'long',
returnType: 'com.taobao.tc.domain.result.QueryTairResultDO'
}
]
}
},
data: () => ({ data: () => ({
metaHeaders: [ metaHeaders: [
{ {
...@@ -189,6 +165,7 @@ ...@@ -189,6 +165,7 @@
}, },
providerDetails: [], providerDetails: [],
consumerDetails: [], consumerDetails: [],
metadata: [],
basic: [] basic: []
}), }),
methods: { methods: {
......
...@@ -18,53 +18,55 @@ ...@@ -18,53 +18,55 @@
<template> <template>
<v-container id="search" grid-list-xl fluid > <v-container id="search" grid-list-xl fluid >
<v-layout row wrap> <v-layout row wrap>
<!--<v-layout row>--> <v-flex xs12 class="justify-center">
<v-flex <v-form>
lg10 <v-layout row wrap>
sm12 <v-flex xs10>
xs12 <v-text-field label="Search dubbo service"
> v-bind:suffix="queryBy"
<v-text-field v-model="filter"></v-text-field>
flat </v-flex>
v-model="filter"
/> <v-flex xs2>
</v-flex> <v-menu bottom left class="hidden-xs-only">
<v-flex lg1 sm6 xs6 <v-btn
class="pl-0 ml-0 pr-0 mr-0" slot="activator"
> icon>
<v-select <v-icon>unfold_more</v-icon>
:items="dropdown_font" </v-btn>
v-model="pattern"
></v-select> <v-list>
</v-flex> <v-list-tile
<v-flex lg1 xm6 xs6 v-for="(item, i) in items"
class="pb-0 mb-0 pl-0 ml-0 mt-2" :key="i"
> @click="selected = i">
<v-btn <v-list-tile-title>{{ item.title }}</v-list-tile-title>
@click="search(filter, pattern, true)" </v-list-tile>
color="primary"> </v-list>
search </v-menu>
</v-btn> <v-btn @click="submit" color="primary" class="ml-4" large>Search</v-btn>
</v-flex> </v-flex>
</v-layout> </v-layout>
<v-flex sm12> </v-form>
<h3>Search Result</h3>
</v-flex>
<v-flex lg12>
<v-data-table
class="elevation-1"
:headers="headers"
:items="services"
>
<template slot="items" slot-scope="props">
<td>{{props.item.serviceName}}</td>
<td>{{props.item.group}}</td>
<td>{{props.item.appName}}</td>
<td><v-btn small color='primary' :href='getHref(props.item.serviceName, props.item.appName)'>Detail</v-btn></td>
</template>
</v-data-table>
</v-flex> </v-flex>
<!--</v-layout>--> </v-layout>
<v-flex sm12>
<h3>Search Result</h3>
</v-flex>
<v-flex lg12>
<v-data-table
class="elevation-1"
:headers="headers"
:items="services"
>
<template slot="items" slot-scope="props">
<td>{{props.item.serviceName}}</td>
<td>{{props.item.group}}</td>
<td>{{props.item.appName}}</td>
<td><v-btn small color='primary' :href='getHref(props.item.serviceName, props.item.appName)'>Detail</v-btn></td>
</template>
</v-data-table>
</v-flex>
</v-container> </v-container>
</template> </template>
<script> <script>
...@@ -72,9 +74,13 @@ ...@@ -72,9 +74,13 @@
export default { export default {
data: () => ({ data: () => ({
items: [
{title: 'service name'},
{title: 'IP'},
{title: 'application'}
],
selected: 0,
services: [], services: [],
dropdown_font: [ 'Service', 'App', 'IP' ],
pattern: 'Service',
filter: '', filter: '',
headers: [ headers: [
{ {
...@@ -99,14 +105,19 @@ ...@@ -99,14 +105,19 @@
} }
] ]
}), }),
computed: {
queryBy () {
return 'by ' + this.items[this.selected].title
}
},
methods: { methods: {
click: function () {
console.log('aaa')
},
getHref: function (service, app) { getHref: function (service, app) {
return '/#/serviceDetail?service=' + service + '&app=' + app return '/#/serviceDetail?service=' + service + '&app=' + app
}, },
submit () {
let pattern = this.items[this.selected].title
this.search(this.filter, pattern, true)
},
search: function (filter, pattern, rewrite) { search: function (filter, pattern, rewrite) {
AXIOS.get('service/search?' + 'filter=' + filter + '&pattern=' + pattern) AXIOS.get('service/search?' + 'filter=' + filter + '&pattern=' + pattern)
.then(response => { .then(response => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册