Skip to content

Commit

Permalink
show restartCount for events (#283)
Browse files Browse the repository at this point in the history
* show restartCount for events

* fix error

Co-authored-by: Nils Gustav Stråbø <[email protected]>
  • Loading branch information
nilsgstrabo and nilsgstrabo committed Apr 23, 2021
1 parent a1e765f commit 315fa24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/components/events-list/event-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ const EventSummary = ({ event }) => {
<li className="events-summary__data-section">
<span>
{event.reason} - {event.message}
{event.involvedObjectState &&
event.involvedObjectState.pod &&
event.involvedObjectState.pod.restartCount > 0 && (
<span>
. Restarted {event.involvedObjectState.pod.restartCount} times
</span>
)}
</span>
{isWarningEvent(event) && <WarningState event={event}></WarningState>}
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/components/page-replica/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const PageReplica = (props) => {
</React.Fragment>
)}
{selectedReplica &&
selectedReplica.restartCount != NaN &&
!Number.isNaN(selectedReplica.restartCount) &&
selectedReplica.restartCount > 0 && (
<p>Restarted {selectedReplica.restartCount} times</p>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/models/replica-summary/normaliser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const normaliser = (props) => {
replica.status = props.replicaStatus.status;
replica.created = replica.created ? new Date(replica.created) : null;
let restartCount = parseInt(replica.restartCount);
replica.restartCount = restartCount === NaN ? 0 : restartCount;
replica.restartCount = Number.isNaN(restartCount) ? 0 : restartCount;
return Object.freeze(replica);
};

Expand Down

0 comments on commit 315fa24

Please sign in to comment.