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/12/10 01:17:44 UTC

[GitHub] [apisix-dashboard] LiteSun opened a new pull request #999: feat: add route group

LiteSun opened a new pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bugfix
   - [x] New feature provided
   - [ ] Improve performance
   
   - Related issues
   
   ___
   ### Bugfix
   - Description
   
   - How to fix?
   
   ___
   ### New feature or improvement
   - Describe the details and related test reports.
   


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] LiteSun merged pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
LiteSun merged pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999


   


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-742169695


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=h1) Report
   > Merging [#999](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=desc) (e7b8b1c) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/97c53973ffc84e488add40ac3fe139ba3dc43ba7?el=desc) (97c5397) will **decrease** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/999/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #999      +/-   ##
   ==========================================
   - Coverage   41.06%   41.00%   -0.06%     
   ==========================================
     Files          28       28              
     Lines        1773     1773              
   ==========================================
   - Hits          728      727       -1     
   - Misses        939      940       +1     
     Partials      106      106              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/999/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `78.57% <0.00%> (-0.65%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=footer). Last update [97c5397...e7b8b1c](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-742169695


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=h1) Report
   > Merging [#999](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=desc) (751a087) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/97c53973ffc84e488add40ac3fe139ba3dc43ba7?el=desc) (97c5397) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/999/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master     #999   +/-   ##
   =======================================
     Coverage   41.06%   41.06%           
   =======================================
     Files          28       28           
     Lines        1773     1773           
   =======================================
     Hits          728      728           
     Misses        939      939           
     Partials      106      106           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=footer). Last update [97c5397...62e7a8d](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
LiteSun commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r547338016



##########
File path: web/src/pages/Route/transform.ts
##########
@@ -35,8 +44,14 @@ export const transformStepData = ({
     };
   }
 
+  const labels = {};
+  transformLableValueToKeyValue(form1Data.labels).forEach(item => {
+    labels[item.labelKey] = item.labelValue;

Review comment:
       if we have `version:v2` and `version:v3`, only the laster one will be posted, need to confirm. 
   cc @juzhiyuan @nic-chen 




----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-751137237


   e2e failed, @idbeta @nic-chen 


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r547572147



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -90,6 +101,47 @@ const Page: React.FC = () => {
       dataIndex: 'desc',
       hideInSearch: true,
     },
+    {
+      title: formatMessage({ id: 'component.global.label' }),
+      dataIndex: 'labels',
+      render: (_, record) => {
+        return Object.keys(record.labels || {}).map((item) => (
+          <Tag key={Math.random().toString(36).slice(2)}>
+            {item}:{record.labels[item]}

Review comment:
       just to make sure that if the `labels` we got from api is a `[key:string]:[value:string]` object, if so, the origin data structure will lose the same key label IMHO

##########
File path: web/src/pages/Route/transform.ts
##########
@@ -35,8 +44,14 @@ export const transformStepData = ({
     };
   }
 
+  const labels = {};
+  transformLableValueToKeyValue(form1Data.labels).forEach(item => {
+    labels[item.labelKey] = item.labelValue;

Review comment:
       both of them need to be posted




----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r547569358



##########
File path: web/src/locales/en-US/component.ts
##########
@@ -32,6 +32,7 @@ export default {
   'component.global.loading': 'Loading',
   'component.global.list': 'List',
   'component.global.description': 'Description',
+  'component.global.label': 'Label',

Review comment:
       ```suggestion
     'component.global.labels': 'Labels',
   ```




----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] codecov-io commented on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-742169695


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=h1) Report
   > Merging [#999](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=desc) (c86a2b7) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/8976cca55972b7ba8686843bd51241cbc3e1554c?el=desc) (8976cca) will **increase** coverage by `0.62%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/999/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #999      +/-   ##
   ==========================================
   + Coverage   43.41%   44.04%   +0.62%     
   ==========================================
     Files          18       18              
     Lines        1299     1310      +11     
   ==========================================
   + Hits          564      577      +13     
   + Misses        643      642       -1     
   + Partials       92       91       -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/999/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `79.22% <0.00%> (+0.64%)` | :arrow_up: |
   | [api/internal/core/store/validate.go](https://codecov.io/gh/apache/apisix-dashboard/pull/999/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvdmFsaWRhdGUuZ28=) | `61.68% <0.00%> (+3.64%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=footer). Last update [8976cca...c86a2b7](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-742169695


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=h1) Report
   > Merging [#999](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=desc) (f15ed3f) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/6fa6a16559a1c1d0e90de4a3277a3db6e73cb9fc?el=desc) (6fa6a16) will **decrease** coverage by `0.45%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/999/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #999      +/-   ##
   ==========================================
   - Coverage   42.12%   41.67%   -0.46%     
   ==========================================
     Files          29       29              
     Lines        1816     1819       +3     
   ==========================================
   - Hits          765      758       -7     
   - Misses        943      952       +9     
   - Partials      108      109       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/handler/consumer/consumer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/999/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvY29uc3VtZXIvY29uc3VtZXIuZ28=) | `63.04% <0.00%> (-5.59%)` | :arrow_down: |
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/999/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `78.57% <0.00%> (-0.65%)` | :arrow_down: |
   | [api/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/999/diff?src=pr&el=tree#diff-YXBpL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=footer). Last update [6fa6a16...f15ed3f](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-742169695


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=h1) Report
   > Merging [#999](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=desc) (773c9e5) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/46bf1ef9cfe4f4c659752176424151bb4fc4952f?el=desc) (46bf1ef) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/999/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master     #999   +/-   ##
   =======================================
     Coverage   41.06%   41.06%           
   =======================================
     Files          28       28           
     Lines        1773     1773           
   =======================================
     Hits          728      728           
     Misses        939      939           
     Partials      106      106           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=footer). Last update [46bf1ef...773c9e5](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r547572147



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -90,6 +101,47 @@ const Page: React.FC = () => {
       dataIndex: 'desc',
       hideInSearch: true,
     },
+    {
+      title: formatMessage({ id: 'component.global.label' }),
+      dataIndex: 'labels',
+      render: (_, record) => {
+        return Object.keys(record.labels || {}).map((item) => (
+          <Tag key={Math.random().toString(36).slice(2)}>
+            {item}:{record.labels[item]}

Review comment:
       just to make sure that if the `labels` we got from api is a `[key:string]:[value:string]` object, if so, the origin data structure will lose the same key label IMHO




----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r548769291



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -14,21 +14,32 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import React, { useRef, useState } from 'react';
+import React, { useRef, useEffect, useState } from 'react';
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
 import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
-import { Button, Popconfirm, notification, Tag, Space } from 'antd';
+import { Button, Popconfirm, notification, Tag, Space, Select } from 'antd';
 import { history, useIntl } from 'umi';
 import { PlusOutlined, BugOutlined } from '@ant-design/icons';
-import { timestampToLocaleString } from '@/helpers';
 
-import { fetchList, remove, updateRouteStatus } from './service';
+import { timestampToLocaleString } from '@/helpers';
+import { transformLabelList } from './transform';
+import { fetchList, remove, fetchLabelList, updateRouteStatus } from './service';
 import { DebugDrawView } from './components/DebugViews';
 
+
+const { OptGroup, Option } = Select;
+
 const Page: React.FC = () => {
   const ref = useRef<ActionType>();
   const { formatMessage } = useIntl();
 
+  const [labelList, setLabelList] = useState<RouteModule.LabelList>({});
+
+  useEffect(() => {
+    fetchLabelList().then((data) => {
+      setLabelList(transformLabelList(data));

Review comment:
       would better use a transformer in service, then you could set state by `then(setXXX)`

##########
File path: web/src/locales/zh-CN/component.ts
##########
@@ -32,6 +32,7 @@ export default {
   'component.global.loading': '加载中',
   'component.global.list': '列表',
   'component.global.description': '描述',
+  'component.global.label': '标签',

Review comment:
       ```suggestion
     'component.global.labels': '标签',
   ```

##########
File path: web/src/pages/Route/List.tsx
##########
@@ -90,6 +101,47 @@ const Page: React.FC = () => {
       dataIndex: 'desc',
       hideInSearch: true,
     },
+    {
+      title: formatMessage({ id: 'component.global.label' }),
+      dataIndex: 'labels',
+      render: (_, record) => {
+        return Object.keys(record.labels || {}).map((item) => (
+          <Tag key={Math.random().toString(36).slice(2)}>

Review comment:
       why use this method to set key?

##########
File path: web/src/pages/Route/components/Step1/LabelsDrawer.tsx
##########
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+import React, { useEffect, useState } from 'react';
+import { AutoComplete, Button, Col, Drawer, Form, notification, Row } from 'antd';
+import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
+
+import { transformLabelList, transformLableValueToKeyValue } from '../../transform';
+import { fetchLabelList } from '../../service';
+
+interface Props extends Pick<RouteModule.Step1PassProps, 'onChange'> {
+  labelsDataSource: string[];
+  disabled: boolean;
+  onClose(): void;
+}
+
+const LabelList = (disabled: boolean, labelList: RouteModule.LabelList) => {
+  const { formatMessage } = useIntl();
+
+  const keyOptions = Object.keys(labelList || {}).map((item) => ({ value: item }));
+  return (
+    <Form.List name="labels">
+      {(fields, { add, remove }) => {
+        return (
+          <>
+            {fields.map((field, index) => (
+              <Form.Item
+                key={field.key}
+                label={index === 0 && 'Label'}
+                labelCol={{ span: index === 0 ? 3 : 0 }}
+                wrapperCol={{ offset: index === 0 ? 0 : 3 }}
+              >
+                <Row style={{ marginBottom: 10 }} gutter={16}>
+                  <Col>
+                    <Form.Item
+                      style={{ marginBottom: 0 }}
+                      name={[field.name, 'labelKey']}
+                      rules={[
+                        {
+                          required: true,
+                          message: 'Please input key',
+                        },
+                      ]}
+                    >
+                      <AutoComplete options={keyOptions} style={{ width: 100 }} />
+                    </Form.Item>
+                  </Col>
+                  <Col>
+                    <Form.Item shouldUpdate noStyle>
+                      {({ getFieldValue }) => {
+                        const key = getFieldValue(['labels', field.name, 'labelKey']);
+                        let valueOptions = [{ value: '' }];
+                        if (labelList) {
+                          valueOptions = (labelList[key] || []).map((item) => ({ value: item }));
+                        }
+
+                        return (
+                          <Form.Item
+                            noStyle
+                            name={[field.name, 'labelValue']}
+                            fieldKey={[field.fieldKey, 'labelValue']}
+                            rules={[
+                              {
+                                required: true,
+                                message: 'Please input value',
+                              },
+                            ]}
+                          >
+                            <AutoComplete options={valueOptions} style={{ width: 100 }} />
+                          </Form.Item>
+                        );
+                      }}
+                    </Form.Item>
+                  </Col>
+                  <Col>
+                    {!disabled && <MinusCircleOutlined onClick={() => remove(field.name)} />}
+                  </Col>
+                </Row>
+              </Form.Item>
+            ))}
+            {!disabled && (
+              <Form.Item wrapperCol={{ offset: 3 }}>
+                <Button type="dashed" onClick={add}>
+                  <PlusOutlined />
+                  {formatMessage({ id: 'component.global.add' })}
+                </Button>
+              </Form.Item>
+            )}
+          </>
+        );
+      }}
+    </Form.List>
+  );
+};
+
+const LabelsDrawer: React.FC<Props> = ({
+  disabled,
+  labelsDataSource,
+  onClose,
+  onChange = () => { },
+}) => {
+  const transformLabel = transformLableValueToKeyValue(labelsDataSource);
+
+  const { formatMessage } = useIntl();
+  const [form] = Form.useForm();
+  const [labelList, setLabelList] = useState<RouteModule.LabelList>();

Review comment:
       default value?




----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
LiteSun commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r548812801



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -14,21 +14,32 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import React, { useRef, useState } from 'react';
+import React, { useRef, useEffect, useState } from 'react';
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
 import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
-import { Button, Popconfirm, notification, Tag, Space } from 'antd';
+import { Button, Popconfirm, notification, Tag, Space, Select } from 'antd';
 import { history, useIntl } from 'umi';
 import { PlusOutlined, BugOutlined } from '@ant-design/icons';
-import { timestampToLocaleString } from '@/helpers';
 
-import { fetchList, remove, updateRouteStatus } from './service';
+import { timestampToLocaleString } from '@/helpers';
+import { transformLabelList } from './transform';
+import { fetchList, remove, fetchLabelList, updateRouteStatus } from './service';
 import { DebugDrawView } from './components/DebugViews';
 
+
+const { OptGroup, Option } = Select;
+
 const Page: React.FC = () => {
   const ref = useRef<ActionType>();
   const { formatMessage } = useIntl();
 
+  const [labelList, setLabelList] = useState<RouteModule.LabelList>({});
+
+  useEffect(() => {
+    fetchLabelList().then((data) => {
+      setLabelList(transformLabelList(data));

Review comment:
       > would better use a transformer in service, then you could set state by `then(setXXX)`
   
   updated.




----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-742906135


   CI pending, need to retrigger.


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-742169695


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=h1) Report
   > Merging [#999](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=desc) (97af52f) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/b3819c5ae939c9c0b0e55958718c9292eb895555?el=desc) (b3819c5) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/999/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master     #999   +/-   ##
   =======================================
     Coverage   41.72%   41.72%           
   =======================================
     Files          29       29           
     Lines        1819     1819           
   =======================================
     Hits          759      759           
     Misses        951      951           
     Partials      109      109           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=footer). Last update [b3819c5...97af52f](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-742169695


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=h1) Report
   > Merging [#999](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=desc) (5803f65) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/6fa6a16559a1c1d0e90de4a3277a3db6e73cb9fc?el=desc) (6fa6a16) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/999/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master     #999   +/-   ##
   =======================================
     Coverage   42.12%   42.12%           
   =======================================
     Files          29       29           
     Lines        1816     1816           
   =======================================
     Hits          765      765           
     Misses        943      943           
     Partials      108      108           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=footer). Last update [6fa6a16...5803f65](https://codecov.io/gh/apache/apisix-dashboard/pull/999?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
LiteSun commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r548812782



##########
File path: web/src/locales/zh-CN/component.ts
##########
@@ -32,6 +32,7 @@ export default {
   'component.global.loading': '加载中',
   'component.global.list': '列表',
   'component.global.description': '描述',
+  'component.global.label': '标签',

Review comment:
       updated.




----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] liuxiran commented on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
liuxiran commented on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-751190127


   > e2e failed, @idbeta @nic-chen
   
   https://github.com/apache/apisix-dashboard/blob/e0af89e7df02de137aeac3d4bad53cf2efde41c6/api/test/e2e/consumer_test.go#L191
   
   need a  `sleep` after 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



[GitHub] [apisix-dashboard] LiteSun commented on pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
LiteSun commented on pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#issuecomment-747928552


   #1061 just merged, will access the API soon. 


----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r547568903



##########
File path: web/src/pages/Route/transform.ts
##########
@@ -35,8 +44,14 @@ export const transformStepData = ({
     };
   }
 
+  const labels = {};
+  transformLableValueToKeyValue(form1Data.labels).forEach(item => {
+    labels[item.labelKey] = item.labelValue;

Review comment:
       both of them need to be posted




----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r547572147



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -90,6 +101,47 @@ const Page: React.FC = () => {
       dataIndex: 'desc',
       hideInSearch: true,
     },
+    {
+      title: formatMessage({ id: 'component.global.label' }),
+      dataIndex: 'labels',
+      render: (_, record) => {
+        return Object.keys(record.labels || {}).map((item) => (
+          <Tag key={Math.random().toString(36).slice(2)}>
+            {item}:{record.labels[item]}

Review comment:
       just to make sure that if the `labels` we got from api is a `[key:string]:[value:string]` object




----------------------------------------------------------------
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



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #999: feat: add route group

Posted by GitBox <gi...@apache.org>.
LiteSun commented on a change in pull request #999:
URL: https://github.com/apache/apisix-dashboard/pull/999#discussion_r548812825



##########
File path: web/src/pages/Route/components/Step1/LabelsDrawer.tsx
##########
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+import React, { useEffect, useState } from 'react';
+import { AutoComplete, Button, Col, Drawer, Form, notification, Row } from 'antd';
+import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
+
+import { transformLabelList, transformLableValueToKeyValue } from '../../transform';
+import { fetchLabelList } from '../../service';
+
+interface Props extends Pick<RouteModule.Step1PassProps, 'onChange'> {
+  labelsDataSource: string[];
+  disabled: boolean;
+  onClose(): void;
+}
+
+const LabelList = (disabled: boolean, labelList: RouteModule.LabelList) => {
+  const { formatMessage } = useIntl();
+
+  const keyOptions = Object.keys(labelList || {}).map((item) => ({ value: item }));
+  return (
+    <Form.List name="labels">
+      {(fields, { add, remove }) => {
+        return (
+          <>
+            {fields.map((field, index) => (
+              <Form.Item
+                key={field.key}
+                label={index === 0 && 'Label'}
+                labelCol={{ span: index === 0 ? 3 : 0 }}
+                wrapperCol={{ offset: index === 0 ? 0 : 3 }}
+              >
+                <Row style={{ marginBottom: 10 }} gutter={16}>
+                  <Col>
+                    <Form.Item
+                      style={{ marginBottom: 0 }}
+                      name={[field.name, 'labelKey']}
+                      rules={[
+                        {
+                          required: true,
+                          message: 'Please input key',
+                        },
+                      ]}
+                    >
+                      <AutoComplete options={keyOptions} style={{ width: 100 }} />
+                    </Form.Item>
+                  </Col>
+                  <Col>
+                    <Form.Item shouldUpdate noStyle>
+                      {({ getFieldValue }) => {
+                        const key = getFieldValue(['labels', field.name, 'labelKey']);
+                        let valueOptions = [{ value: '' }];
+                        if (labelList) {
+                          valueOptions = (labelList[key] || []).map((item) => ({ value: item }));
+                        }
+
+                        return (
+                          <Form.Item
+                            noStyle
+                            name={[field.name, 'labelValue']}
+                            fieldKey={[field.fieldKey, 'labelValue']}
+                            rules={[
+                              {
+                                required: true,
+                                message: 'Please input value',
+                              },
+                            ]}
+                          >
+                            <AutoComplete options={valueOptions} style={{ width: 100 }} />
+                          </Form.Item>
+                        );
+                      }}
+                    </Form.Item>
+                  </Col>
+                  <Col>
+                    {!disabled && <MinusCircleOutlined onClick={() => remove(field.name)} />}
+                  </Col>
+                </Row>
+              </Form.Item>
+            ))}
+            {!disabled && (
+              <Form.Item wrapperCol={{ offset: 3 }}>
+                <Button type="dashed" onClick={add}>
+                  <PlusOutlined />
+                  {formatMessage({ id: 'component.global.add' })}
+                </Button>
+              </Form.Item>
+            )}
+          </>
+        );
+      }}
+    </Form.List>
+  );
+};
+
+const LabelsDrawer: React.FC<Props> = ({
+  disabled,
+  labelsDataSource,
+  onClose,
+  onChange = () => { },
+}) => {
+  const transformLabel = transformLableValueToKeyValue(labelsDataSource);
+
+  const { formatMessage } = useIntl();
+  const [form] = Form.useForm();
+  const [labelList, setLabelList] = useState<RouteModule.LabelList>();

Review comment:
       > default value?
   
   updated.




----------------------------------------------------------------
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