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

Added Last Status information for Container #1041

Merged
merged 3 commits into from
Oct 16, 2020

Conversation

stevejr
Copy link
Collaborator

@stevejr stevejr commented Oct 7, 2020

  • This update will support a last status of terminated and display the information for the terminated state.

Fixes: #926

Signed-off-by: Steve Richards srichards@mirantis.com

- This update will support a last status of terminated and display the
information for the termninated state.

Signed-off-by: Steve Richards <srichards@mirantis.com>
Signed-off-by: Steve Richards <srichards@mirantis.com>
@stevejr stevejr changed the title Issue:926 - Added Last Status information for Container Issue-926 - Added Last Status information for Container Oct 7, 2020
@stevejr stevejr changed the title Issue-926 - Added Last Status information for Container Issue-926: Added Last Status information for Container Oct 7, 2020
@nevalla nevalla changed the title Issue-926: Added Last Status information for Container Added Last Status information for Container Oct 9, 2020
@nevalla nevalla requested a review from a team October 9, 2020 10:30
@nevalla nevalla added the enhancement New feature or request label Oct 9, 2020
@nevalla nevalla added this to the 3.7.0 milestone Oct 9, 2020
@@ -149,7 +149,16 @@ export interface IPodContainerStatus {
reason: string;
};
};
lastState: {};
lastState: {
[index: string]: object;
Copy link
Contributor

Choose a reason for hiding this comment

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

so this is covering running and waiting states?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nevalla - No, the lastState is only going to show terminated. Do we need the lastState to also show waiting as it can't be running as if a pod terminates and restarts it would be status of running and lastState of terminated.

@@ -54,6 +55,15 @@ export class PodDetailsContainer extends React.Component<Props> {
</span>
</DrawerItem>
}
{status &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I would change this to {lastState &&. So not displaying even the title if Last status is not found.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That was a typo. Corrected in next commit

<span>
{lastState ? `${lastState}, ` : ""}
{lastState === 'terminated' ? `${status.lastState.terminated.reason} (${_i18n._(t`exit code`)}: ${status.lastState.terminated.exitCode}),
${_i18n._(t`started at`)}: ${status.lastState.terminated.startedAt}, ${_i18n._(t`finished at`)}: ${status.lastState.terminated.finishedAt}` : ''}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please could you give an example, how these are looking after rendered?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Screen Shot 2020-10-13 at 17 04 41

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is rather hard to read. @nevalla Would a table-like view be better for information like this?

Copy link
Contributor

Choose a reason for hiding this comment

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

How about putting line breaks after exit code and timestamps, so the result would be:

terminated, Error (exit code: 255)
started at: 2020-10-12T10:19:20Z
finished at: 2020-10-13T15:49:23Z

Would it be any better?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That would be better, however then the comma after lastState scans oddly

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How about no comma and we just separate each item with a line break?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Nokel81 , @nevalla - with this logic:

renderLastState(lastState: string, status: IPodContainerStatus) {
    if (lastState === 'terminated') {
      return (
        <span>
          {lastState}<br/> 
          {_i18n._(t`Reason`)}: {status.lastState.terminated.reason} - {_i18n._(t`exit code`)}: {status.lastState.terminated.exitCode}<br/> 
          {_i18n._(t`Started at`)}: {status.lastState.terminated.startedAt}<br/> 
          {_i18n._(t`Finished at`)}: {status.lastState.terminated.finishedAt}<br/> 
        </span>
      )  
    }
  }

we get the following output - is this ok?

Screen Shot 2020-10-14 at 10 57 31

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment on lines 58 to 66
{status &&
<DrawerItem name={<Trans>Last Status</Trans>}>
<span>
{lastState ? `${lastState}, ` : ""}
{lastState === 'terminated' ? `${status.lastState.terminated.reason} (${_i18n._(t`exit code`)}: ${status.lastState.terminated.exitCode}),
${_i18n._(t`started at`)}: ${status.lastState.terminated.startedAt}, ${_i18n._(t`finished at`)}: ${status.lastState.terminated.finishedAt}` : ''}
</span>
</DrawerItem>
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a decently complicated inline render. I personally would like to see it moved to its own function

Copy link
Collaborator Author

@stevejr stevejr Oct 13, 2020

Choose a reason for hiding this comment

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

@Nokel81 - something like this:

renderLastState(lastState: string, status: IPodContainerStatus) {
    return (
      <span>
        {lastState ? `${lastState}, ` : ""}
        {lastState === 'terminated' ? `${status.lastState.terminated.reason} (${_i18n._(t`exit code`)}: ${status.lastState.terminated.exitCode}), 
          ${_i18n._(t`started at`)}: ${status.lastState.terminated.startedAt}, ${_i18n._(t`finished at`)}: ${status.lastState.terminated.finishedAt}` : ''}
      </span>
    );
  }

and the calling line:

{lastState &&
        <DrawerItem name={<Trans>Last Status</Trans>}>
          {this.renderLastState(lastState, status)}
        </DrawerItem>

Wasn't sure if the DrawerItem should also be moved - thought it was better to leave it in the main body for ease of reading.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That could work, I would have the drawer item in the separate function but that is more of a personal preference.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can't see any other examples where we do have the DrawerItem in the function so will leave as currently committed.

Signed-off-by: Steve Richards <srichards@mirantis.com>
Copy link
Collaborator

@Nokel81 Nokel81 left a comment

Choose a reason for hiding this comment

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

I think it is good now

@jakolehm jakolehm merged commit bf20a15 into lensapp:master Oct 16, 2020
@nevalla nevalla modified the milestones: 3.7.0, 4.0.0 Oct 26, 2020
@jakolehm jakolehm mentioned this pull request Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show last pod state and termination reason
4 participants