The environments page (/group/project/environments) currently shows all environments that exist. This is impractical long before my "create 10,000 dynamic review apps" test case.
16:37:19 gitlab-workhorse.1 | localhost:3000 [::1]:59184 - - [2016-12-09 16:36:37.249412121 +0000 GMT] "GET /root/reviewing/environments.json HTTP/1.1" 200 3309398 "http://localhost:3000/root/reviewing/environments" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:50.0) Gecko/20100101 Firefox/50.0" 41.777480
Proposal
Extend the backend to support pagination, and the frontend to do pagination while respecting the different environment_type groups.
Links / references
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
@ayufan and @filipa is it correct that there needs to be a design here that paginates the environments within a review environments folder/group ? I believe it already should have functionality that if it exceeds a certain number of environments it will show a button to see all sub environments on their own view, with pagination not?
@dimitrieh@ayufan@grzesiek
I don't think it solves it, because the items inside a folder are already on the frontend, since they have to be changed into a new structure in order to be displayed as folders, so this would not help with the loading time/performance since it would be on the Frontend only.
It would solve if the "show all..." button would make a call to the API requesting more environments, which would not be the case with the code we have now.
We could make that work, but both Frontend and Backend would need some deeper changes:
The folder structure would have to be sent by the Backend instead of being calculated in the Frontend and for each folder we would need 2 new fields, one to know if there are more environments under that folder, and the other with the URL to make the request.
The view would have to be changes as well to support this, but is not a huge change.
However:I think we can make this work with a classic pagination.
When we render the view, the folders are closed. This means the number of visible environments will not match the number of environments received. But I don't think it is a problem.
Scenario:
We have a folder with 1000 environments
The user is on the first page and opens the folder, clicks to go to the second page. The second page would have the folder name and the environments sent in this second request.
TL;DR;
IMO, The prettiest more awesome solution would me a mix of the two
We need pagination, as we can see here https://gitlab.com/gitlab-com/www-gitlab-com/environments, I suggest we go for the classic pagination in a first iteration and if we realise it does not work/it won't scale, we can implement the mix of the two solutions.
In the case the user has one folder with 1000 environments:
Will see one closed folder when he gets to the page.
When the user opens the folder, will see the first 30 (assuming we request 30 at a time)
When clicks next, will see the folder name and the following 30
Scenario 2:
In the case the user has several folders it could get trickier. But I think we can make it work if we order them by environment_type and date.
Scenario 3:
List of environments without any folder. both paginations would work, but wouldn't it be odd to have a different pagination here than in everywhere else?
Also, with the classic one we can share a link to the exact page. We can't do that with the 'show all ... ' button.
there is a separate API call to get the list of the folders
we paginate folders the usual way
there is a separate API call to get environments inside folders
when someone opens a folders, there is an inner pagination as well
This is more like your proposal to mix frontend and backend changes here. This is a significant effort required to implement that, on both, backend and frontend sides. Any ideas how to make is more simple?
there is a separate API call to get the list of the folders
we paginate folders the usual way
is it the same as this?
The folder structure would have to be sent by the Backend instead of being calculated in the Frontend and for each folder we would need 2 new fields, one to know if there are more environments under that folder, and the other with the URL to make the request.
My suggestion is the API will send an array with both environments and folders with environments instead of doing that transformation in the frontend.
Something like this:
@filipa My point was to introduce two separate endpoints (one for getting the paginated list of folder, and second for getting the paginated list of environments inside the folder), because when you have folder with hundreds of environment you will need additional pagination anyway.
I agree with @dimitrieh's suggestion. Just to further clarify so there's no confusion:
if enough static environments and dynamic environment folders are present, it will create pagination to paginate those rows.
In …/environments there will be a pagination control (1, 2, 3, …) for static environments and dynamic environment folders only.
the "load more" button will load up a page specific to those sub environments with a unique url
Dynamic environment folders have their own page (e.g. …/environments/<folder>) if they have more than 10 dynamic environments inside them. On that page, the dynamic environments list for that folder has a pagination control (1, 2, 3, …).
Can we write an API call that will return paginated root folder? I have concerns that there can be some ~Performance penalty when we will have hypothetical 1000 of environments.
In the second iteration, because we did https://gitlab.com/gitlab-org/gitlab-ce/uploads/4914c5fcae10d8417f9efffd15a71794/image.png. This will allow us to later purely in Frontend to implement expandable folders that will be dynamically loaded when expanded because we will already have all API needed to do that improvement. This is a small regression to what we have now: we have expandable folders, but I don't think that this is the right thing to do that in the first iteration.
We effectively receive a list of folders with information about the name of the folder (or name of the environment if this is not in a folder), a number of environments of the same type and the ID of the newest created one.
This would allow us to return this data in API calls. There are two examples:
1. Return a list of environments, with indication that some of them do have siblings:
Based on this data. The entry review/my-review-app could be presented as a folder. However, this makes it a little inconsistent as we mix data in the API result.
2. Return a list of items with indication what needs to be shown: folder or not.
This is more consistent, as we return a name of the item and we evaluate whether we show folder or the first_item based on number returned by environments.
Final note for API
For me it seems that solution 2. is the better, but I'm leaving that up to @grzesiek and @filipa to decide.
Extra
Our API should also include information about a number of available and stopped environments:
{ count: { available: 100, stopped: 5000 }}
Other discussed solutions
Two API endpoints: expose these folders in separate endpoint, and another endpoint would expose environments,
Create a migration where we would create environment folder in the database and fetch by the user. It has drawbacks,
Paginating resources that belong to groups. We fetch project environments, we paginate that on regular basis, and we calculate environments from a paginating resource.
@filipa sure! however i don't exactly know what you are asking about which icons/colors? i basically created these views in the browser, reusing what was already there. PM me if you need anything specific!