@centreon/ui 25.4.1 → 25.4.3
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
CHANGED
package/src/Form/Inputs/Grid.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { InputPropsWithoutGroup } from './models';
|
|
|
4
4
|
|
|
5
5
|
import { Box, Typography } from '@mui/material';
|
|
6
6
|
import { FormikValues, useFormikContext } from 'formik';
|
|
7
|
+
import { isNotEmpty, isNotNil } from 'ramda';
|
|
7
8
|
import { getInput } from '.';
|
|
8
9
|
|
|
9
10
|
interface StylesProps {
|
|
@@ -47,12 +48,17 @@ const Grid = ({
|
|
|
47
48
|
{grid?.columns.map((field) => {
|
|
48
49
|
const Input = getInput(field.type);
|
|
49
50
|
|
|
51
|
+
const key =
|
|
52
|
+
isNotNil(field.label) || isNotEmpty(field.label)
|
|
53
|
+
? field.label
|
|
54
|
+
: field.additionalLabel;
|
|
55
|
+
|
|
50
56
|
if (field.hideInput?.(values) ?? false) {
|
|
51
57
|
return null;
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
return (
|
|
55
|
-
<Box sx={{ width: '100%' }} key={
|
|
61
|
+
<Box sx={{ width: '100%' }} key={key}>
|
|
56
62
|
{field.additionalLabel && (
|
|
57
63
|
<Typography
|
|
58
64
|
sx={{ marginBottom: 0.5, color: 'primary.main' }}
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
groupBy,
|
|
21
21
|
isEmpty,
|
|
22
22
|
isNil,
|
|
23
|
+
isNotEmpty,
|
|
24
|
+
isNotNil,
|
|
23
25
|
keys,
|
|
24
26
|
last,
|
|
25
27
|
not,
|
|
@@ -204,7 +206,6 @@ const Inputs = ({
|
|
|
204
206
|
: ({} as Group);
|
|
205
207
|
|
|
206
208
|
const hasGroupDivider = !groups[index]?.isDividerHidden;
|
|
207
|
-
|
|
208
209
|
const isFirstElement = areGroupsOpen || equals(index, 0);
|
|
209
210
|
|
|
210
211
|
return (
|
|
@@ -219,22 +220,19 @@ const Inputs = ({
|
|
|
219
220
|
>
|
|
220
221
|
<div className={classes.inputs}>
|
|
221
222
|
{groupedInputs.map((inputProps) => {
|
|
223
|
+
const key =
|
|
224
|
+
isNotNil(inputProps.label) || isNotEmpty(inputProps.label)
|
|
225
|
+
? inputProps.label
|
|
226
|
+
: inputProps.additionalLabel;
|
|
227
|
+
|
|
222
228
|
if (isLoading) {
|
|
223
|
-
return
|
|
224
|
-
<LoadingSkeleton
|
|
225
|
-
input={inputProps}
|
|
226
|
-
key={inputProps.label}
|
|
227
|
-
/>
|
|
228
|
-
);
|
|
229
|
+
return <LoadingSkeleton input={inputProps} key={key} />;
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
const Input = getInput(inputProps.type);
|
|
232
233
|
|
|
233
234
|
return (
|
|
234
|
-
<div
|
|
235
|
-
className={classes.inputWrapper}
|
|
236
|
-
key={inputProps.label}
|
|
237
|
-
>
|
|
235
|
+
<div className={classes.inputWrapper} key={key}>
|
|
238
236
|
{inputProps.additionalLabel && (
|
|
239
237
|
<Typography
|
|
240
238
|
className={cx(
|
|
@@ -30,6 +30,8 @@ interface Props {
|
|
|
30
30
|
start?: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
const getBoolean = (value) => Boolean(Number(value));
|
|
34
|
+
|
|
33
35
|
const useGraphData = ({ data, end, start }: Props): GraphDataResult => {
|
|
34
36
|
const adjustedDataRef = useRef<Data>();
|
|
35
37
|
|
|
@@ -48,7 +50,16 @@ const useGraphData = ({ data, end, start }: Props): GraphDataResult => {
|
|
|
48
50
|
|
|
49
51
|
const newMetrics = Object.entries(metricsGroupedByColor).map(
|
|
50
52
|
([color, value]) => {
|
|
51
|
-
|
|
53
|
+
const adjustedValue = value?.map((item) => ({
|
|
54
|
+
...item,
|
|
55
|
+
ds_data: {
|
|
56
|
+
...item?.ds_data,
|
|
57
|
+
ds_invert: getBoolean(item?.ds_data?.ds_invert),
|
|
58
|
+
ds_filled: getBoolean(item?.ds_data?.ds_filled)
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
return adjustedValue?.map((metric, index) =>
|
|
52
63
|
set(
|
|
53
64
|
lensPath(['ds_data', 'ds_color_line']),
|
|
54
65
|
emphasizeCurveColor({ color, index }),
|
|
@@ -76,6 +87,7 @@ const useGraphData = ({ data, end, start }: Props): GraphDataResult => {
|
|
|
76
87
|
const { title } = dataWithAdjustedMetricsColor.global;
|
|
77
88
|
|
|
78
89
|
const newLineData = adjustGraphData(dataWithAdjustedMetricsColor).lines;
|
|
90
|
+
|
|
79
91
|
const sortedLines = sortBy(compose(toLower, prop('name')), newLineData);
|
|
80
92
|
|
|
81
93
|
adjustedDataRef.current = {
|