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/12/24 10:54:32 UTC
[incubator-apisix-dashboard] branch master updated: feat: added tip
for input hosts (#106)
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 c14dcc2 feat: added tip for input hosts (#106)
c14dcc2 is described below
commit c14dcc28c01c6122b0e2b8160528aeb004406564
Author: 琚致远 <ju...@apache.org>
AuthorDate: Tue Dec 24 18:54:25 2019 +0800
feat: added tip for input hosts (#106)
* feat: added tip for input hosts
* feat: update tip for hosts input
* revert: regep for upstream edit page
---
src/lang/en.ts | 3 ++-
src/lang/zh.ts | 3 ++-
src/views/schema/routes/edit.vue | 26 ++++++++++++++++----------
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/lang/en.ts b/src/lang/en.ts
index 033e573..784e060 100644
--- a/src/lang/en.ts
+++ b/src/lang/en.ts
@@ -72,7 +72,8 @@ export default {
},
schema: {
route: {
- inputMultipleURLs: 'Input value then press return button'
+ inputMultipleValues: 'Input value then press return button',
+ propertyHostsTip: 'Any values are supported'
}
}
}
diff --git a/src/lang/zh.ts b/src/lang/zh.ts
index d7d7dcc..83111b6 100644
--- a/src/lang/zh.ts
+++ b/src/lang/zh.ts
@@ -80,7 +80,8 @@ export default {
},
schema: {
route: {
- inputMultipleURLs: '输入值后并回车'
+ inputMultipleValues: '输入值后并回车',
+ propertyHostsTip: '任何值均可'
}
}
}
diff --git a/src/views/schema/routes/edit.vue b/src/views/schema/routes/edit.vue
index b1b0515..24b04e8 100644
--- a/src/views/schema/routes/edit.vue
+++ b/src/views/schema/routes/edit.vue
@@ -45,7 +45,7 @@
filterable
multiple
default-first-option
- :placeholder="$t('schema.route.inputMultipleURLs')"
+ :placeholder="$t('schema.route.inputMultipleValues')"
@change="filterUriOptions"
>
<el-option
@@ -68,7 +68,7 @@
filterable
allow-create
default-first-option
- @change="filterHostsOptions"
+ :placeholder="$t('schema.route.inputMultipleValues')"
>
<el-option
v-for="item in ExistedHosts"
@@ -77,6 +77,9 @@
:value="item.value"
/>
</el-select>
+ <p class="tip">
+ {{ $t('schema.route.propertyHostsTip') }}
+ </p>
</el-form-item>
<el-form-item
@@ -246,8 +249,8 @@ export default class extends Vue {
}
// TODO: can add existed info from route list
- private ExistedUris = [{ }]
- private ExistedHosts = [{ }]
+ private ExistedUris = [{}]
+ private ExistedHosts = [{}]
private rules = {
uris: {
@@ -297,7 +300,7 @@ export default class extends Vue {
filterDataWithRegex(val: any, regex: any) {
if (val.length > 0) {
- const newArr:string[] = []
+ const newArr: string[] = []
val.filter(function(item: any) {
if (typeof item === 'string') {
item = item.replace(/\s+/g, '')
@@ -306,9 +309,11 @@ export default class extends Vue {
}
}
})
+
newArr.map(function(item: any, index: number) {
val[index] = item
})
+
if (val.length > newArr.length) {
val.splice(newArr.length, val.length)
}
@@ -319,11 +324,6 @@ export default class extends Vue {
this.filterDataWithRegex(val, new RegExp('^([\\*\\./0-9a-zA-Z-_~@\\?\\!#$\\(\\)]+)$'))
}
- private filterHostsOptions(val: any) {
- let regexpFilter = new RegExp('^(([0-9a-zA-Z-]+|\\*)\\.)?([0-9a-zA-Z-]+\\.)+([a-zA-Z]{2,12})$')
- this.filterDataWithRegex(val, regexpFilter)
- }
-
private async getData() {
const { id } = this.$route.params
let {
@@ -487,6 +487,12 @@ export default class extends Vue {
.el-input {
width: 300px;
}
+ .tip {
+ line-height: 24px;
+ font-size: 12px;
+ margin: 0;
+ color: #8e8c8c;
+ }
}
}
}