@centreon/ui 24.4.31 → 24.4.32
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 +14 -19
- 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/index.tsx +1 -1
- package/src/FallbackPage/FallbackPage.tsx +3 -3
- package/src/FileDropZone/index.tsx +1 -3
- package/src/Form/Inputs/CheckboxGroup.tsx +4 -1
- package/src/Form/Inputs/index.tsx +1 -3
- package/src/Form/Inputs/models.ts +1 -9
- package/src/Graph/LineChart/BasicComponents/Lines/Threshold/Circle.tsx +2 -2
- package/src/Graph/LineChart/BasicComponents/Lines/Threshold/index.tsx +4 -5
- 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/Annotation/index.tsx +3 -2
- package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +1 -1
- 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/SingleBar/Thresholds.tsx +2 -2
- package/src/Graph/Text/Text.stories.tsx +4 -60
- package/src/Graph/common/timeSeries/index.ts +3 -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/index.tsx +115 -121
- package/src/InputField/Select/IconPopover/index.tsx +2 -2
- package/src/InputField/Select/index.tsx +1 -1
- package/src/InputField/Text/index.tsx +2 -2
- package/src/Listing/Cell/DataCell.tsx +1 -15
- package/src/Listing/Header/ListingHeader.tsx +1 -1
- package/src/Listing/Listing.cypress.spec.tsx +2 -2
- package/src/Listing/Listing.styles.ts +3 -2
- package/src/Listing/index.stories.tsx +3 -14
- package/src/Listing/index.tsx +125 -138
- package/src/Module/index.tsx +4 -2
- 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/PopoverCustomTimePeriod/PickersStartEndDate.tsx +3 -8
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +2 -0
- package/src/TimePeriods/DateTimePickerInput.tsx +19 -56
- 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/api/QueryProvider.tsx +1 -1
- package/src/api/TestQueryProvider.tsx +1 -1
- package/src/api/useFetchQuery/index.ts +23 -27
- package/src/api/useMutationQuery/index.ts +21 -45
- 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 +4 -4
- package/src/components/DataTable/index.ts +1 -3
- package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +0 -2
- package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +1 -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/Modal/Modal.styles.ts +3 -4
- package/src/components/Modal/ModalActions.tsx +2 -4
- 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/{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/Module/Module.cypress.spec.tsx +0 -129
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "24.4.
|
|
3
|
+
"version": "24.4.32",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"test:ci": "jest --silent --reporter=jest-junit",
|
|
13
13
|
"cypress:ui": "cypress open --component --browser=chrome",
|
|
14
14
|
"cypress:cli:updateSnapshot": "pnpm cypress:cli --env updateSnapshots=true",
|
|
15
|
-
"cypress:run:coverage": "cypress run --component --browser=chrome --env codeCoverageTasksRegistered=true",
|
|
16
15
|
"cypress:cli": "cypress run --component --browser=chrome",
|
|
17
16
|
"tokens:transform": "TS_NODE_PROJECT=tsconfig.node.json ts-node style-dictionary.transform.ts"
|
|
18
17
|
},
|
|
@@ -74,19 +73,16 @@
|
|
|
74
73
|
"@testing-library/react-hooks": "^8.0.1",
|
|
75
74
|
"@types/cypress": "^1.1.3",
|
|
76
75
|
"@types/jest": "^27.5.0",
|
|
77
|
-
"@types/
|
|
78
|
-
"@types/ramda": "^0.29.6",
|
|
76
|
+
"@types/ramda": "^0.28.12",
|
|
79
77
|
"@types/react": "^18.0.26",
|
|
80
78
|
"@types/testing-library__jest-dom": "^5.14.6",
|
|
81
79
|
"@vitejs/plugin-react": "^4.0.0",
|
|
82
80
|
"@vitejs/plugin-react-swc": "^3.3.0",
|
|
83
81
|
"axios-mock-adapter": "^1.21.4",
|
|
84
|
-
"cypress": "^
|
|
82
|
+
"cypress": "^12.8.0",
|
|
85
83
|
"identity-obj-proxy": "^3.0.0",
|
|
86
84
|
"jest-transform-stub": "^2.0.0",
|
|
87
85
|
"mochawesome": "^7.1.3",
|
|
88
|
-
"msw": "1.3.2",
|
|
89
|
-
"msw-storybook-addon": "^1.10.0",
|
|
90
86
|
"puppeteer": "^13.7.0",
|
|
91
87
|
"react": "^18.2.0",
|
|
92
88
|
"react-dom": "^18.2.0",
|
|
@@ -101,18 +97,16 @@
|
|
|
101
97
|
"ts-node": "^10.9.1",
|
|
102
98
|
"use-resize-observer": "^9.1.0",
|
|
103
99
|
"vite": "^4.3.5",
|
|
104
|
-
"vite-plugin-istanbul": "^5.0.0",
|
|
105
100
|
"vite-plugin-svgr": "^3.2.0",
|
|
106
101
|
"vite-plugin-turbosnap": "^1.0.2"
|
|
107
102
|
},
|
|
108
103
|
"dependencies": {
|
|
109
|
-
"@lexical/
|
|
110
|
-
"@lexical/
|
|
111
|
-
"@lexical/
|
|
112
|
-
"@lexical/
|
|
113
|
-
"@lexical/
|
|
114
|
-
"@lexical/
|
|
115
|
-
"@lexical/utils": "^0.12.2",
|
|
104
|
+
"@lexical/link": "0.11.3",
|
|
105
|
+
"@lexical/list": "^0.11.3",
|
|
106
|
+
"@lexical/react": "0.11.3",
|
|
107
|
+
"@lexical/rich-text": "^0.11.3",
|
|
108
|
+
"@lexical/selection": "0.11.3",
|
|
109
|
+
"@lexical/utils": "0.11.3",
|
|
116
110
|
"@react-spring/web": "^9.7.3",
|
|
117
111
|
"@visx/curve": "^2.1.0",
|
|
118
112
|
"@visx/group": "^3.3.0",
|
|
@@ -124,9 +118,10 @@
|
|
|
124
118
|
"anylogger": "^1.0.11",
|
|
125
119
|
"d3-array": "3.2.0",
|
|
126
120
|
"humanize-duration": "^3.27.3",
|
|
127
|
-
"lexical": "
|
|
128
|
-
"
|
|
129
|
-
"
|
|
121
|
+
"lexical": "0.11.3",
|
|
122
|
+
"msw": "0.49.1",
|
|
123
|
+
"msw-storybook-addon": "^1.10.0",
|
|
124
|
+
"notistack": "^2.0.8",
|
|
130
125
|
"react-grid-layout": "^1.3.4",
|
|
131
126
|
"react-html-parser": "^2.0.2",
|
|
132
127
|
"react-resizable": "^3.0.5",
|
|
@@ -142,7 +137,7 @@
|
|
|
142
137
|
"@mui/icons-material": "5.x",
|
|
143
138
|
"@mui/material": "5.x",
|
|
144
139
|
"@mui/styles": "5.x",
|
|
145
|
-
"@tanstack/react-query": "
|
|
140
|
+
"@tanstack/react-query": "4.x",
|
|
146
141
|
"axios": "0.x",
|
|
147
142
|
"dayjs": "1.x",
|
|
148
143
|
"formik": "2.x",
|
|
@@ -15,9 +15,9 @@ interface Props {
|
|
|
15
15
|
|
|
16
16
|
const StartIcon = ({ startIconConfig }: Props): JSX.Element | null =>
|
|
17
17
|
cond<Array<StartIconConfigProps>, JSX.Element | null>([
|
|
18
|
-
[pipe(propEq(
|
|
19
|
-
[propEq(
|
|
20
|
-
[propEq(
|
|
18
|
+
[pipe(propEq('hasLabel', true), not), always(null)],
|
|
19
|
+
[propEq('succeeded', true), always(<CheckIcon />)],
|
|
20
|
+
[propEq('loading', true), always(<SaveIcon />)],
|
|
21
21
|
[T, always(<SaveIcon />)]
|
|
22
22
|
])(startIconConfig);
|
|
23
23
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { any, isEmpty, isNil, not, or, pipe } from 'ramda';
|
|
2
2
|
import { makeStyles } from 'tss-react/mui';
|
|
3
3
|
|
|
4
|
-
import { LoadingButton, LoadingButtonProps } from '@mui/lab';
|
|
5
4
|
import { Theme, Tooltip } from '@mui/material';
|
|
5
|
+
import { LoadingButton } from '@mui/lab';
|
|
6
6
|
|
|
7
7
|
import { getNormalizedId } from '../../utils';
|
|
8
8
|
|
|
9
|
-
import Content from './Content';
|
|
10
9
|
import StartIcon from './StartIcon';
|
|
10
|
+
import Content from './Content';
|
|
11
11
|
|
|
12
12
|
const useStyles = makeStyles()((theme: Theme) => ({
|
|
13
13
|
loadingButton: {
|
|
@@ -15,14 +15,13 @@ const useStyles = makeStyles()((theme: Theme) => ({
|
|
|
15
15
|
}
|
|
16
16
|
}));
|
|
17
17
|
|
|
18
|
-
interface Props {
|
|
18
|
+
interface Props extends Record<string, unknown> {
|
|
19
19
|
className?: string;
|
|
20
20
|
labelLoading?: string;
|
|
21
21
|
labelSave?: string;
|
|
22
22
|
labelSucceeded?: string;
|
|
23
23
|
loading?: boolean;
|
|
24
24
|
size?: 'small' | 'medium' | 'large';
|
|
25
|
-
startIcon?: boolean;
|
|
26
25
|
succeeded?: boolean;
|
|
27
26
|
tooltip?: string;
|
|
28
27
|
tooltipLabel?: string;
|
|
@@ -46,9 +45,8 @@ const SaveButton = ({
|
|
|
46
45
|
labelSave = '',
|
|
47
46
|
size = 'small',
|
|
48
47
|
className,
|
|
49
|
-
startIcon = true,
|
|
50
48
|
...rest
|
|
51
|
-
}: Props
|
|
49
|
+
}: Props): JSX.Element => {
|
|
52
50
|
const { classes, cx } = useStyles();
|
|
53
51
|
const hasLabel = hasValue([labelLoading, labelSave, labelSucceeded]);
|
|
54
52
|
|
|
@@ -75,9 +73,7 @@ const SaveButton = ({
|
|
|
75
73
|
loading={loading}
|
|
76
74
|
loadingPosition={labelLoading ? 'start' : 'center'}
|
|
77
75
|
size={size}
|
|
78
|
-
startIcon={
|
|
79
|
-
startIcon && <StartIcon startIconConfig={startIconConfig} />
|
|
80
|
-
}
|
|
76
|
+
startIcon={<StartIcon startIconConfig={startIconConfig} />}
|
|
81
77
|
variant="contained"
|
|
82
78
|
{...rest}
|
|
83
79
|
>
|
|
@@ -2,7 +2,7 @@ import { makeStyles } from 'tss-react/mui';
|
|
|
2
2
|
import { T, always, cond, equals } from 'ramda';
|
|
3
3
|
|
|
4
4
|
import { SvgIconComponent } from '@mui/icons-material';
|
|
5
|
-
import Typography, {
|
|
5
|
+
import Typography, { TypographyTypeMap } from '@mui/material/Typography';
|
|
6
6
|
import { FormControlLabel, Checkbox as MuiCheckbox, Box } from '@mui/material';
|
|
7
7
|
|
|
8
8
|
export type LabelPlacement = 'bottom' | 'top' | 'end' | 'start' | undefined;
|
|
@@ -56,7 +56,7 @@ interface Props {
|
|
|
56
56
|
disabled?: boolean;
|
|
57
57
|
label: string;
|
|
58
58
|
labelPlacement?: LabelPlacement;
|
|
59
|
-
labelProps?:
|
|
59
|
+
labelProps?: TypographyTypeMap['props'];
|
|
60
60
|
onChange?: (e) => void;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -2,7 +2,7 @@ import { equals, includes } from 'ramda';
|
|
|
2
2
|
import { makeStyles } from 'tss-react/mui';
|
|
3
3
|
|
|
4
4
|
import FormGroup, { FormGroupProps } from '@mui/material/FormGroup';
|
|
5
|
-
import {
|
|
5
|
+
import { TypographyTypeMap } from '@mui/material/Typography';
|
|
6
6
|
|
|
7
7
|
import Checkbox, { LabelPlacement } from '../Checkbox';
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ interface Props {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
formGroupProps?: FormGroupProps;
|
|
15
15
|
labelPlacement?: LabelPlacement;
|
|
16
|
-
labelProps?:
|
|
16
|
+
labelProps?: TypographyTypeMap['props'];
|
|
17
17
|
onChange?: (e) => void;
|
|
18
18
|
options: Array<string>;
|
|
19
19
|
values: Array<string>;
|
package/src/Dashboard/Item.tsx
CHANGED
package/src/Dashboard/Layout.tsx
CHANGED
|
@@ -23,7 +23,7 @@ interface DashboardLayoutProps<T> {
|
|
|
23
23
|
layout: Array<T>;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const Layout = <T extends Layout>({
|
|
27
27
|
children,
|
|
28
28
|
changeLayout,
|
|
29
29
|
displayGrid,
|
|
@@ -76,4 +76,4 @@ const DashboardLayout = <T extends Layout>({
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
export default
|
|
79
|
+
export default Layout;
|
package/src/Dialog/index.tsx
CHANGED
|
@@ -43,7 +43,7 @@ export type Props = {
|
|
|
43
43
|
dialogTitleClassName?: string;
|
|
44
44
|
labelCancel?: string | null;
|
|
45
45
|
labelConfirm?: string | null;
|
|
46
|
-
labelTitle?:
|
|
46
|
+
labelTitle?: string | null;
|
|
47
47
|
onCancel?: () => void;
|
|
48
48
|
onClose?: () => void;
|
|
49
49
|
onConfirm: (event, value?) => void;
|
|
@@ -17,7 +17,7 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
17
17
|
logo: {
|
|
18
18
|
alignSelf: 'flex-end',
|
|
19
19
|
height: theme.spacing(11),
|
|
20
|
-
width: '
|
|
20
|
+
width: '22rem'
|
|
21
21
|
},
|
|
22
22
|
message: {
|
|
23
23
|
color: theme.palette.text.primary
|
|
@@ -66,9 +66,9 @@ export const FallbackPage: FC<FallbackPageProps> = typedMemo(
|
|
|
66
66
|
|
|
67
67
|
return (
|
|
68
68
|
<div className={classes.notAuthorizedContainer}>
|
|
69
|
-
<
|
|
69
|
+
<section className={classes.logo}>
|
|
70
70
|
<CentreonLogo />
|
|
71
|
-
</
|
|
71
|
+
</section>
|
|
72
72
|
<section className={classes.messageBlock}>
|
|
73
73
|
<header>
|
|
74
74
|
<Typography color="primary" fontWeight="bold" variant="h3">
|
|
@@ -98,9 +98,7 @@ const getExtensions = cond([
|
|
|
98
98
|
[T, identity]
|
|
99
99
|
]) as (accept: string) => Array<string>;
|
|
100
100
|
|
|
101
|
-
export const transformFileListToArray = (
|
|
102
|
-
files: FileList | null
|
|
103
|
-
): Array<File> =>
|
|
101
|
+
export const transformFileListToArray = (files: FileList | null): Array<File> =>
|
|
104
102
|
isNil(files)
|
|
105
103
|
? []
|
|
106
104
|
: (Array(files.length)
|
|
@@ -21,7 +21,6 @@ import CheckboxGroup from './CheckboxGroup';
|
|
|
21
21
|
import Checkbox from './Checkbox';
|
|
22
22
|
import Custom from './Custom';
|
|
23
23
|
import LoadingSkeleton from './LoadingSkeleton';
|
|
24
|
-
import List from './List/List';
|
|
25
24
|
|
|
26
25
|
export const getInput = R.cond<
|
|
27
26
|
Array<InputType>,
|
|
@@ -67,7 +66,6 @@ export const getInput = R.cond<
|
|
|
67
66
|
R.equals(InputType.CheckboxGroup) as (b: InputType) => boolean,
|
|
68
67
|
R.always(CheckboxGroup)
|
|
69
68
|
],
|
|
70
|
-
[R.equals(InputType.List) as (b: InputType) => boolean, R.always(List)],
|
|
71
69
|
[R.T, R.always(TextInput)]
|
|
72
70
|
]);
|
|
73
71
|
|
|
@@ -187,7 +185,7 @@ const Inputs = ({
|
|
|
187
185
|
const hasGroupTitle = R.not(R.isNil(groupName));
|
|
188
186
|
|
|
189
187
|
const groupProps = hasGroupTitle
|
|
190
|
-
? R.find(R.propEq(
|
|
188
|
+
? R.find(R.propEq('name', groupName), groups)
|
|
191
189
|
: ({} as Group);
|
|
192
190
|
|
|
193
191
|
const isFirstElement = areGroupsOpen || R.equals(index, 0);
|
|
@@ -18,8 +18,7 @@ export enum InputType {
|
|
|
18
18
|
Grid,
|
|
19
19
|
Custom,
|
|
20
20
|
Checkbox,
|
|
21
|
-
CheckboxGroup
|
|
22
|
-
List
|
|
21
|
+
CheckboxGroup
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
interface FieldsTableGetRequiredProps {
|
|
@@ -77,13 +76,6 @@ export interface InputProps {
|
|
|
77
76
|
hideInput?: (values: FormikValues) => boolean;
|
|
78
77
|
inputClassName?: string;
|
|
79
78
|
label: string;
|
|
80
|
-
list?: {
|
|
81
|
-
AddItem: React.ComponentType<{ addItem }>;
|
|
82
|
-
SortContent: React.ComponentType<object>;
|
|
83
|
-
addItemLabel?: string;
|
|
84
|
-
itemProps: Array<string>;
|
|
85
|
-
sortLabel?: string;
|
|
86
|
-
};
|
|
87
79
|
radio?: {
|
|
88
80
|
options?: Array<{
|
|
89
81
|
label: string | JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Shape } from '@visx/visx';
|
|
2
2
|
import { isEmpty, isNil } from 'ramda';
|
|
3
3
|
|
|
4
|
-
import { Circle
|
|
4
|
+
import { Circle } from './models';
|
|
5
5
|
import useCoordinateCircle from './useCoordinateCircle';
|
|
6
6
|
|
|
7
7
|
const Circle = ({
|
|
@@ -11,7 +11,7 @@ const Circle = ({
|
|
|
11
11
|
timeSeries,
|
|
12
12
|
getX,
|
|
13
13
|
getCountDisplayedCircles
|
|
14
|
-
}:
|
|
14
|
+
}: Circle): JSX.Element | null => {
|
|
15
15
|
const coordinates = useCoordinateCircle({
|
|
16
16
|
getCountDisplayedCircles,
|
|
17
17
|
getX,
|
|
@@ -130,11 +130,10 @@ const WrapperThresholdLines = ({
|
|
|
130
130
|
|
|
131
131
|
return (
|
|
132
132
|
<g>
|
|
133
|
-
{filteredThresholdLines.map(
|
|
134
|
-
(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
))
|
|
133
|
+
{filteredThresholdLines.map((element) =>
|
|
134
|
+
element?.map(({ Component, props, key }) => (
|
|
135
|
+
<Component {...props} id={key} key={key} />
|
|
136
|
+
))
|
|
138
137
|
)}
|
|
139
138
|
</g>
|
|
140
139
|
);
|
|
@@ -2,7 +2,7 @@ import { equals, isNil } from 'ramda';
|
|
|
2
2
|
|
|
3
3
|
import { getUnits, getYScale } from '../../common/timeSeries';
|
|
4
4
|
import { Line } from '../../common/timeSeries/models';
|
|
5
|
-
import { Thresholds
|
|
5
|
+
import { Thresholds } from '../../common/models';
|
|
6
6
|
|
|
7
7
|
import { ThresholdLine } from './ThresholdLine';
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ interface Props {
|
|
|
13
13
|
rightScale: (value: number) => number;
|
|
14
14
|
showTooltip: (props) => void;
|
|
15
15
|
thresholdUnit?: string;
|
|
16
|
-
thresholds:
|
|
16
|
+
thresholds: Thresholds;
|
|
17
17
|
width: number;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@ const useFilterLines = ({
|
|
|
28
28
|
linesGraph,
|
|
29
29
|
setLinesGraph
|
|
30
30
|
}: UseFilterLines): Result => {
|
|
31
|
-
const displayedLines = reject(propEq(
|
|
31
|
+
const displayedLines = reject(propEq('display', false), linesGraph ?? lines);
|
|
32
32
|
const filterLines = (): Array<Line> => {
|
|
33
33
|
const lineOriginMetric = findLineOfOriginMetricThreshold(lines);
|
|
34
34
|
|
|
@@ -2,7 +2,7 @@ import { Shape } from '@visx/visx';
|
|
|
2
2
|
|
|
3
3
|
import { grey } from '@mui/material/colors';
|
|
4
4
|
|
|
5
|
-
import { GuidingLines
|
|
5
|
+
import { GuidingLines } from './models';
|
|
6
6
|
import useTickGraph from './useTickGraph';
|
|
7
7
|
|
|
8
8
|
const GuidingLines = ({
|
|
@@ -10,7 +10,7 @@ const GuidingLines = ({
|
|
|
10
10
|
xScale,
|
|
11
11
|
graphHeight,
|
|
12
12
|
graphWidth
|
|
13
|
-
}:
|
|
13
|
+
}: GuidingLines): JSX.Element | null => {
|
|
14
14
|
const { positionX, positionY } = useTickGraph({
|
|
15
15
|
timeSeries,
|
|
16
16
|
xScale
|
|
@@ -43,8 +43,9 @@ const Annotation = ({
|
|
|
43
43
|
|
|
44
44
|
const setAnnotationHovered = useSetAtom(annotationHoveredAtom);
|
|
45
45
|
|
|
46
|
-
const content = `${truncate(event.content)} (${t(labelBy)} ${
|
|
47
|
-
?.name
|
|
46
|
+
const content = `${truncate(event.content)} (${t(labelBy)} ${
|
|
47
|
+
event.contact?.name
|
|
48
|
+
})`;
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
51
|
<g>
|
|
@@ -27,9 +27,9 @@ interface Props {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const useLegend = ({ lines, setLinesGraph }: Props): LegendActions => {
|
|
30
|
-
const displayedLines = reject(propEq(
|
|
30
|
+
const displayedLines = reject(propEq('display', false), lines);
|
|
31
31
|
const getLineByMetric = (metric_id: number): Line =>
|
|
32
|
-
find(propEq(metric_id,
|
|
32
|
+
find(propEq('metric_id', metric_id), lines) as Line;
|
|
33
33
|
|
|
34
34
|
const toggleMetricLine = (metric_id): void => {
|
|
35
35
|
const data = lines.map((line) => ({
|
|
@@ -92,7 +92,7 @@ const useLegend = ({ lines, setLinesGraph }: Props): LegendActions => {
|
|
|
92
92
|
|
|
93
93
|
const newLines = lines.map((line) => ({
|
|
94
94
|
...line,
|
|
95
|
-
display: find(propEq(
|
|
95
|
+
display: find(propEq('metric_id', line.metric_id), lines)?.display ?? true
|
|
96
96
|
}));
|
|
97
97
|
|
|
98
98
|
setLinesGraph(newLines);
|
|
@@ -69,24 +69,21 @@ export const getDescription = ({ sections }: Description): string => {
|
|
|
69
69
|
})}<br></details>`;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
const formattedProps = props.reduce(
|
|
73
|
-
(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})}`;
|
|
72
|
+
const formattedProps = props.reduce((accumulator, currentValue, index) => {
|
|
73
|
+
const key = Object.keys(currentValue)[0];
|
|
74
|
+
const { description, type } = currentValue[key];
|
|
75
|
+
const body = `${accumulator} ${getBodyDescription({
|
|
76
|
+
description,
|
|
77
|
+
key,
|
|
78
|
+
type
|
|
79
|
+
})}`;
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
if (!equals(index, props.length - 1)) {
|
|
82
|
+
return body;
|
|
83
|
+
}
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
getInitialValue({ section: name, type: item?.type })
|
|
89
|
-
);
|
|
85
|
+
return `${body}</details>`;
|
|
86
|
+
}, getInitialValue({ section: name, type: item?.type }));
|
|
90
87
|
|
|
91
88
|
return formattedProps as string;
|
|
92
89
|
});
|
|
@@ -14,7 +14,7 @@ import { LineChartData } from '../../common/models';
|
|
|
14
14
|
export const adjustGraphData = (graphData: LineChartData): LinesData => {
|
|
15
15
|
const lines = getLineData(graphData);
|
|
16
16
|
const sortedLines = sortBy(prop('name'), lines);
|
|
17
|
-
const displayedLines = reject(propEq(
|
|
17
|
+
const displayedLines = reject(propEq('display', false), sortedLines);
|
|
18
18
|
|
|
19
19
|
const timeSeries = getTimeSeries(graphData);
|
|
20
20
|
|
|
@@ -39,7 +39,8 @@ import { Interval, ThresholdType, TooltipData } from './models';
|
|
|
39
39
|
import WrapperLineChart from './index';
|
|
40
40
|
|
|
41
41
|
const meta: Meta<typeof WrapperLineChart> = {
|
|
42
|
-
component: WrapperLineChart
|
|
42
|
+
component: WrapperLineChart,
|
|
43
|
+
tags: ['autodocs']
|
|
43
44
|
};
|
|
44
45
|
export default meta;
|
|
45
46
|
|
|
@@ -352,9 +353,6 @@ export const LineChartWithTimePeriod: Story = {
|
|
|
352
353
|
end: defaultEnd,
|
|
353
354
|
height: 500,
|
|
354
355
|
start: defaultStart
|
|
355
|
-
},
|
|
356
|
-
parameters: {
|
|
357
|
-
chromatic: { diffThreshold: 0.1 }
|
|
358
356
|
}
|
|
359
357
|
};
|
|
360
358
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Thresholds
|
|
1
|
+
import { Thresholds } from '../common/models';
|
|
2
2
|
|
|
3
3
|
import { ThresholdLine } from './ThresholdLine';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ interface Props {
|
|
|
8
8
|
hideTooltip: () => void;
|
|
9
9
|
showTooltip: (args) => void;
|
|
10
10
|
size: 'small' | 'medium';
|
|
11
|
-
thresholds:
|
|
11
|
+
thresholds: Thresholds;
|
|
12
12
|
xScale: (value: number) => number;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -24,21 +24,7 @@ export const success: Story = {
|
|
|
24
24
|
critical: 'Critical',
|
|
25
25
|
warning: 'Warning'
|
|
26
26
|
},
|
|
27
|
-
thresholds:
|
|
28
|
-
critical: [
|
|
29
|
-
{
|
|
30
|
-
label: 'Critical',
|
|
31
|
-
value: 1.5
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
enabled: true,
|
|
35
|
-
warning: [
|
|
36
|
-
{
|
|
37
|
-
label: 'Warning',
|
|
38
|
-
value: 0.5
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
}
|
|
27
|
+
thresholds: [0.5, 1.5]
|
|
42
28
|
},
|
|
43
29
|
render: Template
|
|
44
30
|
};
|
|
@@ -50,21 +36,7 @@ export const warning: Story = {
|
|
|
50
36
|
critical: 'Critical',
|
|
51
37
|
warning: 'Warning'
|
|
52
38
|
},
|
|
53
|
-
thresholds:
|
|
54
|
-
critical: [
|
|
55
|
-
{
|
|
56
|
-
label: 'Critical',
|
|
57
|
-
value: 1.5
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
enabled: true,
|
|
61
|
-
warning: [
|
|
62
|
-
{
|
|
63
|
-
label: 'Warning',
|
|
64
|
-
value: 0.4
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
}
|
|
39
|
+
thresholds: [0.2, 0.5]
|
|
68
40
|
},
|
|
69
41
|
render: Template
|
|
70
42
|
};
|
|
@@ -76,21 +48,7 @@ export const critical: Story = {
|
|
|
76
48
|
critical: 'Critical',
|
|
77
49
|
warning: 'Warning'
|
|
78
50
|
},
|
|
79
|
-
thresholds:
|
|
80
|
-
critical: [
|
|
81
|
-
{
|
|
82
|
-
label: 'Critical',
|
|
83
|
-
value: 0.3
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
enabled: true,
|
|
87
|
-
warning: [
|
|
88
|
-
{
|
|
89
|
-
label: 'Warning',
|
|
90
|
-
value: 0.2
|
|
91
|
-
}
|
|
92
|
-
]
|
|
93
|
-
}
|
|
51
|
+
thresholds: [0.13, 0.35]
|
|
94
52
|
},
|
|
95
53
|
render: Template
|
|
96
54
|
};
|
|
@@ -103,21 +61,7 @@ export const rawValue: Story = {
|
|
|
103
61
|
critical: 'Critical',
|
|
104
62
|
warning: 'Warning'
|
|
105
63
|
},
|
|
106
|
-
thresholds:
|
|
107
|
-
critical: [
|
|
108
|
-
{
|
|
109
|
-
label: 'Critical',
|
|
110
|
-
value: 1.5
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
enabled: true,
|
|
114
|
-
warning: [
|
|
115
|
-
{
|
|
116
|
-
label: 'Warning',
|
|
117
|
-
value: 0.5
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
}
|
|
64
|
+
thresholds: [0.5, 1.5]
|
|
121
65
|
},
|
|
122
66
|
render: Template
|
|
123
67
|
};
|