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 2021/01/07 17:05:31 UTC

[GitHub] [apisix-dashboard] liuxiran opened a new pull request #1240: feat(fe): export routes

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


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] New feature provided
   
   - Related issues
   export routes FE  part for #826
   
   ___
   ### New feature or improvement
   - Describe the details and related test reports.
   
   1. add `Export OpenApi3.0` button at the footer of the route table
   
   ![image](https://user-images.githubusercontent.com/2561857/103920944-d8b46f00-514c-11eb-8325-a5ae4782bd7b.png)
   
   ![image](https://user-images.githubusercontent.com/2561857/103920990-e79b2180-514c-11eb-8739-10dc9676c78a.png)
   
   
   2. support choose export file type
   
   ![image](https://user-images.githubusercontent.com/2561857/103921106-0b5e6780-514d-11eb-8634-df3c971c0633.png)
   
   3. download file `APISIX_routes_${moment().format('YYYYMMDDHHmmss')}.json/yaml`
   
   


----------------------------------------------------------------
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 #1240: feat(fe): export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (52fc54b) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/55e04494e6cafde51d60bad0e4ac722d4e2c8735?el=desc) (55e0449) will **increase** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1240      +/-   ##
   ==========================================
   + Coverage   42.39%   42.44%   +0.05%     
   ==========================================
     Files          31       31              
     Lines        1932     1932              
   ==========================================
   + Hits          819      820       +1     
   + Misses       1002     1001       -1     
     Partials      111      111              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `80.00% <0.00%> (+0.62%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [55e0449...52fc54b](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (3892f5f) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f2232603588a47f902a90d974692a7c6bea535f?el=desc) (5f22326) will **increase** coverage by `6.58%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1240      +/-   ##
   ==========================================
   + Coverage   42.44%   49.02%   +6.58%     
   ==========================================
     Files          31       41      +10     
     Lines        1932     2360     +428     
   ==========================================
   + Hits          820     1157     +337     
   - Misses       1001     1009       +8     
   - Partials      111      194      +83     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/query.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvcXVlcnkuZ28=) | `0.00% <0.00%> (-88.10%)` | :arrow_down: |
   | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `17.39% <0.00%> (-78.27%)` | :arrow_down: |
   | [api/internal/core/store/selector.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc2VsZWN0b3IuZ28=) | `0.00% <0.00%> (-75.93%)` | :arrow_down: |
   | [api/internal/handler/plugin/plugin.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcGx1Z2luL3BsdWdpbi5nbw==) | `16.66% <0.00%> (-53.34%)` | :arrow_down: |
   | [api/internal/core/store/validate\_mock.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvdmFsaWRhdGVfbW9jay5nbw==) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `57.59% <0.00%> (-22.41%)` | :arrow_down: |
   | [api/internal/handler/handler.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvaGFuZGxlci5nbw==) | `51.85% <0.00%> (-7.41%)` | :arrow_down: |
   | [api/internal/core/store/validate.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvdmFsaWRhdGUuZ28=) | `55.36% <0.00%> (-2.26%)` | :arrow_down: |
   | [api/internal/core/store/store\_mock.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVfbW9jay5nbw==) | `0.00% <0.00%> (ø)` | |
   | [api/cmd/manager/main.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2NtZC9tYW5hZ2VyL21haW4uZ28=) | `0.00% <0.00%> (ø)` | |
   | ... and [29 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [5f22326...3892f5f](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (351810c) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f2232603588a47f902a90d974692a7c6bea535f?el=desc) (5f22326) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #1240   +/-   ##
   =======================================
     Coverage   42.44%   42.44%           
   =======================================
     Files          31       31           
     Lines        1932     1932           
   =======================================
     Hits          820      820           
     Misses       1001     1001           
     Partials      111      111           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [5f22326...351810c](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (e661a7e) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/1bdcaa8df2fe2fa6caba23809e69e26c5ad7902d?el=desc) (1bdcaa8) will **decrease** coverage by `18.31%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1240       +/-   ##
   ===========================================
   - Coverage   62.29%   43.97%   -18.32%     
   ===========================================
     Files          42       33        -9     
     Lines        2395     1976      -419     
   ===========================================
   - Hits         1492      869      -623     
   - Misses        722      996      +274     
   + Partials      181      111       -70     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `0.00% <0.00%> (-74.49%)` | :arrow_down: |
   | [api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `0.00% <0.00%> (-62.50%)` | :arrow_down: |
   | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (-55.47%)` | :arrow_down: |
   | [api/internal/handler/server\_info/server\_info.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmVyX2luZm8vc2VydmVyX2luZm8uZ28=) | `57.14% <0.00%> (-33.34%)` | :arrow_down: |
   | [api/internal/utils/closer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2Nsb3Nlci5nbw==) | `0.00% <0.00%> (-33.34%)` | :arrow_down: |
   | [api/internal/handler/consumer/consumer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvY29uc3VtZXIvY29uc3VtZXIuZ28=) | `63.82% <0.00%> (-27.66%)` | :arrow_down: |
   | [api/internal/utils/pid.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3BpZC5nbw==) | `0.00% <0.00%> (-26.67%)` | :arrow_down: |
   | [api/internal/utils/json\_patch.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2pzb25fcGF0Y2guZ28=) | `34.48% <0.00%> (-24.14%)` | :arrow_down: |
   | ... and [24 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [1bdcaa8...e661a7e](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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] juzhiyuan commented on a change in pull request #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/locales/zh-CN.ts
##########
@@ -125,8 +125,8 @@ export default {
   'page.route.TabPane.authentication': '认证',
   'page.route.TabPane.response': '响应结果',
   'page.route.debugWithoutAuth': '当前请求不启用任何认证方式。',
-  'page.route.button.exportOpenApi': '导出 OpenApi',
+  'page.route.button.exportOpenApi': '导出 OpenAPI',
   'page.route.exportRoutesTips': '请选择下载文件的类型',
-  'page.route.button.importOpenApi': '导入 OpenApi',
+  'page.route.button.importOpenApi': '导入 OpenAPI',

Review comment:
       https://github.com/liuxiran/apisix-dashboard/blob/import_export_fe/web/src/pages/Route/locales/en-US.ts#L128-L130
   
   😂




----------------------------------------------------------------
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 #1240: feat(fe): export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (1cd72ad) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/55e04494e6cafde51d60bad0e4ac722d4e2c8735?el=desc) (55e0449) will **increase** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1240      +/-   ##
   ==========================================
   + Coverage   42.39%   42.44%   +0.05%     
   ==========================================
     Files          31       31              
     Lines        1932     1932              
   ==========================================
   + Hits          819      820       +1     
   + Misses       1002     1001       -1     
     Partials      111      111              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `80.00% <0.00%> (+0.62%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [55e0449...071b708](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -63,6 +104,84 @@ const Page: React.FC = () => {
     });
   };
 
+  const handleExport = (exportFileType: number) => {

Review comment:
       used  `ExportFileType` instead, thanks a lot




----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/locales/zh-CN.ts
##########
@@ -125,4 +125,8 @@ export default {
   'page.route.TabPane.authentication': '认证',
   'page.route.TabPane.response': '响应结果',
   'page.route.debugWithoutAuth': '当前请求不启用任何认证方式。',
+  'page.route.button.exportOpenApi': '导出OpenApi',

Review comment:
       fixed, thanks




----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (525a8b8) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f2232603588a47f902a90d974692a7c6bea535f?el=desc) (5f22326) will **increase** coverage by `1.66%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1240      +/-   ##
   ==========================================
   + Coverage   42.44%   44.10%   +1.66%     
   ==========================================
     Files          31       31              
     Lines        1932     1943      +11     
   ==========================================
   + Hits          820      857      +37     
   + Misses       1001      974      -27     
   - Partials      111      112       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/utils/utils.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3V0aWxzLmdv) | `59.09% <0.00%> (+1.27%)` | :arrow_up: |
   | [api/internal/handler/route/route.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcm91dGUvcm91dGUuZ28=) | `46.25% <0.00%> (+2.81%)` | :arrow_up: |
   | [api/internal/filter/authentication.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9hdXRoZW50aWNhdGlvbi5nbw==) | `76.47% <0.00%> (+76.47%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [5f22326...525a8b8](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -63,6 +104,84 @@ const Page: React.FC = () => {
     });
   };
 
+  const handleExport = (exportFileType: number) => {
+    exportRoutes(selectedRowKeys.join(',')).then((resp) => {
+      let exportFile: string;
+      let exportFileName = `APISIX_routes_${moment().format('YYYYMMDDHHmmss')}`;
+
+      switch (exportFileType) {
+        case ExportFileType.YAML:
+          exportFile = yaml.dump(resp.data);
+          exportFileName = `${exportFileName}.yaml`;
+          break;
+        case ExportFileType.JSON:
+        default:
+          exportFile = js_beautify(JSON.stringify(resp.data), {
+            indent_size: 2,
+          });
+          exportFileName = `${exportFileName}.json`;
+          break;
+      }
+
+      const blob = new Blob([exportFile], {
+        type: EXPORT_FILE_MIME_TYPE_SUPPORTED[exportFileType],
+      });
+      const aLink = document.createElement('a');

Review comment:
       > Please take a look at `file-saver` if it's helpful
   > 
   > https://github.com/eligrey/FileSaver.js
   
   so cool~! it would be better than native approach, let me updated ASAP, thanks a lot  @juzhiyuan 
   




----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (f6fe1b2) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f2232603588a47f902a90d974692a7c6bea535f?el=desc) (5f22326) will **decrease** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1240      +/-   ##
   ==========================================
   - Coverage   42.44%   42.39%   -0.06%     
   ==========================================
     Files          31       31              
     Lines        1932     1932              
   ==========================================
   - Hits          820      819       -1     
   - Misses       1001     1002       +1     
     Partials      111      111              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `79.37% <0.00%> (-0.63%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [5f22326...f6fe1b2](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (2507fa8) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/6ee8dd15f22e10182a27cbfa4a69b56a3b0f9b43?el=desc) (6ee8dd1) will **increase** coverage by `0.27%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1240      +/-   ##
   ==========================================
   + Coverage   65.48%   65.75%   +0.27%     
   ==========================================
     Files          44       44              
     Lines        2929     2929              
   ==========================================
   + Hits         1918     1926       +8     
   + Misses        782      771      -11     
   - Partials      229      232       +3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/utils/closer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2Nsb3Nlci5nbw==) | `33.33% <0.00%> (ø)` | |
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `87.27% <0.00%> (+1.21%)` | :arrow_up: |
   | [api/internal/core/storage/etcd.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmFnZS9ldGNkLmdv) | `50.50% <0.00%> (+2.02%)` | :arrow_up: |
   | [api/cmd/managerapi.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2NtZC9tYW5hZ2VyYXBpLmdv) | `60.29% <0.00%> (+5.88%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [6ee8dd1...2507fa8](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (92271e6) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/0f322e1d4a03e3416da1ae989fcfa49232035648?el=desc) (0f322e1) will **decrease** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1240      +/-   ##
   ==========================================
   - Coverage   42.44%   42.39%   -0.06%     
   ==========================================
     Files          31       31              
     Lines        1932     1932              
   ==========================================
   - Hits          820      819       -1     
   - Misses       1001     1002       +1     
     Partials      111      111              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `79.37% <0.00%> (-0.63%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [0f322e1...92271e6](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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] starsz commented on pull request #1240: feat(fe): import and export routes

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


   > https://github.com/apache/apisix-dashboard/pull/1240/checks?check_run_id=1700366308
   > 
   > be skywalking e2e test failed, pls take a look when you have time, many thanks~! @nic-chen @starsz
   
   Sorry, I am not very familiar with this. 
   @nic-chen Can you help to deal with it? Otherwise, I will deal with it when I am free.


----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -63,6 +104,84 @@ const Page: React.FC = () => {
     });
   };
 
+  const handleExport = (exportFileType: number) => {
+    exportRoutes(selectedRowKeys.join(',')).then((resp) => {
+      let exportFile: string;
+      let exportFileName = `APISIX_routes_${moment().format('YYYYMMDDHHmmss')}`;
+
+      switch (exportFileType) {
+        case ExportFileType.YAML:
+          exportFile = yaml.dump(resp.data);
+          exportFileName = `${exportFileName}.yaml`;
+          break;
+        case ExportFileType.JSON:
+        default:
+          exportFile = js_beautify(JSON.stringify(resp.data), {
+            indent_size: 2,
+          });
+          exportFileName = `${exportFileName}.json`;
+          break;
+      }
+
+      const blob = new Blob([exportFile], {
+        type: EXPORT_FILE_MIME_TYPE_SUPPORTED[exportFileType],
+      });
+      const aLink = document.createElement('a');

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



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -17,29 +17,70 @@
 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, Select } from 'antd';
+import {
+  Button,
+  Popconfirm,
+  notification,
+  Tag,
+  Space,
+  Select,
+  Radio,
+  Form,
+  Upload,
+  Modal,
+  Divider,
+} from 'antd';
 import { history, useIntl } from 'umi';
-import { PlusOutlined, BugOutlined } from '@ant-design/icons';
+import { PlusOutlined, BugOutlined, ExportOutlined, ImportOutlined } from '@ant-design/icons';
+import { js_beautify } from 'js-beautify';
+import yaml from 'js-yaml';
+import moment from 'moment';
 
 import { timestampToLocaleString } from '@/helpers';
-import { fetchList, remove, fetchLabelList, updateRouteStatus } from './service';
+import { RcFile } from 'antd/lib/upload';
+import {
+  fetchList,
+  remove,
+  fetchLabelList,
+  updateRouteStatus,
+  exportRoutes,
+  importRoutes,
+} from './service';
 import { DebugDrawView } from './components/DebugViews';
+import { EXPORT_FILE_MIME_TYPE_SUPPORTED } from './constants';
 
 const { OptGroup, Option } = Select;
 
 const Page: React.FC = () => {
   const ref = useRef<ActionType>();
   const { formatMessage } = useIntl();
+  const [exportFileTypeForm] = Form.useForm();
+
+  enum RouteStatus {
+    Offline = 0,
+    Publish,
+  }
+
+  enum ExportFileType {
+    Json = 0,

Review comment:
       ```suggestion
       JSON = 0,
       YAML
   ```
   will be better.




----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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


   during debug the FE e2e, I caught an error https://github.com/apache/apisix-dashboard/pull/1240/checks?check_run_id=1776569227, maybe this will be solved by #1372 


----------------------------------------------------------------
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] imjoey commented on pull request #1240: feat(fe): export routes

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


   @liuxiran great work. Thank you very much. Only a small piece of advice, it would be more friendly to non-Chinese developers if you could take the screenshot of the English version. 😄 


----------------------------------------------------------------
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 merged pull request #1240: feat(fe): import and export routes

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


   


----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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


   I wiil deal with the fe e2e failure after related BE prs merged


----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (e661a7e) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/1bdcaa8df2fe2fa6caba23809e69e26c5ad7902d?el=desc) (1bdcaa8) will **decrease** coverage by `18.31%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1240       +/-   ##
   ===========================================
   - Coverage   62.29%   43.97%   -18.32%     
   ===========================================
     Files          42       33        -9     
     Lines        2395     1976      -419     
   ===========================================
   - Hits         1492      869      -623     
   - Misses        722      996      +274     
   + Partials      181      111       -70     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `0.00% <0.00%> (-74.49%)` | :arrow_down: |
   | [api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `0.00% <0.00%> (-62.50%)` | :arrow_down: |
   | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (-55.47%)` | :arrow_down: |
   | [api/internal/handler/server\_info/server\_info.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmVyX2luZm8vc2VydmVyX2luZm8uZ28=) | `57.14% <0.00%> (-33.34%)` | :arrow_down: |
   | [api/internal/utils/closer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2Nsb3Nlci5nbw==) | `0.00% <0.00%> (-33.34%)` | :arrow_down: |
   | [api/internal/handler/consumer/consumer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvY29uc3VtZXIvY29uc3VtZXIuZ28=) | `63.82% <0.00%> (-27.66%)` | :arrow_down: |
   | [api/internal/utils/pid.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3BpZC5nbw==) | `0.00% <0.00%> (-26.67%)` | :arrow_down: |
   | [api/internal/utils/json\_patch.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2pzb25fcGF0Y2guZ28=) | `34.48% <0.00%> (-24.14%)` | :arrow_down: |
   | ... and [24 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [1bdcaa8...e661a7e](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 pull request #1240: feat(fe): import and export routes

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


   > `yarn.lock` should be forced push IMO.
   
   trying to update `yarn.lock`


----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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



##########
File path: web/cypress/integration/route/import_export_route.spec.js
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+/* eslint-disable no-undef */
+import actionBarUS from '../../../src/components/ActionBar/locales/en-US';
+import componentLocaleUS from '../../../src/locales/en-US/component';
+import menuLocaleUS from '../../../src/locales/en-US/menu';
+import routeLocaleUS from '../../../src/pages/Route/locales/en-US';
+context('Create two routes', () => {
+  const domSelector = {
+    route_name: '#name',
+    nodes_0_host: '#nodes_0_host',
+  }
+  const data = {
+    route_name_0: 'route_name_0',
+    route_name_1: 'route_name_1',
+    upstream_node0_host_0: '1.1.1.1',
+    upstream_node0_host_1: '2.2.2.2',
+  }
+
+  const yourFixturePath = './import.json';
+  beforeEach(() => {
+    // init login
+    cy.login();
+  });
+  it('should create route1 and route2', () => {
+    //  go to route create page
+    cy.visit('/');
+    // create two routes
+    for (let i=0; i<2; i += 1) {
+      cy.contains(menuLocaleUS['menu.routes']).click();
+      cy.contains(componentLocaleUS['component.global.create']).click();
+      // input name, click Next
+      cy.get(domSelector.route_name).type(data[`route_name_${i}`]);
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // input nodes_0_host, click Next
+      cy.get(domSelector.nodes_0_host).type(data[`upstream_node0_host_${i}`])
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // do not config plugins, click Next
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // click submit to create route
+      cy.contains(componentLocaleUS['component.global.submit']).click();
+      // submit successfully
+      cy.contains(`${componentLocaleUS['component.global.submit']} ${componentLocaleUS['component.status.success']}`);
+    }
+  });
+  it('should export route: route_name_0, route_name_1', () => {
+    cy.visit('/');
+    cy.contains('Route').click();
+    // select two routes in the list
+    for (let i=0; i<2; i += 1) {
+      cy.contains(data[`route_name_${i}`]).prev().click();
+    }
+    // click Export OpenAPI Button
+    cy.contains(routeLocaleUS['page.route.button.exportOpenApi']).click();
+    // click Confirm button in the popup
+    cy.contains(componentLocaleUS['component.global.confirm']).click();
+    // download a json files
+    // down load a yaml files
+  });
+  it('should import route: route_name_0, route_name_1', () => {
+    cy.visit('/');
+    cy.contains('Route').click();
+    // click import button
+    cy.contains(routeLocaleUS['page.route.button.importOpenApi']).click();
+    //
+    cy.get('[type=file]').attachFile(yourFixturePath);
+    cy.contains(componentLocaleUS['component.global.confirm']).click();
+  });
+});

Review comment:
       extra 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] liuxiran commented on a change in pull request #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/locales/zh-CN.ts
##########
@@ -125,8 +125,8 @@ export default {
   'page.route.TabPane.authentication': '认证',
   'page.route.TabPane.response': '响应结果',
   'page.route.debugWithoutAuth': '当前请求不启用任何认证方式。',
-  'page.route.button.exportOpenApi': '导出 OpenApi',
+  'page.route.button.exportOpenApi': '导出 OpenAPI',
   'page.route.exportRoutesTips': '请选择下载文件的类型',
-  'page.route.button.importOpenApi': '导入 OpenApi',
+  'page.route.button.importOpenApi': '导入 OpenAPI',

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



[GitHub] [apisix-dashboard] liuxiran commented on pull request #1240: feat(fe): import and export routes

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


   I wiil deal with the fe e2e failure after related BE prs merged


----------------------------------------------------------------
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 #1240: feat(fe): export routes

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


   > @liuxiran great work. Thank you very much. Only a small piece of advice, it would be more friendly to non-Chinese developers if you could take the screenshot of the English version.
   
   thanks a lot, the screenshots in the issue descirption have been 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] codecov-io edited a comment on pull request #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (f0f8702) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/0f322e1d4a03e3416da1ae989fcfa49232035648?el=desc) (0f322e1) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #1240   +/-   ##
   =======================================
     Coverage   42.44%   42.44%           
   =======================================
     Files          31       31           
     Lines        1932     1932           
   =======================================
     Hits          820      820           
     Misses       1001     1001           
     Partials      111      111           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [0f322e1...f0f8702](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 pull request #1240: feat(fe): import and export routes

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


   as all the related PRs have been merged and CI passed, this pr is ready, merged, thanks for all your reviews


----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/List.tsx
##########
@@ -18,29 +18,70 @@ import React, { useRef, useEffect, useState } from 'react';
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
 import type { ProColumns, ActionType } from '@ant-design/pro-table';
-import { Button, Popconfirm, notification, Tag, Space, Select } from 'antd';
+import {
+  Button,
+  Popconfirm,
+  notification,
+  Tag,
+  Space,
+  Select,
+  Radio,
+  Form,
+  Upload,
+  Modal,
+  Divider,
+} from 'antd';
 import { history, useIntl } from 'umi';
-import { PlusOutlined, BugOutlined } from '@ant-design/icons';
+import { PlusOutlined, BugOutlined, ExportOutlined, ImportOutlined } from '@ant-design/icons';
+import { js_beautify } from 'js-beautify';
+import yaml from 'js-yaml';
+import moment from 'moment';
 
 import { timestampToLocaleString } from '@/helpers';
-import { fetchList, remove, fetchLabelList, updateRouteStatus } from './service';
+import { RcFile } from 'antd/lib/upload';

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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1240: feat(fe): import and export routes

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


   `yarn.lock` should be forced push IMO.


----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/locales/zh-CN.ts
##########
@@ -125,4 +125,8 @@ export default {
   'page.route.TabPane.authentication': '认证',
   'page.route.TabPane.response': '响应结果',
   'page.route.debugWithoutAuth': '当前请求不启用任何认证方式。',
+  'page.route.button.exportOpenApi': '导出OpenApi',

Review comment:
       ```suggestion
     'page.route.button.exportOpenApi': '导出 OpenApi',
   ```




----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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



##########
File path: web/cypress/integration/route/import_export_route.spec.js
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+/* eslint-disable no-undef */
+import actionBarUS from '../../../src/components/ActionBar/locales/en-US';
+import componentLocaleUS from '../../../src/locales/en-US/component';
+import menuLocaleUS from '../../../src/locales/en-US/menu';
+import routeLocaleUS from '../../../src/pages/Route/locales/en-US';
+context('Create two routes', () => {
+  const domSelector = {
+    route_name: '#name',
+    nodes_0_host: '#nodes_0_host',
+  }
+  const data = {
+    route_name_0: 'route_name_0',
+    route_name_1: 'route_name_1',
+    upstream_node0_host_0: '1.1.1.1',
+    upstream_node0_host_1: '2.2.2.2',
+  }
+
+  const yourFixturePath = './import.json';
+  beforeEach(() => {
+    // init login
+    cy.login();
+  });
+  it('should create route1 and route2', () => {
+    //  go to route create page
+    cy.visit('/');
+    // create two routes
+    for (let i=0; i<2; i += 1) {
+      cy.contains(menuLocaleUS['menu.routes']).click();
+      cy.contains(componentLocaleUS['component.global.create']).click();
+      // input name, click Next
+      cy.get(domSelector.route_name).type(data[`route_name_${i}`]);
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // input nodes_0_host, click Next
+      cy.get(domSelector.nodes_0_host).type(data[`upstream_node0_host_${i}`])
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // do not config plugins, click Next
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // click submit to create route
+      cy.contains(componentLocaleUS['component.global.submit']).click();
+      // submit successfully
+      cy.contains(`${componentLocaleUS['component.global.submit']} ${componentLocaleUS['component.status.success']}`);
+    }
+  });
+  it('should export route: route_name_0, route_name_1', () => {
+    cy.visit('/');
+    cy.contains('Route').click();
+    // select two routes in the list
+    for (let i=0; i<2; i += 1) {
+      cy.contains(data[`route_name_${i}`]).prev().click();
+    }
+    // click Export OpenAPI Button
+    cy.contains(routeLocaleUS['page.route.button.exportOpenApi']).click();
+    // click Confirm button in the popup
+    cy.contains(componentLocaleUS['component.global.confirm']).click();
+    // download a json files
+    // down load a yaml files
+  });
+  it('should import route: route_name_0, route_name_1', () => {
+    cy.visit('/');
+    cy.contains('Route').click();
+    // click import button
+    cy.contains(routeLocaleUS['page.route.button.importOpenApi']).click();
+    //
+    cy.get('[type=file]').attachFile(yourFixturePath);
+    cy.contains(componentLocaleUS['component.global.confirm']).click();
+  });
+});

Review comment:
       done




----------------------------------------------------------------
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 #1240: feat(fe): export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (071b708) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/55e04494e6cafde51d60bad0e4ac722d4e2c8735?el=desc) (55e0449) will **increase** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1240      +/-   ##
   ==========================================
   + Coverage   42.39%   42.44%   +0.05%     
   ==========================================
     Files          31       31              
     Lines        1932     1932              
   ==========================================
   + Hits          819      820       +1     
   + Misses       1002     1001       -1     
     Partials      111      111              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `80.00% <0.00%> (+0.62%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [55e0449...071b708](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (50f95d4) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f2232603588a47f902a90d974692a7c6bea535f?el=desc) (5f22326) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #1240   +/-   ##
   =======================================
     Coverage   42.44%   42.44%           
   =======================================
     Files          31       31           
     Lines        1932     1932           
   =======================================
     Hits          820      820           
     Misses       1001     1001           
     Partials      111      111           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [5f22326...50f95d4](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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] juzhiyuan commented on a change in pull request #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/locales/zh-CN.ts
##########
@@ -125,4 +125,8 @@ export default {
   'page.route.TabPane.authentication': '认证',
   'page.route.TabPane.response': '响应结果',
   'page.route.debugWithoutAuth': '当前请求不启用任何认证方式。',
+  'page.route.button.exportOpenApi': '导出 OpenApi',
+  'page.route.exportRoutesTips': '请选择下载文件的类型',
+  'page.route.button.importOpenApi': '导入 OpenApi',

Review comment:
       ![image](https://user-images.githubusercontent.com/2106987/104534878-0ff4b580-5650-11eb-9aa1-b7878785aa64.png)
   
   ```suggestion
     'page.route.button.importOpenApi': '导入 OpenAPI',
   ```

##########
File path: web/src/pages/Route/List.tsx
##########
@@ -63,6 +104,84 @@ const Page: React.FC = () => {
     });
   };
 
+  const handleExport = (exportFileType: number) => {
+    exportRoutes(selectedRowKeys.join(',')).then((resp) => {
+      let exportFile: string;
+      let exportFileName = `APISIX_routes_${moment().format('YYYYMMDDHHmmss')}`;
+
+      switch (exportFileType) {
+        case ExportFileType.YAML:
+          exportFile = yaml.dump(resp.data);
+          exportFileName = `${exportFileName}.yaml`;
+          break;
+        case ExportFileType.JSON:
+        default:
+          exportFile = js_beautify(JSON.stringify(resp.data), {
+            indent_size: 2,
+          });
+          exportFileName = `${exportFileName}.json`;
+          break;
+      }
+
+      const blob = new Blob([exportFile], {
+        type: EXPORT_FILE_MIME_TYPE_SUPPORTED[exportFileType],
+      });
+      const aLink = document.createElement('a');
+      const evt = document.createEvent('MouseEvents');
+      evt.initEvent('click', false, true);
+      aLink.download = exportFileName;
+      aLink.href = window.URL.createObjectURL(blob);
+      aLink.dispatchEvent(evt);
+    });
+  };
+
+  const handleImport = () => {
+    const formData = new FormData();
+
+    formData.append('file', uploadFileList[0]);
+
+    importRoutes(formData).then(() => {
+      handleTableActionSuccessResponse(
+        `${formatMessage({ id: 'page.route.button.importOpenApi' })}${formatMessage({
+          id: 'component.status.success',
+        })}`,
+      );
+      setShowImportModal(false);
+    });
+  };
+
+  const ListFooter: React.FC = () => {
+    return (
+      <>

Review comment:
       extra Fragment

##########
File path: web/src/pages/Route/List.tsx
##########
@@ -18,29 +18,70 @@ import React, { useRef, useEffect, useState } from 'react';
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
 import ProTable from '@ant-design/pro-table';
 import type { ProColumns, ActionType } from '@ant-design/pro-table';
-import { Button, Popconfirm, notification, Tag, Space, Select } from 'antd';
+import {
+  Button,
+  Popconfirm,
+  notification,
+  Tag,
+  Space,
+  Select,
+  Radio,
+  Form,
+  Upload,
+  Modal,
+  Divider,
+} from 'antd';
 import { history, useIntl } from 'umi';
-import { PlusOutlined, BugOutlined } from '@ant-design/icons';
+import { PlusOutlined, BugOutlined, ExportOutlined, ImportOutlined } from '@ant-design/icons';
+import { js_beautify } from 'js-beautify';
+import yaml from 'js-yaml';
+import moment from 'moment';
 
 import { timestampToLocaleString } from '@/helpers';
-import { fetchList, remove, fetchLabelList, updateRouteStatus } from './service';
+import { RcFile } from 'antd/lib/upload';

Review comment:
       ```suggestion
   import type { RcFile } from 'antd/lib/upload';
   ```

##########
File path: web/src/pages/Route/List.tsx
##########
@@ -63,6 +104,84 @@ const Page: React.FC = () => {
     });
   };
 
+  const handleExport = (exportFileType: number) => {
+    exportRoutes(selectedRowKeys.join(',')).then((resp) => {
+      let exportFile: string;
+      let exportFileName = `APISIX_routes_${moment().format('YYYYMMDDHHmmss')}`;
+
+      switch (exportFileType) {
+        case ExportFileType.YAML:
+          exportFile = yaml.dump(resp.data);
+          exportFileName = `${exportFileName}.yaml`;
+          break;
+        case ExportFileType.JSON:
+        default:
+          exportFile = js_beautify(JSON.stringify(resp.data), {
+            indent_size: 2,
+          });
+          exportFileName = `${exportFileName}.json`;
+          break;
+      }
+
+      const blob = new Blob([exportFile], {
+        type: EXPORT_FILE_MIME_TYPE_SUPPORTED[exportFileType],
+      });
+      const aLink = document.createElement('a');

Review comment:
       Please take a look at `file-saver` if it's helpful
   
   https://github.com/eligrey/FileSaver.js

##########
File path: web/src/pages/Route/List.tsx
##########
@@ -63,6 +104,84 @@ const Page: React.FC = () => {
     });
   };
 
+  const handleExport = (exportFileType: number) => {

Review comment:
       number is not clear enough IMO, could we use keyof or something else to have a clearer typing?




----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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



##########
File path: web/cypress/integration/route/import_export_route.spec.js
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+/* eslint-disable no-undef */
+import actionBarUS from '../../../src/components/ActionBar/locales/en-US';
+import componentLocaleUS from '../../../src/locales/en-US/component';
+import menuLocaleUS from '../../../src/locales/en-US/menu';
+import routeLocaleUS from '../../../src/pages/Route/locales/en-US';
+context('Create two routes', () => {
+  const domSelector = {
+    route_name: '#name',
+    nodes_0_host: '#nodes_0_host',
+  }
+  const data = {
+    route_name_0: 'route_name_0',
+    route_name_1: 'route_name_1',
+    upstream_node0_host_0: '1.1.1.1',
+    upstream_node0_host_1: '2.2.2.2',
+  }
+
+  const yourFixturePath = './import.json';
+  beforeEach(() => {
+    // init login
+    cy.login();
+  });
+  it('should create route1 and route2', () => {
+    //  go to route create page
+    cy.visit('/');
+    // create two routes
+    for (let i=0; i<2; i += 1) {
+      cy.contains(menuLocaleUS['menu.routes']).click();
+      cy.contains(componentLocaleUS['component.global.create']).click();
+      // input name, click Next
+      cy.get(domSelector.route_name).type(data[`route_name_${i}`]);
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // input nodes_0_host, click Next
+      cy.get(domSelector.nodes_0_host).type(data[`upstream_node0_host_${i}`])
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // do not config plugins, click Next
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // click submit to create route
+      cy.contains(componentLocaleUS['component.global.submit']).click();
+      // submit successfully
+      cy.contains(`${componentLocaleUS['component.global.submit']} ${componentLocaleUS['component.status.success']}`);
+    }
+  });
+  it('should export route: route_name_0, route_name_1', () => {
+    cy.visit('/');
+    cy.contains('Route').click();
+    // select two routes in the list
+    for (let i=0; i<2; i += 1) {
+      cy.contains(data[`route_name_${i}`]).prev().click();
+    }
+    // click Export OpenAPI Button
+    cy.contains(routeLocaleUS['page.route.button.exportOpenApi']).click();
+    // click Confirm button in the popup
+    cy.contains(componentLocaleUS['component.global.confirm']).click();
+    // download a json files
+    // down load a yaml files
+  });
+  it('should import route: route_name_0, route_name_1', () => {
+    cy.visit('/');
+    cy.contains('Route').click();
+    // click import button
+    cy.contains(routeLocaleUS['page.route.button.importOpenApi']).click();
+    //
+    cy.get('[type=file]').attachFile(yourFixturePath);
+    cy.contains(componentLocaleUS['component.global.confirm']).click();
+  });
+});

Review comment:
       extra 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] liuxiran commented on pull request #1240: feat(fe): import and export routes

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


   https://github.com/apache/apisix-dashboard/pull/1240/checks?check_run_id=1700366308
   
   be skywalking e2e test failed, pls take a look when you have time, many thanks~! @nic-chen @starsz 


----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/locales/zh-CN.ts
##########
@@ -125,4 +125,8 @@ export default {
   'page.route.TabPane.authentication': '认证',
   'page.route.TabPane.response': '响应结果',
   'page.route.debugWithoutAuth': '当前请求不启用任何认证方式。',
+  'page.route.button.exportOpenApi': '导出OpenApi',
+  'page.route.exportRoutesTips': '请选择下载文件的类型',
+  'page.route.button.importOpenApi': '导入OpenApi',

Review comment:
       fixed 

##########
File path: web/src/pages/Route/List.tsx
##########
@@ -17,29 +17,70 @@
 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, Select } from 'antd';
+import {
+  Button,
+  Popconfirm,
+  notification,
+  Tag,
+  Space,
+  Select,
+  Radio,
+  Form,
+  Upload,
+  Modal,
+  Divider,
+} from 'antd';
 import { history, useIntl } from 'umi';
-import { PlusOutlined, BugOutlined } from '@ant-design/icons';
+import { PlusOutlined, BugOutlined, ExportOutlined, ImportOutlined } from '@ant-design/icons';
+import { js_beautify } from 'js-beautify';
+import yaml from 'js-yaml';
+import moment from 'moment';
 
 import { timestampToLocaleString } from '@/helpers';
-import { fetchList, remove, fetchLabelList, updateRouteStatus } from './service';
+import { RcFile } from 'antd/lib/upload';
+import {
+  fetchList,
+  remove,
+  fetchLabelList,
+  updateRouteStatus,
+  exportRoutes,
+  importRoutes,
+} from './service';
 import { DebugDrawView } from './components/DebugViews';
+import { EXPORT_FILE_MIME_TYPE_SUPPORTED } from './constants';
 
 const { OptGroup, Option } = Select;
 
 const Page: React.FC = () => {
   const ref = useRef<ActionType>();
   const { formatMessage } = useIntl();
+  const [exportFileTypeForm] = Form.useForm();
+
+  enum RouteStatus {
+    Offline = 0,
+    Publish,
+  }
+
+  enum ExportFileType {
+    Json = 0,

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



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #1240: feat(fe): import and export routes

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



##########
File path: web/src/pages/Route/locales/zh-CN.ts
##########
@@ -125,4 +125,8 @@ export default {
   'page.route.TabPane.authentication': '认证',
   'page.route.TabPane.response': '响应结果',
   'page.route.debugWithoutAuth': '当前请求不启用任何认证方式。',
+  'page.route.button.exportOpenApi': '导出OpenApi',
+  'page.route.exportRoutesTips': '请选择下载文件的类型',
+  'page.route.button.importOpenApi': '导入OpenApi',

Review comment:
       ditto.




----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (2507fa8) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/6ee8dd15f22e10182a27cbfa4a69b56a3b0f9b43?el=desc) (6ee8dd1) will **decrease** coverage by `21.74%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1240       +/-   ##
   ===========================================
   - Coverage   65.48%   43.74%   -21.75%     
   ===========================================
     Files          44       35        -9     
     Lines        2929     2508      -421     
   ===========================================
   - Hits         1918     1097      -821     
   - Misses        782     1254      +472     
   + Partials      229      157       -72     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `0.00% <0.00%> (-70.41%)` | :arrow_down: |
   | [api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (-55.47%)` | :arrow_down: |
   | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/handler/upstream/upstream.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvdXBzdHJlYW0vdXBzdHJlYW0uZ28=) | `20.16% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `27.41% <0.00%> (-37.50%)` | :arrow_down: |
   | [api/internal/handler/server\_info/server\_info.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmVyX2luZm8vc2VydmVyX2luZm8uZ28=) | `57.14% <0.00%> (-33.34%)` | :arrow_down: |
   | [api/internal/utils/closer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2Nsb3Nlci5nbw==) | `0.00% <0.00%> (-33.34%)` | :arrow_down: |
   | ... and [30 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [6ee8dd1...2507fa8](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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 #1240: feat(fe): export routes

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


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=h1) Report
   > Merging [#1240](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=desc) (f93c44a) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/55e04494e6cafde51d60bad0e4ac722d4e2c8735?el=desc) (55e0449) will **increase** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1240      +/-   ##
   ==========================================
   + Coverage   42.39%   42.44%   +0.05%     
   ==========================================
     Files          31       31              
     Lines        1932     1932              
   ==========================================
   + Hits          819      820       +1     
   + Misses       1002     1001       -1     
     Partials      111      111              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1240/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `80.00% <0.00%> (+0.62%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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/1240?src=pr&el=footer). Last update [55e0449...f93c44a](https://codecov.io/gh/apache/apisix-dashboard/pull/1240?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] juzhiyuan commented on pull request #1240: feat(fe): import and export routes

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


   wait for the other 2 backends PRs.


----------------------------------------------------------------
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 #1240: feat(fe): import and export routes

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



##########
File path: web/cypress/integration/route/import_export_route.spec.js
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+/* eslint-disable no-undef */
+import actionBarUS from '../../../src/components/ActionBar/locales/en-US';
+import componentLocaleUS from '../../../src/locales/en-US/component';
+import menuLocaleUS from '../../../src/locales/en-US/menu';
+import routeLocaleUS from '../../../src/pages/Route/locales/en-US';
+context('Create two routes', () => {
+  const domSelector = {
+    route_name: '#name',
+    nodes_0_host: '#nodes_0_host',
+  }
+  const data = {
+    route_name_0: 'route_name_0',
+    route_name_1: 'route_name_1',
+    upstream_node0_host_0: '1.1.1.1',
+    upstream_node0_host_1: '2.2.2.2',
+  }
+
+  const yourFixturePath = './import.json';
+  beforeEach(() => {
+    // init login
+    cy.login();
+  });
+  it('should create route1 and route2', () => {
+    //  go to route create page
+    cy.visit('/');
+    // create two routes
+    for (let i=0; i<2; i += 1) {
+      cy.contains(menuLocaleUS['menu.routes']).click();
+      cy.contains(componentLocaleUS['component.global.create']).click();
+      // input name, click Next
+      cy.get(domSelector.route_name).type(data[`route_name_${i}`]);
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // input nodes_0_host, click Next
+      cy.get(domSelector.nodes_0_host).type(data[`upstream_node0_host_${i}`])
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // do not config plugins, click Next
+      cy.contains(actionBarUS['component.actionbar.button.nextStep']).click();
+      // click submit to create route
+      cy.contains(componentLocaleUS['component.global.submit']).click();
+      // submit successfully
+      cy.contains(`${componentLocaleUS['component.global.submit']} ${componentLocaleUS['component.status.success']}`);
+    }
+  });
+  it('should export route: route_name_0, route_name_1', () => {
+    cy.visit('/');
+    cy.contains('Route').click();
+    // select two routes in the list
+    for (let i=0; i<2; i += 1) {
+      cy.contains(data[`route_name_${i}`]).prev().click();
+    }
+    // click Export OpenAPI Button
+    cy.contains(routeLocaleUS['page.route.button.exportOpenApi']).click();
+    // click Confirm button in the popup
+    cy.contains(componentLocaleUS['component.global.confirm']).click();
+    // download a json files
+    // down load a yaml files
+  });
+  it('should import route: route_name_0, route_name_1', () => {
+    cy.visit('/');
+    cy.contains('Route').click();
+    // click import button
+    cy.contains(routeLocaleUS['page.route.button.importOpenApi']).click();
+    //
+    cy.get('[type=file]').attachFile(yourFixturePath);
+    cy.contains(componentLocaleUS['component.global.confirm']).click();
+  });
+});

Review comment:
       done




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