-
Notifications
You must be signed in to change notification settings - Fork 169
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
base: main
Are you sure you want to change the base?
Conversation
fc3b1a0
to
3c5102b
Compare
cc @lijianzhi01 |
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.
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-'); | |||
|
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.
Do not remove this.
portsToShow && | ||
container.ports && | ||
portsToShow.length < container.ports.length && ( | ||
<Grid item xs={12}> |
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.
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.
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 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')} |
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 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?
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 tested it for a 1000 ports exposed, I am not sure if that's something which is likely in a real world scenario.
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 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.
a790524
to
acd7832
Compare
acd7832
to
5836a44
Compare
Signed-off-by: ashu8912 <aghildiyal@microsoft.com>
5836a44
to
8285993
Compare
Signed-off-by: Joaquim Rocha <joaquim.rocha@microsoft.com>
8285993
to
78c4f58
Compare
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.