@centreon/ui 24.10.12 → 24.10.13
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 +3 -2
- package/public/mockServiceWorker.js +1 -1
- package/src/Button/Icon/index.tsx +3 -1
- package/src/Dashboard/Dashboard.styles.ts +3 -4
- package/src/Dashboard/DashboardLayout.stories.tsx +1 -1
- package/src/Dashboard/Grid.tsx +11 -17
- package/src/Dashboard/Layout.tsx +27 -56
- package/src/Dialog/UnsavedChanges/index.tsx +15 -13
- package/src/Dialog/UnsavedChanges/translatedLabels.ts +15 -13
- package/src/Form/Form.tsx +0 -1
- package/src/Form/Inputs/Autocomplete.tsx +1 -1
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +5 -2
- package/src/Form/Inputs/Grid.tsx +7 -1
- package/src/Form/Inputs/Radio.tsx +1 -1
- package/src/Form/Inputs/Switch.tsx +1 -1
- package/src/Form/Inputs/Text.tsx +1 -1
- package/src/Form/Inputs/index.tsx +25 -24
- package/src/Form/Inputs/models.ts +2 -0
- package/src/Graph/BarChart/BarChart.cypress.spec.tsx +3 -3
- package/src/Graph/BarChart/BarChart.tsx +24 -31
- package/src/Graph/BarChart/BarGroup.tsx +32 -59
- package/src/Graph/BarChart/BarStack.tsx +64 -13
- package/src/Graph/BarChart/MemoizedGroup.tsx +123 -0
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +21 -7
- package/src/Graph/BarStack/BarStack.cypress.spec.tsx +87 -9
- package/src/Graph/BarStack/BarStack.stories.tsx +13 -4
- package/src/Graph/BarStack/BarStack.styles.ts +57 -33
- package/src/Graph/BarStack/Graph.tsx +173 -0
- package/src/Graph/BarStack/GraphAndLegend.tsx +117 -0
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +61 -168
- package/src/Graph/BarStack/constants.ts +5 -0
- package/src/Graph/BarStack/models.ts +0 -1
- package/src/Graph/BarStack/useGraphAndLegend.ts +84 -0
- package/src/Graph/BarStack/useResponsiveBarStack.ts +73 -97
- package/src/Graph/Chart/Chart.cypress.spec.tsx +14 -26
- package/src/Graph/Chart/Chart.stories.tsx +1 -1
- package/src/Graph/Chart/Chart.tsx +53 -37
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +3 -3
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +19 -6
- package/src/Graph/Chart/Legend/Legend.styles.ts +25 -11
- package/src/Graph/Chart/Legend/index.tsx +6 -24
- package/src/Graph/Chart/index.tsx +34 -43
- package/src/Graph/Chart/models.ts +0 -1
- package/src/Graph/Chart/useChartData.ts +19 -1
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +20 -2
- package/src/Graph/HeatMap/model.ts +6 -2
- package/src/Graph/Legend/Legend.styles.ts +10 -0
- package/src/Graph/Legend/Legend.tsx +6 -1
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +9 -10
- package/src/Graph/SingleBar/ThresholdLine.tsx +6 -6
- package/src/Graph/Text/Text.styles.ts +2 -2
- package/src/Graph/Text/Text.tsx +23 -10
- package/src/Graph/Timeline/ResponsiveTimeline.tsx +152 -0
- package/src/Graph/Timeline/Timeline.cypress.spec.tsx +148 -0
- package/src/Graph/Timeline/Timeline.stories.tsx +91 -0
- package/src/Graph/Timeline/Timeline.tsx +28 -0
- package/src/Graph/Timeline/index.ts +1 -0
- package/src/Graph/Timeline/models.ts +20 -0
- package/src/Graph/Timeline/timeline.styles.ts +11 -0
- package/src/Graph/Timeline/translatedLabel.ts +6 -0
- package/src/Graph/Timeline/useTimeline.ts +90 -0
- package/src/Graph/Tree/Links.tsx +2 -2
- package/src/Graph/Tree/Tree.tsx +2 -2
- package/src/Graph/Tree/constants.ts +1 -1
- package/src/Graph/common/Axes/index.tsx +1 -1
- package/src/Graph/common/Axes/useAxisY.ts +8 -4
- package/src/Graph/common/BaseChart/BaseChart.tsx +3 -12
- package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +12 -4
- package/src/Graph/common/BaseChart/Header/index.tsx +3 -1
- package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +23 -11
- package/src/Graph/common/BaseChart/useComputeYAxisMaxCharacters.ts +92 -0
- package/src/Graph/common/models.ts +7 -8
- package/src/Graph/common/timeSeries/index.test.ts +1 -1
- package/src/Graph/common/timeSeries/index.ts +56 -29
- package/src/Graph/common/timeSeries/models.ts +2 -0
- package/src/Graph/common/utils.ts +51 -3
- package/src/Graph/index.ts +4 -1
- package/src/Graph/mockedData/lastDayWithNullValues.json +6 -6
- package/src/Graph/mockedData/pingServiceLinesBars.json +47 -47
- package/src/Icon/DowntimeIcon.tsx +8 -1
- package/src/Icon/FlappingIcon.tsx +22 -0
- package/src/Icon/index.ts +1 -0
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +21 -1
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +2 -2
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +52 -15
- package/src/InputField/Select/Autocomplete/Multi/index.stories.tsx +19 -0
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +8 -5
- package/src/InputField/Select/Autocomplete/index.tsx +79 -54
- package/src/InputField/Text/index.tsx +6 -4
- package/src/InputField/translatedLabels.ts +2 -0
- package/src/Listing/ActionBar/index.tsx +1 -1
- package/src/Listing/Listing.styles.ts +3 -3
- package/src/Listing/index.tsx +40 -37
- package/src/Listing/models.ts +0 -8
- package/src/Listing/useStyleTable.ts +58 -32
- package/src/MultiSelectEntries/index.tsx +2 -0
- package/src/PopoverMenu/index.tsx +2 -9
- package/src/SortableItems/index.tsx +0 -1
- package/src/ThemeProvider/index.tsx +1 -1
- package/src/ThemeProvider/palettes.ts +6 -0
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +2 -3
- package/src/TimePeriods/DateTimePickerInput.tsx +3 -1
- package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +7 -1
- package/src/api/buildListingEndpoint/models.ts +1 -0
- package/src/api/customFetch.ts +4 -1
- package/src/api/models.ts +9 -0
- package/src/api/useGraphQuery/index.ts +117 -20
- package/src/api/useGraphQuery/models.ts +1 -0
- package/src/api/useMutationQuery/index.ts +1 -1
- package/src/components/DataTable/DataTable.styles.ts +1 -1
- package/src/components/DataTable/EmptyState/DataTableEmptyState.styles.ts +2 -1
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +4 -1
- package/src/components/DataTable/Item/DataTableItem.styles.ts +28 -2
- package/src/components/DataTable/Item/DataTableItem.tsx +19 -4
- package/src/components/Form/FormActions.tsx +21 -12
- package/src/components/Layout/AreaIndicator.tsx +1 -1
- package/src/components/Layout/PageLayout/PageLayout.styles.ts +2 -7
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +0 -1
- package/src/components/Zoom/Zoom.tsx +9 -2
- package/src/components/Zoom/ZoomContent.tsx +143 -136
- package/src/components/Zoom/models.ts +18 -15
- package/src/components/Zoom/useMinimap.ts +5 -8
- package/src/components/Zoom/useZoom.ts +3 -3
- package/src/index.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/useLocale/index.ts +9 -0
- package/src/utils/useLocale/useLocale.cypress.spec.tsx +38 -0
- package/src/utils/useLocaleDateTimeFormat/index.ts +4 -2
- package/src/utils/usePluralizedTranslation.ts +2 -3
- package/src/Graph/common/timeSeries/index.test.ts-E +0 -622
- package/src/components/CrudPage/Actions/Actions.styles.ts +0 -16
- package/src/components/CrudPage/Actions/Actions.tsx +0 -24
- package/src/components/CrudPage/Actions/AddButton.tsx +0 -23
- package/src/components/CrudPage/Actions/Filters.tsx +0 -25
- package/src/components/CrudPage/Actions/Search.tsx +0 -31
- package/src/components/CrudPage/Actions/useSearch.tsx +0 -24
- package/src/components/CrudPage/Columns/Actions.tsx +0 -88
- package/src/components/CrudPage/CrudPage.cypress.spec.tsx +0 -559
- package/src/components/CrudPage/CrudPage.stories.tsx +0 -278
- package/src/components/CrudPage/CrudPageRoot.tsx +0 -142
- package/src/components/CrudPage/DeleteModal.tsx +0 -77
- package/src/components/CrudPage/Form/AddModal.tsx +0 -35
- package/src/components/CrudPage/Form/Buttons.tsx +0 -98
- package/src/components/CrudPage/Form/UpdateModal.tsx +0 -60
- package/src/components/CrudPage/Listing.tsx +0 -63
- package/src/components/CrudPage/atoms.ts +0 -30
- package/src/components/CrudPage/hooks/useDeleteItem.ts +0 -53
- package/src/components/CrudPage/hooks/useGetItem.ts +0 -36
- package/src/components/CrudPage/hooks/useGetItems.ts +0 -67
- package/src/components/CrudPage/hooks/useListingQueryKey.ts +0 -31
- package/src/components/CrudPage/index.tsx +0 -7
- package/src/components/CrudPage/models.ts +0 -118
- package/src/components/CrudPage/utils.ts +0 -4
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
filter,
|
|
15
15
|
find,
|
|
16
16
|
flatten,
|
|
17
|
+
gt,
|
|
17
18
|
head,
|
|
18
19
|
identity,
|
|
19
20
|
includes,
|
|
20
21
|
isEmpty,
|
|
21
22
|
isNil,
|
|
22
|
-
isNotNil,
|
|
23
23
|
keys,
|
|
24
24
|
last,
|
|
25
25
|
lt,
|
|
@@ -298,13 +298,17 @@ const getTimeSeriesForLines = ({
|
|
|
298
298
|
return map(
|
|
299
299
|
({ timeTick, ...metricsValue }): TimeValue => ({
|
|
300
300
|
...reduce(
|
|
301
|
-
(acc, metric_id): Omit<TimeValue, 'timePick'> =>
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
301
|
+
(acc, metric_id): Omit<TimeValue, 'timePick'> => {
|
|
302
|
+
return {
|
|
303
|
+
...acc,
|
|
304
|
+
[metric_id]:
|
|
305
|
+
invert &&
|
|
306
|
+
metricsValue[metric_id] &&
|
|
307
|
+
gt(metricsValue[metric_id], 0)
|
|
308
|
+
? negate(metricsValue[metric_id])
|
|
309
|
+
: metricsValue[metric_id]
|
|
310
|
+
};
|
|
311
|
+
},
|
|
308
312
|
{},
|
|
309
313
|
metrics
|
|
310
314
|
),
|
|
@@ -348,6 +352,19 @@ const getScaleType = (
|
|
|
348
352
|
const hasOnlyZeroesHasValue = (graphValues: Array<number>): boolean =>
|
|
349
353
|
graphValues.every((value) => equals(value, 0) || equals(value, null));
|
|
350
354
|
|
|
355
|
+
const getSanitizedValues = reject(
|
|
356
|
+
(
|
|
357
|
+
value:
|
|
358
|
+
| number
|
|
359
|
+
| false
|
|
360
|
+
| typeof Number.POSITIVE_INFINITY
|
|
361
|
+
| typeof Number.NEGATIVE_INFINITY
|
|
362
|
+
) =>
|
|
363
|
+
equals(value, false) ||
|
|
364
|
+
equals(value, Number.POSITIVE_INFINITY) ||
|
|
365
|
+
equals(value, Number.NEGATIVE_INFINITY)
|
|
366
|
+
);
|
|
367
|
+
|
|
351
368
|
const getScale = ({
|
|
352
369
|
graphValues,
|
|
353
370
|
height,
|
|
@@ -358,21 +375,33 @@ const getScale = ({
|
|
|
358
375
|
scaleLogarithmicBase,
|
|
359
376
|
isHorizontal,
|
|
360
377
|
invert,
|
|
361
|
-
hasDisplayAsBar
|
|
378
|
+
hasDisplayAsBar,
|
|
379
|
+
hasLineFilled
|
|
362
380
|
}): ScaleLinear<number, number> => {
|
|
363
381
|
const isLogScale = equals(scale, 'logarithmic');
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
382
|
+
const sanitizedValuesFormMinimum = getSanitizedValues([
|
|
383
|
+
invert && graphValues.every(lt(0))
|
|
384
|
+
? negate(getMax(graphValues))
|
|
385
|
+
: getMin(graphValues),
|
|
386
|
+
!isEmpty(stackedValues) &&
|
|
387
|
+
!equals(stackedValues, [0]) &&
|
|
388
|
+
getMin(stackedValues),
|
|
368
389
|
Math.min(...thresholds)
|
|
369
|
-
);
|
|
370
|
-
const
|
|
390
|
+
]);
|
|
391
|
+
const minValue = Math.min(...sanitizedValuesFormMinimum);
|
|
392
|
+
const minValueWithMargin =
|
|
393
|
+
(hasDisplayAsBar || hasLineFilled) && minValue > 0
|
|
394
|
+
? 0
|
|
395
|
+
: minValue - Math.abs(minValue) * 0.05;
|
|
396
|
+
|
|
397
|
+
const sanitizedValuesForMaximum = getSanitizedValues([
|
|
371
398
|
getMax(graphValues),
|
|
372
399
|
getMax(stackedValues),
|
|
373
400
|
hasOnlyZeroesHasValue(graphValues) ? 1 : 0,
|
|
374
401
|
Math.max(...thresholds)
|
|
375
|
-
);
|
|
402
|
+
]);
|
|
403
|
+
const maxValue = Math.max(...sanitizedValuesForMaximum);
|
|
404
|
+
const maxValueWithMargin = maxValue + Math.abs(maxValue) * 0.05;
|
|
376
405
|
|
|
377
406
|
const scaleType = getScaleType(scale);
|
|
378
407
|
|
|
@@ -380,7 +409,10 @@ const getScale = ({
|
|
|
380
409
|
const range = [height, upperRangeValue];
|
|
381
410
|
|
|
382
411
|
if (isCenteredZero) {
|
|
383
|
-
const greatestValue = Math.max(
|
|
412
|
+
const greatestValue = Math.max(
|
|
413
|
+
Math.abs(maxValueWithMargin),
|
|
414
|
+
Math.abs(minValueWithMargin)
|
|
415
|
+
);
|
|
384
416
|
|
|
385
417
|
return scaleType<number>({
|
|
386
418
|
base: scaleLogarithmicBase || 2,
|
|
@@ -389,7 +421,7 @@ const getScale = ({
|
|
|
389
421
|
});
|
|
390
422
|
}
|
|
391
423
|
|
|
392
|
-
const domain = [isLogScale ? 0.001 :
|
|
424
|
+
const domain = [isLogScale ? 0.001 : minValueWithMargin, maxValueWithMargin];
|
|
393
425
|
|
|
394
426
|
return scaleType<number>({
|
|
395
427
|
base: scaleLogarithmicBase || 2,
|
|
@@ -462,10 +494,11 @@ const getYScaleUnit = ({
|
|
|
462
494
|
return getScale({
|
|
463
495
|
graphValues,
|
|
464
496
|
hasDisplayAsBar: dataLines.some(
|
|
465
|
-
({ displayAs, unit: lineUnit
|
|
466
|
-
equals(unit, lineUnit) &&
|
|
467
|
-
|
|
468
|
-
|
|
497
|
+
({ displayAs, unit: lineUnit }) =>
|
|
498
|
+
equals(unit, lineUnit) && equals(displayAs, 'bar')
|
|
499
|
+
),
|
|
500
|
+
hasLineFilled: dataLines.some(
|
|
501
|
+
({ unit: lineUnit, filled }) => equals(unit, lineUnit) && filled
|
|
469
502
|
),
|
|
470
503
|
height: valueGraphHeight,
|
|
471
504
|
invert,
|
|
@@ -516,13 +549,7 @@ const getYScalePerUnit = ({
|
|
|
516
549
|
};
|
|
517
550
|
|
|
518
551
|
const formatTime = (value: number): string => {
|
|
519
|
-
|
|
520
|
-
return `${numeral(value).format('0.[00]a')} ms`;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
const t = numeral(value / 1000).format('0.[00]a');
|
|
524
|
-
|
|
525
|
-
return `${t} seconds`;
|
|
552
|
+
return `${numeral(value).format('0.[00]a')} ms`;
|
|
526
553
|
};
|
|
527
554
|
|
|
528
555
|
const registerMsUnitToNumeral = (): null => {
|
|
@@ -8,16 +8,18 @@ import {
|
|
|
8
8
|
gte,
|
|
9
9
|
head,
|
|
10
10
|
isNil,
|
|
11
|
+
last,
|
|
11
12
|
length,
|
|
12
13
|
lt,
|
|
13
14
|
lte,
|
|
14
|
-
pluck
|
|
15
|
-
last
|
|
15
|
+
pluck
|
|
16
16
|
} from 'ramda';
|
|
17
17
|
|
|
18
18
|
import { Theme, darken, getLuminance, lighten } from '@mui/material';
|
|
19
19
|
|
|
20
|
-
import { Thresholds } from './models';
|
|
20
|
+
import { Threshold, Thresholds } from './models';
|
|
21
|
+
import { formatMetricValue } from './timeSeries';
|
|
22
|
+
import { Line, TimeValue } from './timeSeries/models';
|
|
21
23
|
|
|
22
24
|
interface GetColorFromDataAndThresholdsProps {
|
|
23
25
|
baseColor?: string;
|
|
@@ -179,3 +181,49 @@ export const commonTickLabelProps = {
|
|
|
179
181
|
fontSize: 10,
|
|
180
182
|
textAnchor: 'middle'
|
|
181
183
|
};
|
|
184
|
+
|
|
185
|
+
interface GetFormattedAxisValuesProps {
|
|
186
|
+
thresholdUnit?: string;
|
|
187
|
+
axisUnit: string;
|
|
188
|
+
base?: number;
|
|
189
|
+
timeSeries: Array<TimeValue>;
|
|
190
|
+
threshold: Array<Threshold>;
|
|
191
|
+
lines: Array<Line>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export const getFormattedAxisValues = ({
|
|
195
|
+
thresholdUnit,
|
|
196
|
+
axisUnit,
|
|
197
|
+
timeSeries,
|
|
198
|
+
base = 1000,
|
|
199
|
+
lines,
|
|
200
|
+
threshold
|
|
201
|
+
}: GetFormattedAxisValuesProps): Array<string> => {
|
|
202
|
+
const metricId = (lines.find(({ unit }) => equals(unit, axisUnit)) as Line)
|
|
203
|
+
?.metric_id;
|
|
204
|
+
|
|
205
|
+
if (isNil(metricId)) {
|
|
206
|
+
return [];
|
|
207
|
+
}
|
|
208
|
+
const formattedData = timeSeries.map((data) =>
|
|
209
|
+
formatMetricValue({
|
|
210
|
+
value: data[metricId],
|
|
211
|
+
unit: axisUnit,
|
|
212
|
+
base
|
|
213
|
+
})
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
const formattedThresholdValues = equals(thresholdUnit, axisUnit)
|
|
217
|
+
? threshold.map(({ value }) =>
|
|
218
|
+
formatMetricValue({
|
|
219
|
+
value,
|
|
220
|
+
unit: axisUnit,
|
|
221
|
+
base
|
|
222
|
+
})
|
|
223
|
+
) || []
|
|
224
|
+
: [];
|
|
225
|
+
|
|
226
|
+
return formattedData
|
|
227
|
+
.concat(formattedThresholdValues)
|
|
228
|
+
.filter((v) => v) as Array<string>;
|
|
229
|
+
};
|
package/src/Graph/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { ParentSizeProps } from '@visx/responsive/lib/components/ParentSize';
|
|
1
2
|
export { default as LineChart } from './Chart';
|
|
2
3
|
export { default as ThresholdLines } from './Chart/BasicComponents/Lines/Threshold';
|
|
3
4
|
export { default as useLineChartData } from './Chart/useChartData';
|
|
@@ -5,12 +6,14 @@ export { default as BarChart } from './BarChart/BarChart';
|
|
|
5
6
|
export { Gauge } from './Gauge';
|
|
6
7
|
export { SingleBar } from './SingleBar';
|
|
7
8
|
export { Text as GraphText } from './Text';
|
|
9
|
+
export { default as Header } from './common/BaseChart/Header';
|
|
8
10
|
|
|
9
11
|
export { HeatMap } from './HeatMap';
|
|
10
12
|
export { BarStack } from './BarStack';
|
|
11
13
|
export { PieChart } from './PieChart';
|
|
14
|
+
export { Timeline } from './Timeline';
|
|
12
15
|
export * from './Tree';
|
|
13
|
-
export type { LineChartData } from './common/models';
|
|
16
|
+
export type { LineChartData, Threshold, Thresholds } from './common/models';
|
|
14
17
|
export * from './common/timeSeries';
|
|
15
18
|
export type { Metric } from './common/timeSeries/models';
|
|
16
19
|
export * from './Chart/models';
|
|
@@ -974,12 +974,12 @@
|
|
|
974
974
|
0.32092,
|
|
975
975
|
0.23609333333,
|
|
976
976
|
0.45102333333,
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
977
|
+
null,
|
|
978
|
+
null,
|
|
979
|
+
null,
|
|
980
|
+
null,
|
|
981
|
+
null,
|
|
982
|
+
null,
|
|
983
983
|
null
|
|
984
984
|
],
|
|
985
985
|
"prints": [["Last:0.65"], ["Min:0.03"], ["Max:0.98"], ["Average:0.50"]],
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"global": {
|
|
3
3
|
"base": 1000,
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "Ping service"
|
|
5
5
|
},
|
|
6
6
|
"metrics": [
|
|
7
7
|
{
|
|
8
8
|
"metric_id": 2,
|
|
9
|
-
"metric": "
|
|
10
|
-
"metric_legend": "
|
|
11
|
-
"unit": "
|
|
9
|
+
"metric": "Centreon-Server: pl",
|
|
10
|
+
"metric_legend": "Centreon-Server: pl",
|
|
11
|
+
"unit": "B",
|
|
12
12
|
"min": 0.0,
|
|
13
13
|
"max": 100.0,
|
|
14
14
|
"ds_data": {
|
|
15
|
-
"ds_color_line": "#
|
|
16
|
-
"ds_color_area": "#
|
|
15
|
+
"ds_color_line": "#F30B23",
|
|
16
|
+
"ds_color_area": "#F30B23",
|
|
17
17
|
"ds_filled": true,
|
|
18
18
|
"ds_invert": false,
|
|
19
19
|
"ds_legend": null,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"ds_color_line_mode": 0
|
|
24
24
|
},
|
|
25
25
|
"displayAs": "bar",
|
|
26
|
-
"legend": "
|
|
26
|
+
"legend": "Centreon-Server: Packet Loss",
|
|
27
27
|
"stack": 0,
|
|
28
28
|
"warning_high_threshold": 20.0,
|
|
29
29
|
"critical_high_threshold": 50.0,
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"critical_low_threshold": 0.0,
|
|
32
32
|
"ds_order": 1,
|
|
33
33
|
"data": [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
1243.0,
|
|
35
|
+
3562.0,
|
|
36
|
+
3532.0,
|
|
37
|
+
9843.0,
|
|
38
|
+
3332.0,
|
|
39
|
+
6576.0,
|
|
40
|
+
5647.0,
|
|
41
|
+
8763.0,
|
|
42
|
+
7487.0,
|
|
43
|
+
4783.0,
|
|
44
|
+
6835.0,
|
|
45
45
|
null,
|
|
46
46
|
null
|
|
47
47
|
],
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"metric_id": 10,
|
|
55
|
-
"metric": "
|
|
56
|
-
"metric_legend": "
|
|
57
|
-
"unit": "
|
|
55
|
+
"metric": "Space used",
|
|
56
|
+
"metric_legend": "Space used",
|
|
57
|
+
"unit": "B",
|
|
58
58
|
"min": 0.0,
|
|
59
59
|
"max": 100.0,
|
|
60
60
|
"ds_data": {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"ds_color_line_mode": 0
|
|
70
70
|
},
|
|
71
71
|
"displayAs": "bar",
|
|
72
|
-
"legend": "
|
|
72
|
+
"legend": "Space used",
|
|
73
73
|
"stack": 0,
|
|
74
74
|
"warning_high_threshold": 20.0,
|
|
75
75
|
"critical_high_threshold": 50.0,
|
|
@@ -90,14 +90,14 @@
|
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
"metric_id": 1,
|
|
93
|
-
"metric": "
|
|
94
|
-
"metric_legend": "
|
|
93
|
+
"metric": "Centreon-Server: rta",
|
|
94
|
+
"metric_legend": "Centreon-Server: rta",
|
|
95
95
|
"unit": "ms",
|
|
96
96
|
"min": 0.0,
|
|
97
97
|
"max": null,
|
|
98
98
|
"ds_data": {
|
|
99
|
-
"ds_color_line": "#
|
|
100
|
-
"ds_color_area": "#
|
|
99
|
+
"ds_color_line": "#29AFEE",
|
|
100
|
+
"ds_color_area": "#29AFEE",
|
|
101
101
|
"ds_filled": true,
|
|
102
102
|
"ds_invert": false,
|
|
103
103
|
"ds_legend": null,
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"ds_color_line_mode": 0
|
|
108
108
|
},
|
|
109
109
|
"displayAs": "line",
|
|
110
|
-
"legend": "
|
|
110
|
+
"legend": "Centreon-Server: Round-Trip Average Time",
|
|
111
111
|
"stack": 0,
|
|
112
112
|
"warning_high_threshold": 200.0,
|
|
113
113
|
"critical_high_threshold": 400.0,
|
|
@@ -136,8 +136,8 @@
|
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
"metric_id": 3,
|
|
139
|
-
"metric": "
|
|
140
|
-
"metric_legend": "
|
|
139
|
+
"metric": "Centreon-Server: rtmax",
|
|
140
|
+
"metric_legend": "Centreon-Server: rtmax",
|
|
141
141
|
"unit": "ms",
|
|
142
142
|
"min": null,
|
|
143
143
|
"max": null,
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"ds_color_line": "#525256",
|
|
146
146
|
"ds_color_area": "#525256",
|
|
147
147
|
"ds_filled": false,
|
|
148
|
-
"ds_invert":
|
|
148
|
+
"ds_invert": true,
|
|
149
149
|
"ds_legend": null,
|
|
150
150
|
"ds_stack": false,
|
|
151
151
|
"ds_order": 2,
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"ds_color_line_mode": 0
|
|
154
154
|
},
|
|
155
155
|
"displayAs": "line",
|
|
156
|
-
"legend": "
|
|
156
|
+
"legend": "Centreon-Server: Round-Trip Maximum Time",
|
|
157
157
|
"stack": 0,
|
|
158
158
|
"warning_high_threshold": null,
|
|
159
159
|
"critical_high_threshold": null,
|
|
@@ -182,8 +182,8 @@
|
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
"metric_id": 4,
|
|
185
|
-
"metric": "
|
|
186
|
-
"metric_legend": "
|
|
185
|
+
"metric": "Centreon-Server: rtmin",
|
|
186
|
+
"metric_legend": "Centreon-Server: rtmin",
|
|
187
187
|
"unit": "ms",
|
|
188
188
|
"min": null,
|
|
189
189
|
"max": null,
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
"ds_color_line_mode": 0
|
|
200
200
|
},
|
|
201
201
|
"displayAs": "line",
|
|
202
|
-
"legend": "
|
|
202
|
+
"legend": "Centreon-Server: Round-Trip Minimum Time",
|
|
203
203
|
"stack": 0,
|
|
204
204
|
"warning_high_threshold": null,
|
|
205
205
|
"critical_high_threshold": null,
|
|
@@ -228,18 +228,18 @@
|
|
|
228
228
|
}
|
|
229
229
|
],
|
|
230
230
|
"times": [
|
|
231
|
-
"2024-06-
|
|
232
|
-
"2024-06-
|
|
233
|
-
"2024-06-
|
|
234
|
-
"2024-06-
|
|
235
|
-
"2024-06-
|
|
236
|
-
"2024-06-
|
|
237
|
-
"2024-06-
|
|
238
|
-
"2024-06-
|
|
239
|
-
"2024-06-
|
|
240
|
-
"2024-06-
|
|
241
|
-
"2024-06-
|
|
242
|
-
"2024-06-
|
|
243
|
-
"2024-06-
|
|
231
|
+
"2024-06-19T10:50:00+02:00",
|
|
232
|
+
"2024-06-19T10:55:00+02:00",
|
|
233
|
+
"2024-06-19T11:00:00+02:00",
|
|
234
|
+
"2024-06-19T11:05:00+02:00",
|
|
235
|
+
"2024-06-19T11:10:00+02:00",
|
|
236
|
+
"2024-06-19T11:15:00+02:00",
|
|
237
|
+
"2024-06-19T11:20:00+02:00",
|
|
238
|
+
"2024-06-19T11:25:00+02:00",
|
|
239
|
+
"2024-06-19T11:30:00+02:00",
|
|
240
|
+
"2024-06-19T11:35:00+02:00",
|
|
241
|
+
"2024-06-19T11:40:00+02:00",
|
|
242
|
+
"2024-06-19T11:45:00+02:00",
|
|
243
|
+
"2024-06-19T11:50:00+02:00"
|
|
244
244
|
]
|
|
245
245
|
}
|
|
@@ -10,5 +10,12 @@ const icon = (
|
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
export const DowntimeIcon = (props: SvgIconProps): JSX.Element => (
|
|
13
|
-
<BaseIcon
|
|
13
|
+
<BaseIcon
|
|
14
|
+
{...props}
|
|
15
|
+
Icon={icon}
|
|
16
|
+
height="24"
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
width="24"
|
|
19
|
+
dataTestId="DowntimeIcon"
|
|
20
|
+
/>
|
|
14
21
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvgIconProps } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
import BaseIcon from './BaseIcon';
|
|
4
|
+
|
|
5
|
+
const icon = (
|
|
6
|
+
<g>
|
|
7
|
+
<path d="M22 10.07c-2.24 0-4.01-1.04-5.72-2.04-1.61-.94-3.13-1.83-4.96-1.83s-3.18.92-4.57 1.9c-1.33 1.16-3 1.85-4.76 1.97v-.83c1.7 0 2.95-.88 4.28-1.82 1.41-1.22 3.19-2.05 5.05-2.05 1.95 0 3.8.82 5.38 1.95 1.56 1.11 3.39 1.78 5.3 1.92v.83Z" />
|
|
8
|
+
<path d="M22 14.07c-2.24 0-4.01-1.04-5.72-2.04-1.61-.94-3.13-1.83-4.96-1.83s-3.18.92-4.57 1.9c-1.33 1.16-3 1.85-4.76 1.97v-.83c1.7 0 2.95-.88 4.28-1.82 1.41-1.22 3.18-2.05 5.05-2.05 1.87 0 3.8.82 5.38 1.95 1.56 1.11 3.39 1.78 5.3 1.92v.83Z" />
|
|
9
|
+
<path d="M22 18.07c-2.24 0-4.01-1.04-5.72-2.04-1.61-.94-3.13-1.83-4.96-1.83s-3.18.92-4.57 1.9c-1.33 1.16-3 1.85-4.76 1.97v-.83c1.7 0 2.95-.88 4.28-1.82 1.41-1.22 3.18-2.07 5.05-2.05 1.87.02 3.8.82 5.38 1.95 1.56 1.11 3.39 1.78 5.3 1.92v.83Z" />
|
|
10
|
+
</g>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const FlappingIcon = (props: SvgIconProps): JSX.Element => (
|
|
14
|
+
<BaseIcon
|
|
15
|
+
{...props}
|
|
16
|
+
dataTestId="FlappingIcon"
|
|
17
|
+
Icon={icon}
|
|
18
|
+
height="24"
|
|
19
|
+
viewBox="0 0 24 24"
|
|
20
|
+
width="24"
|
|
21
|
+
/>
|
|
22
|
+
);
|
package/src/Icon/index.ts
CHANGED
|
@@ -13,11 +13,12 @@ import { baseEndpoint, getEndpoint, label, optionsData } from './utils';
|
|
|
13
13
|
|
|
14
14
|
import MultiConnectedAutocompleteField from '.';
|
|
15
15
|
|
|
16
|
-
const renderMultiAutocompleteField = (): RenderResult =>
|
|
16
|
+
const renderMultiAutocompleteField = (customRenderTags?): RenderResult =>
|
|
17
17
|
render(
|
|
18
18
|
<TestQueryProvider>
|
|
19
19
|
<MultiConnectedAutocompleteField
|
|
20
20
|
baseEndpoint=""
|
|
21
|
+
customRenderTags={customRenderTags}
|
|
21
22
|
field="host.name"
|
|
22
23
|
getEndpoint={getEndpoint}
|
|
23
24
|
label={label}
|
|
@@ -42,4 +43,23 @@ describe(MultiConnectedAutocompleteField, () => {
|
|
|
42
43
|
expect(getFetchCall(0)).toEqual(`${baseEndpoint}?page=1`);
|
|
43
44
|
});
|
|
44
45
|
});
|
|
46
|
+
|
|
47
|
+
it('display tags when customTagsRender is defined', async () => {
|
|
48
|
+
const customRender = (tags: React.ReactNode): React.ReactNode => (
|
|
49
|
+
<div data-testid="custom-tags-wrapper">{tags}</div>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const { getByLabelText, getByTestId } =
|
|
53
|
+
renderMultiAutocompleteField(customRender);
|
|
54
|
+
|
|
55
|
+
fireEvent.click(getByLabelText('Open'));
|
|
56
|
+
|
|
57
|
+
await waitFor(() => {
|
|
58
|
+
const tagChip = getByTestId(
|
|
59
|
+
`tag-option-chip-${optionsData.result[0].id}`
|
|
60
|
+
);
|
|
61
|
+
expect(tagChip).toBeVisible();
|
|
62
|
+
expect(tagChip).toHaveTextContent(optionsData.result[0].name);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
45
65
|
});
|
|
@@ -95,8 +95,8 @@ describe(SingleConnectedAutocompleteField, () => {
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
await waitFor(() => {
|
|
98
|
-
expect(getFetchCall(2)).toEqual(
|
|
99
|
-
|
|
98
|
+
expect(decodeURIComponent(getFetchCall(2))).toEqual(
|
|
99
|
+
'endpoint?page=1&search={"$and":[{"$and":[{"host.name":{"$lk":"%My Option 2%"}}]}]}'
|
|
100
100
|
);
|
|
101
101
|
});
|
|
102
102
|
});
|