Skip to content

Commit

Permalink
fix(console): support terminating status and evicted reason show (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfan committed Dec 6, 2020
1 parent e003a53 commit 9ce96c3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 0 additions & 2 deletions web/console/src/modules/cluster/actions/resourcePodActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ const fetchPodActions = generateFetcherActionCreator({
isNeedSpecific: false,
isContinue: true
});
// 原因为 Evicted的pod没有必要再进行展示,直接进行过滤
records = records.filter(item => item.status.reason !== 'Evicted');

dispatch(resourcePodActions.changeContinueToken(continueToken));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,16 @@ export class ResourcePodPanel extends React.Component<RootProps, ResourcePodPane
});
}

function getPodStatus(pod) {
let result = pod.status.phase;
if (pod.status.phase === 'Running' && pod.metadata.deletionTimestamp) {
result = <Text theme="warning">Terminating</Text>;
}
if (pod.status.reason) {
result = <>{pod.status.phase}<Text theme="warning">({pod.status.reason})</Text></>
}
return result;
}
return (
<div>
<span
Expand All @@ -412,7 +422,7 @@ export class ResourcePodPanel extends React.Component<RootProps, ResourcePodPane
'text-danger': isStatusOK && !isConditionOK
})}
>
{pod.status.phase}
{getPodStatus.call(this, pod)}
</span>
{(!isStatusOK || !isConditionOK) && pod.status.conditions && (
<Bubble
Expand Down
4 changes: 4 additions & 0 deletions web/console/src/modules/cluster/models/Pod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ interface Metadata {

creationTimestamp?: string;

deletionTimestamp?: string;

name?: string;

namespace?: string;
Expand All @@ -40,6 +42,8 @@ interface Status {

phase?: string;

reason?: string;

qosClass?: string;

/** pod所在node 的ip */
Expand Down

0 comments on commit 9ce96c3

Please sign in to comment.