[CONTROLLER-428] RESTConf API Explorer: Add pagination and searching Created: 29/Apr/14  Updated: 14/Nov/17  Resolved: 02/Oct/14

Status: Resolved
Project: controller
Component/s: restconf
Affects Version/s: Helium
Fix Version/s: None

Type: Improvement
Reporter: Abhishek Kumar Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS
Platform: PC



 Description   

There are a lot of yang modules (current count is 84) in controller. Rendering APIs for all those is extremely slow in API Explorer. Pagination and search support would limit the number of modules that needs to be rendered in UI. As a result, it would speed up the load time.



 Comments   
Comment by Jozef Gloncak [ 11/Jul/14 ]

Is it possible to use pagination? Can you give me some hint?

Comment by Devin Avery [ 11/Jul/14 ]

Here is how I would approach this.

1) Split searching into another bug
2) For pagination... see below.

To add pagination the first thing you would need to do is modify the rest APIs to take a page number as a query parameter, and possible a page size.

  • I would make these arguments optional
  • If pageSize is provided, but not pageNumber, default pageNumber = 1
  • If pageNumber is provided, but not pageSize, default pageSize=20 (or some other number)
  • If neither page # or page size is provided, then default pageNumber=1 and pageSize = to max size (i.e. all)
  • Paging relies on having a sorted list so you can correctly index into the list each time. Since we already sort the modules by name / revision etc this shouldn't be difficult. So likely you can continue to get back the entire list of modules and then page as a second step if needed.
  • You also need to modify the return information to somehow include either:
    1) That there is a "next page" or
    2) How many more elements there are, so the UI can figure out what the next page is.

Once you have modified the APIs to support paging you need to modify the web page to provide the concept of paging. This will require modifying the HTML page to make the initial call with the correct page information and then showing what page you are on, providing next calls etc. You will see that we have already abstracted away the idea of loading the swagger UI to a method call, so that should hopefully be easy. So when someone loads the next page, you make the new rest call with the new page information.

Comment by Devin Avery [ 11/Jul/14 ]

I should add though - the "slowness" that is referred to in this bug is really caused by the hundreds of possible rest calls under each module. Not the number of modules. We actually reduce the number of modules down to 18 by removing any module that didn't have a rest conf URL exposed.

So paging modules actually isn't going to get us much...

So what I said before is probably the wrong thing. We really want to page the URLs underneath a module...and that I am not sure how to do - it seems like it is something that would need to be added to the swagger functionality.

Perhaps we should just settle with showing a loading indicator while the swagger UI is doing its thing...??

Comment by Jozef Gloncak [ 01/Oct/14 ]

It was reported that pagination and searching should be available to
decrease amount of data which have to be transferred when REST API for all
YANG modules is generated.

Currently after GET on
http://server:port/apidoc/apis/modules
the list of yang modules will be returned. Every listed module contains at
least one rpc or list|container as top level. It is also possible to
search via searching area in top right corner. It is also possible to
display pagination (currently it is switched off).
This returning html isn't existing file and is generating. Probably it would be possible to create html file which would do this REST call bug it would require more investigation

Every module name in table is hyperlink
http://server:port/apidoc/explorer?moduleName=name&revision=YYYY-DD-MM
It will navigate swagger UI where only API links for this module are loaded.

Original access to REST apis kept preserved. It means that is is still
possible to list all REST apis via
http://server:port/appidoc/explorer

Patch set
https://git.opendaylight.org/gerrit/#/c/11691/

Comment by Abhishek Kumar [ 02/Oct/14 ]

This enhancement is not needed anymore. The list of yang modules loaded in api explorer has been filtered down to about 20 and the UI rendering is not slow anymore.

Generated at Wed Feb 07 19:52:59 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.