@centreon/ui 25.7.0 → 25.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Graph/common/utils.ts +18 -10
package/package.json
CHANGED
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
always,
|
|
5
5
|
cond,
|
|
6
6
|
equals,
|
|
7
|
+
flatten,
|
|
7
8
|
gt,
|
|
8
9
|
gte,
|
|
9
10
|
head,
|
|
11
|
+
isEmpty,
|
|
10
12
|
isNil,
|
|
11
13
|
last,
|
|
12
14
|
length,
|
|
@@ -220,20 +222,26 @@ export const getFormattedAxisValues = ({
|
|
|
220
222
|
lines,
|
|
221
223
|
threshold
|
|
222
224
|
}: GetFormattedAxisValuesProps): Array<string> => {
|
|
223
|
-
const
|
|
224
|
-
?.metric_id;
|
|
225
|
+
const filteredMetrics = lines.filter(({ unit }) => equals(unit, axisUnit));
|
|
225
226
|
|
|
226
|
-
if (
|
|
227
|
+
if (isEmpty(filteredMetrics)) {
|
|
227
228
|
return [];
|
|
228
229
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
230
|
+
|
|
231
|
+
const metricIds = pluck('metric_id', filteredMetrics);
|
|
232
|
+
|
|
233
|
+
const formattedData = metricIds.map((metricId) =>
|
|
234
|
+
timeSeries.map((data) =>
|
|
235
|
+
formatMetricValue({
|
|
236
|
+
value: data[metricId],
|
|
237
|
+
unit: axisUnit,
|
|
238
|
+
base
|
|
239
|
+
})
|
|
240
|
+
)
|
|
235
241
|
);
|
|
236
242
|
|
|
243
|
+
const flattenedFormattedData = flatten(formattedData);
|
|
244
|
+
|
|
237
245
|
const formattedThresholdValues = equals(thresholdUnit, axisUnit)
|
|
238
246
|
? threshold.map(({ value }) =>
|
|
239
247
|
formatMetricValue({
|
|
@@ -244,7 +252,7 @@ export const getFormattedAxisValues = ({
|
|
|
244
252
|
) || []
|
|
245
253
|
: [];
|
|
246
254
|
|
|
247
|
-
return
|
|
255
|
+
return flattenedFormattedData
|
|
248
256
|
.concat(formattedThresholdValues)
|
|
249
257
|
.filter((v) => v) as Array<string>;
|
|
250
258
|
};
|