@centreon/ui 23.10.57 → 23.10.58

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 (121) 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/RichTextEditor/RichTextEditor.cypress.spec.tsx +10 -6
  64. package/src/api/useGraphQuery/index.ts +7 -4
  65. package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +1 -0
  66. package/src/index.ts +3 -2
  67. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Axes/UnitLabel.tsx +0 -0
  68. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Grids/index.tsx +0 -0
  69. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/Circle.tsx +0 -0
  70. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/helpers/index.ts +0 -0
  71. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/useCoordinateCircle.ts +0 -0
  72. /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/LoadingProgress.tsx +0 -0
  73. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/GuidingLines.tsx +0 -0
  74. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/TooltipAnchorPoint.tsx +0 -0
  75. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/index.tsx +0 -0
  76. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/useTooltipAnchorPoint.ts +0 -0
  77. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Annotation/Area.tsx +0 -0
  78. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Annotation/Line.tsx +0 -0
  79. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Annotation/index.tsx +0 -0
  80. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Area/Downtime.tsx +0 -0
  81. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/EventAnnotations.tsx +0 -0
  82. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Line/Acknowledgement.tsx +0 -0
  83. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Line/Comments.tsx +0 -0
  84. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/annotationsAtoms.ts +0 -0
  85. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/index.tsx +0 -0
  86. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/models.ts +0 -0
  87. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/useAnnotation.ts +0 -0
  88. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Bar.tsx +0 -0
  89. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/TimeShiftIcon.tsx +0 -0
  90. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/TimeShiftZone.tsx +0 -0
  91. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/index.tsx +0 -0
  92. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/models.ts +0 -0
  93. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/useTimeShiftZones.ts +0 -0
  94. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Tooltip/index.tsx +0 -0
  95. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Tooltip/models.ts +0 -0
  96. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/index.tsx +0 -0
  97. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/models.ts +0 -0
  98. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/useZoomPreview.ts +0 -0
  99. /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/zoomPreviewAtoms.ts +0 -0
  100. /package/src/Graph/{Legend → LineChart/Legend}/InteractiveValue.tsx +0 -0
  101. /package/src/Graph/{Legend → LineChart/Legend}/Legend.styles.ts +0 -0
  102. /package/src/Graph/{Legend → LineChart/Legend}/LegendContent.tsx +0 -0
  103. /package/src/Graph/{Legend → LineChart/Legend}/Marker.tsx +0 -0
  104. /package/src/Graph/{Legend → LineChart/Legend}/models.ts +0 -0
  105. /package/src/Graph/{Graph.styles.ts → LineChart/LineChart.styles.ts} +0 -0
  106. /package/src/Graph/{LoadingSkeleton.tsx → LineChart/LoadingSkeleton.tsx} +0 -0
  107. /package/src/Graph/{common → LineChart/common}/index.ts +0 -0
  108. /package/src/Graph/{helpers → LineChart/helpers}/doc.ts +0 -0
  109. /package/src/Graph/{mockedData → LineChart/mockedData}/annotationData.json +0 -0
  110. /package/src/Graph/{mockedData → LineChart/mockedData}/exclusionPeriodFirstPeriod.json +0 -0
  111. /package/src/Graph/{mockedData → LineChart/mockedData}/exclusionPeriodSecondPeriod.json +0 -0
  112. /package/src/Graph/{mockedData → LineChart/mockedData}/exclusionPeriodThirdPeriod.json +0 -0
  113. /package/src/Graph/{mockedData → LineChart/mockedData}/lastDay.json +0 -0
  114. /package/src/Graph/{mockedData → LineChart/mockedData}/lastDayAreaStack.json +0 -0
  115. /package/src/Graph/{mockedData → LineChart/mockedData}/lastDayForward.json +0 -0
  116. /package/src/Graph/{mockedData → LineChart/mockedData}/lastDayThreshold.json +0 -0
  117. /package/src/Graph/{mockedData → LineChart/mockedData}/lastMonth.json +0 -0
  118. /package/src/Graph/{mockedData → LineChart/mockedData}/lastWeek.json +0 -0
  119. /package/src/Graph/{mockedData → LineChart/mockedData}/zoomPreview.json +0 -0
  120. /package/src/Graph/{translatedLabels.ts → LineChart/translatedLabels.ts} +0 -0
  121. /package/src/Graph/{useGraphIntersection.ts → LineChart/useLineChartIntersection.ts} +0 -0
@@ -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';
File without changes
File without changes