@centreon/ui 23.10.57 → 23.10.59

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.
Files changed (126) hide show
  1. package/package.json +3 -1
  2. package/src/Graph/Gauge/AnimatedPie.tsx +87 -0
  3. package/src/Graph/Gauge/Gauge.stories.tsx +45 -0
  4. package/src/Graph/Gauge/Gauge.tsx +44 -0
  5. package/src/Graph/Gauge/PieData.tsx +79 -0
  6. package/src/Graph/Gauge/ResponsiveGauge.tsx +135 -0
  7. package/src/Graph/Gauge/Thresholds.tsx +87 -0
  8. package/src/Graph/Gauge/index.ts +1 -0
  9. package/src/Graph/Gauge/models.ts +20 -0
  10. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Axes/index.tsx +1 -1
  11. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Axes/models.ts +1 -1
  12. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Axes/useAxisY.ts +1 -1
  13. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/RegularLines/index.tsx +2 -2
  14. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/RegularLines/useRegularLines.ts +2 -2
  15. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/StackedLines/index.tsx +2 -2
  16. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/StackedLines/useStackedLines.ts +1 -1
  17. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/BasicThreshold.tsx +1 -1
  18. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/ThresholdWithPatternLines.tsx +3 -2
  19. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/ThresholdWithVariation.tsx +1 -1
  20. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/index.tsx +1 -1
  21. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/models.ts +1 -1
  22. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/useScaleThreshold.ts +2 -2
  23. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/index.tsx +6 -2
  24. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/models.ts +3 -3
  25. package/src/Graph/{BasicComponents → LineChart/BasicComponents}/useFilterLines.ts +1 -1
  26. package/src/Graph/{Header → LineChart/Header}/index.tsx +4 -4
  27. package/src/Graph/{Icons → LineChart/Icons}/Downtime.tsx +1 -1
  28. package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/RegularAnchorPoint.tsx +2 -2
  29. package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/StackedAnchorPoint.tsx +2 -2
  30. package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/models.ts +1 -1
  31. package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/useTickGraph.ts +2 -2
  32. package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Tooltip/useGraphTooltip.ts +1 -1
  33. package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/index.tsx +2 -2
  34. package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/interactionWithGraphAtoms.ts +1 -1
  35. package/src/Graph/{Legend → LineChart/Legend}/LegendHeader.tsx +1 -1
  36. package/src/Graph/{Legend → LineChart/Legend}/index.tsx +2 -2
  37. package/src/Graph/{Legend → LineChart/Legend}/useInteractiveValues.ts +6 -2
  38. package/src/Graph/{Legend → LineChart/Legend}/useLegend.ts +1 -1
  39. package/src/Graph/{Graph.tsx → LineChart/LineChart.tsx} +8 -7
  40. package/src/Graph/{graphAtoms.ts → LineChart/graphAtoms.ts} +1 -1
  41. package/src/Graph/{helpers → LineChart/helpers}/index.ts +9 -4
  42. package/src/Graph/{index.stories.tsx → LineChart/index.stories.tsx} +39 -38
  43. package/src/Graph/{index.tsx → LineChart/index.tsx} +14 -12
  44. package/src/Graph/{models.ts → LineChart/models.ts} +8 -12
  45. package/src/Graph/{useGraphData.ts → LineChart/useLineChartData.ts} +5 -3
  46. package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +163 -0
  47. package/src/Graph/SingleBar/SingleBar.stories.tsx +45 -0
  48. package/src/Graph/SingleBar/SingleBar.tsx +25 -0
  49. package/src/Graph/SingleBar/Thresholds.tsx +100 -0
  50. package/src/Graph/SingleBar/index.ts +1 -0
  51. package/src/Graph/SingleBar/models.ts +8 -0
  52. package/src/Graph/Text/Text.stories.tsx +54 -0
  53. package/src/Graph/Text/Text.styles.ts +17 -0
  54. package/src/Graph/Text/Text.tsx +80 -0
  55. package/src/Graph/Text/index.ts +1 -0
  56. package/src/Graph/common/margins.ts +1 -0
  57. package/src/Graph/common/models.ts +7 -0
  58. package/src/Graph/{timeSeries → common/timeSeries}/index.test.ts +2 -2
  59. package/src/Graph/{timeSeries → common/timeSeries}/index.ts +22 -6
  60. package/src/Graph/{timeSeries → common/timeSeries}/models.ts +2 -0
  61. package/src/Graph/common/utils.ts +20 -0
  62. package/src/Graph/index.ts +4 -0
  63. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +4 -6
  64. package/src/Listing/Listing.cypress.spec.tsx +2 -2
  65. package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +10 -6
  66. package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +1 -1
  67. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +1 -1
  68. package/src/api/useGraphQuery/index.ts +7 -4
  69. package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +1 -0
  70. package/src/index.ts +3 -2
  71. package/src/utils/useLicenseExpirationWarning.cypress.spec.tsx +1 -1
  72. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Axes/UnitLabel.tsx +0 -0
  73. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Grids/index.tsx +0 -0
  74. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/Circle.tsx +0 -0
  75. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/helpers/index.ts +0 -0
  76. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/useCoordinateCircle.ts +0 -0
  77. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/LoadingProgress.tsx +0 -0
  78. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/GuidingLines.tsx +0 -0
  79. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/TooltipAnchorPoint.tsx +0 -0
  80. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/index.tsx +0 -0
  81. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/useTooltipAnchorPoint.ts +0 -0
  82. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Annotation/Area.tsx +0 -0
  83. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Annotation/Line.tsx +0 -0
  84. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Annotation/index.tsx +0 -0
  85. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Area/Downtime.tsx +0 -0
  86. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/EventAnnotations.tsx +0 -0
  87. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Line/Acknowledgement.tsx +0 -0
  88. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Line/Comments.tsx +0 -0
  89. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/annotationsAtoms.ts +0 -0
  90. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/index.tsx +0 -0
  91. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/models.ts +0 -0
  92. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/useAnnotation.ts +0 -0
  93. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Bar.tsx +0 -0
  94. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/TimeShiftIcon.tsx +0 -0
  95. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/TimeShiftZone.tsx +0 -0
  96. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/index.tsx +0 -0
  97. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/models.ts +0 -0
  98. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/useTimeShiftZones.ts +0 -0
  99. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Tooltip/index.tsx +0 -0
  100. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Tooltip/models.ts +0 -0
  101. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/index.tsx +0 -0
  102. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/models.ts +0 -0
  103. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/useZoomPreview.ts +0 -0
  104. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/zoomPreviewAtoms.ts +0 -0
  105. /package/src/Graph/{Legend → LineChart/Legend}/InteractiveValue.tsx +0 -0
  106. /package/src/Graph/{Legend → LineChart/Legend}/Legend.styles.ts +0 -0
  107. /package/src/Graph/{Legend → LineChart/Legend}/LegendContent.tsx +0 -0
  108. /package/src/Graph/{Legend → LineChart/Legend}/Marker.tsx +0 -0
  109. /package/src/Graph/{Legend → LineChart/Legend}/models.ts +0 -0
  110. /package/src/Graph/{Graph.styles.ts → LineChart/LineChart.styles.ts} +0 -0
  111. /package/src/Graph/{LoadingSkeleton.tsx → LineChart/LoadingSkeleton.tsx} +0 -0
  112. /package/src/Graph/{common → LineChart/common}/index.ts +0 -0
  113. /package/src/Graph/{helpers → LineChart/helpers}/doc.ts +0 -0
  114. /package/src/Graph/{mockedData → LineChart/mockedData}/annotationData.json +0 -0
  115. /package/src/Graph/{mockedData → LineChart/mockedData}/exclusionPeriodFirstPeriod.json +0 -0
  116. /package/src/Graph/{mockedData → LineChart/mockedData}/exclusionPeriodSecondPeriod.json +0 -0
  117. /package/src/Graph/{mockedData → LineChart/mockedData}/exclusionPeriodThirdPeriod.json +0 -0
  118. /package/src/Graph/{mockedData → LineChart/mockedData}/lastDay.json +0 -0
  119. /package/src/Graph/{mockedData → LineChart/mockedData}/lastDayAreaStack.json +0 -0
  120. /package/src/Graph/{mockedData → LineChart/mockedData}/lastDayForward.json +0 -0
  121. /package/src/Graph/{mockedData → LineChart/mockedData}/lastDayThreshold.json +0 -0
  122. /package/src/Graph/{mockedData → LineChart/mockedData}/lastMonth.json +0 -0
  123. /package/src/Graph/{mockedData → LineChart/mockedData}/lastWeek.json +0 -0
  124. /package/src/Graph/{mockedData → LineChart/mockedData}/zoomPreview.json +0 -0
  125. /package/src/Graph/{translatedLabels.ts → LineChart/translatedLabels.ts} +0 -0
  126. /package/src/Graph/{useGraphIntersection.ts → LineChart/useLineChartIntersection.ts} +0 -0
@@ -73,15 +73,13 @@ describe('Multi connected autocomplete', () => {
73
73
  });
74
74
  });
75
75
 
76
- cy.matchImageSnapshot(
77
- 'displays the list when the user clicks on the input'
78
- );
76
+ cy.makeSnapshot('displays the list when the user clicks on the input');
79
77
 
80
78
  cy.get('@input').click();
81
79
 
82
80
  cy.get('@listOptions').should('not.exist');
83
81
 
84
- cy.matchImageSnapshot('hides the list when the user clicks on the input');
82
+ cy.makeSnapshot('hides the list when the user clicks on the input');
85
83
  });
86
84
 
87
85
  it('displays exactly one option on the list when the user types that option', () => {
@@ -109,7 +107,7 @@ describe('Multi connected autocomplete', () => {
109
107
  cy.contains(optionOne).should('be.visible');
110
108
  });
111
109
 
112
- cy.matchImageSnapshot();
110
+ cy.makeSnapshot();
113
111
  });
114
112
 
115
113
  it('displays all options on the list when the user searches for and selects an option', () => {
@@ -156,6 +154,6 @@ describe('Multi connected autocomplete', () => {
156
154
  });
157
155
  });
158
156
 
159
- cy.matchImageSnapshot();
157
+ cy.makeSnapshot();
160
158
  });
161
159
  });
@@ -105,7 +105,7 @@ describe('Listing', () => {
105
105
  });
106
106
  });
107
107
 
108
- cy.matchImageSnapshot();
108
+ cy.makeSnapshot();
109
109
  });
110
110
 
111
111
  it('collapses the row when the corresponding icon si clicked', () => {
@@ -115,6 +115,6 @@ describe('Listing', () => {
115
115
 
116
116
  cy.contains('Sub item 100').should('not.exist');
117
117
 
118
- cy.matchImageSnapshot();
118
+ cy.makeSnapshot();
119
119
  });
120
120
  });
@@ -187,9 +187,11 @@ describe('Rich Text Editor', () => {
187
187
  });
188
188
 
189
189
  it('displays editor when editable props is false and an initialState exist', () => {
190
- cy.get('[data-testid="RichTextEditor"]')
191
- .invoke('attr', 'contenteditable')
192
- .should('eq', 'false');
190
+ cy.get('[data-testid="RichTextEditor"]').should(
191
+ 'have.attr',
192
+ 'contenteditable',
193
+ 'false'
194
+ );
193
195
  cy.findByLabelText('Undo').should('not.exist');
194
196
  cy.findByLabelText('Redo').should('not.exist');
195
197
  cy.findByLabelText('bold').should('not.exist');
@@ -214,9 +216,11 @@ describe('Rich Text Editor', () => {
214
216
  });
215
217
 
216
218
  it('displays editor when editable props is false and an initialState exist', () => {
217
- cy.get('[data-testid="RichTextEditor"]')
218
- .invoke('attr', 'contenteditable')
219
- .should('eq', 'true');
219
+ cy.get('[data-testid="RichTextEditor"]').should(
220
+ 'have.attr',
221
+ 'contenteditable',
222
+ 'false'
223
+ );
220
224
  cy.findByLabelText('Undo').should('be.disabled');
221
225
  cy.findByLabelText('Redo').should('be.disabled');
222
226
  cy.findByLabelText('bold').should('be.disabled');
@@ -59,7 +59,7 @@ data.forEach((item) =>
59
59
  });
60
60
 
61
61
  it(`displays correctly the dates design when screen resolution is ${width}px`, () => {
62
- cy.matchImageSnapshot(`${width}px`);
62
+ cy.makeSnapshot(`${width}px`);
63
63
  });
64
64
  })
65
65
  );
@@ -499,7 +499,7 @@ testData.forEach((item) =>
499
499
  getNextMonth({ currentMonth, labelButton: item.button });
500
500
  }
501
501
 
502
- cy.matchImageSnapshot(
502
+ cy.makeSnapshot(
503
503
  `calendar-${item.timezone}-${
504
504
  Object.keys(element)[0]
505
505
  }-when-clicking-on-${item.button}`
@@ -1,19 +1,20 @@
1
1
  import { T, always, cond, flatten, isEmpty, join, pipe, pluck } from 'ramda';
2
2
  import dayjs from 'dayjs';
3
3
 
4
- import { GraphData, useFetchQuery } from '../..';
4
+ import { LineChartData, useFetchQuery } from '../..';
5
5
 
6
6
  import { ServiceMetric } from './models';
7
7
 
8
8
  interface UseMetricsQueryProps {
9
9
  baseEndpoint: string;
10
10
  metrics: Array<ServiceMetric>;
11
+ refreshInterval?: number | false;
11
12
  timePeriod?: TimePeriod;
12
13
  }
13
14
 
14
15
  interface UseMetricsQueryState {
15
16
  end: string;
16
- graphData: GraphData | undefined;
17
+ graphData: LineChartData | undefined;
17
18
  isGraphLoading: boolean;
18
19
  isMetricIdsEmpty: boolean;
19
20
  start: string;
@@ -37,14 +38,15 @@ const getStartEndFromTimePeriod = (
37
38
  ])(timePeriod);
38
39
  };
39
40
 
40
- interface PerformanceGraphData extends Omit<GraphData, 'global'> {
41
+ interface PerformanceGraphData extends Omit<LineChartData, 'global'> {
41
42
  base: number;
42
43
  }
43
44
 
44
45
  const useGraphQuery = ({
45
46
  metrics,
46
47
  baseEndpoint,
47
- timePeriod = TimePeriod.lastDay
48
+ timePeriod = TimePeriod.lastDay,
49
+ refreshInterval = false
48
50
  }: UseMetricsQueryProps): UseMetricsQueryState => {
49
51
  const metricIds = pipe(
50
52
  pluck('metrics'),
@@ -65,6 +67,7 @@ const useGraphQuery = ({
65
67
  getQueryKey: () => ['graph', metricIds],
66
68
  queryOptions: {
67
69
  enabled: !isEmpty(metricIds),
70
+ refetchInterval: refreshInterval,
68
71
  suspense: false
69
72
  }
70
73
  });
@@ -2,6 +2,7 @@ import { makeStyles } from 'tss-react/mui';
2
2
 
3
3
  export const useCollapsibleItemStyles = makeStyles()((theme) => ({
4
4
  accordion: {
5
+ backgroundColor: 'transparent',
5
6
  border: 'none',
6
7
  borderBottom: `1px solid ${theme.palette.divider}`
7
8
  },
package/src/index.ts CHANGED
@@ -144,5 +144,6 @@ export type { ResponseError, CatchErrorProps } from './api/customFetch';
144
144
  export * from './utils';
145
145
  export { default as FluidTypography } from './Typography/FluidTypography';
146
146
  export * from './Dashboard';
147
- export { default as Graph } from './Graph';
148
- export type { GraphData } from './Graph/models';
147
+ export * from './Graph';
148
+ export type { LineChartData } from './Graph/common/models';
149
+ export * from './Graph/common/timeSeries';
@@ -132,6 +132,6 @@ describe('License', () => {
132
132
 
133
133
  cy.findByText(labelLicenseWarning('centreon-autodiscovery-server', 10));
134
134
 
135
- cy.matchImageSnapshot();
135
+ cy.makeSnapshot();
136
136
  });
137
137
  });
File without changes
File without changes