jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.53k stars 4.02k forks source link

Default Page Size and Max Page Size setting for pre-populated Dropdowns / select boxes #22371

Closed OmarHawk closed 3 months ago

OmarHawk commented 1 year ago
Overview of the feature request

Hi,

In #6734 and in #6339 there were suggestions regarding getting the dropdowns / select boxes for the *ToMany relations actually be usable if in the remote tables contain more than 20 entries. While I can fix it by myself in my own project by just providing corresponding spring data settings settings (maxPageSize also needs to be set like that unfortunately, because it otherwise defaults to 2000)

spring.data.web.pageable.defaultPageSize=2147483647
spring.data.web.pageable.maxPageSize=2147483647

or by providing a custom PageableConfiguration

@Configuration
public class PageableConfiguration implements WebMvcConfigurer {

    private static final int MAXIMUM_PAGE_SIZE = Integer.MAX_VALUE;

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        PageableHandlerMethodArgumentResolver resolver = new PageableHandlerMethodArgumentResolver();

        resolver.setFallbackPageable(PageRequest.of(0, MAXIMUM_PAGE_SIZE));
        resolver.setMaxPageSize(MAXIMUM_PAGE_SIZE);

        argumentResolvers.add(resolver);
    }
}

I think, it would still be worth taking up the discussion, as the select boxes and dropdowns are not really usable in the default configuration. As a quick win, one could theoretically provide these values mentioned above, but could potentially run in OutOfMemoryErrors. as mentioned in the corresponding Spring Data Javadoc:

https://github.com/spring-projects/spring-data-commons/blob/2937d620ad952e32a0fc0009becd9e880b0b9003/src/main/java/org/springframework/data/web/PageableHandlerMethodArgumentResolverSupport.java#L91-L99

So, ideally, we would rather provide frontend components instead of standard dropdowns / selects being capable of also handling Pageable parameters...

Motivation for or Use Case

UI for Many-relationships by default not really usable. I think, that should still be the case for a freshly generated application. ;-)

Related issues or PR

Issues #6734 #6339 - both have just been closed without finally providing either one of the suggested solutions. + I don't agree that everyone should fix such a thing by him/herself. ;-) related PR #6618 also closed without fianlly providing a solution

github-actions[bot] commented 9 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days

atomfrede commented 9 months ago

As an idea we could open a modal dialog with a list providing proper pagination and maybe a filter too.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days