Skip to content

Commit

Permalink
fix: fix some issues (apache#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
SDUWYS authored Jul 8, 2023
1 parent cf1c91b commit 9e25208
Show file tree
Hide file tree
Showing 16 changed files with 490 additions and 382 deletions.
6 changes: 3 additions & 3 deletions dubbo-admin-ui/src/api/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const Menu = [
{ title: 'trafficAccesslog', path: '/traffic/accesslog' },
{ title: 'trafficGray', path: '/traffic/gray' },
// { title: 'trafficHost', path: '/traffic/host' },
{ title: 'routingRule', path: '/governance/routingRule' },
{ title: 'tagRule', path: '/governance/tagRule' },
{ title: 'dynamicConfig', path: '/governance/config' }
{ title: 'routingRule', path: '/traffic/routingRule' },
{ title: 'tagRule', path: '/traffic/tagRule' },
{ title: 'dynamicConfig', path: '/traffic/config' }
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion dubbo-admin-ui/src/components/ServiceDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<template slot="items" slot-scope="props">
<td>{{props.item.name}}</td>
<td>
<v-chip v-for="(type, index) in props.item.parameterTypes" :key="type.id" label>{{type}}</v-chip>
<v-chip v-for="(type) in props.item.parameterTypes" :key="type.id" label>{{type}}</v-chip>
</td>
<td>
<v-chip label>{{props.item.returnType}}</v-chip>
Expand Down
1 change: 1 addition & 0 deletions dubbo-admin-ui/src/components/apiDocs/ApiForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ export default {
}
var tempMapValueArray = tempMap.get(tempMapKey)
if (!tempMapValueArray) {
// eslint-disable-next-line no-array-constructor
tempMapValueArray = new Array()
tempMap.set(tempMapKey, tempMapValueArray)
}
Expand Down
1 change: 1 addition & 0 deletions dubbo-admin-ui/src/components/public/AceEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export default {
data () {
return {
$ace: null,
// eslint-disable-next-line vue/no-reserved-keys
_content: ''
}
},
Expand Down
1 change: 1 addition & 0 deletions dubbo-admin-ui/src/components/public/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default {
},
items: {
type: Array,
// eslint-disable-next-line vue/require-valid-default-prop
default: []
}
},
Expand Down
5 changes: 3 additions & 2 deletions dubbo-admin-ui/src/components/public/Drawer.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- eslint-disable vue/valid-v-for -->
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
Expand Down Expand Up @@ -34,15 +35,15 @@
</v-toolbar>

<v-list expand>
<template v-for="(item, i) in menus">
<template v-for="(item) in menus">
<v-list-group v-if="item.items" :group="item.group" :prepend-icon="item.icon" no-action>
<v-list-tile slot="activator" ripple>
<v-list-tile-content>
<v-list-tile-title>{{ $t(item.title) }}</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>

<template v-for="(subItem, i) in item.items">
<template v-for="(subItem) in item.items">
<v-list-tile :to="subItem.path" ripple>
<v-list-tile-content>
<v-list-tile-title>{{ $t(subItem.title) }}</v-list-tile-title>
Expand Down
42 changes: 29 additions & 13 deletions dubbo-admin-ui/src/components/traffic/Accesslog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@
<v-card-text>
<v-form>
<v-layout row wrap>
<v-combobox
:loading="searchLoading"
:items="typeAhead"
:search-input.sync="application"
flat
append-icon=""
hide-no-data
label="请输入application"
<v-text-field
label="Application Name"
hint="请输入application"
></v-combobox>
v-model="application"
></v-text-field>
<v-btn @click="submit" color="primary" large>搜索</v-btn>
<v-btn @click="create" color="primary" large>新建</v-btn>
</v-layout>
Expand Down Expand Up @@ -131,6 +126,7 @@
<v-text-field
label="Application Name"
hint="请输入应用名"
disabled
v-model="updateApplication"
></v-text-field>
</v-flex>
Expand Down Expand Up @@ -176,7 +172,7 @@
<v-btn
color="green darken-1"
text
@click="confirmDelete"
@click="confirmDelete()"
>
确定
</v-btn>
Expand Down Expand Up @@ -266,6 +262,9 @@ export default {
}
})
}
setTimeout(() => {
this.search()
}, 1000)
},
setHeaders: function () {
this.headers = [
Expand All @@ -288,18 +287,30 @@ export default {
},
create () {
this.dialog = true
this.createAccesslog = ''
this.createApplication = ''
},
confirmDelete () {
console.log(this.deleteApplication)
this.$axios.delete('/traffic/accesslog', {
application: this.deleteApplication
}).then((res) => {
params: {
application: this.deleteApplication,
group: this.group,
version: this.version
}
}
).then((res) => {
if (res) {
alert('操作成功')
}
})
this.deleteAccesslog = false
this.deleteDialog = false
setTimeout(() => {
this.search()
}, 1000)
},
deleteItem (props) {
console.log(props)
this.deleteDialog = true
this.deleteAccesslog = props.accesslog
this.deleteApplication = props.application
Expand All @@ -324,6 +335,9 @@ export default {
alert('访问日志未开启,请选中开关后再保存!')
}
this.dialog = false
setTimeout(() => {
this.search()
}, 1000)
},
closeDialog () {
this.dialog = false
Expand All @@ -336,6 +350,8 @@ export default {
},
mounted () {
this.setHeaders()
this.application = '*'
this.search()
}
}
Expand Down
116 changes: 57 additions & 59 deletions dubbo-admin-ui/src/components/traffic/Arguments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,12 @@
<v-card-text>
<v-form>
<v-layout row wrap>
<v-flex xs6 sm3 md3>
<v-flex xs6 sm3 md9>
<v-text-field
v-model="service"
v-model="searchService"
flat
label="请输入服务名"
></v-text-field>
</v-flex>
<v-flex xs6 sm3 md2 >
<v-text-field
label="Version"
:hint="$t('dataIdVersionHint')"
v-model="group"
></v-text-field>
</v-flex>
<v-flex xs6 sm3 md2 >
<v-text-field
label="Group"
:hint="$t('dataIdGroupHint')"
v-model="version"
hint="请输入service,如有group和version,请按照group/service:version格式输入"
></v-text-field>
</v-flex>
<v-btn @click="submit" color="primary" large>{{$t('search')}}</v-btn>
Expand Down Expand Up @@ -101,27 +88,13 @@
</v-layout>
<v-card-text >
<v-layout wrap>
<v-flex xs6 sm3 md3>
<v-flex xs6 sm3 md9>
<v-text-field
label="服务名"
hint="请输入服务名"
hint="请输入service,如有group和version,请按照group/service:version格式输入"
v-model="createService"
></v-text-field>
</v-flex>
<v-flex style="margin-left: 10px;" xs6 sm3 md2>
<v-text-field
label="Group"
hint="请输入服务分组group(可选)"
v-model="createGroup"
></v-text-field>
</v-flex>
<v-flex style="margin-left: 10px;" xs6 sm3 md2>
<v-text-field
label="Version"
hint="请输入服务版本version(可选)"
v-model="createVersion"
></v-text-field>
</v-flex>
</v-layout>
<v-layout wrap>
<v-flex lg12>
Expand Down Expand Up @@ -186,27 +159,14 @@
</v-layout>
<v-card-text >
<v-layout wrap>
<v-flex xs6 sm3 md3>
<v-flex xs6 sm3 md9>
<v-text-field
label="服务名"
hint="请输入服务名"
hint="请输入service,如有group和version,请按照group/service:version格式输入"
disabled
v-model="updateService"
></v-text-field>
</v-flex>
<v-flex style="margin-left: 10px;" xs6 sm3 md2>
<v-text-field
label="Group"
hint="请输入服务分组group(可选)"
v-model="updateGroup"
></v-text-field>
</v-flex>
<v-flex style="margin-left: 10px;" xs6 sm3 md2>
<v-text-field
label="Version"
hint="请输入服务版本version(可选)"
v-model="updateVersion"
></v-text-field>
</v-flex>
</v-layout>
<v-layout wrap>
<v-flex lg12>
Expand Down Expand Up @@ -315,6 +275,7 @@ export default {
version: '',
createGroup: '',
createVersion: '',
searchService: '',
createRuleMethod: '',
createRuleIndex: '',
createRuleMatch: '',
Expand Down Expand Up @@ -346,6 +307,18 @@ export default {
this.search()
},
search () {
if (this.searchService === '*') {
this.service = '*'
} else {
const matches = this.searchService.split(/^(.*?)\/(.*?):(.*)$/)
if (matches.length === 1) {
this.service = matches[0]
} else {
this.group = matches[1]
this.service = matches[2]
this.version = matches[3]
}
}
this.$axios.get('/traffic/argument', {
params: {
service: this.service,
Expand All @@ -368,7 +341,7 @@ export default {
const matchCondition = `method=${this.updateRuleMethod} & arguments[${this.updateRuleIndex}]=${this.updateRuleMatch}`
const filterCondition = ` => ${this.updateFilterCondition}`
this.$axios.put('/traffic/argument', {
service: this.updateService,
service: this.tempService,
rule: matchCondition + filterCondition,
group: this.updateGroup,
version: this.updateVersion
Expand All @@ -378,6 +351,9 @@ export default {
}
})
}
setTimeout(() => {
this.search()
}, 1000)
},
setHeaders: function () {
this.headers = [
Expand Down Expand Up @@ -408,19 +384,27 @@ export default {
},
create () {
this.dialog = true
this.createService = ''
this.createRule = ''
},
confirmDelete () {
console.log(this.deleteArguments)
this.$axios.delete('/traffic/argument', {
service: this.deleteService,
group: this.deleteGroup,
version: this.deleteVersion
}).then((res) => {
params: {
service: this.deleteService,
group: this.deleteGroup,
version: this.deleteVersion
}
}
).then((res) => {
if (res) {
alert('操作成功')
}
})
this.deleteArguments = false
this.deleteDialog = false
setTimeout(() => {
this.search()
}, 1000)
},
deleteItem (props) {
this.deleteDialog = true
Expand All @@ -429,7 +413,12 @@ export default {
this.deleteVersion = props.version
},
update (props) {
this.updateService = props.service
if (props.version && props.group) {
this.updateService = `${props.group}/${props.service}:${props.version}`
} else {
this.updateService = props.service
}
this.tempService = props.service
var parts = props.rule.split(/(\w+)\[(\w+)\]=(\w+)/)
this.updateRuleMethod = parts[1]
this.updateRuleIndex = parts[2]
Expand All @@ -439,9 +428,14 @@ export default {
this.updateDialog = true
},
save () {
// if (!this.createRuleMethod || !this.createRuleMatch || !this.createRuleIndex || !this.createFilterCondition) {
// alert('请分别输入方法匹配条件和机器过滤条件')
// } else {
const matches = this.createService.split(/^(.*?)\/(.*?):(.*)$/)
if (matches.length === 1) {
this.createService = matches[0]
} else {
this.createGroup = matches[1]
this.createService = matches[2]
this.createVersion = matches[3]
}
const matchCondition = `method=${this.createRuleMethod} & arguments[${this.createRuleIndex}]=${this.createRuleMatch}`
const filterCondition = ` => ${this.createFilterCondition}`
this.$axios.post('/traffic/argument', {
Expand All @@ -454,8 +448,10 @@ export default {
alert('操作成功')
}
})
// }
this.dialog = false
setTimeout(() => {
this.search()
}, 1000)
},
closeDialog () {
this.dialog = false
Expand All @@ -468,6 +464,8 @@ export default {
},
mounted () {
this.setHeaders()
this.searchService = '*'
this.search()
}
}
Expand Down
Loading

0 comments on commit 9e25208

Please sign in to comment.