-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix/1077 apps page reload pagination #840
Open
BeriBoss
wants to merge
7
commits into
angular_fixes
Choose a base branch
from
bugfix/1077-apps-page-reload-pagination
base: angular_fixes
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bf3a5bb
to
2f47ce9
Compare
14 tasks
2f47ce9
to
a30daa2
Compare
@@ -86,9 +86,8 @@ public void testGetAppServersWithApplications() throws Exception { | |||
UserSettingsEntity userSettings = Mockito.mock(UserSettingsEntity.class); | |||
Mockito.when(userSettingsService.getUserSettings(Mockito.anyString())).thenReturn(userSettings); | |||
List<ResourceEntity> aslist = Arrays.asList(as); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, only a single app server is added to this list. Making the test more robust by mocking multiple application servers would be beneficial
AMW_business/src/main/java/ch/puzzle/itc/mobiliar/business/apps/boundary/ListAppsUseCase.java
Show resolved
Hide resolved
.../src/main/java/ch/puzzle/itc/mobiliar/business/resourcegroup/boundary/ResourceRelations.java
Outdated
Show resolved
Hide resolved
...n/java/ch/puzzle/itc/mobiliar/business/domain/applist/ApplistScreenDomainServiceQueries.java
Show resolved
Hide resolved
9264edb
to
22dea9d
Compare
llorentelemmc
approved these changes
Mar 5, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug: Incorrect Pagination on the Apps Page
The pagination on the Apps page was faulty. When on the page, a list of app servers with their apps was displayed, but neither the correct number of app servers (not the selected maximum results per page) nor the correct number of pages for all results was displayed.
Incorrect Behavior: If the maximum number of results per page was set to 10 and there were a total of 50 results, 7 app servers were displayed on the first page, but it was indicated that there were 5 pages. On the next page, 3 app servers were displayed, etc.
Correct Solution: 10 app servers should be displayed per page and it should be indicated that there are 5 pages.
Cause of the Error: The error was in the backend. The idea was that the frontend could make a REST call and specify the following query parameters:
The endpoint should then return the filtered result with the correct offset (which page am I on) and the correct maximum number of results per page.
First Problem: The total number of results (
result.getB()
) was always returned as the number of all unfiltered Resource Entities with the ResourceType = APPLICATIONSERVER.ch.mobi.itc.mobiliar.rest.apps.AppsRest#getApps
:return Response.status(OK).entity(appServersToResponse(result.getA())).header("X-total-count", result.getB()).build();
Solution to that would have been:
return Response.status(OK).entity(appServersToResponse(result.getA())).header("X-total-count", result.getA().size()).build();
Second Problem: Even if the total number of results had been corrected, the pagination would still not have worked. The reason for this was that the endpoint set a query that retrieved all Resource Entities with the ResourceType = APPLICATIONSERVER and the filtered name. The offset and limit were then set in the query:
The idea was to reduce the load time by only retrieving the "paginated" results directly. However, the problem was that this already paginated list of results was filtered twice in the business logic, so that the set start and limit no longer matched the final list.
Solution: The original solution would have been to correct the pagination, but this would have increased the load time (See commit: b695fa0 ). Since the DB was already under load, it was decided to remove the pagination and initially display only the first 20 app servers, as it was in the old version.