@centreon/ui 24.8.2 → 24.8.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 +14 -17
- package/src/Graph/BarChart/BarChart.cypress.spec.tsx +38 -79
- package/src/Graph/BarChart/BarChart.tsx +4 -4
- package/src/Graph/BarChart/BarGroup.tsx +81 -92
- package/src/Graph/BarChart/BarStack.tsx +21 -13
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +26 -50
- package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +1 -1
- package/src/Graph/BarChart/useBarStack.ts +1 -1
- package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Point.tsx +1 -1
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/useStackedLines.ts +67 -0
- package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/ThresholdWithPatternLines.tsx +4 -7
- package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/index.tsx +6 -9
- package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/models.ts +1 -2
- package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/useScaleThreshold.ts +8 -20
- package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/index.tsx +64 -43
- package/src/Graph/{LineChart/LineChart.cypress.spec.tsx → Chart/Chart.cypress.spec.tsx} +272 -23
- package/src/Graph/{LineChart/index.stories.tsx → Chart/Chart.stories.tsx} +217 -24
- package/src/Graph/{LineChart/LineChart.styles.ts → Chart/Chart.styles.ts} +1 -1
- package/src/Graph/{LineChart/LineChart.tsx → Chart/Chart.tsx} +84 -100
- package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +5 -1
- package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +6 -1
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +61 -0
- package/src/Graph/{LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx → Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltipContent.tsx} +2 -2
- package/src/Graph/{LineChart → Chart}/InteractiveComponents/index.tsx +11 -15
- package/src/Graph/{LineChart → Chart}/Legend/Legend.styles.ts +1 -7
- package/src/Graph/{LineChart → Chart}/Legend/LegendHeader.tsx +9 -5
- package/src/Graph/{LineChart → Chart}/Legend/index.tsx +2 -1
- package/src/Graph/Chart/graphAtoms.ts +6 -0
- package/src/Graph/{LineChart → Chart}/index.tsx +10 -7
- package/src/Graph/{LineChart → Chart}/models.ts +8 -3
- package/src/Graph/common/Axes/AxisStyles.ts +11 -0
- package/src/Graph/common/Axes/UnitLabel.tsx +41 -10
- package/src/Graph/common/Axes/index.tsx +18 -12
- package/src/Graph/common/Axes/models.ts +4 -2
- package/src/Graph/common/Axes/useAxisY.ts +22 -12
- package/src/Graph/common/BaseChart/BaseChart.tsx +2 -2
- package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +8 -5
- package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +1 -1
- package/src/Graph/common/Grids/index.tsx +2 -2
- package/src/Graph/common/Thresholds/ThresholdLine.tsx +1 -1
- package/src/Graph/common/Thresholds/Thresholds.tsx +10 -15
- package/src/Graph/common/timeSeries/index.ts +109 -131
- package/src/Graph/common/timeSeries/models.ts +4 -5
- package/src/Graph/index.ts +4 -4
- package/src/Graph/mockedData/lastDayWithLotOfUnits.json +1668 -0
- package/src/Graph/mockedData/pingService.json +46 -1
- package/src/Graph/mockedData/pingServiceLinesBars.json +253 -0
- package/src/Graph/mockedData/pingServiceLinesBarsMixed.json +253 -0
- package/src/Graph/mockedData/pingServiceLinesBarsStacked.json +253 -0
- package/src/Graph/mockedData/pingServiceMixedStacked.json +46 -1
- package/src/Graph/mockedData/pingServiceStacked.json +46 -1
- package/src/Typography/EllipsisTypography.tsx +5 -2
- package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +16 -24
- package/src/components/Form/AccessRights/AccessRights.stories.tsx +5 -5
- package/src/components/Form/AccessRights/AccessRights.tsx +3 -3
- package/src/components/Form/index.ts +2 -2
- package/src/utils/index.ts +2 -2
- package/src/Graph/BarChart/SingleBar.tsx +0 -62
- package/src/Graph/BarChart/useSingleBar.ts +0 -199
- package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/useStackedLines.ts +0 -39
- package/src/Graph/LineChart/graphAtoms.ts +0 -3
- /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/RegularLines/index.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/RegularLines/useRegularLines.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/StackedLines/index.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/BasicThreshold.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/Circle.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/ThresholdWithVariation.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/helpers/index.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/useCoordinateCircle.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/models.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/GuidingLines.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/index.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/models.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/useTickGraph.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Annotation/Area.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Annotation/Line.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Annotation/index.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Area/Downtime.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/EventAnnotations.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Line/Acknowledgement.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Line/Comments.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/annotationsAtoms.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/index.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/models.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/useAnnotation.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Bar.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/TimeShiftIcon.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/TimeShiftZone.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/index.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/models.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/useTimeShiftZones.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Tooltip/index.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Tooltip/models.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Tooltip/useGraphTooltip.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/ZoomPreview/index.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/ZoomPreview/models.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/ZoomPreview/useZoomPreview.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/ZoomPreview/zoomPreviewAtoms.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/InteractiveComponents/interactionWithGraphAtoms.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/Legend/LegendContent.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/Legend/models.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/Legend/useLegend.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/LoadingSkeleton.tsx +0 -0
- /package/src/Graph/{LineChart → Chart}/common/index.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/helpers/doc.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/helpers/index.ts +0 -0
- /package/src/Graph/{LineChart → Chart}/translatedLabels.ts +0 -0
- /package/src/Graph/{LineChart/useLineChartData.ts → Chart/useChartData.ts} +0 -0
- /package/src/Graph/{LineChart/useLineChartIntersection.ts → Chart/useChartIntersection.ts} +0 -0
|
@@ -12,8 +12,7 @@ import { displayArea } from '../../helpers/index';
|
|
|
12
12
|
import { DisplayAnchor, GlobalAreaLines } from '../../models';
|
|
13
13
|
import {
|
|
14
14
|
getDates,
|
|
15
|
-
|
|
16
|
-
getUnits,
|
|
15
|
+
getTimeSeriesForLines,
|
|
17
16
|
getYScale
|
|
18
17
|
} from '../../../common/timeSeries';
|
|
19
18
|
import { Line, TimeValue } from '../../../common/timeSeries/models';
|
|
@@ -39,14 +38,15 @@ interface Props extends GlobalAreaLines {
|
|
|
39
38
|
dotOffset?: number;
|
|
40
39
|
graphSvgRef: MutableRefObject<SVGSVGElement | null>;
|
|
41
40
|
height: number;
|
|
42
|
-
leftScale: ScaleLinear<number, number>;
|
|
43
41
|
lineWidth?: number;
|
|
44
|
-
|
|
42
|
+
scale?: 'linear' | 'logarithmic';
|
|
43
|
+
scaleLogarithmicBase?: number;
|
|
45
44
|
showArea?: boolean;
|
|
46
45
|
showPoints?: boolean;
|
|
47
46
|
timeSeries: Array<TimeValue>;
|
|
48
47
|
width: number;
|
|
49
48
|
xScale: ScaleLinear<number, number>;
|
|
49
|
+
yScalesPerUnit: Record<string, ScaleLinear<number, number>>;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const Lines = ({
|
|
@@ -55,9 +55,8 @@ const Lines = ({
|
|
|
55
55
|
graphSvgRef,
|
|
56
56
|
width,
|
|
57
57
|
displayAnchor,
|
|
58
|
-
leftScale,
|
|
59
|
-
rightScale,
|
|
60
58
|
curve,
|
|
59
|
+
yScalesPerUnit,
|
|
61
60
|
xScale,
|
|
62
61
|
timeSeries,
|
|
63
62
|
displayedLines,
|
|
@@ -69,7 +68,9 @@ const Lines = ({
|
|
|
69
68
|
lineWidth,
|
|
70
69
|
dotOffset,
|
|
71
70
|
dashLength,
|
|
72
|
-
dashOffset
|
|
71
|
+
dashOffset,
|
|
72
|
+
scale,
|
|
73
|
+
scaleLogarithmicBase
|
|
73
74
|
}: Props): JSX.Element => {
|
|
74
75
|
const { stackedLinesData, invertedStackedLinesData } = useStackedLines({
|
|
75
76
|
lines: displayedLines,
|
|
@@ -85,11 +86,6 @@ const Lines = ({
|
|
|
85
86
|
const displayAreaRegularLines =
|
|
86
87
|
(areaRegularLines?.display ?? true) && displayArea(regularLines);
|
|
87
88
|
|
|
88
|
-
const stackedYScale = getStackedYScale({
|
|
89
|
-
leftScale,
|
|
90
|
-
rightScale
|
|
91
|
-
});
|
|
92
|
-
|
|
93
89
|
const displayGuidingLines = displayAnchor?.displayGuidingLines ?? true;
|
|
94
90
|
const commonStackedLinesProps = {
|
|
95
91
|
areaTransparency,
|
|
@@ -104,8 +100,7 @@ const Lines = ({
|
|
|
104
100
|
lineWidth,
|
|
105
101
|
showArea,
|
|
106
102
|
showPoints,
|
|
107
|
-
xScale
|
|
108
|
-
yScale: stackedYScale
|
|
103
|
+
xScale
|
|
109
104
|
};
|
|
110
105
|
|
|
111
106
|
return (
|
|
@@ -121,20 +116,33 @@ const Lines = ({
|
|
|
121
116
|
|
|
122
117
|
{(areaStackedLines?.display ?? true) && (
|
|
123
118
|
<>
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
119
|
+
{Object.entries(stackedLinesData).map(
|
|
120
|
+
([unit, { lines, timeSeries: stackedTimeSeries }]) => (
|
|
121
|
+
<StackedLines
|
|
122
|
+
key={`stacked-${unit}`}
|
|
123
|
+
lines={lines}
|
|
124
|
+
timeSeries={stackedTimeSeries}
|
|
125
|
+
yScale={yScalesPerUnit[unit]}
|
|
126
|
+
{...commonStackedLinesProps}
|
|
127
|
+
/>
|
|
128
|
+
)
|
|
130
129
|
)}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
{Object.entries(invertedStackedLinesData).map(
|
|
131
|
+
([unit, { lines, timeSeries: stackedTimeSeries }]) => (
|
|
132
|
+
<StackedLines
|
|
133
|
+
key={`invert-stacked-${unit}`}
|
|
134
|
+
lines={lines}
|
|
135
|
+
timeSeries={stackedTimeSeries}
|
|
136
|
+
yScale={getYScale({
|
|
137
|
+
invert: '1',
|
|
138
|
+
scale,
|
|
139
|
+
scaleLogarithmicBase,
|
|
140
|
+
unit,
|
|
141
|
+
yScalesPerUnit
|
|
142
|
+
})}
|
|
143
|
+
{...commonStackedLinesProps}
|
|
144
|
+
/>
|
|
145
|
+
)
|
|
138
146
|
)}
|
|
139
147
|
</>
|
|
140
148
|
)}
|
|
@@ -143,11 +151,10 @@ const Lines = ({
|
|
|
143
151
|
<WrapperThresholdLines
|
|
144
152
|
areaThresholdLines={areaThresholdLines}
|
|
145
153
|
graphHeight={height}
|
|
146
|
-
leftScale={leftScale}
|
|
147
154
|
lines={displayedLines}
|
|
148
|
-
rightScale={rightScale}
|
|
149
155
|
timeSeries={timeSeries}
|
|
150
156
|
xScale={xScale}
|
|
157
|
+
yScalesPerUnit={yScalesPerUnit}
|
|
151
158
|
/>
|
|
152
159
|
)}
|
|
153
160
|
|
|
@@ -161,18 +168,32 @@ const Lines = ({
|
|
|
161
168
|
unit,
|
|
162
169
|
highlight,
|
|
163
170
|
invert,
|
|
164
|
-
metric_id
|
|
171
|
+
metric_id,
|
|
172
|
+
...rest
|
|
165
173
|
}) => {
|
|
166
|
-
const [, secondUnit, thirdUnit] = getUnits(
|
|
167
|
-
regularLines as Array<Line>
|
|
168
|
-
);
|
|
169
174
|
const yScale = getYScale({
|
|
170
|
-
hasMoreThanTwoUnits: !isNil(thirdUnit),
|
|
171
175
|
invert,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
scale,
|
|
177
|
+
scaleLogarithmicBase,
|
|
178
|
+
unit,
|
|
179
|
+
yScalesPerUnit
|
|
180
|
+
});
|
|
181
|
+
const relatedTimeSeries = getTimeSeriesForLines({
|
|
182
|
+
invert,
|
|
183
|
+
lines: [
|
|
184
|
+
{
|
|
185
|
+
areaColor,
|
|
186
|
+
filled,
|
|
187
|
+
highlight,
|
|
188
|
+
invert,
|
|
189
|
+
lineColor,
|
|
190
|
+
metric_id,
|
|
191
|
+
transparency,
|
|
192
|
+
unit,
|
|
193
|
+
...rest
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
timeSeries
|
|
176
197
|
});
|
|
177
198
|
|
|
178
199
|
return (
|
|
@@ -182,25 +203,25 @@ const Lines = ({
|
|
|
182
203
|
areaColor={areaColor || lineColor}
|
|
183
204
|
lineColor={lineColor}
|
|
184
205
|
metric_id={metric_id}
|
|
185
|
-
timeSeries={
|
|
206
|
+
timeSeries={relatedTimeSeries}
|
|
186
207
|
transparency={transparency}
|
|
187
208
|
xScale={xScale}
|
|
188
209
|
yScale={yScale}
|
|
189
210
|
/>
|
|
190
211
|
)}
|
|
191
212
|
{showPoints &&
|
|
192
|
-
getDates(
|
|
213
|
+
getDates(relatedTimeSeries).map((timeTick) => (
|
|
193
214
|
<Point
|
|
194
215
|
key={timeTick.toString()}
|
|
195
216
|
lineColor={lineColor}
|
|
196
217
|
metric_id={metric_id}
|
|
197
218
|
radius={getPointRadius(lineWidth)}
|
|
198
|
-
timeSeries={
|
|
219
|
+
timeSeries={relatedTimeSeries}
|
|
199
220
|
timeTick={timeTick}
|
|
200
221
|
xScale={xScale}
|
|
201
222
|
yPoint={getYAnchorPoint({
|
|
202
223
|
metric_id,
|
|
203
|
-
timeSeries,
|
|
224
|
+
timeSeries: relatedTimeSeries,
|
|
204
225
|
timeTick,
|
|
205
226
|
yScale
|
|
206
227
|
})}
|
|
@@ -219,7 +240,7 @@ const Lines = ({
|
|
|
219
240
|
lineColor={lineColor}
|
|
220
241
|
lineWidth={lineWidth}
|
|
221
242
|
metric_id={metric_id}
|
|
222
|
-
timeSeries={
|
|
243
|
+
timeSeries={relatedTimeSeries}
|
|
223
244
|
transparency={
|
|
224
245
|
isNil(areaTransparency)
|
|
225
246
|
? transparency || 80
|