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

feat(frontend): Support showing Omitted node phase with new Argo version #5339

Merged
merged 5 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions frontend/src/lib/StatusUtils.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('StatusUtils', () => {
NodePhase.CACHED,
NodePhase.SKIPPED,
NodePhase.TERMINATED,
NodePhase.OMITTED,
].forEach(status => {
it(`returns \'true\' if status is: ${status}`, () => {
expect(hasFinished(status)).toBe(true);
Expand Down Expand Up @@ -75,6 +76,10 @@ describe('StatusUtils', () => {
expect(consoleSpy).toHaveBeenLastCalledWith('Unknown node phase:', undefined);
});

it("returns color 'not started' if status is 'Omitted'", () => {
expect(statusToBgColor(NodePhase.OMITTED)).toEqual(statusBgColors.notStarted);
});

it("returns color 'not started' if status is 'Pending'", () => {
expect(statusToBgColor(NodePhase.PENDING)).toEqual(statusBgColors.notStarted);
});
Expand Down Expand Up @@ -116,6 +121,7 @@ describe('StatusUtils', () => {
NodePhase.PENDING,
NodePhase.RUNNING,
NodePhase.TERMINATING,
NodePhase.OMITTED,
NodePhase.UNKNOWN,
].forEach(status => {
it(`returns the original status, even if message is 'terminated', if status is: ${status}`, () => {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/StatusUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export enum NodePhase {
TERMINATING = 'Terminating',
TERMINATED = 'Terminated',
UNKNOWN = 'Unknown',
OMITTED = 'Omitted',
}

export function hasFinished(status?: NodePhase): boolean {
Expand All @@ -48,6 +49,7 @@ export function hasFinished(status?: NodePhase): boolean {
case NodePhase.ERROR: // Fall through
case NodePhase.SKIPPED: // Fall through
case NodePhase.TERMINATED:
case NodePhase.OMITTED:
return true;
case NodePhase.PENDING: // Fall through
case NodePhase.RUNNING: // Fall through
Expand Down
50 changes: 50 additions & 0 deletions frontend/src/pages/Status.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,56 @@ describe('Status', () => {
expect(consoleSpy).toHaveBeenLastCalledWith('Unknown node phase:', undefined);
});

it('handles ERROR phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
zijianjoy marked this conversation as resolved.
Show resolved Hide resolved
});

it('handles FAILED phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
});

it('handles PENDING phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
});

it('handles RUNNING phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
});

it('handles TERMINATING phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
});

it('handles SKIPPED phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
});

it('handles SUCCEEDED phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
});

it('handles CACHED phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
});

it('handles TERMINATED phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
});

it('handles OMITTED phase', () => {
const tree = shallow(statusToIcon(NodePhase.OMITTED));
expect(tree).toMatchSnapshot();
});

it('displays start and end dates if both are provided', () => {
const tree = shallow(statusToIcon(NodePhase.SUCCEEDED, startDate, endDate));
expect(tree).toMatchSnapshot();
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/pages/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import PendingIcon from '@material-ui/icons/Schedule';
import RunningIcon from '../icons/statusRunning';
import SkippedIcon from '@material-ui/icons/SkipNext';
import SuccessIcon from '@material-ui/icons/CheckCircle';
import ClearIcon from '@material-ui/icons/Clear';
import CachedIcon from '../icons/statusCached';
import TerminatedIcon from '../icons/statusTerminated';
import Tooltip from '@material-ui/core/Tooltip';
Expand Down Expand Up @@ -84,6 +85,10 @@ export function statusToIcon(
iconColor = color.terminated;
title = 'Run was manually terminated';
break;
case NodePhase.OMITTED:
IconComponent = ClearIcon;
title = "Run was omitted and didn't execute.";
zijianjoy marked this conversation as resolved.
Show resolved Hide resolved
break;
case NodePhase.UNKNOWN:
break;
default:
Expand Down