@centreon/ui 26.5.9 → 26.5.11
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 -1
- package/src/@types/globals.d.ts +21 -0
- package/src/Colors/index.tsx +1 -1
- package/src/Dashboard/Item.tsx +11 -14
- package/src/Dialog/Duplicate/index.tsx +1 -1
- package/src/FileDropZone/useDropzone.test.ts +18 -15
- package/src/Form/Inputs/Checkbox.tsx +6 -3
- package/src/Form/Inputs/CheckboxGroup.tsx +8 -8
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +9 -3
- package/src/Form/Inputs/FieldsTable/FieldsTable.tsx +1 -1
- package/src/Form/Inputs/File.tsx +3 -1
- package/src/Form/Inputs/Grid.tsx +1 -1
- package/src/Form/Inputs/List/List.tsx +8 -7
- package/src/Form/Inputs/List/useList.ts +12 -6
- package/src/Form/Inputs/Radio.tsx +7 -1
- package/src/Form/Inputs/Text.tsx +1 -1
- package/src/Form/Inputs/index.tsx +7 -2
- package/src/Form/storiesData.tsx +5 -2
- package/src/Graph/BarChart/Bar.tsx +2 -2
- package/src/Graph/BarChart/BarChart.tsx +2 -0
- package/src/Graph/BarChart/BarGroup.tsx +3 -0
- package/src/Graph/BarChart/BarStack.tsx +1 -0
- package/src/Graph/BarChart/MemoizedGroup.tsx +3 -1
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +5 -0
- package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +4 -0
- package/src/Graph/BarStack/Graph.tsx +3 -0
- package/src/Graph/Chart/BasicComponents/Lines/RegularLines/index.tsx +4 -1
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +7 -1
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/BasicThreshold.tsx +1 -0
- package/src/Graph/Chart/BasicComponents/Lines/index.tsx +11 -1
- package/src/Graph/Chart/Chart.tsx +9 -0
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +2 -0
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +2 -0
- package/src/Graph/Chart/InteractiveComponents/Annotations/annotationsAtoms.ts +5 -0
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +3 -0
- package/src/Graph/Chart/Legend/LegendHeader.tsx +1 -0
- package/src/Graph/Chart/Legend/index.tsx +6 -1
- package/src/Graph/Chart/useChartData.ts +6 -0
- package/src/Graph/Gauge/AnimatedPie.tsx +3 -0
- package/src/Graph/Gauge/PieData.tsx +5 -0
- package/src/Graph/Gauge/ResponsiveGauge.tsx +2 -0
- package/src/Graph/Gauge/Thresholds.tsx +1 -0
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +1 -0
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +2 -0
- package/src/Graph/Timeline/ResponsiveTimeline.tsx +1 -0
- package/src/Graph/Tree/Links.tsx +1 -0
- package/src/Graph/Tree/Tree.tsx +1 -0
- package/src/Graph/Tree/stories/datas.ts +2 -0
- package/src/Graph/common/Axes/index.tsx +3 -3
- package/src/Graph/common/BaseChart/BaseChart.tsx +3 -0
- package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +1 -0
- package/src/Graph/common/BaseChart/Header/models.ts +1 -0
- package/src/Graph/common/timeSeries/index.test.ts +17 -1
- package/src/Graph/common/timeSeries/index.ts +12 -0
- package/src/Graph/common/utils.ts +6 -2
- package/src/InputField/Number/Number.tsx +10 -4
- package/src/InputField/Search/PersistentTooltip.tsx +6 -5
- package/src/InputField/Select/Autocomplete/Connected/Single.tsx +3 -1
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +5 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +4 -5
- package/src/InputField/Select/Autocomplete/Draggable/index.tsx +4 -5
- package/src/InputField/Select/Autocomplete/Multi/Listbox.tsx +16 -1
- package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +44 -30
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +1 -0
- package/src/InputField/Select/Autocomplete/index.tsx +7 -1
- package/src/InputField/Select/IconPopover/index.tsx +0 -3
- package/src/InputField/Select/Option.tsx +6 -1
- package/src/InputField/Select/index.tsx +3 -3
- package/src/InputField/Text/index.tsx +11 -3
- package/src/InputField/Text/useAutoSize.ts +2 -2
- package/src/Listing/ActionBar/index.tsx +2 -3
- package/src/Listing/Cell/index.tsx +24 -22
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +7 -0
- package/src/Listing/Header/ListingHeader.tsx +2 -2
- package/src/Listing/Header/_internals/PredefinedSelectionList.tsx +3 -3
- package/src/Listing/index.tsx +29 -34
- package/src/Listing/useStyleTable.ts +1 -1
- package/src/Module/index.tsx +3 -3
- package/src/MultiSelectEntries/index.tsx +1 -1
- package/src/Pagination/Pagination.tsx +1 -1
- package/src/ParentSize/ParentSize.tsx +2 -1
- package/src/PopoverMenu/index.tsx +1 -7
- package/src/RichTextEditor/ContentEditable.tsx +2 -0
- package/src/RichTextEditor/RichTextEditor.tsx +1 -0
- package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +1 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +1 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +2 -0
- package/src/Snackbar/index.tsx +3 -1
- package/src/SortableItems/Item.tsx +8 -7
- package/src/SortableItems/index.tsx +1 -1
- package/src/ThemeProvider/index.tsx +5 -3
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +3 -2
- package/src/TimePeriods/SelectedTimePeriod.tsx +1 -1
- package/src/TimePeriods/timePeriodsAtoms.ts +1 -1
- package/src/TimePeriods/useSortTimePeriods.ts +1 -1
- package/src/Typography/Subtitle.tsx +3 -1
- package/src/Typography/story.utils.tsx +3 -2
- package/src/Wizard/ActionsBar.tsx +2 -2
- package/src/api/QueryProvider.tsx +1 -2
- package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +4 -2
- package/src/api/useGraphQuery/index.ts +11 -6
- package/src/api/useMutationQuery/index.ts +11 -7
- package/src/api/useMutationQuery/useOptimisticMutation.ts +34 -16
- package/src/api/useRequest/index.test.ts +1 -1
- package/src/api/useRequest/index.ts +1 -1
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/CrudPage/Actions/Filters.tsx +1 -1
- package/src/components/CrudPage/Actions/useSearch.tsx +1 -1
- package/src/components/CrudPage/Columns/Actions.tsx +2 -2
- package/src/components/CrudPage/CrudPageRoot.tsx +1 -1
- package/src/components/CrudPage/DeleteModal.tsx +14 -6
- package/src/components/CrudPage/Form/AddModal.tsx +16 -4
- package/src/components/CrudPage/Form/UpdateModal.tsx +2 -2
- package/src/components/CrudPage/Listing.tsx +2 -1
- package/src/components/CrudPage/hooks/useDeleteItem.ts +5 -1
- package/src/components/CrudPage/hooks/useGetItem.ts +3 -3
- package/src/components/DataTable/DataListing.tsx +1 -1
- package/src/components/ExpandableContainer/ExpandableContainer.tsx +1 -0
- package/src/components/Form/AccessRights/Actions/Actions.tsx +1 -1
- package/src/components/Form/AccessRights/Actions/useActions.ts +1 -4
- package/src/components/Form/AccessRights/List/StateChip.tsx +1 -1
- package/src/components/Form/AccessRights/Stats/Stats.tsx +1 -1
- package/src/components/Form/AccessRights/common/RoleSelectField.tsx +4 -6
- package/src/components/Form/Dashboard/DashboardForm.tsx +2 -2
- package/src/components/Header/PageHeader/PageHeader.styles.ts +26 -20
- package/src/components/Menu/useMenu.tsx +3 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +14 -9
- package/src/components/Modal/Modal.tsx +5 -3
- package/src/components/Modal/ModalActions.tsx +1 -1
- package/src/components/Modal/ModalBody.tsx +2 -2
- package/src/components/Modal/ModalHeader.tsx +2 -2
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +8 -2
- package/src/index.ts +1 -1
- package/src/utils/sanitizedHTML.ts +1 -1
- package/src/utils/useDebounce.ts +3 -1
- package/src/utils/useLicenseExpirationWarning.ts +11 -6
- package/src/utils/useLocaleDateTimeFormat/index.test.tsx +3 -1
- package/src/utils/useLocaleDateTimeFormat/localeFallback.test.tsx +3 -1
- package/src/utils/useMemoComponent.ts +1 -1
- package/src/utils/usePluralizedTranslation.test.ts +2 -0
- package/src/utils/useViewportIntersection.ts +3 -4
package/src/Listing/index.tsx
CHANGED
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
pick,
|
|
22
22
|
prop,
|
|
23
23
|
propEq,
|
|
24
|
-
reduce,
|
|
25
24
|
reject,
|
|
26
25
|
slice,
|
|
27
26
|
subtract,
|
|
@@ -146,7 +145,7 @@ const Listing = <
|
|
|
146
145
|
TRow extends {
|
|
147
146
|
id: RowId;
|
|
148
147
|
internalListingParentId?: RowId;
|
|
149
|
-
internalListingParentRow
|
|
148
|
+
internalListingParentRow?: TRow;
|
|
150
149
|
}
|
|
151
150
|
>({
|
|
152
151
|
customListingComponent,
|
|
@@ -217,22 +216,21 @@ const Listing = <
|
|
|
217
216
|
const [lastSelectionIndex, setLastSelectionIndex] = useState<number | null>(
|
|
218
217
|
null
|
|
219
218
|
);
|
|
220
|
-
const containerRef = useRef<HTMLDivElement>();
|
|
221
|
-
const actionBarRef = useRef<HTMLDivElement>();
|
|
219
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
220
|
+
const actionBarRef = useRef<HTMLDivElement>(null);
|
|
222
221
|
|
|
223
222
|
const subItemsPivots = useAtomValue(subItemsPivotsAtom);
|
|
224
223
|
|
|
225
224
|
const allSubItemIds = useMemo(
|
|
226
225
|
() =>
|
|
227
|
-
reduce<
|
|
226
|
+
rows.reduce<Array<string | number>>(
|
|
228
227
|
(acc, row) => [
|
|
229
228
|
...acc,
|
|
230
229
|
...(row[subItems?.getRowProperty() || ''] || []).map(
|
|
231
230
|
({ id }) => `${subItemPrefixKey}_${getId(row)}_${id}`
|
|
232
231
|
)
|
|
233
232
|
],
|
|
234
|
-
[]
|
|
235
|
-
rows
|
|
233
|
+
[]
|
|
236
234
|
),
|
|
237
235
|
[rows, subItems, getId]
|
|
238
236
|
);
|
|
@@ -240,28 +238,24 @@ const Listing = <
|
|
|
240
238
|
const rowsToDisplay = useMemo(
|
|
241
239
|
() =>
|
|
242
240
|
subItems?.enable
|
|
243
|
-
? reduce<TRow, Array<TRow
|
|
244
|
-
(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
...
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
[],
|
|
263
|
-
rows
|
|
264
|
-
)
|
|
241
|
+
? rows.reduce<Array<TRow>>((acc, row): Array<TRow> => {
|
|
242
|
+
if (
|
|
243
|
+
row[subItems.getRowProperty()] &&
|
|
244
|
+
subItemsPivots.includes(row.id)
|
|
245
|
+
) {
|
|
246
|
+
return [
|
|
247
|
+
...acc,
|
|
248
|
+
row,
|
|
249
|
+
...row[subItems.getRowProperty()].map((subRow) => ({
|
|
250
|
+
...subRow,
|
|
251
|
+
internalListingParentId: row.id,
|
|
252
|
+
internalListingParentRow: row
|
|
253
|
+
}))
|
|
254
|
+
];
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return [...acc, row];
|
|
258
|
+
}, [])
|
|
265
259
|
: rows,
|
|
266
260
|
[rows, subItemsPivots, subItems]
|
|
267
261
|
);
|
|
@@ -434,7 +428,7 @@ const Listing = <
|
|
|
434
428
|
);
|
|
435
429
|
};
|
|
436
430
|
|
|
437
|
-
const selectRow = (event: MouseEvent, row): void => {
|
|
431
|
+
const selectRow = (event: React.MouseEvent, row): void => {
|
|
438
432
|
event.preventDefault();
|
|
439
433
|
event.stopPropagation();
|
|
440
434
|
// This prevents unwanted text selection
|
|
@@ -700,7 +694,9 @@ const Listing = <
|
|
|
700
694
|
<EmptyResult
|
|
701
695
|
label={
|
|
702
696
|
labelNoResultFound
|
|
703
|
-
?
|
|
697
|
+
? typeof labelNoResultFound === 'string'
|
|
698
|
+
? t(labelNoResultFound)
|
|
699
|
+
: labelNoResultFound
|
|
704
700
|
: t(defaultLabelNoResultFound)
|
|
705
701
|
}
|
|
706
702
|
/>
|
|
@@ -768,9 +764,8 @@ export const MemoizedListing = <TRow extends { id: string | number }>({
|
|
|
768
764
|
),
|
|
769
765
|
memoProps: [
|
|
770
766
|
...memoProps,
|
|
771
|
-
|
|
772
|
-
['id', 'label', 'disabled', 'width', 'shortLabel', 'sortField']
|
|
773
|
-
columns
|
|
767
|
+
columns.map(
|
|
768
|
+
pick(['id', 'label', 'disabled', 'width', 'shortLabel', 'sortField'])
|
|
774
769
|
),
|
|
775
770
|
columnConfiguration,
|
|
776
771
|
limit,
|
|
@@ -34,7 +34,7 @@ export const getTextStyleByViewMode = ({
|
|
|
34
34
|
pick(
|
|
35
35
|
['color', 'fontSize', 'lineHeight'],
|
|
36
36
|
theme.typography[isCompactMode(listingVariant) ? 'body2' : 'body1']
|
|
37
|
-
);
|
|
37
|
+
) as CSSObject;
|
|
38
38
|
|
|
39
39
|
const useStyleTable = ({ listingVariant }: TableStyle): TableStyleState => {
|
|
40
40
|
const dataStyle = useAtomValue(tableStyleAtom);
|
package/src/Module/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PaletteOptions } from '@mui/material';
|
|
2
2
|
import { createGenerateClassName, StylesProvider } from '@mui/styles';
|
|
3
3
|
|
|
4
4
|
import type { QueryClient } from '@tanstack/react-query';
|
|
@@ -14,8 +14,8 @@ export interface ModuleProps {
|
|
|
14
14
|
seedName: string;
|
|
15
15
|
store: ReturnType<typeof createStore>;
|
|
16
16
|
overrideTheme?: {
|
|
17
|
-
light: Partial<
|
|
18
|
-
dark: Partial<
|
|
17
|
+
light: Partial<PaletteOptions>;
|
|
18
|
+
dark: Partial<PaletteOptions>;
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -65,7 +65,7 @@ const Pagination = ({
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const pagesCount = Math.ceil(data?.meta
|
|
68
|
+
const pagesCount = Math.ceil((data?.meta?.total ?? 0) / limit);
|
|
69
69
|
const arePaginationComponentsDisplayed = !equals(pagesCount, 1);
|
|
70
70
|
|
|
71
71
|
const hasNoElements = useMemo(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Responsive } from '@visx/visx';
|
|
2
|
-
import type { ReactElement } from 'react';
|
|
2
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
3
3
|
|
|
4
4
|
type ParentSizeState = {
|
|
5
5
|
height: number;
|
|
@@ -10,6 +10,7 @@ type ParentSizeState = {
|
|
|
10
10
|
|
|
11
11
|
type Props = {
|
|
12
12
|
children: (args: ParentSizeState) => ReactElement;
|
|
13
|
+
parentSizeStyles?: CSSProperties;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
const ParentSize = ({ children, ...props }: Props): JSX.Element => {
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
} from '@mui/material';
|
|
7
7
|
import type { PopperProps } from '@mui/material/Popper';
|
|
8
8
|
|
|
9
|
-
import { equals, type } from 'ramda';
|
|
10
9
|
import { type Dispatch, type SetStateAction, useEffect, useState } from 'react';
|
|
11
10
|
import { makeStyles } from 'tss-react/mui';
|
|
12
11
|
|
|
@@ -108,17 +107,12 @@ const PopoverMenu = ({
|
|
|
108
107
|
<Popper
|
|
109
108
|
anchorEl={anchorEl}
|
|
110
109
|
className={classes.popover}
|
|
111
|
-
nonce={undefined}
|
|
112
|
-
onResize={(): undefined => undefined}
|
|
113
|
-
onResizeCapture={(): undefined => undefined}
|
|
114
110
|
open
|
|
115
111
|
placement={popperPlacement}
|
|
116
112
|
{...popperProps}
|
|
117
113
|
>
|
|
118
114
|
<Paper className={tooltipClassName}>
|
|
119
|
-
{
|
|
120
|
-
? children({ close })
|
|
121
|
-
: children}
|
|
115
|
+
{typeof children === 'function' ? children({ close }) : children}
|
|
122
116
|
</Paper>
|
|
123
117
|
</Popper>
|
|
124
118
|
</ClickAwayListener>
|
|
@@ -145,10 +145,12 @@ const ContentEditable = ({
|
|
|
145
145
|
|
|
146
146
|
const isTextEmpty =
|
|
147
147
|
isEmpty(root) &&
|
|
148
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
148
149
|
!editor.getEditorState().toJSON().root.children?.[0]?.children?.length;
|
|
149
150
|
|
|
150
151
|
const handleBlur = (event: React.FocusEvent<HTMLInputElement>): void => {
|
|
151
152
|
setFocused(false);
|
|
153
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
152
154
|
onBlur?.(event);
|
|
153
155
|
};
|
|
154
156
|
|
|
@@ -81,6 +81,7 @@ const BlockButtons = ({ disabled }: Props): JSX.Element => {
|
|
|
81
81
|
|
|
82
82
|
const updateToolbar = useCallback(() => {
|
|
83
83
|
const selection = $getSelection();
|
|
84
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
84
85
|
const anchorNode = selection?.anchor.getNode();
|
|
85
86
|
const element = equals(anchorNode?.getKey(), 'root')
|
|
86
87
|
? anchorNode
|
|
@@ -79,6 +79,7 @@ const ListButton = ({ disabled }: Props): JSX.Element => {
|
|
|
79
79
|
|
|
80
80
|
const updateToolbar = useCallback(() => {
|
|
81
81
|
const selection = $getSelection();
|
|
82
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
82
83
|
const anchorNode = selection?.anchor.getNode();
|
|
83
84
|
const element = equals(anchorNode?.getKey(), 'root')
|
|
84
85
|
? anchorNode
|
|
@@ -100,6 +101,7 @@ const ListButton = ({ disabled }: Props): JSX.Element => {
|
|
|
100
101
|
const type = parentList
|
|
101
102
|
? parentList.getListType()
|
|
102
103
|
: element.getListType();
|
|
104
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
103
105
|
setElementList(type);
|
|
104
106
|
}
|
|
105
107
|
}, [editor]);
|
package/src/Snackbar/index.tsx
CHANGED
|
@@ -41,7 +41,9 @@ const Snackbar = forwardRef(
|
|
|
41
41
|
): JSX.Element => {
|
|
42
42
|
const { classes } = useStyles();
|
|
43
43
|
const { closeSnackbar } = useSnackbar();
|
|
44
|
-
const timeoutId = useRef<
|
|
44
|
+
const timeoutId = useRef<ReturnType<typeof setTimeout> | undefined>(
|
|
45
|
+
undefined
|
|
46
|
+
);
|
|
45
47
|
|
|
46
48
|
useEffect((): void => {
|
|
47
49
|
timeoutId.current = setTimeout(() => {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
2
|
|
|
3
3
|
interface Props extends Record<string, unknown> {
|
|
4
|
-
Content: (props) => JSX.Element;
|
|
4
|
+
Content: (props: Record<string, unknown>) => JSX.Element;
|
|
5
5
|
isInDragOverlay?: boolean;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
const Item = forwardRef(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const Item = forwardRef<HTMLDivElement, Props>(({ Content, ...props }, ref) => {
|
|
9
|
+
const ContentComponent = Content as React.ComponentType<
|
|
10
|
+
Record<string, unknown>
|
|
11
|
+
>;
|
|
12
|
+
return <ContentComponent {...props} itemRef={ref} />;
|
|
13
|
+
});
|
|
13
14
|
|
|
14
15
|
export default Item;
|
|
@@ -121,7 +121,9 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
121
121
|
MuiChip: {
|
|
122
122
|
styleOverrides: {
|
|
123
123
|
root: ({ ownerState, theme }) => ({
|
|
124
|
-
backgroundColor: !ownerState.color
|
|
124
|
+
backgroundColor: !ownerState.color
|
|
125
|
+
? theme.palette.divider
|
|
126
|
+
: undefined,
|
|
125
127
|
...(equals(ownerState.size, 'medium') && {
|
|
126
128
|
borderRadius: theme.spacing(1.25),
|
|
127
129
|
fontSize: theme.typography.body2.fontSize,
|
|
@@ -179,7 +181,7 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
179
181
|
MuiInputBase: {
|
|
180
182
|
styleOverrides: {
|
|
181
183
|
root: ({ ownerState, theme }) => ({
|
|
182
|
-
...getInputBaseInputStyle(ownerState),
|
|
184
|
+
...(getInputBaseInputStyle(ownerState) as Record<string, unknown>),
|
|
183
185
|
backgroundColor: theme.palette.background.paper
|
|
184
186
|
})
|
|
185
187
|
}
|
|
@@ -271,7 +273,7 @@ const ThemeProvider = ({ children, overrideTheme }: Props): JSX.Element => {
|
|
|
271
273
|
return createTheme(
|
|
272
274
|
mergeDeepRight(getTheme(themeMode || ThemeMode.light), {
|
|
273
275
|
palette: overrideThemeByMode || {}
|
|
274
|
-
})
|
|
276
|
+
}) as ThemeOptions
|
|
275
277
|
);
|
|
276
278
|
}, [themeMode, overrideTheme]);
|
|
277
279
|
|
|
@@ -3,6 +3,7 @@ import { Typography } from '@mui/material';
|
|
|
3
3
|
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
4
4
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
5
5
|
|
|
6
|
+
import type { Dayjs } from 'dayjs';
|
|
6
7
|
import dayjs from 'dayjs';
|
|
7
8
|
import timezone from 'dayjs/plugin/timezone';
|
|
8
9
|
import utc from 'dayjs/plugin/utc';
|
|
@@ -80,8 +81,8 @@ const PickerDateWithLabel = ({
|
|
|
80
81
|
changeDate={changeDate}
|
|
81
82
|
date={date}
|
|
82
83
|
disabled={disabled}
|
|
83
|
-
maxDate={maxDate}
|
|
84
|
-
minDate={minDate}
|
|
84
|
+
maxDate={maxDate as (Date & Dayjs) | undefined}
|
|
85
|
+
minDate={minDate as (Date & Dayjs) | undefined}
|
|
85
86
|
property={property}
|
|
86
87
|
/>
|
|
87
88
|
</div>
|
|
@@ -27,7 +27,7 @@ export const getNewCustomTimePeriod = ({
|
|
|
27
27
|
.duration(dayjs(end).diff(dayjs(start)))
|
|
28
28
|
.asDays();
|
|
29
29
|
|
|
30
|
-
const timelineEventsLimit = cond<number, number>([
|
|
30
|
+
const timelineEventsLimit = cond<[number], number>([
|
|
31
31
|
[gte(1), always(20)],
|
|
32
32
|
[gte(7), always(100)],
|
|
33
33
|
[T, always(500)]
|
|
@@ -12,7 +12,7 @@ const useSortTimePeriods = (
|
|
|
12
12
|
|
|
13
13
|
const numberOfDays = dayjs.duration(dayjs(end).diff(dayjs(start))).asDays();
|
|
14
14
|
|
|
15
|
-
const timelineEventsLimit = cond<number, number>([
|
|
15
|
+
const timelineEventsLimit = cond<[number], number>([
|
|
16
16
|
[gte(1), always(20)],
|
|
17
17
|
[gte(7), always(100)],
|
|
18
18
|
[T, always(500)]
|
|
@@ -30,7 +30,9 @@ const Subtitle = ({ children, secondaryLabel }: Props): JSX.Element => {
|
|
|
30
30
|
followCursor={false}
|
|
31
31
|
label={
|
|
32
32
|
containsSeveralSecondaryLabels
|
|
33
|
-
? secondaryLabel.map((label) =>
|
|
33
|
+
? (secondaryLabel as Array<string>).map((label) => (
|
|
34
|
+
<p key={label}>{t(label)}</p>
|
|
35
|
+
))
|
|
34
36
|
: t(secondaryLabel)
|
|
35
37
|
}
|
|
36
38
|
placement="right"
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
CardHeader,
|
|
6
6
|
Stack,
|
|
7
7
|
Typography,
|
|
8
|
+
type TypographyVariant,
|
|
8
9
|
useTheme
|
|
9
10
|
} from '@mui/material';
|
|
10
11
|
|
|
@@ -29,7 +30,7 @@ const TypographyStory = (): JSX.Element => {
|
|
|
29
30
|
const { classes } = useStyles();
|
|
30
31
|
const { typography } = useTheme();
|
|
31
32
|
|
|
32
|
-
const variants = [
|
|
33
|
+
const variants: Array<TypographyVariant> = [
|
|
33
34
|
'h1',
|
|
34
35
|
'h2',
|
|
35
36
|
'h3',
|
|
@@ -77,7 +78,7 @@ const TypographyStory = (): JSX.Element => {
|
|
|
77
78
|
{key}
|
|
78
79
|
</Typography>
|
|
79
80
|
<Typography color="text.secondary" variant="body2">
|
|
80
|
-
{value}
|
|
81
|
+
{value as string}
|
|
81
82
|
</Typography>
|
|
82
83
|
</Box>
|
|
83
84
|
))}
|
|
@@ -45,7 +45,7 @@ const ActionsBar = ({
|
|
|
45
45
|
direction="row"
|
|
46
46
|
justifyContent="flex-end"
|
|
47
47
|
>
|
|
48
|
-
<Grid
|
|
48
|
+
<Grid>
|
|
49
49
|
{!isFirstStep && (
|
|
50
50
|
<Button
|
|
51
51
|
aria-label={labelPrevious}
|
|
@@ -56,7 +56,7 @@ const ActionsBar = ({
|
|
|
56
56
|
</Button>
|
|
57
57
|
)}
|
|
58
58
|
</Grid>
|
|
59
|
-
<Grid
|
|
59
|
+
<Grid>
|
|
60
60
|
<Button
|
|
61
61
|
aria-label={labelNextFinish}
|
|
62
62
|
color="primary"
|
|
@@ -110,14 +110,16 @@ const getConditionsSearchQueryParameterValue = (
|
|
|
110
110
|
];
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
return toPairs(
|
|
113
|
+
return (toPairs as (obj: object) => Array<[string, unknown]>)(
|
|
114
|
+
values || {}
|
|
115
|
+
).map(([operator, operatorValue]) => ({
|
|
114
116
|
[listField]: {
|
|
115
117
|
[operator]: operatorValue
|
|
116
118
|
}
|
|
117
119
|
}));
|
|
118
120
|
})
|
|
119
121
|
)
|
|
120
|
-
};
|
|
122
|
+
} as { $or: Array<Record<string, unknown>> };
|
|
121
123
|
};
|
|
122
124
|
|
|
123
125
|
return {
|
|
@@ -35,6 +35,7 @@ interface UseMetricsQueryProps {
|
|
|
35
35
|
timePeriodType: number;
|
|
36
36
|
};
|
|
37
37
|
isEnabled?: boolean;
|
|
38
|
+
enforceIsEnabled?: boolean;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
interface UseMetricsQueryState {
|
|
@@ -101,7 +102,8 @@ const useGraphQuery = ({
|
|
|
101
102
|
refreshCount,
|
|
102
103
|
bypassQueryParams = false,
|
|
103
104
|
prefix,
|
|
104
|
-
isEnabled = true
|
|
105
|
+
isEnabled = true,
|
|
106
|
+
enforceIsEnabled
|
|
105
107
|
}: UseMetricsQueryProps): UseMetricsQueryState => {
|
|
106
108
|
const timePeriodToUse = equals(timePeriod?.timePeriodType, -1)
|
|
107
109
|
? {
|
|
@@ -159,9 +161,10 @@ const useGraphQuery = ({
|
|
|
159
161
|
],
|
|
160
162
|
queryOptions: {
|
|
161
163
|
enabled:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
enforceIsEnabled ??
|
|
165
|
+
(areResourcesFullfilled(resources) &&
|
|
166
|
+
!isEmpty(definedMetrics) &&
|
|
167
|
+
isEnabled),
|
|
165
168
|
refetchInterval: refreshInterval,
|
|
166
169
|
suspense: false
|
|
167
170
|
},
|
|
@@ -183,7 +186,9 @@ const useGraphQuery = ({
|
|
|
183
186
|
: data.current.metrics.filter(({ metric_id }) => {
|
|
184
187
|
return pipe(
|
|
185
188
|
pluck('excludedMetrics'),
|
|
186
|
-
flatten
|
|
189
|
+
flatten as unknown as (
|
|
190
|
+
list: Array<unknown>
|
|
191
|
+
) => ReadonlyArray<number>,
|
|
187
192
|
includes(metric_id),
|
|
188
193
|
not
|
|
189
194
|
)(metrics);
|
|
@@ -273,7 +278,7 @@ const useGraphQuery = ({
|
|
|
273
278
|
base: data.current.base,
|
|
274
279
|
title: ''
|
|
275
280
|
},
|
|
276
|
-
metrics: getFormattedMetrics(),
|
|
281
|
+
metrics: getFormattedMetrics() ?? [],
|
|
277
282
|
times: data.current.times
|
|
278
283
|
}
|
|
279
284
|
: undefined;
|
|
@@ -129,7 +129,7 @@ const useMutationQuery = <T extends object, TMeta>({
|
|
|
129
129
|
const listingQueryKey = getListingQueryKey();
|
|
130
130
|
queryClient.setQueriesData(
|
|
131
131
|
{ queryKey: listingQueryKey },
|
|
132
|
-
context
|
|
132
|
+
(context as { previousListing: unknown })?.previousListing
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -150,7 +150,11 @@ const useMutationQuery = <T extends object, TMeta>({
|
|
|
150
150
|
return { previousListing };
|
|
151
151
|
}
|
|
152
152
|
: onMutate,
|
|
153
|
-
onSettled
|
|
153
|
+
onSettled: onSettled as UseMutationOptions<
|
|
154
|
+
T | ResponseError,
|
|
155
|
+
ResponseError,
|
|
156
|
+
Variables<TMeta, T>
|
|
157
|
+
>['onSettled'],
|
|
154
158
|
onSuccess: (data, variables, context) => {
|
|
155
159
|
if (optimisticListing?.enabled) {
|
|
156
160
|
const isQueryKeyArray = equals(
|
|
@@ -162,20 +166,20 @@ const useMutationQuery = <T extends object, TMeta>({
|
|
|
162
166
|
: [optimisticListing?.queryKey];
|
|
163
167
|
|
|
164
168
|
queryClient.invalidateQueries({
|
|
165
|
-
queryKey: listingQueryKey
|
|
169
|
+
queryKey: listingQueryKey as Array<string>
|
|
166
170
|
});
|
|
167
171
|
}
|
|
168
172
|
|
|
169
|
-
if (data?.isError) {
|
|
173
|
+
if ((data as ResponseError)?.isError) {
|
|
170
174
|
if (optimisticListing?.enabled) {
|
|
171
175
|
const listingQueryKey = getListingQueryKey();
|
|
172
176
|
queryClient.setQueriesData(
|
|
173
177
|
{ queryKey: listingQueryKey },
|
|
174
|
-
context
|
|
178
|
+
(context as { previousListing: unknown })?.previousListing
|
|
175
179
|
);
|
|
176
180
|
}
|
|
177
181
|
|
|
178
|
-
onError?.(data, variables, context);
|
|
182
|
+
onError?.(data as ResponseError, variables, context);
|
|
179
183
|
|
|
180
184
|
return;
|
|
181
185
|
}
|
|
@@ -209,7 +213,7 @@ const useMutationQuery = <T extends object, TMeta>({
|
|
|
209
213
|
...omit(['isError'], queryData),
|
|
210
214
|
isError: (queryData.data as ResponseError | undefined)?.isError || false,
|
|
211
215
|
isMutating: queryData.isPending
|
|
212
|
-
}
|
|
216
|
+
} as unknown as UseMutationQueryState<T, TMeta>;
|
|
213
217
|
};
|
|
214
218
|
|
|
215
219
|
export default useMutationQuery;
|