Skip to content

Commit

Permalink
fix: support CommandState for experiment icon (#8709)
Browse files Browse the repository at this point in the history
* fix: support `CommandState` for experiment icon

* fix: add default case
  • Loading branch information
keita-determined authored Jan 18, 2024
1 parent 83fe474 commit dbeb458
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions webui/react/src/components/ExperimentIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import Icon, { Props as IconProps, IconSize } from 'hew/Icon';
import React, { useMemo } from 'react';

import { stateToLabel } from 'constants/states';
import { CompoundRunState, JobState, RunState } from 'types';
import { CommandState, CompoundRunState, JobState, RunState } from 'types';

interface Props {
showTooltip?: boolean;
state: CompoundRunState;
state: CompoundRunState | CommandState;
size?: IconSize;
backgroundColor?: React.CSSProperties['backgroundColor'];
opacity?: React.CSSProperties['opacity'];
Expand All @@ -25,11 +25,16 @@ const ExperimentIcons: React.FC<Props> = ({
case JobState.SCHEDULEDBACKFILLED:
case JobState.QUEUED:
case RunState.Queued:
case CommandState.Queued:
case CommandState.Waiting:
return { backgroundColor, name: 'queued', opacity, title: stateToLabel(state) };
case RunState.Starting:
case RunState.Pulling:
case CommandState.Starting:
case CommandState.Pulling:
return { name: 'spin-bowtie', title: stateToLabel(state) };
case RunState.Running:
case CommandState.Running:
return { name: 'spin-shadow', title: stateToLabel(state) };
case RunState.Paused:
return { color: 'cancel', name: 'pause', title: 'Paused' };
Expand All @@ -48,9 +53,13 @@ const ExperimentIcons: React.FC<Props> = ({
case RunState.StoppingCompleted:
case RunState.StoppingError:
case RunState.StoppingKilled:
case CommandState.Terminating:
return { color: 'cancel', name: 'spin-shadow', title: stateToLabel(state) };
case RunState.Canceled:
case CommandState.Terminated:
return { color: 'cancel', name: 'cancelled', title: 'Stopped' };
default:
return { color: 'cancel', name: 'exclamation-circle', title: 'Unknown State' };
}
}, [backgroundColor, opacity, state]);

Expand Down

0 comments on commit dbeb458

Please sign in to comment.