@centreon/ui 24.4.57 → 24.4.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.
- package/package.json +31 -38
- package/public/mockServiceWorker.js +1 -1
- package/src/Button/Icon/index.tsx +1 -1
- package/src/Button/Save/StartIcon.tsx +3 -3
- package/src/Button/Save/index.tsx +5 -9
- package/src/Checkbox/Checkbox.tsx +2 -2
- package/src/Checkbox/CheckboxGroup/index.tsx +2 -2
- package/src/Dashboard/Item.tsx +1 -1
- package/src/Dashboard/Layout.tsx +2 -2
- package/src/Dialog/Confirm/index.tsx +2 -10
- package/src/Dialog/index.tsx +2 -9
- package/src/FallbackPage/FallbackPage.tsx +3 -3
- package/src/FileDropZone/index.tsx +1 -3
- package/src/Form/Inputs/index.tsx +1 -3
- package/src/Form/Inputs/models.ts +1 -9
- package/src/Graph/Gauge/Gauge.tsx +1 -1
- package/src/Graph/HeatMap/HeatMap.stories.tsx +25 -0
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +2 -8
- package/src/Graph/LineChart/BasicComponents/Lines/Threshold/Circle.tsx +2 -2
- package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +2 -2
- package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +1 -1
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +2 -2
- package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +1 -1
- package/src/Graph/LineChart/Legend/Legend.styles.ts +1 -1
- package/src/Graph/LineChart/Legend/LegendHeader.tsx +1 -1
- package/src/Graph/LineChart/Legend/useInteractiveValues.ts +2 -2
- package/src/Graph/LineChart/Legend/useLegend.ts +3 -3
- package/src/Graph/LineChart/helpers/doc.ts +13 -16
- package/src/Graph/LineChart/helpers/index.ts +1 -1
- package/src/Graph/LineChart/index.stories.tsx +2 -4
- package/src/Graph/LineChart/index.tsx +1 -1
- package/src/Graph/SingleBar/Thresholds.tsx +2 -2
- package/src/Graph/Text/Text.stories.tsx +4 -60
- package/src/Graph/Text/Text.tsx +1 -1
- package/src/Graph/common/timeSeries/index.ts +14 -22
- package/src/Graph/common/utils.ts +0 -19
- package/src/Graph/index.ts +0 -3
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +7 -10
- package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/index.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +2 -4
- package/src/InputField/Select/Autocomplete/index.tsx +116 -129
- package/src/InputField/Select/IconPopover/index.tsx +2 -2
- package/src/InputField/Select/index.tsx +1 -12
- package/src/InputField/Text/index.tsx +2 -2
- package/src/Listing/ActionBar/index.tsx +8 -9
- package/src/Listing/Cell/DataCell.styles.ts +0 -3
- package/src/Listing/Cell/DataCell.tsx +5 -23
- package/src/Listing/Header/ListingHeader.tsx +1 -1
- package/src/Listing/Listing.cypress.spec.tsx +4 -80
- package/src/Listing/Listing.styles.ts +7 -4
- package/src/Listing/index.stories.tsx +3 -37
- package/src/Listing/index.test.tsx +1 -1
- package/src/Listing/index.tsx +3 -4
- package/src/Listing/models.ts +0 -1
- package/src/Module/index.tsx +4 -2
- package/src/PopoverMenu/index.tsx +5 -6
- package/src/RichTextEditor/RichTextEditor.tsx +1 -12
- package/src/SortableItems/index.tsx +7 -2
- package/src/ThemeProvider/index.tsx +0 -24
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +7 -6
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +3 -8
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +2 -0
- package/src/TimePeriods/DateTimePickerInput.tsx +19 -56
- package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +9 -12
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +33 -9
- package/src/TimePeriods/helpers/index.ts +1 -1
- package/src/TimePeriods/index.stories.tsx +4 -12
- package/src/TimePeriods/index.tsx +2 -2
- package/src/Typography/FluidTypography/index.stories.tsx +2 -2
- package/src/Typography/FluidTypography/index.tsx +28 -21
- package/src/Typography/FluidTypography/useFluidResizeObserver.ts +56 -0
- package/src/api/QueryProvider.tsx +1 -1
- package/src/api/TestQueryProvider.tsx +1 -1
- package/src/api/index.ts +3 -3
- package/src/api/useFetchQuery/index.ts +23 -27
- package/src/api/useMutationQuery/index.test.ts +4 -4
- package/src/api/useMutationQuery/index.ts +25 -60
- package/src/components/Button/Icon/IconButton.tsx +2 -6
- package/src/components/DataTable/DataTable.stories.tsx +0 -40
- package/src/components/DataTable/DataTable.styles.ts +0 -3
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/DataTable/Item/DataTableItem.styles.ts +2 -7
- package/src/components/DataTable/Item/DataTableItem.tsx +28 -9
- package/src/components/DataTable/index.ts +1 -3
- package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +3 -3
- package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +0 -1
- package/src/components/Form/Dashboard/DashboardForm.tsx +12 -15
- package/src/components/Layout/PageLayout/PageLayout.tsx +1 -1
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +0 -1
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +0 -1
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +1 -5
- package/src/components/Layout/PageLayout/index.ts +1 -3
- package/src/components/List/Item/ListItem.tsx +3 -3
- package/src/components/Modal/Modal.styles.ts +3 -8
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +3 -3
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +1 -1
- package/src/components/Tooltip/ConfirmationTooltip/models.ts +1 -1
- package/src/index.ts +2 -2
- package/src/queryParameters/url/index.ts +1 -5
- package/src/screens/dashboard/DashboardsDetail.stories.tsx +108 -0
- package/src/screens/dashboard/DashboardsOverview.stories.tsx +281 -0
- package/src/utils/index.ts +1 -1
- package/src/utils/useDateTimePickerAdapter.ts +309 -0
- package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +3 -1
- package/src/utils/useFullscreen/useFullscreenListener.ts +7 -10
- package/src/utils/useInfiniteScrollListing.ts +1 -4
- package/src/utils/{useLicenseExpirationWarning.test.tsx → useLicenseExpirationWarning.cypress.spec.tsx} +37 -48
- package/src/utils/useLicenseExpirationWarning.ts +18 -18
- package/src/Form/Form.cypress.spec.tsx +0 -133
- package/src/Form/Inputs/List/Content.tsx +0 -62
- package/src/Form/Inputs/List/List.styles.ts +0 -29
- package/src/Form/Inputs/List/List.tsx +0 -58
- package/src/Form/Inputs/List/useList.ts +0 -81
- package/src/Graph/BarStack/BarStack.cypress.spec.tsx +0 -154
- package/src/Graph/BarStack/BarStack.stories.tsx +0 -123
- package/src/Graph/BarStack/BarStack.styles.ts +0 -37
- package/src/Graph/BarStack/BarStack.tsx +0 -14
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +0 -222
- package/src/Graph/BarStack/index.ts +0 -1
- package/src/Graph/BarStack/models.ts +0 -20
- package/src/Graph/BarStack/useResponsiveBarStack.ts +0 -137
- package/src/Graph/Gauge/Gauge.cypress.spec.tsx +0 -102
- package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +0 -145
- package/src/Graph/Legend/Legend.tsx +0 -21
- package/src/Graph/Legend/index.ts +0 -1
- package/src/Graph/Legend/models.ts +0 -11
- package/src/Graph/PieChart/PieChart.cypress.spec.tsx +0 -169
- package/src/Graph/PieChart/PieChart.stories.tsx +0 -194
- package/src/Graph/PieChart/PieChart.styles.ts +0 -39
- package/src/Graph/PieChart/PieChart.tsx +0 -14
- package/src/Graph/PieChart/ResponsivePie.tsx +0 -254
- package/src/Graph/PieChart/index.ts +0 -1
- package/src/Graph/PieChart/models.ts +0 -20
- package/src/Graph/PieChart/useResponsivePie.ts +0 -85
- package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +0 -121
- package/src/Graph/Text/Text.cypress.spec.tsx +0 -101
- package/src/Graph/common/testUtils.ts +0 -71
- package/src/Graph/translatedLabels.ts +0 -1
- package/src/Module/Module.cypress.spec.tsx +0 -129
- package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +0 -27
- package/src/components/DataTable/DataListing.tsx +0 -6
- package/src/components/DataTable/DataTable.cypress.spec.tsx +0 -193
- package/src/components/Layout/PageLayout/PageQuickAccess.tsx +0 -76
- package/src/components/Layout/PageLayout.cypress.spec.tsx +0 -66
- package/src/utils/usePluralizedTranslation.ts +0 -21
|
@@ -48,7 +48,7 @@ describe('useFetchQuery', () => {
|
|
|
48
48
|
method: Method.POST
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
result.current.mutate(
|
|
51
|
+
result.current.mutate(user);
|
|
52
52
|
|
|
53
53
|
await waitFor(() => {
|
|
54
54
|
expect(result.current?.isError).toEqual(false);
|
|
@@ -64,7 +64,7 @@ describe('useFetchQuery', () => {
|
|
|
64
64
|
method: Method.POST
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
result.current.mutate(
|
|
67
|
+
result.current.mutate(user);
|
|
68
68
|
|
|
69
69
|
await waitFor(() => {
|
|
70
70
|
expect(result.current?.isError).toEqual(true);
|
|
@@ -85,7 +85,7 @@ describe('useFetchQuery', () => {
|
|
|
85
85
|
method: Method.POST
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
result.current.mutate(
|
|
88
|
+
result.current.mutate(user);
|
|
89
89
|
|
|
90
90
|
await waitFor(() => {
|
|
91
91
|
expect(result.current?.isError).toEqual(true);
|
|
@@ -109,7 +109,7 @@ describe('useFetchQuery', () => {
|
|
|
109
109
|
method: Method.POST
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
result.current.mutate(
|
|
112
|
+
result.current.mutate(user);
|
|
113
113
|
|
|
114
114
|
await waitFor(() => {
|
|
115
115
|
expect(mockedShowErrorMessage).not.toHaveBeenCalled();
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '@tanstack/react-query';
|
|
9
9
|
import { JsonDecoder } from 'ts.data.json';
|
|
10
10
|
import anylogger from 'anylogger';
|
|
11
|
-
import { includes
|
|
11
|
+
import { includes } from 'ramda';
|
|
12
12
|
|
|
13
13
|
import { CatchErrorProps, customFetch, ResponseError } from '../customFetch';
|
|
14
14
|
import useSnackbar from '../../Snackbar/useSnackbar';
|
|
@@ -22,11 +22,6 @@ export enum Method {
|
|
|
22
22
|
PUT = 'PUT'
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
interface Variables<TMeta, T> {
|
|
26
|
-
_meta?: TMeta;
|
|
27
|
-
payload?: T;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
25
|
export type UseMutationQueryProps<T, TMeta> = {
|
|
31
26
|
baseEndpoint?: string;
|
|
32
27
|
catchError?: (props: CatchErrorProps) => void;
|
|
@@ -36,39 +31,14 @@ export type UseMutationQueryProps<T, TMeta> = {
|
|
|
36
31
|
getEndpoint: (_meta: TMeta) => string;
|
|
37
32
|
httpCodesBypassErrorSnackbar?: Array<number>;
|
|
38
33
|
method: Method;
|
|
39
|
-
|
|
40
|
-
error: ResponseError,
|
|
41
|
-
variables: Variables<TMeta, T>,
|
|
42
|
-
context: unknown
|
|
43
|
-
) => unknown;
|
|
44
|
-
onMutate?: (variables: Variables<TMeta, T>) => Promise<unknown> | unknown;
|
|
45
|
-
onSuccess?: (
|
|
46
|
-
data: ResponseError | T,
|
|
47
|
-
variables: Variables<TMeta, T>,
|
|
48
|
-
context: unknown
|
|
49
|
-
) => unknown;
|
|
50
|
-
} & Omit<
|
|
51
|
-
UseMutationOptions<{ _meta?: TMeta; payload: T }>,
|
|
52
|
-
'mutationFn' | 'onError' | 'onMutate' | 'onSuccess' | 'mutateAsync' | 'mutate'
|
|
53
|
-
>;
|
|
34
|
+
} & Omit<UseMutationOptions<T & { _meta?: TMeta }>, 'mutationFn'>;
|
|
54
35
|
|
|
55
36
|
const log = anylogger('API Request');
|
|
56
37
|
|
|
57
|
-
export type UseMutationQueryState<T
|
|
58
|
-
UseMutationResult<T | ResponseError>,
|
|
59
|
-
'isError' | 'mutate' | 'mutateAsync'
|
|
60
|
-
> & {
|
|
38
|
+
export type UseMutationQueryState<T> = {
|
|
61
39
|
isError: boolean;
|
|
62
40
|
isMutating: boolean;
|
|
63
|
-
|
|
64
|
-
mutateAsync: (
|
|
65
|
-
variables: Variables<TMeta, T>,
|
|
66
|
-
rest?: Pick<
|
|
67
|
-
UseMutationQueryProps<T, TMeta>,
|
|
68
|
-
'onError' | 'onMutate' | 'onSettled' | 'onSuccess'
|
|
69
|
-
>
|
|
70
|
-
) => Promise<ResponseError | T>;
|
|
71
|
-
};
|
|
41
|
+
} & UseMutationResult<T | ResponseError>;
|
|
72
42
|
|
|
73
43
|
const useMutationQuery = <T extends object, TMeta>({
|
|
74
44
|
getEndpoint,
|
|
@@ -81,20 +51,17 @@ const useMutationQuery = <T extends object, TMeta>({
|
|
|
81
51
|
onMutate,
|
|
82
52
|
onError,
|
|
83
53
|
onSuccess,
|
|
84
|
-
onSettled,
|
|
85
54
|
baseEndpoint
|
|
86
|
-
}: UseMutationQueryProps<T, TMeta>): UseMutationQueryState<T
|
|
55
|
+
}: UseMutationQueryProps<T, TMeta>): UseMutationQueryState<T> => {
|
|
87
56
|
const { showErrorMessage } = useSnackbar();
|
|
88
57
|
|
|
89
58
|
const queryData = useMutation<
|
|
90
59
|
T | ResponseError,
|
|
91
60
|
ResponseError,
|
|
92
|
-
|
|
93
|
-
>(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
): Promise<T | ResponseError> => {
|
|
97
|
-
const { _meta, payload } = variables || {};
|
|
61
|
+
T & { _meta: TMeta }
|
|
62
|
+
>(
|
|
63
|
+
(_payload: T & { _meta: TMeta }): Promise<T | ResponseError> => {
|
|
64
|
+
const { _meta, ...payload } = _payload || {};
|
|
98
65
|
|
|
99
66
|
return customFetch<T>({
|
|
100
67
|
baseEndpoint,
|
|
@@ -111,18 +78,19 @@ const useMutationQuery = <T extends object, TMeta>({
|
|
|
111
78
|
payload
|
|
112
79
|
});
|
|
113
80
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
81
|
+
{
|
|
82
|
+
onError,
|
|
83
|
+
onMutate,
|
|
84
|
+
onSuccess: (data, variables, context) => {
|
|
85
|
+
if (data?.isError) {
|
|
86
|
+
onError?.(data, variables, context);
|
|
87
|
+
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
onSuccess?.(data, variables, context);
|
|
122
91
|
}
|
|
123
|
-
onSuccess?.(data, variables, context);
|
|
124
92
|
}
|
|
125
|
-
|
|
93
|
+
);
|
|
126
94
|
|
|
127
95
|
const manageError = (): void => {
|
|
128
96
|
const data = queryData.data as ResponseError | undefined;
|
|
@@ -139,17 +107,14 @@ const useMutationQuery = <T extends object, TMeta>({
|
|
|
139
107
|
}
|
|
140
108
|
};
|
|
141
109
|
|
|
142
|
-
useEffect(
|
|
143
|
-
()
|
|
144
|
-
|
|
145
|
-
},
|
|
146
|
-
useDeepCompare([queryData.data])
|
|
147
|
-
);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
manageError();
|
|
112
|
+
}, useDeepCompare([queryData.data]));
|
|
148
113
|
|
|
149
114
|
return {
|
|
150
|
-
...
|
|
115
|
+
...queryData,
|
|
151
116
|
isError: (queryData.data as ResponseError | undefined)?.isError || false,
|
|
152
|
-
isMutating: queryData.
|
|
117
|
+
isMutating: queryData.isLoading
|
|
153
118
|
};
|
|
154
119
|
};
|
|
155
120
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
IconButton as MuiIconButton,
|
|
5
|
-
IconButtonProps as MuiIconButtonProps
|
|
6
|
-
} from '@mui/material';
|
|
3
|
+
import { IconButton as MuiIconButton } from '@mui/material';
|
|
7
4
|
|
|
8
5
|
import { AriaLabelingAttributes } from '../../../@types/aria-attributes';
|
|
9
6
|
import { DataTestAttributes } from '../../../@types/data-attributes';
|
|
@@ -26,8 +23,7 @@ type IconButtonProps = {
|
|
|
26
23
|
size?: 'small' | 'medium' | 'large';
|
|
27
24
|
variant?: 'primary' | 'secondary' | 'ghost';
|
|
28
25
|
} & AriaLabelingAttributes &
|
|
29
|
-
DataTestAttributes
|
|
30
|
-
MuiIconButtonProps;
|
|
26
|
+
DataTestAttributes;
|
|
31
27
|
|
|
32
28
|
/**
|
|
33
29
|
* @todo re-factor as `iconVariant: 'icon-only'` Button variant, and remove IconButton component (reason: code duplication)
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
-
import { Box } from '@mui/material';
|
|
4
|
-
|
|
5
|
-
import { ColumnType } from '../../Listing/models';
|
|
6
|
-
|
|
7
3
|
import { DataTable } from './index';
|
|
8
4
|
|
|
9
5
|
const meta: Meta<typeof DataTable> = {
|
|
@@ -53,39 +49,3 @@ export const withFixedHeightContainer: Story = {
|
|
|
53
49
|
</div>
|
|
54
50
|
)
|
|
55
51
|
};
|
|
56
|
-
|
|
57
|
-
const ListingTemplate = (args): JSX.Element => (
|
|
58
|
-
<Box sx={{ height: '80vh' }}>
|
|
59
|
-
<DataTable {...args} />
|
|
60
|
-
</Box>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
export const listing: Story = {
|
|
64
|
-
args: {
|
|
65
|
-
children: (
|
|
66
|
-
<DataTable.Listing
|
|
67
|
-
columns={[
|
|
68
|
-
{
|
|
69
|
-
getFormattedString: (row) => row.title,
|
|
70
|
-
id: 'title',
|
|
71
|
-
label: 'Title',
|
|
72
|
-
type: ColumnType.string
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
getFormattedString: (row) => row.description,
|
|
76
|
-
id: 'description',
|
|
77
|
-
label: 'Description',
|
|
78
|
-
type: ColumnType.string
|
|
79
|
-
}
|
|
80
|
-
]}
|
|
81
|
-
rows={[...Array(5)].map((_, i) => ({
|
|
82
|
-
description: `Item description ${i}`,
|
|
83
|
-
id: i,
|
|
84
|
-
title: `Item ${i}`
|
|
85
|
-
}))}
|
|
86
|
-
/>
|
|
87
|
-
),
|
|
88
|
-
variant: 'listing'
|
|
89
|
-
},
|
|
90
|
-
render: ListingTemplate
|
|
91
|
-
};
|
|
@@ -10,9 +10,6 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
10
10
|
gridGap: theme.spacing(2.5),
|
|
11
11
|
gridTemplateColumns: `repeat(auto-fill, ${theme.spacing(45)})`
|
|
12
12
|
},
|
|
13
|
-
'&[data-variant="listing"]': {
|
|
14
|
-
height: '100%'
|
|
15
|
-
},
|
|
16
13
|
'&[data-variant][data-is-empty="true"]': {
|
|
17
14
|
display: 'flex',
|
|
18
15
|
justifyContent: 'center',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import { useStyles } from './DataTable.styles';
|
|
4
4
|
|
|
5
5
|
type DataTableProps = {
|
|
6
|
-
children
|
|
6
|
+
children: ReactNode | Array<ReactNode>;
|
|
7
7
|
isEmpty?: boolean;
|
|
8
|
-
variant
|
|
8
|
+
variant?: 'grid';
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
/** *
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { makeStyles } from 'tss-react/mui';
|
|
2
2
|
|
|
3
3
|
const useStyles = makeStyles()((theme) => ({
|
|
4
|
-
actions: {
|
|
5
|
-
display: 'flex',
|
|
6
|
-
flexDirection: 'row',
|
|
7
|
-
justifyContent: 'space-between'
|
|
8
|
-
},
|
|
9
4
|
dataTableItem: {
|
|
10
5
|
'& .MuiCardActionArea-root': {
|
|
11
6
|
alignItems: 'flex-start',
|
|
12
7
|
display: 'flex',
|
|
13
8
|
flexDirection: 'column',
|
|
14
9
|
height: '100%',
|
|
15
|
-
justifyContent: '
|
|
10
|
+
justifyContent: 'space-between'
|
|
16
11
|
},
|
|
17
12
|
'& .MuiCardActions-root': {
|
|
18
13
|
'& > span': {
|
|
@@ -20,13 +15,13 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
20
15
|
gap: theme.spacing(1)
|
|
21
16
|
},
|
|
22
17
|
display: 'flex',
|
|
18
|
+
|
|
23
19
|
justifyContent: 'space-between'
|
|
24
20
|
},
|
|
25
21
|
borderRadius: theme.shape.borderRadius,
|
|
26
22
|
display: 'flex',
|
|
27
23
|
flexDirection: 'column',
|
|
28
24
|
height: '186px',
|
|
29
|
-
justifyContent: 'space-between',
|
|
30
25
|
p: {
|
|
31
26
|
color: theme.palette.text.secondary,
|
|
32
27
|
letterSpacing: '0',
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from '@mui/icons-material';
|
|
15
15
|
|
|
16
16
|
import { IconButton } from '../../Button';
|
|
17
|
+
import { ConfirmationTooltip } from '../../Tooltip/ConfirmationTooltip';
|
|
17
18
|
|
|
18
19
|
import { useStyles } from './DataTableItem.styles';
|
|
19
20
|
|
|
@@ -21,6 +22,13 @@ export interface DataTableItemProps {
|
|
|
21
22
|
description?: string;
|
|
22
23
|
hasActions?: boolean;
|
|
23
24
|
hasCardAction?: boolean;
|
|
25
|
+
labelsDelete: {
|
|
26
|
+
cancel: string;
|
|
27
|
+
confirm: {
|
|
28
|
+
label: string;
|
|
29
|
+
secondaryLabel?: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
24
32
|
onClick?: () => void;
|
|
25
33
|
onDelete?: () => void;
|
|
26
34
|
onEdit?: () => void;
|
|
@@ -38,7 +46,8 @@ const DataTableItem = forwardRef(
|
|
|
38
46
|
onClick,
|
|
39
47
|
onEdit,
|
|
40
48
|
onDelete,
|
|
41
|
-
onEditAccessRights
|
|
49
|
+
onEditAccessRights,
|
|
50
|
+
labelsDelete
|
|
42
51
|
}: DataTableItemProps,
|
|
43
52
|
ref
|
|
44
53
|
): ReactElement => {
|
|
@@ -67,14 +76,24 @@ const DataTableItem = forwardRef(
|
|
|
67
76
|
{hasActions && (
|
|
68
77
|
<MuiCardActions>
|
|
69
78
|
<span>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
{onDelete && (
|
|
80
|
+
<ConfirmationTooltip
|
|
81
|
+
confirmVariant="error"
|
|
82
|
+
labels={labelsDelete}
|
|
83
|
+
onConfirm={onDelete}
|
|
84
|
+
>
|
|
85
|
+
{(openTooltip) => (
|
|
86
|
+
<IconButton
|
|
87
|
+
aria-label="delete"
|
|
88
|
+
data-testid="delete"
|
|
89
|
+
icon={<DeleteIcon />}
|
|
90
|
+
size="small"
|
|
91
|
+
variant="ghost"
|
|
92
|
+
onClick={openTooltip}
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
95
|
+
</ConfirmationTooltip>
|
|
96
|
+
)}
|
|
78
97
|
</span>
|
|
79
98
|
<span>
|
|
80
99
|
<IconButton
|
|
@@ -2,11 +2,9 @@ import { DataTable as DataTableRoot } from './DataTable';
|
|
|
2
2
|
import { DataTableItem } from './Item/DataTableItem';
|
|
3
3
|
import { DataTableItemSkeleton } from './Item/DataTableItemSkeleton';
|
|
4
4
|
import { DataTableEmptyState } from './EmptyState/DataTableEmptyState';
|
|
5
|
-
import { DataListing } from './DataListing';
|
|
6
5
|
|
|
7
6
|
export const DataTable = Object.assign(DataTableRoot, {
|
|
8
7
|
EmptyState: DataTableEmptyState,
|
|
9
8
|
Item: DataTableItem,
|
|
10
|
-
ItemSkeleton: DataTableItemSkeleton
|
|
11
|
-
Listing: DataListing
|
|
9
|
+
ItemSkeleton: DataTableItemSkeleton
|
|
12
10
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useSetAtom } from 'jotai';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
|
|
4
4
|
import { FormControlLabel, Radio, RadioGroup } from '@mui/material';
|
|
@@ -17,7 +17,7 @@ const ContactSwitch = ({ labels }: Props): JSX.Element => {
|
|
|
17
17
|
const { classes } = useContactSwitchStyles();
|
|
18
18
|
const { t } = useTranslation();
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const setContactType = useSetAtom(contactTypeAtom);
|
|
21
21
|
|
|
22
22
|
const change = (event: React.ChangeEvent<HTMLInputElement>): void => {
|
|
23
23
|
setContactType(event.target.value as ContactType);
|
|
@@ -29,7 +29,7 @@ const ContactSwitch = ({ labels }: Props): JSX.Element => {
|
|
|
29
29
|
<RadioGroup
|
|
30
30
|
row
|
|
31
31
|
className={classes.inputs}
|
|
32
|
-
|
|
32
|
+
defaultValue={ContactType.Contact}
|
|
33
33
|
onChange={change}
|
|
34
34
|
>
|
|
35
35
|
<FormControlLabel
|
|
@@ -52,7 +52,6 @@ const ShareInput = ({ labels, endpoints, roles }: Props): JSX.Element => {
|
|
|
52
52
|
? t(labels.autocompleteContactGroup)
|
|
53
53
|
: t(labels.autocompleteContact)
|
|
54
54
|
)}
|
|
55
|
-
queryKey={isContactGroup ? labels.contactGroup : labels.contact}
|
|
56
55
|
renderOption={renderOption}
|
|
57
56
|
value={selectedContact}
|
|
58
57
|
onChange={selectContact}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ReactElement, useCallback, useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as Yup from 'yup';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { equals } from 'ramda';
|
|
6
5
|
|
|
7
6
|
import { InputType } from '../../../Form/Inputs/models';
|
|
8
7
|
import { Form, FormProps } from '../../../Form';
|
|
@@ -85,8 +84,8 @@ const DashboardForm = ({
|
|
|
85
84
|
}
|
|
86
85
|
],
|
|
87
86
|
submit: (values, bag) => onSubmit?.(values, bag),
|
|
88
|
-
validationSchema: object({
|
|
89
|
-
description: string()
|
|
87
|
+
validationSchema: Yup.object().shape({
|
|
88
|
+
description: Yup.string()
|
|
90
89
|
.label(labels?.entity?.description || '')
|
|
91
90
|
.max(
|
|
92
91
|
180,
|
|
@@ -94,19 +93,17 @@ const DashboardForm = ({
|
|
|
94
93
|
`${p.label} ${t(labelMustBeMost)} ${p.max} ${t(labelCharacters)}`
|
|
95
94
|
)
|
|
96
95
|
.nullable(),
|
|
97
|
-
globalRefreshInterval: object({
|
|
98
|
-
interval: number().when('type',
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return schema.nullable();
|
|
96
|
+
globalRefreshInterval: Yup.object().shape({
|
|
97
|
+
interval: Yup.number().when('type', {
|
|
98
|
+
is: 'global',
|
|
99
|
+
otherwise: Yup.number().nullable(),
|
|
100
|
+
then: Yup.number()
|
|
101
|
+
.min(1, ({ min }) => t(labelMustBeAtLeast, { min }))
|
|
102
|
+
.required(t(labelRequired) as string)
|
|
106
103
|
}),
|
|
107
|
-
type: string()
|
|
104
|
+
type: Yup.string()
|
|
108
105
|
}),
|
|
109
|
-
name: string()
|
|
106
|
+
name: Yup.string()
|
|
110
107
|
.label(labels?.entity?.name)
|
|
111
108
|
.min(3, ({ min, label }) => t(labelMustBeAtLeast, { label, min }))
|
|
112
109
|
.max(50, ({ max, label }) => t(labelMustBeMost, { label, max }))
|
|
@@ -11,9 +11,5 @@ export const PageLayoutHeader = ({
|
|
|
11
11
|
}: PageLayoutHeaderProps): JSX.Element => {
|
|
12
12
|
const { classes } = useStyles();
|
|
13
13
|
|
|
14
|
-
return
|
|
15
|
-
<header className={classes.pageLayoutHeader} id="header">
|
|
16
|
-
{children}
|
|
17
|
-
</header>
|
|
18
|
-
);
|
|
14
|
+
return <header className={classes.pageLayoutHeader}>{children}</header>;
|
|
19
15
|
};
|
|
@@ -2,11 +2,9 @@ import { PageLayout as PageLayoutRoot } from './PageLayout';
|
|
|
2
2
|
import { PageLayoutHeader } from './PageLayoutHeader';
|
|
3
3
|
import { PageLayoutBody } from './PageLayoutBody';
|
|
4
4
|
import { PageLayoutActions } from './PageLayoutActions';
|
|
5
|
-
import { PageQuickAccess } from './PageQuickAccess';
|
|
6
5
|
|
|
7
6
|
export const PageLayout = Object.assign(PageLayoutRoot, {
|
|
8
7
|
Actions: PageLayoutActions,
|
|
9
8
|
Body: PageLayoutBody,
|
|
10
|
-
Header: PageLayoutHeader
|
|
11
|
-
QuickAccess: PageQuickAccess
|
|
9
|
+
Header: PageLayoutHeader
|
|
12
10
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ForwardedRef, forwardRef, ReactElement, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ListItem as MuiListItem } from '@mui/material';
|
|
4
4
|
|
|
5
5
|
import { useStyles } from './ListItem.styles';
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
type ListItemProps = {
|
|
8
8
|
action?: ReactElement;
|
|
9
9
|
children: ReactNode | Array<ReactNode>;
|
|
10
10
|
className?: string;
|
|
@@ -12,7 +12,7 @@ type Props = {
|
|
|
12
12
|
|
|
13
13
|
export const ListItem = forwardRef(
|
|
14
14
|
(
|
|
15
|
-
{ action, children, className, ...attr }:
|
|
15
|
+
{ action, children, className, ...attr }: ListItemProps,
|
|
16
16
|
ref?: ForwardedRef<HTMLLIElement>
|
|
17
17
|
) => {
|
|
18
18
|
const { classes, cx } = useStyles();
|
|
@@ -28,7 +28,6 @@ const useStyles = makeStyles<{
|
|
|
28
28
|
left: props?.left ?? 0,
|
|
29
29
|
margin: 0,
|
|
30
30
|
maxWidth: 'unset',
|
|
31
|
-
paddingBottom: theme.spacing(8),
|
|
32
31
|
position: 'absolute',
|
|
33
32
|
right: props?.right ?? 0,
|
|
34
33
|
top: props?.top ?? 0,
|
|
@@ -51,18 +50,14 @@ const useStyles = makeStyles<{
|
|
|
51
50
|
},
|
|
52
51
|
modalActions: {
|
|
53
52
|
'&[data-fixed="true"]': {
|
|
54
|
-
|
|
55
|
-
position: 'fixed',
|
|
56
|
-
width: '100%'
|
|
53
|
+
position: 'fixed'
|
|
57
54
|
},
|
|
58
|
-
bottom:
|
|
55
|
+
bottom: theme.spacing(2),
|
|
59
56
|
display: 'flex',
|
|
60
57
|
flexDirection: 'row',
|
|
61
58
|
gap: theme.spacing(2),
|
|
62
59
|
justifyContent: 'flex-end',
|
|
63
|
-
|
|
64
|
-
right: 0,
|
|
65
|
-
zIndex: theme.zIndex.modal
|
|
60
|
+
right: theme.spacing(2)
|
|
66
61
|
},
|
|
67
62
|
modalBody: {
|
|
68
63
|
'& > p': {
|
|
@@ -15,7 +15,7 @@ type Story = StoryObj<typeof ConfirmationTooltip>;
|
|
|
15
15
|
|
|
16
16
|
export const Default: Story = {
|
|
17
17
|
args: {
|
|
18
|
-
children: (
|
|
18
|
+
children: (toggleTooltip) => (
|
|
19
19
|
<IconButton icon={<SaveIcon />} onClick={toggleTooltip} />
|
|
20
20
|
),
|
|
21
21
|
labels: {
|
|
@@ -30,7 +30,7 @@ export const Default: Story = {
|
|
|
30
30
|
|
|
31
31
|
export const WithConfirmVariant: Story = {
|
|
32
32
|
args: {
|
|
33
|
-
children: (
|
|
33
|
+
children: (toggleTooltip) => (
|
|
34
34
|
<IconButton icon={<DeleteIcon color="error" />} onClick={toggleTooltip} />
|
|
35
35
|
),
|
|
36
36
|
confirmVariant: 'error',
|
|
@@ -46,7 +46,7 @@ export const WithConfirmVariant: Story = {
|
|
|
46
46
|
|
|
47
47
|
export const WithSecondaryLabel: Story = {
|
|
48
48
|
args: {
|
|
49
|
-
children: (
|
|
49
|
+
children: (toggleTooltip) => (
|
|
50
50
|
<IconButton icon={<DeleteIcon color="error" />} onClick={toggleTooltip} />
|
|
51
51
|
),
|
|
52
52
|
confirmVariant: 'error',
|
|
@@ -49,7 +49,7 @@ export const ConfirmationTooltip = ({
|
|
|
49
49
|
return (
|
|
50
50
|
<ClickAwayListener onClickAway={close}>
|
|
51
51
|
<div>
|
|
52
|
-
{children(
|
|
52
|
+
{children(isOpen ? close : open)}
|
|
53
53
|
<Popper
|
|
54
54
|
anchorEl={anchorElement}
|
|
55
55
|
className={classes.popper}
|
package/src/index.ts
CHANGED
|
@@ -163,8 +163,8 @@ export * from './Graph/common/timeSeries';
|
|
|
163
163
|
|
|
164
164
|
export { default as TimePeriods } from './TimePeriods';
|
|
165
165
|
export { default as SimpleCustomTimePeriod } from './TimePeriods/CustomTimePeriod/SimpleCustomTimePeriod';
|
|
166
|
-
export { default as DateTimePickerInput } from './TimePeriods/DateTimePickerInput';
|
|
167
166
|
export * from './ParentSize';
|
|
168
|
-
|
|
167
|
+
|
|
169
168
|
export { default as TablePagination } from './Listing/ActionBar/Pagination';
|
|
170
169
|
export { default as PaginationActions } from './Listing/ActionBar/PaginationActions';
|
|
170
|
+
export { default as Subtitle } from './Typography/Subtitle';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fromPairs
|
|
1
|
+
import { fromPairs } from 'ramda';
|
|
2
2
|
|
|
3
3
|
import { QueryParameter } from '../models';
|
|
4
4
|
|
|
@@ -25,10 +25,6 @@ const getUrlQueryParameters = <
|
|
|
25
25
|
|
|
26
26
|
const entries = [...urlParams.entries()].map<[string, string]>(
|
|
27
27
|
([key, value]) => {
|
|
28
|
-
if (startsWith('/', value)) {
|
|
29
|
-
return [key, value];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
28
|
return [key, JSON.parse(value)];
|
|
33
29
|
}
|
|
34
30
|
);
|