Skip to content

Commit

Permalink
feat(dashboard): improve pods visibility (argoproj#3483)
Browse files Browse the repository at this point in the history
This commit adds two improvements to the Pods view:
* Show spinner (pending status) while the pod is not ready (like ArgoCD UI does)
* Show the `ready` property on the tooltip

Signed-off-by: Alejandro López Sánchez <[email protected]>
  • Loading branch information
alopezsanchez authored Mar 29, 2024
1 parent 47f579c commit 190c42a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions USERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Organizations below are **officially** using Argo Rollouts. Please send a PR wit
1. [DaoCloud](https://daocloud.io)
1. [Databricks](https://github.com/databricks)
1. [Devtron Labs](https://github.com/devtron-labs/devtron)
1. [Factorial](https://factorialhr.com)
1. [Farfetch](https://www.farfetch.com/)
1. [Flipkart](https://flipkart.com)
1. [GetYourGuide](https://www.getyourguide.com)
Expand Down
20 changes: 16 additions & 4 deletions ui/src/app/components/pods/pods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ export enum PodStatus {
Unknown = 'unknown',
}

export const ParsePodStatus = (status: string): PodStatus => {
const isPodReady = (ready: string) => {
// Ready is a string in the format "0/1", "1/1", etc.
const [current, total] = ready.split('/');
return current === total;
};

export const ParsePodStatus = (status: string, ready: string): PodStatus => {
if (status === 'Running' && !isPodReady(ready)) {
return PodStatus.Pending;
}

switch (status) {
case 'Pending':
case 'Terminating':
Expand Down Expand Up @@ -101,10 +111,12 @@ export const ReplicaSet = (props: {rs: RolloutReplicaSetInfo; showRevision?: boo
key={pod.objectMeta?.uid}
name={pod.objectMeta?.name}
status={pod.status}
ready={pod.ready}
tooltip={
<div>
<div>Status: {pod.status}</div>
<div>{pod.objectMeta?.name}</div>
<div>Status: {pod.status}</div>
<div>Ready: {pod.ready}</div>
</div>
}
/>
Expand All @@ -115,7 +127,7 @@ export const ReplicaSet = (props: {rs: RolloutReplicaSetInfo; showRevision?: boo
);
};

export const PodWidget = ({name, status, tooltip, customIcon}: {name: string; status: string; tooltip: React.ReactNode; customIcon?: IconDefinition}) => {
export const PodWidget = ({name, status, ready, tooltip, customIcon}: {name: string; status: string; ready: string; tooltip: React.ReactNode; customIcon?: IconDefinition}) => {
let icon: IconDefinition;
let spin = false;
if (status.startsWith('Init:')) {
Expand All @@ -129,7 +141,7 @@ export const PodWidget = ({name, status, tooltip, customIcon}: {name: string; st
icon = faExclamationTriangle;
}

const className = ParsePodStatus(status);
const className = ParsePodStatus(status, ready);

if (customIcon) {
icon = customIcon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import './rollout-grid-widget.scss';
export const isInProgress = (rollout: RolloutInfo): boolean => {
for (const rs of rollout.replicaSets || []) {
for (const p of rs.pods || []) {
const status = ParsePodStatus(p.status);
const status = ParsePodStatus(p.status, p.ready);
if (status === PodStatus.Pending) {
return true;
}
Expand Down

0 comments on commit 190c42a

Please sign in to comment.