@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
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Add } from '@mui/icons-material';
|
|
2
|
-
import { useSetAtom } from 'jotai';
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { Button } from '../../Button';
|
|
5
|
-
import { openFormModalAtom } from '../atoms';
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
label: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const AddButton = ({ label }: Props): JSX.Element => {
|
|
12
|
-
const setOpenFormModal = useSetAtom(openFormModalAtom);
|
|
13
|
-
|
|
14
|
-
const add = useCallback(() => setOpenFormModal('add'), []);
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<Button size="small" icon={<Add />} iconVariant="start" onClick={add}>
|
|
18
|
-
{label}
|
|
19
|
-
</Button>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default AddButton;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Tune } from '@mui/icons-material';
|
|
2
|
-
import { isValidElement } from 'react';
|
|
3
|
-
import PopoverMenu from '../../../PopoverMenu';
|
|
4
|
-
import { useActionsStyles } from './Actions.styles';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
label: string;
|
|
8
|
-
filters: JSX.Element;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const Filters: React.FC<Props> = ({ label, filters }: Props): JSX.Element => {
|
|
12
|
-
const { classes } = useActionsStyles();
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<PopoverMenu
|
|
16
|
-
title={label}
|
|
17
|
-
icon={<Tune />}
|
|
18
|
-
tooltipClassName={classes.tooltipFilters}
|
|
19
|
-
>
|
|
20
|
-
{isValidElement(filters) ? filters : <div />}
|
|
21
|
-
</PopoverMenu>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default Filters;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { SearchField } from '@centreon/ui';
|
|
2
|
-
import { useActionsStyles } from './Actions.styles';
|
|
3
|
-
import Filters from './Filters';
|
|
4
|
-
import { useSearch } from './useSearch';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
label: string;
|
|
8
|
-
filters: JSX.Element;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const Search = ({ label, filters }: Props): JSX.Element => {
|
|
12
|
-
const { classes } = useActionsStyles();
|
|
13
|
-
|
|
14
|
-
const { change } = useSearch();
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<SearchField
|
|
18
|
-
className={classes.search}
|
|
19
|
-
debounced
|
|
20
|
-
fullWidth
|
|
21
|
-
dataTestId={label}
|
|
22
|
-
placeholder={label}
|
|
23
|
-
onChange={change}
|
|
24
|
-
InputProps={{
|
|
25
|
-
endAdornment: <Filters label="filters" filters={filters} />
|
|
26
|
-
}}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default Search;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useAtom } from 'jotai';
|
|
2
|
-
import { ChangeEvent, useCallback, useRef } from 'react';
|
|
3
|
-
import { searchAtom } from '../atoms';
|
|
4
|
-
|
|
5
|
-
interface UseSearchState {
|
|
6
|
-
search: string;
|
|
7
|
-
change: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const useSearch = (): UseSearchState => {
|
|
11
|
-
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
12
|
-
|
|
13
|
-
const [search, setSearch] = useAtom(searchAtom);
|
|
14
|
-
|
|
15
|
-
const change = useCallback((event: ChangeEvent<HTMLInputElement>): void => {
|
|
16
|
-
if (timeoutRef.current) {
|
|
17
|
-
clearTimeout(timeoutRef.current);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
timeoutRef.current = setTimeout(() => setSearch(event.target.value), 500);
|
|
21
|
-
}, []);
|
|
22
|
-
|
|
23
|
-
return { search, change };
|
|
24
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { EditOutlined } from '@mui/icons-material';
|
|
2
|
-
import DeleteOutline from '@mui/icons-material/DeleteOutline';
|
|
3
|
-
import { Box } from '@mui/material';
|
|
4
|
-
import { useAtomValue, useSetAtom } from 'jotai';
|
|
5
|
-
import { isNil } from 'ramda';
|
|
6
|
-
import { useCallback } from 'react';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
import { IconButton } from '../../Button';
|
|
9
|
-
import {
|
|
10
|
-
canDeleteSubItemsAtom,
|
|
11
|
-
itemToDeleteAtom,
|
|
12
|
-
openFormModalAtom
|
|
13
|
-
} from '../atoms';
|
|
14
|
-
|
|
15
|
-
interface Props<TData> {
|
|
16
|
-
row: TData & {
|
|
17
|
-
internalListingParentId?: number;
|
|
18
|
-
internalListingParentRow: TData;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const labelDelete = 'Delete';
|
|
23
|
-
const labelUpdate = 'Update';
|
|
24
|
-
|
|
25
|
-
const Actions = <TData extends { id: number; name: string }>({
|
|
26
|
-
row
|
|
27
|
-
}: Props<TData>): JSX.Element => {
|
|
28
|
-
const { t } = useTranslation();
|
|
29
|
-
const canDeleteSubItems = useAtomValue(canDeleteSubItemsAtom);
|
|
30
|
-
const setItemToDelete = useSetAtom(itemToDeleteAtom);
|
|
31
|
-
const setOpenFormModal = useSetAtom(openFormModalAtom);
|
|
32
|
-
|
|
33
|
-
const askBeforeDelete = (): void => {
|
|
34
|
-
setItemToDelete({
|
|
35
|
-
id: row.id,
|
|
36
|
-
name: row.name,
|
|
37
|
-
parent: isNil(row.internalListingParentRow)
|
|
38
|
-
? undefined
|
|
39
|
-
: {
|
|
40
|
-
id: row.internalListingParentRow.id,
|
|
41
|
-
name: row.internalListingParentRow.name
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const updateRow = useCallback(() => setOpenFormModal(row.id), [row.id]);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<Box
|
|
50
|
-
sx={{
|
|
51
|
-
display: 'flex',
|
|
52
|
-
flexDirection: 'row',
|
|
53
|
-
gap: 1,
|
|
54
|
-
width: '100%',
|
|
55
|
-
justifyContent: 'flex-end'
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
{isNil(row.internalListingParentRow) && (
|
|
59
|
-
<IconButton
|
|
60
|
-
size="small"
|
|
61
|
-
icon={<EditOutlined fontSize="small" color="primary" />}
|
|
62
|
-
onClick={updateRow}
|
|
63
|
-
title={t(labelUpdate)}
|
|
64
|
-
data-testid={
|
|
65
|
-
row.internalListingParentRow
|
|
66
|
-
? `edit-${row.internalListingParentRow.id}-${row.id}`
|
|
67
|
-
: `edit-${row.id}`
|
|
68
|
-
}
|
|
69
|
-
/>
|
|
70
|
-
)}
|
|
71
|
-
{(canDeleteSubItems || isNil(row.internalListingParentRow)) && (
|
|
72
|
-
<IconButton
|
|
73
|
-
size="small"
|
|
74
|
-
icon={<DeleteOutline fontSize="small" color="error" />}
|
|
75
|
-
onClick={askBeforeDelete}
|
|
76
|
-
title={t(labelDelete)}
|
|
77
|
-
data-testid={
|
|
78
|
-
row.internalListingParentRow
|
|
79
|
-
? `delete-${row.internalListingParentRow.id}-${row.id}`
|
|
80
|
-
: `delete-${row.id}`
|
|
81
|
-
}
|
|
82
|
-
/>
|
|
83
|
-
)}
|
|
84
|
-
</Box>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export default Actions;
|