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

Hide container/image Command details for quadlets #1963

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/ContainerDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ const ContainerDetails = ({ container }) => {
<DescriptionListTerm>{_("Image")}</DescriptionListTerm>
<DescriptionListDescription>{container.ImageName}</DescriptionListDescription>
</DescriptionListGroup>
{container.Config?.Cmd &&
<DescriptionListGroup>
<DescriptionListTerm>{_("Command")}</DescriptionListTerm>
<DescriptionListDescription>{utils.quote_cmdline(container.Config?.Cmd)}</DescriptionListDescription>
<DescriptionListDescription>{utils.quote_cmdline(container.Config.Cmd)}</DescriptionListDescription>
</DescriptionListGroup>
}
</DescriptionList>
</FlexItem>
<FlexItem>
Expand Down
2 changes: 1 addition & 1 deletion src/ImageDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const _ = cockpit.gettext;
const ImageDetails = ({ containers, image, showAll }) => {
return (
<DescriptionList className='image-details' isAutoFit>
{image.Command !== "" &&
{image.Command &&
<DescriptionListGroup>
<DescriptionListTerm>{_("Command")}</DescriptionListTerm>
<DescriptionListDescription>{utils.quote_cmdline(image.Command)}</DescriptionListDescription>
Expand Down
31 changes: 31 additions & 0 deletions test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,37 @@ class TestApplication(testlib.MachineCase):
b.wait_not_in_text("#containers-images", "<none>:<none>")
b.wait_not_in_text("#containers-containers", IMG_INTERMEDIATE)

# Image without a Command, shows no Command. This is common for podman quadlets
IMG_ENTRYPOINT = "localhost/test-entrypoint"
tmpdir = self.execute(auth, "mktemp -d").strip()
self.addCleanup(self.execute, auth, f"rm -r {tmpdir}")
self.execute(auth, f"echo 'FROM {IMG_REGISTRY}\nENTRYPOINT /entrypoint' > {tmpdir}/Dockerfile")
self.execute(auth, f"podman build -t {IMG_ENTRYPOINT} {tmpdir}")

b.click(f"#containers-images tr:contains('{IMG_ENTRYPOINT}') td.pf-v5-c-table__toggle button")
b.wait_in_text("#containers-images tbody.pf-m-expanded tr .image-details", "/bin/sh -c /entrypoint")
b.wait_not_in_text("#containers-images tbody.pf-m-expanded tr .image-details", "Command")

b.click(f'#containers-images tbody tr:contains("{IMG_ENTRYPOINT}") .ct-container-create')
b.wait_visible('div.pf-v5-c-modal-box header:contains("Create container")')
b.set_input_text("#run-image-dialog-name", "no-cmd")
b.wait_visible("#run-image-dialog-command[value='']")
b.wait_text("#run-image-dialog-entrypoint", "/bin/sh -c /entrypoint")

b.click('.pf-v5-c-modal-box__footer #create-image-create-run-btn')
b.wait_not_present("div.pf-v5-c-modal-box")
self.waitContainerRow("no-cmd")
self.toggleExpandedContainer("no-cmd")
b.wait_in_text("#containers-containers tbody tr:contains('no-cmd')", IMG_ENTRYPOINT)
b.wait_not_in_text("#containers-containers tbody tr:contains('no-cmd')", "Command")

sha = self.execute(auth, f"podman inspect --format '{{{{.Id}}}}' {IMG_ENTRYPOINT}").strip()
entrypoint_sel = f"#containers-images tbody tr[data-row-id=\"{sha}{auth}\"]".lower()
clickDeleteImage(entrypoint_sel)
self.confirm_modal("Delete")
self.confirm_modal("Force delete")
b.wait_not_in_text("#containers-images", "<none>:<none>")

def testCommitUser(self):
self._testCommit(False)

Expand Down