Skip to content

Add Pod Log viewer - #10201

Open
ishaaq-48 wants to merge 3 commits into
ManageIQ:masterfrom
ishaaq-48:feature-pod-log
Open

Add Pod Log viewer#10201
ishaaq-48 wants to merge 3 commits into
ManageIQ:masterfrom
ishaaq-48:feature-pod-log

Conversation

@ishaaq-48

@ishaaq-48 ishaaq-48 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Purpose

Provide a UI to view Kubernetes/OpenShift pod logs for running pod.

Changes

  • Add "Pod Logs" button
  • Add React component
  • Display logs in the UI
  • Handle loading and errors

Testing

  • Opened pod details
image
  • Clicked Container Group Logs button under Access
image

Select the container for which the pod log should be shown and click View Logs.

  • Logs displayed successfully
image

Depends On:

container_group = ContainerGroup.find(params.expect(:id))
container_name = params[:container]

render :json => {:logs => container_group.logs(container_name)}

@Fryguy Fryguy Aug 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if this makes more sense over the API instead?

Then you also wouldn't have a split between logs and logs_page...instead you'd have container_groups/1/logs for UI and /api/container_groups/1/logs for API

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Fryguy, Just to make sure I build the right thing — should this stay as a POST resource action (reusing the existing logs_resource/check_compliance-style pattern), or would you prefer a proper GET subcollection (GET /api/container_groups/:id/logs?container=...)? The latter needs a different mechanism (subcollection route + handler vs. the resource-action config), so want to confirm before I build it out.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was thinking get on a subcollection. @agrare Thoughts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

are you expecting something like this?

GET /api/container_groups/:id/logs?container=my-container

instead of a resource action?

@miq-bot

miq-bot commented Aug 3, 2026

Copy link
Copy Markdown
Member

Checked commits ishaaq-48/manageiq-ui-classic@21c46fe~...6445598 with ruby 3.3.10, rubocop 1.86.0, haml-lint 0.73.0, and yamllint 1.37.1
4 files checked, 1 offense detected

app/views/container_group/logs.html.haml

  • ⚠️ - Line 1 - Line is too long. [130/80]

@ishaaq-48

Copy link
Copy Markdown
Member Author

@Fryguy I have updated the code kindly check it out

@GilbertCherrie GilbertCherrie self-assigned this Aug 5, 2026
action: 'logs',
container: selectedContainer,
}),
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of fetch to call the /api, you can use the helper API.post.

API.post('api/container_groups/${podId}'), { payload.... }

@@ -0,0 +1,77 @@
import React, { useState } from 'react';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can remove import React from 'react'

</select>

<button onClick={ fetchLogs } disabled={ !selectedContainer } style={ { marginLeft: '10px' } }>
View Logs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing translation. Wrap with __()

View Logs
</button>

{ loading && <p>Loading...</p> }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing translation


return (
<div>
<h3>{ `Logs for ${podName}` }</h3>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing translation

Comment on lines +45 to +54
<select
value={ selectedContainer }
onChange={ (e) => setSelectedContainer(e.target.value) }
>
{ containers.map((name) => (
<option key={ name } value={ name }>{ name }</option>
)) }
</select>

<button onClick={ fetchLogs } disabled={ !selectedContainer } style={ { marginLeft: '10px' } }>

@elsamaryv elsamaryv Aug 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use Carbon components instead of native HTML elements. The project uses @carbon/react throughout. You could use <SelectItem>, <Button>

</button>

{ loading && <p>Loading...</p> }
{ error && <p style={ { color: 'red' } }>{ error }</p> }

@elsamaryv elsamaryv Aug 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See if you could use <InlineNotification> instead

View Logs
</button>

{ loading && <p>Loading...</p> }

@elsamaryv elsamaryv Aug 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use <Loading> from '@carbon/react'

);
};

export default ContainerGroupLogs; No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit - No new line at the eof

@miq-bot

miq-bot commented Aug 14, 2026

Copy link
Copy Markdown
Member

This pull request is not mergeable. Please rebase and repush.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants