apisix-dashboard icon indicating copy to clipboard operation
apisix-dashboard copied to clipboard

bug: when created route by adminAPI, "method" can be null value which dashboard can not identify

Open idbeta opened this issue 6 years ago • 14 comments

  • Why do you submit this issue?
  • [ ] Question or discussion
  • [x] Bug
  • [ ] Requirements
  • [ ] Feature or performance improvement
  • [ ] Other

when created route by adminAPI, method can be null value which mean all method good to use, bug dashboard can not identify. adminAPI,no method, means all method can be used:

curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
 {
     "name":"test_route_%s",
     "uri": "/name/1/*",
     "upstream": {
         "type": "roundrobin",
         "nodes": {
             "127.0.0.1:9797": 1
         }
     }
}

dashboard, can not identify image

idbeta avatar Nov 11 '20 08:11 idbeta

cc @membphis to determine this issue.

juzhiyuan avatar Nov 11 '20 09:11 juzhiyuan

adminAPI,no method, means all method can be used

confirm, that is the default way for admin API. we'd better keep same for this process

membphis avatar Nov 15 '20 03:11 membphis

This will make confusion in the frontend, two solutions here,

  1. If the response doesn't have that field, the manager-api will modify it and apply all HTTP methods.
  2. Update APISIX's logic, though it's a default action, it's not clear and will lead to complexity if using the dashboard, right?

juzhiyuan avatar Nov 15 '20 03:11 juzhiyuan

for method, I think the Admin API's logic is fine.

  1. no method: means any method.
  2. has method: limit with listed method.

It is the same as other fields, eg: host, remote_addr etc.

image

membphis avatar Nov 18 '20 06:11 membphis

It may be reasonable in the APIs, but it's not in GUI (UX). Let's hear others' opinions.

cc @liuxiran @LiteSun @moonming @ShiningRush

juzhiyuan avatar Nov 18 '20 09:11 juzhiyuan

I think there is good with the dashboard interaction now

moonming avatar Nov 18 '20 09:11 moonming

The dashboard does not need to be completely consistent with the admin API

moonming avatar Nov 18 '20 09:11 moonming

  1. no method: means any method.

I don't think the user should remember these default rules, otherwise it will be very difficult to use Dashboard later as the number of default rules increases.

LiteSun avatar Nov 18 '20 13:11 LiteSun

I don't think the user should remember these default rules, otherwise it will be very difficult to use Dashboard later as the number of default rules increases.

agree +1 What you see is what you get is easier for users to accept😊, at the same time, the page supports multiple choices, which can cover all scenarios of method field, that is enough

liuxiran avatar Nov 18 '20 14:11 liuxiran

I think we can use multiple-select instead of check box, then we can select/unselect all methods through a shortcut button(such as select all) instead of clicking them one by one.

BTW: when I first saw the UI interaction of the method, I found it very inconvenient to use. The checkbox occupies too much page space and must be clicked one by one : ( it is a chance to optimize interaction.

ShiningRush avatar Nov 19 '20 03:11 ShiningRush

Nice catch for me! And the antd should support this.

juzhiyuan avatar Nov 19 '20 03:11 juzhiyuan

for method, I think the Admin API's logic is fine.

  1. no method: means any method.

That is not for Admin API, that is the default action for Route.

image

Please read the doc of Route: https://github.com/apache/apisix/blob/master/doc/admin-api.md#route

Same issue: hosts, methods and remote_addrs.

membphis avatar Nov 23 '20 15:11 membphis

And I believe that many users' route data does not have the methods field.

membphis avatar Nov 23 '20 15:11 membphis

current solution: use multiple select[1] to resolve this issue

[1] https://ant.design/components/select-cn/

juzhiyuan avatar Nov 24 '20 03:11 juzhiyuan