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

feat: allow to add port mappings when image has no exported port (#1046) #1265

Merged
merged 6 commits into from
Jan 27, 2023

Conversation

lstocchi
Copy link
Contributor

@lstocchi lstocchi commented Jan 26, 2023

What does this PR do?

Allow to add port mappings when starting an image that has no exported ports.

Screenshot/screencast of this PR

If there is no exported port, the user is free to add multiple local:remote port mappings
new_port_mapping_5

What issues does this PR fix or reference?

fixes #1046

How to test this PR?

  1. Pull rancher/hello-world
  2. Start it

@slemeur
Copy link
Contributor

slemeur commented Jan 26, 2023

Nice job @lstocchi !

If we want to be consistent in term of UI/UX with the other options, shouldn't we have the same type of layout with two columns and the '+' button?
Left column would be host port and right column container port? WDYT

@lstocchi
Copy link
Contributor Author

lstocchi commented Jan 26, 2023

If we want to be consistent in term of UI/UX with the other options, shouldn't we have the same type of layout with two columns and the '+' button? Left column would be host port and right column container port? WDYT

Sure, now that you make me think about it, yes 😓 . I didn't notice it's the same exact case of adding new envs, for example.

@slemeur
Copy link
Contributor

slemeur commented Jan 26, 2023

Also, if in the container definition there are already exposed port, we are showing it like this:
Capture d’écran 2023-01-26 à 12 04 57

Maybe, we should make that consistent - and allow the user to add additional port mapping even if the image has some pre-defined exposed port?

@lstocchi
Copy link
Contributor Author

lstocchi commented Jan 26, 2023

Maybe, we should make that consistent - and allow the user to add additional port mapping even if the image has some pre-defined exposed port?

@slemeur It's certainly a use-case that could happen, do we want to always show those fields or I add a button that creates new fields when requested?

This is static, always visible. Maybe we should add a sentence to explain it
immagine

By adding new fields dynamically
new_port_mapping

WDYT? Do you have other ideas?

@slemeur
Copy link
Contributor

slemeur commented Jan 26, 2023

I really like the dynamic approach you choose. Works well IMO.
Let's maybe clarify the tooltip on the "+" action?

@benoitf
Copy link
Collaborator

benoitf commented Jan 26, 2023

do we need to add a small text/subsection before the ports exposed from the EXPOSE instructions in the Dockerfile
And then add 'additional exposure/ports' where we can add new ports ?

@deboer-tim
Copy link
Contributor

To me it isn't obvious looking at the UI that clicking on the [+] would create another port vs doing something on the existing port 80/9000, so I wouldn't have even looked at the hover help. If there are two existing ports it would probably be more confusing, so I would +1 Florent's comments to separating it and making it more obvious in the UI (but keeping it simple/compact is good).

I'm the kind of person that notices the volume, port, and environment variables all have two text fields and the middles are at three different y positions. :) The local 80/9000 port essentially creates a fourth. Would appreciate it if you could fix at least some of this, and line up the new port columns with something existing.

@lstocchi
Copy link
Contributor Author

New day, new proposals

Based on your feedbacks I see this in two ways.

The first is just a static section which is always visible. Maybe we can indent the title and inputs a bit to the right to show they are children of the parent port mapping section.

additional_port

the second is an evolution of the dynamic button.
Added a text so everyone notices it. When clicked extra inputs are shown. If clicked again all inputs and their value are removed. It's like a reset.

new_port_mapping_2

WDYT? @slemeur @benoitf @deboer-tim

@benoitf
Copy link
Collaborator

benoitf commented Jan 27, 2023

I like option 2 but maybe the add remove custom ports button should be on the left ( Or maybe it's a bad idea as well)

@lstocchi
Copy link
Contributor Author

I like option 2 but maybe the add remove custom ports button should be on the left ( Or maybe it's a bad idea as well)

This is when displayed on the left
new_port_mapping_4

Signed-off-by: luca <lstocchi@redhat.com>
@benoitf
Copy link
Collaborator

benoitf commented Jan 27, 2023

yes it may be better like that especially when we don't have any EXPOSE instruction

@benoitf
Copy link
Collaborator

benoitf commented Jan 27, 2023

It looks like the codebase is still for the yesterday behaviour

Signed-off-by: luca <lstocchi@redhat.com>
Signed-off-by: luca <lstocchi@redhat.com>
Signed-off-by: luca <lstocchi@redhat.com>
@lstocchi
Copy link
Contributor Author

It looks like the codebase is still for the yesterday behaviour

I was waiting for an OK about the new design. Code pushed 👍

Copy link
Collaborator

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

image

tested and works fine for me 🎉

@deboer-tim
Copy link
Contributor

Much better, but for me it's a bit odd that you add the first one from a button on the left and then add more on the right (which 'moves' each time you add one), plus the fact that the initial button changes from 'add one' to 'remove all'. I'd suggest always keeping the "Add custom port mapping" button as-is, and each row just has a delete button on the right. Florent has already approved, so I'd be fine doing this as an additional PR.

@benoitf
Copy link
Collaborator

benoitf commented Jan 27, 2023

I'm fine to have follow up PRs or amend this one

@lstocchi
Copy link
Contributor Author

Much better, but for me it's a bit odd that you add the first one from a button on the left and then add more on the right (which 'moves' each time you add one), plus the fact that the initial button changes from 'add one' to 'remove all'. I'd suggest always keeping the "Add custom port mapping" button as-is, and each row just has a delete button on the right. Florent has already approved, so I'd be fine doing this as an additional PR.

I see your point.

The initial idea was to have something similar to an Advanced settings button that makes visible a tab/panel with all extra settings. And then when clicking on it again the tab/panel gets closed. This is why the 'add one' and 'remove all'. For me it was more 'open the custom port mappings view', 'close it'.

I'm going to update this PR 👍

Signed-off-by: luca <lstocchi@redhat.com>
@lstocchi
Copy link
Contributor Author

@deboer-tim something like this?

new_port_mapping_5

@benoitf
Copy link
Collaborator

benoitf commented Jan 27, 2023

@lstocchi would be nice to update the description body to be accurate ( the image)

@deboer-tim
Copy link
Contributor

In case my thumbs-up isn't visible enough: yes! Thank you, looks great.

@lstocchi
Copy link
Contributor Author

lstocchi commented Jan 27, 2023

@lstocchi would be nice to update the description body to be accurate ( the image)

@benoitf You mean the image in the first message right?

@cdrage
Copy link
Contributor

cdrage commented Jan 27, 2023

Tested and works well! Grats on the first ever svelte / UX/UI change merged PR! 🎉

@cdrage cdrage merged commit 6ad7427 into podman-desktop:main Jan 27, 2023
@podman-desktop-bot podman-desktop-bot added this to the 0.12.0 milestone Jan 27, 2023
@lstocchi lstocchi deleted the i1046 branch February 13, 2023 16:58
@benoitf benoitf changed the title fix: allow to add port mappings when image has no exported port (#1046) feat: allow to add port mappings when image has no exported port (#1046) Feb 14, 2023
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.

Port Mapping Fields are not shown in the create container from image panel
6 participants