@centreon/ui 25.4.2 → 25.4.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "25.4.2",
3
+ "version": "25.4.4",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -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
- return value?.map((metric, index) =>
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 = {
@@ -26,7 +26,7 @@ const Links = <TData extends BaseProp>({
26
26
  }: Props<TData>): Array<JSX.Element> => {
27
27
  const theme = useTheme();
28
28
 
29
- return links.map((link) => {
29
+ return links.map((link, idx) => {
30
30
  const ancestorIds = link.target
31
31
  .ancestors()
32
32
  .map((ancestor) => ancestor.data.data.id);
@@ -37,7 +37,7 @@ const Links = <TData extends BaseProp>({
37
37
 
38
38
  const LinkComponent = getLinkComponent(treeLink?.type);
39
39
 
40
- const key = `${link.source.data.data.id}-${link.source.data.data.name}-${ancestorIds}_${link.target.data.data.id}-${link.target.data.data.name}-${descendantIds}`;
40
+ const key = `${link.source.data.data.id}-${link.source.data.data.name}-${ancestorIds}_${link.target.data.data.id}-${link.target.data.data.name}-${descendantIds}-${idx}`;
41
41
 
42
42
  return (
43
43
  <LinkComponent
@@ -84,10 +84,10 @@ export const Tree = <TData extends BaseProp>({
84
84
  );
85
85
 
86
86
  return (
87
- <Group left={node.width}>
87
+ <Group left={node.width / 2}>
88
88
  <VisxTree
89
89
  left={0}
90
- nodeSize={[node.width + nodeMargins.y, node.height + nodeMargins.x]}
90
+ nodeSize={[node.height + nodeMargins.x, node.height + node.width]}
91
91
  root={hierarchy(formattedTree, getExpanded)}
92
92
  separation={() => 1}
93
93
  size={[containerWidth, containerHeight]}
@@ -1,2 +1,2 @@
1
1
  export const margins = { bottom: 30, left: 30, right: 30, top: 30 };
2
- export const nodeMargins = { x: 90, y: 16 };
2
+ export const nodeMargins = { x: 2 };