You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/03/24 07:41:26 UTC

[GitHub] [incubator-apisix-dashboard] dingchaofa opened a new pull request #160: feature:allow set vars filter in router configuration page

dingchaofa opened a new pull request #160: feature:allow set vars filter in router configuration page
URL: https://github.com/apache/incubator-apisix-dashboard/pull/160
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix-dashboard] juzhiyuan merged pull request #160: feature:allow set vars filter in router configuration page

Posted by GitBox <gi...@apache.org>.
juzhiyuan merged pull request #160: feature:allow set vars filter in router configuration page
URL: https://github.com/apache/incubator-apisix-dashboard/pull/160
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix-dashboard] juzhiyuan commented on a change in pull request #160: feature:allow set vars filter in router configuration page

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #160: feature:allow set vars filter in router configuration page
URL: https://github.com/apache/incubator-apisix-dashboard/pull/160#discussion_r396953265
 
 

 ##########
 File path: src/views/schema/routes/edit.vue
 ##########
 @@ -497,5 +511,15 @@ export default class extends Vue {
       }
     }
   }
+  .var-item {
+    .el-form-item {
+      margin-bottom: 10px;
+      display: inline-block;
+      .el-form-item__label {}
 
 Review comment:
   Please remove this line

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix-dashboard] dingchaofa commented on a change in pull request #160: feature:allow set vars filter in router configuration page

Posted by GitBox <gi...@apache.org>.
dingchaofa commented on a change in pull request #160: feature:allow set vars filter in router configuration page
URL: https://github.com/apache/incubator-apisix-dashboard/pull/160#discussion_r396960211
 
 

 ##########
 File path: vue.config.js
 ##########
 @@ -28,7 +28,7 @@ module.exports = {
   productionSourceMap: false,
   devServer: {
     // https://cli.vuejs.org/zh/config/#devserver-proxy
-    proxy: 'http://127.0.0.1:9080/apisix/admin/'
+    proxy: 'http://192.168.10.152/apisix/admin/'
 
 Review comment:
   fixed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix-dashboard] dingchaofa commented on a change in pull request #160: feature:allow set vars filter in router configuration page

Posted by GitBox <gi...@apache.org>.
dingchaofa commented on a change in pull request #160: feature:allow set vars filter in router configuration page
URL: https://github.com/apache/incubator-apisix-dashboard/pull/160#discussion_r396960714
 
 

 ##########
 File path: src/views/schema/routes/edit.vue
 ##########
 @@ -497,5 +511,15 @@ export default class extends Vue {
       }
     }
   }
+  .var-item {
+    .el-form-item {
+      margin-bottom: 10px;
+      display: inline-block;
+      .el-form-item__label {}
 
 Review comment:
   fixed and other file also was fixed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix-dashboard] juzhiyuan commented on a change in pull request #160: feature:allow set vars filter in router configuration page

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #160: feature:allow set vars filter in router configuration page
URL: https://github.com/apache/incubator-apisix-dashboard/pull/160#discussion_r396953056
 
 

 ##########
 File path: vue.config.js
 ##########
 @@ -28,7 +28,7 @@ module.exports = {
   productionSourceMap: false,
   devServer: {
     // https://cli.vuejs.org/zh/config/#devserver-proxy
-    proxy: 'http://127.0.0.1:9080/apisix/admin/'
+    proxy: 'http://192.168.10.152/apisix/admin/'
 
 Review comment:
   Please use localhost

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix-dashboard] juzhiyuan commented on a change in pull request #160: feature:allow set vars filter in router configuration page

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #160: feature:allow set vars filter in router configuration page
URL: https://github.com/apache/incubator-apisix-dashboard/pull/160#discussion_r396953680
 
 

 ##########
 File path: src/components/VarArgs/index.vue
 ##########
 @@ -0,0 +1,128 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+<template>
+  <el-form>
+    <el-form-item
+      v-for="(item, index) in vars"
+      :key="index"
+      :label="'Var' + (index + 1)"
+      class="var-item"
+    >
+      <el-form-item :prop="'var.' + index + '.ip'">
+        <el-select
+          v-model="item.name"
+          :placeholder="$t('schema.route.inputMultipleValues')"
+          filterable
+          allow-create
+          default-first-option
+          @change="onChange"
+        >
+          <el-option
+            v-for="name in varNames"
+            :key="name"
+            :label="name"
+            :value="name"
+          />
+        </el-select>
+        <el-select
+          v-model="item.operator"
+          placeholder="Operator"
+          @change="onChange"
+        >
+          <el-option
+            v-for="operator in varOperator"
+            :key="operator"
+            :label="operator"
+            :value="operator"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-input
+          v-model="item.value"
+          placeholder=""
+          @input="onChange"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="danger"
+          @click.prevent="removeVar(index)"
+        >
+          {{ $t("button.delete") }}
+        </el-button>
+      </el-form-item>
+    </el-form-item>
+    <el-form-item>
+      <el-button @click="addVar">
+        {{ $t("button.add_var") }}
+      </el-button>
+    </el-form-item>
+  </el-form>
+</template>
+
+<script lang="ts">
+import { Component, Vue, Watch, Prop } from 'vue-property-decorator'
+
+@Component({
+  name: 'VarArgs'
+})
+export default class extends Vue {
+  @Prop({ default: () => [] }) private pVars!: any
+  private isFullscreen = false;
+  private get vars() {
+    const _vars = this.pVars.map((arr:Array<any>) => {
+      const [name, operator, value] = arr
+      return { name, operator, value }
+    })
+    return _vars
+  }
+  private varNames = ['remote_addr', 'host', 'uri', 'http_user_agent', 'http_referer', 'http_cookie', 'http_accept_language', 'request_uri', 'query_string', 'remote_port', 'hostname', 'arg_id'];
+
+  private varOperator = ['==', '~=', '>', '<', '~~'];
+
+  private onChange() {
+    const val = this.vars.map((e:any) => Object.values(e))
+    this.$emit('update:pVars', val)
+  }
+
+  private addVar() {
+    (this.vars as any).push({
+      name: null,
+      operator: null,
+      value: null
+    })
+    this.onChange()
+  }
+
+  private removeVar(index:number) {
+    this.$confirm(`Do you want to remove the var?`, 'Warning', {
 
 Review comment:
   Please use `''` when there has no variables

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix-dashboard] dingchaofa commented on a change in pull request #160: feature:allow set vars filter in router configuration page

Posted by GitBox <gi...@apache.org>.
dingchaofa commented on a change in pull request #160: feature:allow set vars filter in router configuration page
URL: https://github.com/apache/incubator-apisix-dashboard/pull/160#discussion_r396960805
 
 

 ##########
 File path: src/components/VarArgs/index.vue
 ##########
 @@ -0,0 +1,128 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+<template>
+  <el-form>
+    <el-form-item
+      v-for="(item, index) in vars"
+      :key="index"
+      :label="'Var' + (index + 1)"
+      class="var-item"
+    >
+      <el-form-item :prop="'var.' + index + '.ip'">
+        <el-select
+          v-model="item.name"
+          :placeholder="$t('schema.route.inputMultipleValues')"
+          filterable
+          allow-create
+          default-first-option
+          @change="onChange"
+        >
+          <el-option
+            v-for="name in varNames"
+            :key="name"
+            :label="name"
+            :value="name"
+          />
+        </el-select>
+        <el-select
+          v-model="item.operator"
+          placeholder="Operator"
+          @change="onChange"
+        >
+          <el-option
+            v-for="operator in varOperator"
+            :key="operator"
+            :label="operator"
+            :value="operator"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-input
+          v-model="item.value"
+          placeholder=""
+          @input="onChange"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="danger"
+          @click.prevent="removeVar(index)"
+        >
+          {{ $t("button.delete") }}
+        </el-button>
+      </el-form-item>
+    </el-form-item>
+    <el-form-item>
+      <el-button @click="addVar">
+        {{ $t("button.add_var") }}
+      </el-button>
+    </el-form-item>
+  </el-form>
+</template>
+
+<script lang="ts">
+import { Component, Vue, Watch, Prop } from 'vue-property-decorator'
+
+@Component({
+  name: 'VarArgs'
+})
+export default class extends Vue {
+  @Prop({ default: () => [] }) private pVars!: any
+  private isFullscreen = false;
+  private get vars() {
+    const _vars = this.pVars.map((arr:Array<any>) => {
+      const [name, operator, value] = arr
+      return { name, operator, value }
+    })
+    return _vars
+  }
+  private varNames = ['remote_addr', 'host', 'uri', 'http_user_agent', 'http_referer', 'http_cookie', 'http_accept_language', 'request_uri', 'query_string', 'remote_port', 'hostname', 'arg_id'];
+
+  private varOperator = ['==', '~=', '>', '<', '~~'];
+
+  private onChange() {
+    const val = this.vars.map((e:any) => Object.values(e))
+    this.$emit('update:pVars', val)
+  }
+
+  private addVar() {
+    (this.vars as any).push({
+      name: null,
+      operator: null,
+      value: null
+    })
+    this.onChange()
+  }
+
+  private removeVar(index:number) {
+    this.$confirm(`Do you want to remove the var?`, 'Warning', {
 
 Review comment:
   fixed and other file also was fixed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services