@centreon/ui 26.11.9 → 26.11.10
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 +2 -2
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +0 -1
- package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/index.tsx +1 -1
- package/src/Graph/Chart/common/index.ts +4 -4
- package/src/Graph/common/BaseChart/Header/index.tsx +2 -2
- package/src/Graph/common/BaseChart/Header/useHeaderStyles.ts +1 -1
- package/src/Graph/common/timeSeries/index.test.ts +31 -30
- package/src/Graph/common/timeSeries/index.ts +20 -20
- package/src/Listing/Cell/DataCell.tsx +0 -2
- package/src/Listing/Listing.cypress.spec.tsx +45 -0
- package/src/StatusChip/index.tsx +1 -1
- package/src/api/index.ts +1 -1
- package/src/components/Button/Icon/IconButton.tsx +1 -0
- package/src/components/Form/Dashboard/DashboardForm.styles.ts +1 -1
- package/src/components/Menu/useMenu.tsx +1 -1
- package/src/index.ts +5 -6
- package/src/queryParameters/url/index.ts +1 -1
- package/src/utils/useLocaleDateTimeFormat/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "26.11.
|
|
3
|
+
"version": "26.11.10",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update:deps": "pnpx npm-check-updates -i --format group",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"test/*"
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@biomejs/biome": "2.
|
|
59
|
+
"@biomejs/biome": "2.5.14",
|
|
60
60
|
"@cypress/react": "^9.0.0",
|
|
61
61
|
"@cypress/webpack-dev-server": "^4.0.1",
|
|
62
62
|
"@faker-js/faker": "^9.5.1",
|
|
@@ -42,11 +42,11 @@ const getCurveFactory = (
|
|
|
42
42
|
|
|
43
43
|
export {
|
|
44
44
|
commonTickLabelProps,
|
|
45
|
-
margin,
|
|
46
|
-
getFillColor,
|
|
47
45
|
dateFormat,
|
|
48
|
-
timeFormat,
|
|
49
46
|
dateTimeFormat,
|
|
47
|
+
getCurveFactory,
|
|
48
|
+
getFillColor,
|
|
49
|
+
margin,
|
|
50
50
|
maxLinesDisplayedLegend,
|
|
51
|
-
|
|
51
|
+
timeFormat
|
|
52
52
|
};
|
|
@@ -5,7 +5,7 @@ import { useMemoComponent } from '@centreon/ui';
|
|
|
5
5
|
import type { ReactElement } from 'react';
|
|
6
6
|
|
|
7
7
|
import type { LineChartHeader } from './models';
|
|
8
|
-
import {
|
|
8
|
+
import { useHeaderChartStyles } from './useHeaderStyles';
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
header?: LineChartHeader;
|
|
@@ -13,7 +13,7 @@ interface Props {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const Header = ({ title, header }: Props): ReactElement => {
|
|
16
|
-
const { classes } =
|
|
16
|
+
const { classes } = useHeaderChartStyles();
|
|
17
17
|
|
|
18
18
|
const displayTitle = header?.displayTitle ?? true;
|
|
19
19
|
|
|
@@ -397,11 +397,14 @@ describe('timeSeries', () => {
|
|
|
397
397
|
[null, 'B', 1024, null]
|
|
398
398
|
];
|
|
399
399
|
|
|
400
|
-
it.each(
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
400
|
+
it.each(cases)(
|
|
401
|
+
'formats the given value to a human readable form according to the given unit and base',
|
|
402
|
+
(value, unit, base, formattedResult) => {
|
|
403
|
+
expect(formatMetricValue({ base, unit, value })).toEqual(
|
|
404
|
+
formattedResult
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
);
|
|
405
408
|
});
|
|
406
409
|
|
|
407
410
|
describe('getSortedStackedLines', () => {
|
|
@@ -639,33 +642,31 @@ describe('Format value with unit', () => {
|
|
|
639
642
|
});
|
|
640
643
|
|
|
641
644
|
describe('Format the value as human readable', () => {
|
|
642
|
-
it.each(humanReadableTestCases)(
|
|
643
|
-
value,
|
|
644
|
-
unit,
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
});
|
|
645
|
+
it.each(humanReadableTestCases)(
|
|
646
|
+
'formats the value with $unit',
|
|
647
|
+
({ value, unit, expectedResult }) => {
|
|
648
|
+
expect(
|
|
649
|
+
formatMetricValueWithUnit({
|
|
650
|
+
unit,
|
|
651
|
+
value
|
|
652
|
+
})
|
|
653
|
+
).toEqual(expectedResult);
|
|
654
|
+
}
|
|
655
|
+
);
|
|
654
656
|
});
|
|
655
657
|
|
|
656
658
|
describe('Format the value as raw', () => {
|
|
657
|
-
it.each(rawTestCases)(
|
|
658
|
-
value,
|
|
659
|
-
unit,
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
});
|
|
659
|
+
it.each(rawTestCases)(
|
|
660
|
+
'formats the value with $unit',
|
|
661
|
+
({ value, unit, expectedResult }) => {
|
|
662
|
+
expect(
|
|
663
|
+
formatMetricValueWithUnit({
|
|
664
|
+
isRaw: true,
|
|
665
|
+
unit,
|
|
666
|
+
value
|
|
667
|
+
})
|
|
668
|
+
).toEqual(expectedResult);
|
|
669
|
+
}
|
|
670
|
+
);
|
|
670
671
|
});
|
|
671
672
|
});
|
|
@@ -947,32 +947,32 @@ export const getStackedLinesTimeSeriesPerStackAndUnit = ({
|
|
|
947
947
|
};
|
|
948
948
|
|
|
949
949
|
export {
|
|
950
|
-
|
|
950
|
+
bisectDate,
|
|
951
|
+
formatMetricValue,
|
|
952
|
+
formatMetricValueWithUnit,
|
|
953
|
+
getDates,
|
|
954
|
+
getInvertedStackedLines,
|
|
951
955
|
getLineData,
|
|
952
|
-
|
|
956
|
+
getLineForMetric,
|
|
953
957
|
getMax,
|
|
954
|
-
getTime,
|
|
955
958
|
getMetrics,
|
|
956
|
-
getValueForMetric,
|
|
957
|
-
getMetricValuesForUnit,
|
|
958
|
-
getUnits,
|
|
959
|
-
getDates,
|
|
960
|
-
getLineForMetric,
|
|
961
959
|
getMetricValuesForLines,
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
getInvertedStackedLines,
|
|
960
|
+
getMetricValuesForUnit,
|
|
961
|
+
getMetricWithLatestData,
|
|
962
|
+
getMin,
|
|
966
963
|
getNotInvertedStackedLines,
|
|
967
|
-
hasUnitStackedLines,
|
|
968
|
-
getYScale,
|
|
969
964
|
getScale,
|
|
970
|
-
|
|
971
|
-
|
|
965
|
+
getSortedStackedLines,
|
|
966
|
+
getStackedMetricValues,
|
|
967
|
+
getTime,
|
|
968
|
+
getTimeSeries,
|
|
969
|
+
getTimeSeriesForLines,
|
|
972
970
|
getTimeValue,
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
971
|
+
getUnits,
|
|
972
|
+
getValueForMetric,
|
|
973
|
+
getXScale,
|
|
974
|
+
getYScale,
|
|
975
|
+
getYScalePerUnit,
|
|
976
976
|
getYScaleUnit,
|
|
977
|
-
|
|
977
|
+
hasUnitStackedLines
|
|
978
978
|
};
|
|
@@ -113,7 +113,6 @@ const DataCell = ({
|
|
|
113
113
|
if (!clickable) {
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
e.preventDefault();
|
|
117
116
|
e.stopPropagation();
|
|
118
117
|
}}
|
|
119
118
|
{...commonCellProps}
|
|
@@ -130,7 +129,6 @@ const DataCell = ({
|
|
|
130
129
|
if (!clickable) {
|
|
131
130
|
return;
|
|
132
131
|
}
|
|
133
|
-
e.preventDefault();
|
|
134
132
|
e.stopPropagation();
|
|
135
133
|
}}
|
|
136
134
|
style={{
|
|
@@ -15,6 +15,19 @@ const ButtonColumn = ({ row }: Props): JSX.Element => (
|
|
|
15
15
|
<Button size="small">Click to reveal details about {row.name}</Button>
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
+
const CheckboxColumn = ({ row }: Props): JSX.Element => {
|
|
19
|
+
const [checked, setChecked] = useState(false);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<input
|
|
23
|
+
aria-label={`Toggle ${row.name}`}
|
|
24
|
+
checked={checked}
|
|
25
|
+
onChange={(event) => setChecked(event.target.checked)}
|
|
26
|
+
type="checkbox"
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
18
31
|
const LargeText = (): JSX.Element => (
|
|
19
32
|
<Typography sx={{ whiteSpace: 'normal' }}>
|
|
20
33
|
This is a large text that fills the content
|
|
@@ -301,4 +314,36 @@ describe('Listing', () => {
|
|
|
301
314
|
|
|
302
315
|
cy.makeSnapshot();
|
|
303
316
|
});
|
|
317
|
+
|
|
318
|
+
it('toggles a checkbox in a clickable column without clicking the row', () => {
|
|
319
|
+
const onRowClick = cy.stub().as('rowClick');
|
|
320
|
+
|
|
321
|
+
cy.mount({
|
|
322
|
+
Component: (
|
|
323
|
+
<div style={{ height: '100vh' }}>
|
|
324
|
+
<Listing
|
|
325
|
+
columns={[
|
|
326
|
+
{
|
|
327
|
+
Component: CheckboxColumn,
|
|
328
|
+
clickable: true,
|
|
329
|
+
id: 'toggle',
|
|
330
|
+
label: 'Toggle',
|
|
331
|
+
type: ColumnType.component
|
|
332
|
+
}
|
|
333
|
+
]}
|
|
334
|
+
currentPage={1}
|
|
335
|
+
limit={10}
|
|
336
|
+
onRowClick={onRowClick}
|
|
337
|
+
rows={[{ id: 0, name: 'E0' }]}
|
|
338
|
+
totalRows={1}
|
|
339
|
+
/>
|
|
340
|
+
</div>
|
|
341
|
+
)
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
cy.findByLabelText('Toggle E0').click();
|
|
345
|
+
|
|
346
|
+
cy.findByLabelText('Toggle E0').should('be.checked');
|
|
347
|
+
cy.get('@rowClick').should('not.have.been.called');
|
|
348
|
+
});
|
|
304
349
|
});
|
package/src/StatusChip/index.tsx
CHANGED
package/src/api/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { Props as SingleAutocompleteFieldProps } from './InputField/Select/Autocomplete';
|
|
2
2
|
|
|
3
|
-
export { default as IconButton } from './Button/Icon';
|
|
4
|
-
export { Checkbox, CheckboxGroup } from './Checkbox';
|
|
5
|
-
export { default as SingleAutocompleteField } from './InputField/Select/Autocomplete';
|
|
6
|
-
export { default as Pagination } from './Pagination';
|
|
7
|
-
export type { SingleAutocompleteFieldProps };
|
|
8
|
-
|
|
9
3
|
export type { ActionsListActions } from './ActionsList';
|
|
10
4
|
export {
|
|
11
5
|
ActionsListActionDivider,
|
|
@@ -46,7 +40,9 @@ export {
|
|
|
46
40
|
export { WidgetResourceType as ResourceType } from './api/useGraphQuery/models';
|
|
47
41
|
export { default as useMutationQuery, Method } from './api/useMutationQuery';
|
|
48
42
|
export { default as useRequest } from './api/useRequest';
|
|
43
|
+
export { default as IconButton } from './Button/Icon';
|
|
49
44
|
export { default as SaveButton } from './Button/Save';
|
|
45
|
+
export { Checkbox, CheckboxGroup } from './Checkbox';
|
|
50
46
|
export { default as ContentWithCircularLoading } from './ContentWithCircularProgress';
|
|
51
47
|
export * from './Dashboard';
|
|
52
48
|
export { default as Dialog } from './Dialog';
|
|
@@ -78,6 +74,7 @@ export { default as PersistentTooltip } from './InputField/Search/PersistentTool
|
|
|
78
74
|
export { default as RegexpHelpTooltip } from './InputField/Search/RegexpHelpTooltip';
|
|
79
75
|
export type { SelectEntry } from './InputField/Select';
|
|
80
76
|
export { default as SelectField } from './InputField/Select';
|
|
77
|
+
export { default as SingleAutocompleteField } from './InputField/Select/Autocomplete';
|
|
81
78
|
export { default as MultiConnectedAutocompleteField } from './InputField/Select/Autocomplete/Connected/Multi/index';
|
|
82
79
|
export { default as PopoverMultiConnectedAutocompleteField } from './InputField/Select/Autocomplete/Connected/Multi/Popover';
|
|
83
80
|
export { default as SingleConnectedAutocompleteField } from './InputField/Select/Autocomplete/Connected/Single';
|
|
@@ -112,6 +109,7 @@ export { default as Module } from './Module/index';
|
|
|
112
109
|
export { default as LicensedModule } from './Module/LicensedModule';
|
|
113
110
|
export { default as MultiSelectEntries } from './MultiSelectEntries';
|
|
114
111
|
export { default as PageSkeleton } from './PageSkeleton';
|
|
112
|
+
export { default as Pagination } from './Pagination';
|
|
115
113
|
export { default as Panel } from './Panel';
|
|
116
114
|
export { default as MemoizedPanel } from './Panel/Memoized';
|
|
117
115
|
export { default as SectionPanel, MemoizedSectionPanel } from './Panel/Section';
|
|
@@ -145,3 +143,4 @@ export { default as Subtitle } from './Typography/Subtitle';
|
|
|
145
143
|
export * from './utils';
|
|
146
144
|
export { default as WallpaperPage } from './WallpaperPage';
|
|
147
145
|
export { default as Wizard } from './Wizard';
|
|
146
|
+
export type { SingleAutocompleteFieldProps };
|