Skip to content
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

frontend: Handle large list of ports #2038

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

ashu8912
Copy link
Member

When we have a lot of container ports exposed on a pod the page gets very slow, This PR takes care of not rendering all port items at once but allowing to gradually show more ports by adding a button for that.

@ashu8912
Copy link
Member Author

Screenshot 2024-06-13 at 12 17 44 PM

@ashu8912 ashu8912 force-pushed the large-port-list-handle branch 2 times, most recently from fc3b1a0 to 3c5102b Compare June 13, 2024 06:50
@ashu8912
Copy link
Member Author

cc @lijianzhi01

Copy link
Collaborator

@joaquimrocha joaquimrocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of comments. Also added a fixup commit just to add the base for a storybook story since we should have this tested.

@@ -738,7 +739,6 @@ export function ContainerInfo(props: ContainerInfoProps) {
}) {
const { rows } = props;
const id = useId('status-value-');

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not remove this.

portsToShow &&
container.ports &&
portsToShow.length < container.ports.length && (
<Grid item xs={12}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we show allow these to be displayed horizontally since there's a lot of horizontal space which can help reduce the needed height when there are many items.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated it to take up horizontal space as well keeping in mind that we also show a port forward button beside these container ports on desktop app

<Grid item xs={12}>
<Box display="flex" mt={2}>
<Button onClick={() => setMaxPortsToShow(prev => prev * 2)}>
{t('translation|Show More')}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this gradual show is the correct one here. Just use a button "Show All" for example. Also makes the code simpler.
How many ports did this user have BTW?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it for a 1000 ports exposed, I am not sure if that's something which is likely in a real world scenario.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a show all commit fixup today to check how it felt. I think in a real use-case scenario, users are unlikely to want to discover ports gradually by doing the show more. Normally they want to see whether a certain port is there or to see all of them. I understand we cannot show them all by default, because it slows down the whole view if we have a lot of ports to display, but if that's a consequence of a user action (clicking "Show All") then I think it's acceptable.
Now sure why the tests are failing as I did update the snapshots.

@illume illume marked this pull request as draft June 18, 2024 14:55
@illume illume marked this pull request as draft June 18, 2024 14:55
Signed-off-by: ashu8912 <aghildiyal@microsoft.com>
Signed-off-by: Joaquim Rocha <joaquim.rocha@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants