-
Notifications
You must be signed in to change notification settings - Fork 28
[ui] Add infinite pagination/scrolling in subnet's visual hosts view #66 #89
Conversation
5f1b980
to
fbce0b5
Compare
Pull Request Test Coverage Report for Build 351
💛 - Coveralls |
I have implemented this feature the way wanted there: #66 (comment), there are only 5 pages in DOM tree at time to reduce memory usage, however a few measurements have shown me that keeping these pages as a JS object doesn't really consume much memory compared to the entire page, so in this implementation they are stored this way client-side so there's no need to fetch one page from server multiple times. I see visualization is disabled on IPV6 networks, should I make it work? |
I created a really large subnet like |
@atb00ker No, it's woking with such subnet on my end, could you tell what browser do you use and how does it exactly behave? I have tested in both on firefox and chromium. |
19a7cb8
to
61d3cde
Compare
Hi, sorry for sharing a google drive link but I don't have the time to debug this so I am attaching a video, I tested on |
The behaviour isn't smooth, it's hard to navigate from one subnet to another or to find a specific subnet. @nemesisdesign what do you think? I am thinking to peek into the implementation of |
I changed that implementation a bit, now start of every page is aligned to the left, it may look a bit worse, but with this approach it's no longer 'hopping' when scrolling. I also turned off browser's automatic scroll anchoring and replaced it with a code that manually prevents random scrolling, It should fix your issue on chrome @atb00ker, could you check if it did? |
7d6d630
to
693a76f
Compare
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.
I see good progress!
Please make sure this feature does not impact subnets which have a manegeable size, for example, standard /24 subnets should look very similar to how they looked before.
For some reason I can't scroll by using my mouse, does it happen to you as well?
django_ipam/templates/admin/django-ipam/subnet/change_form.html
Outdated
Show resolved
Hide resolved
django_ipam/templates/admin/django-ipam/subnet/change_form.html
Outdated
Show resolved
Hide resolved
django_ipam/templates/admin/django-ipam/subnet/change_form.html
Outdated
Show resolved
Hide resolved
django_ipam/templates/admin/django-ipam/subnet/change_form.html
Outdated
Show resolved
Hide resolved
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.
@pawelplsi @nemesisdesign
I tested it, it works! 😄
For some reason I can't scroll by using my mouse, does it happen to you as well?
When using a scrollbar inside a page, the behaviour is really flaky and dependant on your type of pointer & browser, that's why scroll highjacking is discouraged at some places.
I have 2 mouses,
- Internal one scrolls on focus, if curser is inside the subnet section, it scrolls that section.
- External mouse requires me to hold right button while scrolling, try doing that, it might work for you! 😄
@nemesisdesign |
@pawelplsi I mean I cannot scroll by pressing the mouse left button and dragging it up or down |
Huh, the scrollbar was partially covered with right menu/drawer object, one of most annoying things I debugged recently 😄 |
7c9285c
to
227ced1
Compare
77cd96e
to
ca17750
Compare
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.
LGTM! 😄
Final testing done on chrome and firefox! 😄
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.
Wait a minute, why is IPv6 not implemented?
I think in the past we excluded ipv6 subnets exactly because they would not load since the page would be too big.
Since we solved that problem with this solution we should support IPv6 as well!
django_ipam/templates/admin/django-ipam/subnet/change_form.html
Outdated
Show resolved
Hide resolved
5a1b2b9
to
a8556df
Compare
I added IPv6 support, that let me simplify some logic also, and wrote a custom pagination (start adddress parameter instead of page number) that will be more convenient later in fixing #91, now I only need to write some more tests to increase the coverage. |
…penwisp#66 Added infinite scrolling, added visualization in IPv6 subnet edit form, optimized subnet chart data queries. Should fix openwisp#66
@atb00ker added fixed width margins to these cells, it seems to be fixed now 😄 |
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.
Great work!
I am going to apply a small css fix (a28b66c) to resolve an issue that causes a line break at each page. While I applied that fix in my dev branch I noticed another issue for which I opened an issue for:
#96.
Another follow up is to add support for this into openwisp-ipam: openwisp/openwisp-ipam#24.
@pawelplsi I think you're the best person right now to fix it, it's not a big deal, it's just a matter of changing the HTML tags. The rest of the functionality should be intact.
Thanks for your appreciation @nemesisdesign, but are you sure inlining page divs is the right way to go? I have not done it that way by an accident. The pages are not always as wide as your screen is, so after a page is removed from the beginning (to save memory) the pages are aligned differently, so the hosts are 'hopping' through the list, as I explained in comments above, I tried to solve it but I didn't manage to do it any efficient way, and I think it's possible there's no 'not-dirty' way to solve that. Although the line breaks may not look really well to you, I think that the problem above is a way more annoying. |
@pawelplsi occasional hops while scrolling an infinite scroller is pretty common, but if you can find a solution that solves both problems (line break and hopping) would be great! Otherwise we can live with the occasional hopping, the line-break is too obvious to keep, it makes it look unprofessional. |
Fixes little issue with hosts list href/align/styling Fixes openwisp#89
Should fix #66