You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2019/11/07 02:53:18 UTC
[incubator-apisix-dashboard] branch master updated: feature:
support multi hosts and uris when make configration for router (#62)
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 97b52f8 feature: support multi hosts and uris when make configration for router (#62)
97b52f8 is described below
commit 97b52f8995f2836e29eef7f7fd49588e79884abb
Author: Lien <li...@users.noreply.github.com>
AuthorDate: Thu Nov 7 10:53:12 2019 +0800
feature: support multi hosts and uris when make configration for router (#62)
---
src/views/schema/routes/edit.vue | 68 +++++++++++++++++++++++++++-----------
src/views/schema/routes/list.vue | 16 +++++++--
src/views/schema/service/list.vue | 3 +-
src/views/schema/ssl/list.vue | 3 +-
src/views/schema/upstream/list.vue | 7 ++--
5 files changed, 69 insertions(+), 28 deletions(-)
diff --git a/src/views/schema/routes/edit.vue b/src/views/schema/routes/edit.vue
index 239ae40..98cabd1 100644
--- a/src/views/schema/routes/edit.vue
+++ b/src/views/schema/routes/edit.vue
@@ -36,23 +36,45 @@
</el-form-item>
<el-form-item
- label="URI"
- prop="uri"
+ label="URIs"
+ prop="uris"
+ placeholder="can write multi uri here"
>
- <el-input
- v-model="form.uri"
- placeholder="URI"
- />
+ <el-select
+ v-model="form.uris"
+ allow-create
+ filterable
+ multiple
+ default-first-option
+ >
+ <el-option
+ v-for="item in ExistedUris"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
</el-form-item>
<el-form-item
- label="Host"
- prop="host"
+ label="Hosts"
+ prop="hosts"
+ placeholder="Hosts"
>
- <el-input
- v-model="form.host"
- placeholder="Host"
- />
+ <el-select
+ v-model="form.hosts"
+ multiple
+ filterable
+ allow-create
+ default-first-option
+ >
+ <el-option
+ v-for="item in ExistedHosts"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
</el-form-item>
<el-form-item
@@ -90,6 +112,7 @@
v-model="form.upstream_id"
placeholder="Upstream"
clearable
+ filterable
>
<el-option
v-for="item in upstreamList"
@@ -108,6 +131,7 @@
v-model="form.service_id"
placeholder="Service"
clearable
+ filterable
>
<el-option
v-for="item in serviceList"
@@ -209,8 +233,8 @@ import { TagsViewModule } from '@/store/modules/tags-view'
export default class extends Vue {
private form = {
- uri: '',
- host: '',
+ uris: [],
+ hosts: [],
remote_addr: '',
upstream_id: '',
service_id: '',
@@ -219,6 +243,10 @@ export default class extends Vue {
desc: ''
}
+ // TODO: can add existed info from route list
+ private ExistedUris = [{ }]
+ private ExistedHosts = [{ }]
+
private rules = {
uri: {
required: true
@@ -254,8 +282,8 @@ export default class extends Vue {
private reset() {
this.form = {
- uri: '',
- host: '',
+ uris: [],
+ hosts: [],
remote_addr: '',
upstream_id: '',
service_id: '',
@@ -270,8 +298,8 @@ export default class extends Vue {
const {
node: {
value: {
- uri = '',
- host = '',
+ uris = [],
+ hosts = [],
remote_addr = '',
upstream_id = '',
service_id = '',
@@ -283,8 +311,8 @@ export default class extends Vue {
} = await getRouter(id) as any
this.form = {
- uri,
- host,
+ uris,
+ hosts,
remote_addr,
upstream_id,
service_id,
diff --git a/src/views/schema/routes/list.vue b/src/views/schema/routes/list.vue
index 25e0268..48e8b82 100644
--- a/src/views/schema/routes/list.vue
+++ b/src/views/schema/routes/list.vue
@@ -39,6 +39,7 @@
fit
highlight-current-row
style="width: 100%;"
+ :default-sort="{prop: 'id', order: 'descending'}"
@sort-change="sortChange"
>
<el-table-column
@@ -53,8 +54,9 @@
<el-table-column
:label="$t('table.actions')"
align="center"
- width="230"
+ width="200"
class-name="fixed-width"
+ fixed="right"
>
<template slot-scope="{row}">
<el-button
@@ -119,7 +121,7 @@ export default class extends Vue {
this.tableKeys = [
{
key: 'id',
- width: 100
+ width: 80
}, {
key: 'description',
width: 300,
@@ -151,7 +153,7 @@ export default class extends Vue {
let { node: { nodes = [] } } = await getList() as any
nodes = [...nodes].map((item: any) => {
const id = item.key.match(/\/([0-9]+)/)[1]
- const fakeId = id.replace(/^(0+)/, '')
+ const fakeId = parseInt(id.replace(/^(0+)/, ''))
let {
uri = '',
@@ -166,6 +168,14 @@ export default class extends Vue {
methods = methods.join(', ')
+ if (item.value.uris) {
+ uri = item.value.uris.join(', ')
+ }
+
+ if (item.value.hosts) {
+ host = item.value.hosts.join('\n ')
+ }
+
plugins = Object.keys(plugins as any).join(', ')
return {
diff --git a/src/views/schema/service/list.vue b/src/views/schema/service/list.vue
index f9354a4..38b6ed5 100644
--- a/src/views/schema/service/list.vue
+++ b/src/views/schema/service/list.vue
@@ -39,6 +39,7 @@
fit
highlight-current-row
style="width: 100%;"
+ :default-sort="{prop: 'id', order: 'descending'}"
@sort-change="sortChange"
>
<el-table-column
@@ -133,7 +134,7 @@ export default class extends Vue {
let { node: { nodes = [] } } = await getServiceList() as any
nodes = [...nodes].map((item: any) => {
const id = item.key.match(/\/([0-9]+)/)[1]
- const fakeId = id.replace(/^(0+)/, '')
+ const fakeId = parseInt(id.replace(/^(0+)/, ''))
const desc = item.value.desc
const pluginArr: any[] = []
diff --git a/src/views/schema/ssl/list.vue b/src/views/schema/ssl/list.vue
index c9180c8..2840231 100644
--- a/src/views/schema/ssl/list.vue
+++ b/src/views/schema/ssl/list.vue
@@ -39,6 +39,7 @@
fit
highlight-current-row
style="width: 100%;"
+ :default-sort="{prop: 'id', order: 'descending'}"
@sort-change="sortChange"
>
<el-table-column
@@ -128,7 +129,7 @@ export default class extends Vue {
let { node: { nodes = [] } } = await getSSLList() as any
nodes = [...nodes].map((item: any) => {
const id = item.key.match(/\/([0-9]+)/)[1]
- const fakeId = id.replace(/^(0+)/, '')
+ const fakeId = parseInt(id.replace(/^(0+)/, ''))
return {
id: fakeId,
diff --git a/src/views/schema/upstream/list.vue b/src/views/schema/upstream/list.vue
index 57f9f98..42cc329 100644
--- a/src/views/schema/upstream/list.vue
+++ b/src/views/schema/upstream/list.vue
@@ -40,6 +40,7 @@
fit
highlight-current-row
style="width: 100%;"
+ :default-sort="{prop: 'id', order: 'descending'}"
@sort-change="sortChange"
>
<el-table-column
@@ -144,14 +145,14 @@ export default class extends Vue {
this.tableKeys = [
{
key: 'id',
- width: 100
+ width: 80
}, {
key: 'description',
width: 300,
align: 'left'
}, {
key: 'type',
- width: 200
+ width: 120
}, {
key: 'nodes',
width: 'auto'
@@ -161,7 +162,7 @@ export default class extends Vue {
let { node: { nodes = [] } } = await getUpstreamList() as any
nodes = [...nodes].map((item: any) => {
const id = item.key.match(/\/([0-9]+)/)[1]
- const fakeId = id.replace(/^(0+)/, '')
+ const fakeId = parseInt(id.replace(/^(0+)/, ''))
const type = item.value.type
const desc = item.value.desc