Skip to content

Commit

Permalink
feat: display green / grey / red bulbs in the events log
Browse files Browse the repository at this point in the history
  • Loading branch information
brusherru committed Jul 12, 2023
1 parent 4e580d8 commit 295f25c
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions app/screens/node/NodeEventsLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,32 @@ const getStageName = (event: NodeEvent) => {
}
};

const getStatusColor = (event: NodeEvent) => {
if (event && event.failure) {
return smColors.red;
}
switch (getEventType(event)) {
case 'initComplete':
case 'postComplete':
case 'proposal':
return smColors.green;
default:
return smColors.mediumGray;
}
};

const renderNodeActivity = (event: NodeEvent) => {
if (event && event?.failure) {
if (event && event.failure) {
return (
<ErrorMessage>
Stage &quot;{getStageName(event)}&quot; failed. Check the logs for more
details.
</ErrorMessage>
);
}
if (!event) {
return 'Node is preparing...';
}
switch (getEventType(event)) {
case 'initStart':
return 'Started PoST data initialization';
Expand Down Expand Up @@ -205,7 +222,7 @@ const renderNodeActivity = (event: NodeEvent) => {
case 'beacon':
return `Node computed randomness beacon for epoch ${event.beacon?.epoch}`;
default:
return event?.help || 'Node is preparing...';
return event.help ?? 'Node is preparing...';
}
};

Expand Down Expand Up @@ -263,7 +280,7 @@ const NodeEventsLog = ({ history }: RouteComponentProps) => {
>
<TextWrapper>
<ColorStatusIndicator
color={e?.failure ? smColors.red : smColors.mediumGraySecond}
color={getStatusColor(e)}
style={{ marginRight: '1em' }}
/>
<NoWrap>
Expand Down

0 comments on commit 295f25c

Please sign in to comment.