Skip to content

Commit 3322527

Browse files
committed
fix: multiple workload issues
1 parent 2cdcbfd commit 3322527

6 files changed

Lines changed: 250 additions & 155 deletions

File tree

src/components/playback-bar/index.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,21 @@ const PlaybackBar = ({ isLoading, onPreload, onSeek, onChange }) => {
143143
}, []);
144144

145145
useEffect(() => {
146-
if (nerdletState.playbackTimeRange) {
147-
setTimeRange(nerdletState.playbackTimeRange);
148-
setSelectedIncrement(
149-
nerdletState.playbackIncrement
150-
? nerdletState.playbackIncrement
151-
: playbackIncrementForSelectedDuration(nerdletState.playbackTimeRange)
152-
);
153-
}
146+
if (!nerdletState.playbackTimeRange) return;
147+
setTimeRange((prev) => {
148+
const { begin_time, end_time, duration } = nerdletState.playbackTimeRange;
149+
return prev?.begin_time === begin_time &&
150+
prev?.end_time === end_time &&
151+
prev?.duration === duration
152+
? prev
153+
: nerdletState.playbackTimeRange;
154+
});
155+
setSelectedIncrement((prev) => {
156+
const next = nerdletState.playbackIncrement
157+
? nerdletState.playbackIncrement
158+
: playbackIncrementForSelectedDuration(nerdletState.playbackTimeRange);
159+
return prev?.timeInMs === next.timeInMs ? prev : next;
160+
});
154161
}, [nerdletState.playbackTimeRange]);
155162

156163
useEffect(() => {

src/components/signal-tooltip/index.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { HeadingText, Popover, PopoverBody, PopoverTrigger } from 'nr1';
55

66
import { AppContext, SignalsContext } from '../../contexts';
77
import { generateIncidentsList } from '../../utils';
8-
import { ALERT_SEVERITY, UI_CONTENT, SIGNAL_TYPES } from '../../constants';
8+
import {
9+
ALERT_SEVERITY,
10+
UI_CONTENT,
11+
SIGNAL_TYPES,
12+
WORKLOAD_STATUS_VALUE_CODES,
13+
} from '../../constants';
914

1015
import typesList from '../../../nerdlets/signal-selection/types.json';
1116

@@ -53,6 +58,19 @@ const SignalTooltip = ({
5358
});
5459
if (signalType === SIGNAL_TYPES.ENTITY) {
5560
if (data.type === 'WORKLOAD') {
61+
if (Number.isFinite(data.statusValueCode)) {
62+
switch (data.statusValueCode) {
63+
case WORKLOAD_STATUS_VALUE_CODES.DISRUPTED:
64+
return UI_CONTENT.SIGNAL.TOOLTIP.WORKLOAD_DISRUPTED;
65+
case WORKLOAD_STATUS_VALUE_CODES.DEGRADED:
66+
return UI_CONTENT.SIGNAL.TOOLTIP.WORKLOAD_DEGRADED;
67+
case WORKLOAD_STATUS_VALUE_CODES.OPERATIONAL:
68+
return UI_CONTENT.SIGNAL.TOOLTIP.WORKLOAD_OPERATIONAL;
69+
default:
70+
return UI_CONTENT.SIGNAL.TOOLTIP.WORKLOAD_UNKNOWN;
71+
}
72+
}
73+
5674
if (data.alertSeverity === ALERT_SEVERITY.NOT_CONFIGURED) {
5775
return UI_CONTENT.SIGNAL.TOOLTIP.WORKLOAD_UNKNOWN;
5876
}

src/constants/ui-content.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ export const UI_CONTENT = {
178178
TOOLTIP: {
179179
WORKLOAD_UNKNOWN: 'The status of this workload is unknown',
180180
WORKLOAD_DISRUPTED: 'The workload is disrupted',
181+
WORKLOAD_DEGRADED: 'The workload is degraded',
181182
WORKLOAD_OPERATIONAL: 'The workload is operational',
182183
SIGNAL_UNKNOWN: 'No alert conditions set up',
183184
SIGNAL_DISRUPTED: ' incident(s) in progress',

src/hooks/use-debug-logger/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ const useDebugLogger = ({ allowDebug = false }) => {
2121
);
2222

2323
const debugString = useCallback(
24-
(str, title = 'Debug info') => {
24+
(str, title = '') => {
2525
if (allowDebug && str) {
26-
console.groupCollapsed(title);
27-
console.debug(str);
28-
console.groupEnd();
26+
console.debug(title, str);
2927
}
3028
},
3129
[allowDebug]

0 commit comments

Comments
 (0)