diff --git a/demo/src/equipment-search.tsx b/demo/src/equipment-search.tsx
index 771ce301..76f1d1db 100644
--- a/demo/src/equipment-search.tsx
+++ b/demo/src/equipment-search.tsx
@@ -8,7 +8,14 @@ import { useState } from 'react';
import { Button, TextField } from '@mui/material';
import { Search } from '@mui/icons-material';
import { useIntl } from 'react-intl';
-import { ElementSearchDialog, EquipmentItem, equipmentStyles, EquipmentType, useElementSearch } from '../../src/index';
+import {
+ ElementSearchDialog,
+ EquipmentItem,
+ EquipmentItemProps,
+ equipmentStyles,
+ EquipmentType,
+ useElementSearch,
+} from '../../src/index';
interface AnyElementInterface {
id: string;
@@ -56,11 +63,11 @@ export function EquipmentSearchDialog() {
open={isSearchOpen}
onClose={() => setIsSearchOpen(false)}
onSearchTermChange={updateSearchTerm}
- onSelectionChange={(element: any) => {
+ onSelectionChange={(element: unknown) => {
console.log(element);
}}
elementsFound={elementsFound}
- renderElement={(props: any) => (
+ renderElement={(props: EquipmentItemProps) => (
)}
searchTerm={searchTerm}
diff --git a/demo/src/inline-search.tsx b/demo/src/inline-search.tsx
index f59bffcf..791ed043 100644
--- a/demo/src/inline-search.tsx
+++ b/demo/src/inline-search.tsx
@@ -8,7 +8,7 @@ import { useState } from 'react';
import { TextField } from '@mui/material';
import { Search } from '@mui/icons-material';
import { useIntl } from 'react-intl';
-import { ElementSearchInput, EquipmentItem, EquipmentType, equipmentStyles } from '../../src';
+import { ElementSearchInput, EquipmentItem, EquipmentItemProps, EquipmentType, equipmentStyles } from '../../src';
export function InlineSearch() {
const [searchTerm, setSearchTerm] = useState('');
@@ -25,7 +25,7 @@ export function InlineSearch() {
return (
{
+ onSelectionChange={(element: unknown) => {
console.log(element);
}}
elementsFound={
@@ -46,7 +46,7 @@ export function InlineSearch() {
]
: []
}
- renderElement={(props: any) => (
+ renderElement={(props: EquipmentItemProps) => (
)}
searchTerm={searchTerm}
diff --git a/src/components/checkBoxList/DraggableClickableCheckBoxItem.tsx b/src/components/checkBoxList/DraggableClickableCheckBoxItem.tsx
index 832a33fa..151403a0 100644
--- a/src/components/checkBoxList/DraggableClickableCheckBoxItem.tsx
+++ b/src/components/checkBoxList/DraggableClickableCheckBoxItem.tsx
@@ -6,12 +6,12 @@
*/
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
-import { Checkbox, IconButton, ListItemIcon, ListItemText } from '@mui/material';
+import { Checkbox, IconButton, ListItemIcon, ListItemText, Theme } from '@mui/material';
import { OverflowableText } from '../overflowableText';
import { DraggableClickableCheckBoxItemProps } from './checkBoxList.type';
const styles = {
- dragIcon: (theme: any) => ({
+ dragIcon: (theme: Theme) => ({
padding: 'unset',
border: theme.spacing(0),
borderRadius: theme.spacing(0),
diff --git a/src/components/checkBoxList/DraggableClickableRowItem.tsx b/src/components/checkBoxList/DraggableClickableRowItem.tsx
index 53ed1811..58dc7e3b 100644
--- a/src/components/checkBoxList/DraggableClickableRowItem.tsx
+++ b/src/components/checkBoxList/DraggableClickableRowItem.tsx
@@ -6,12 +6,13 @@
*/
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
-import { Checkbox, IconButton, ListItemButton, ListItemIcon, ListItemText } from '@mui/material';
+import { Checkbox, IconButton, ListItemButton, ListItemIcon, ListItemText, SxProps, Theme } from '@mui/material';
import { OverflowableText } from '../overflowableText';
import { DraggableClickableRowItemProps } from './checkBoxList.type';
+import { mergeSx } from '../../utils';
-const styles = {
- dragIcon: (theme: any) => ({
+const styles: Record> = {
+ dragIcon: (theme) => ({
padding: 'unset',
border: theme.spacing(0),
borderRadius: theme.spacing(0),
@@ -45,11 +46,7 @@ export function DraggableClickableRowItem({
return (
diff --git a/src/components/dialogs/customMuiDialog/CustomMuiDialog.tsx b/src/components/dialogs/customMuiDialog/CustomMuiDialog.tsx
index c077b667..7ede15d6 100644
--- a/src/components/dialogs/customMuiDialog/CustomMuiDialog.tsx
+++ b/src/components/dialogs/customMuiDialog/CustomMuiDialog.tsx
@@ -6,7 +6,7 @@
*/
import React, { useCallback, useState } from 'react';
-import { FieldErrors, UseFormReturn } from 'react-hook-form';
+import { FieldErrors, FieldValues, SubmitHandler, UseFormReturn } from 'react-hook-form';
import { FormattedMessage } from 'react-intl';
import { Dialog, DialogActions, DialogContent, DialogTitle, Grid, LinearProgress } from '@mui/material';
import * as yup from 'yup';
@@ -15,12 +15,12 @@ import { CancelButton } from '../../inputs/reactHookForm/utils/CancelButton';
import { CustomFormProvider, MergedFormContextProps } from '../../inputs/reactHookForm/provider/CustomFormProvider';
import { PopupConfirmationDialog } from '../popupConfirmationDialog/PopupConfirmationDialog';
-export interface CustomMuiDialogProps {
+export interface CustomMuiDialogProps {
open: boolean;
formSchema: yup.AnySchema;
- formMethods: UseFormReturn | MergedFormContextProps;
- onClose: (event: React.MouseEvent) => void;
- onSave: (data: any) => void;
+ formMethods: UseFormReturn | MergedFormContextProps;
+ onClose: (event?: React.MouseEvent) => void;
+ onSave: SubmitHandler;
onValidationError?: (errors: FieldErrors) => void;
titleId: string;
disabledSave?: boolean;
@@ -76,7 +76,7 @@ export const unscrollableDialogStyles = {
},
};
-export function CustomMuiDialog({
+export function CustomMuiDialog({
open,
formSchema,
formMethods,
@@ -92,9 +92,9 @@ export function CustomMuiDialog({
language,
confirmationMessageKey,
unscrollableFullHeight = false,
-}: Readonly) {
+}: Readonly>) {
const [openConfirmationPopup, setOpenConfirmationPopup] = useState(false);
- const [validatedData, setValidatedData] = useState(undefined);
+ const [validatedData, setValidatedData] = useState();
const { handleSubmit } = formMethods;
const handleCancel = useCallback(
@@ -113,15 +113,15 @@ export function CustomMuiDialog({
};
const validate = useCallback(
- (data: any) => {
+ (data: T) => {
onSave(data);
- onClose(data);
+ onClose();
},
[onClose, onSave]
);
const handleValidate = useCallback(
- (data: any) => {
+ (data: T) => {
if (confirmationMessageKey) {
setValidatedData(data);
setOpenConfirmationPopup(true);
@@ -134,7 +134,9 @@ export function CustomMuiDialog({
const handlePopupConfirmation = useCallback(() => {
setOpenConfirmationPopup(false);
- validate(validatedData);
+ if (validatedData) {
+ validate(validatedData);
+ }
}, [validate, validatedData]);
const handleValidationError = (errors: FieldErrors) => {
diff --git a/src/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.tsx b/src/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.tsx
index 2d6d4e20..37663851 100644
--- a/src/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.tsx
+++ b/src/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.tsx
@@ -6,7 +6,7 @@
*/
import { useCallback } from 'react';
-import { useForm } from 'react-hook-form';
+import { SubmitHandler, useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import { Box } from '@mui/material';
import yup from '../../../utils/yupConfig';
@@ -26,6 +26,7 @@ export interface DescriptionModificationDialogProps {
const schema = yup.object().shape({
[FieldConstants.DESCRIPTION]: yup.string().max(500, 'descriptionLimitError'),
});
+type SchemaType = yup.InferType;
export function DescriptionModificationDialog({
elementUuid,
@@ -54,15 +55,17 @@ export function DescriptionModificationDialog({
onClose();
};
- const onSubmit = useCallback(
- (data: { description: string }) => {
+ const onSubmit = useCallback>(
+ (data) => {
updateElement(elementUuid, {
- [FieldConstants.DESCRIPTION]: data[FieldConstants.DESCRIPTION].trim(),
- }).catch((error: any) => {
- snackError({
- messageTxt: error.message,
- headerId: 'descriptionModificationError',
- });
+ [FieldConstants.DESCRIPTION]: data[FieldConstants.DESCRIPTION]?.trim() ?? '',
+ }).catch((error: unknown) => {
+ if (error instanceof Object && 'message' in error && typeof error.message === 'string') {
+ snackError({
+ messageTxt: error.message,
+ headerId: 'descriptionModificationError',
+ });
+ }
});
},
[elementUuid, updateElement, snackError]
diff --git a/src/components/dialogs/modifyElementSelection/ModifyElementSelection.tsx b/src/components/dialogs/modifyElementSelection/ModifyElementSelection.tsx
index 91bed9b1..57ac64be 100644
--- a/src/components/dialogs/modifyElementSelection/ModifyElementSelection.tsx
+++ b/src/components/dialogs/modifyElementSelection/ModifyElementSelection.tsx
@@ -15,6 +15,7 @@ import { FieldConstants } from '../../../utils/constants/fieldConstants';
import { DirectoryItemSelector } from '../../directoryItemSelector/DirectoryItemSelector';
import { ElementType } from '../../../utils/types/elementType';
import { fetchDirectoryElementPath } from '../../../services';
+import { ElementAttributes } from '../../../utils';
export interface ModifyElementSelectionProps {
elementType: ElementType;
@@ -46,8 +47,8 @@ export function ModifyElementSelection(props: ModifyElementSelectionProps) {
useEffect(() => {
if (directory) {
- fetchDirectoryElementPath(directory).then((res: any) => {
- setActiveDirectoryName(res.map((element: any) => element.elementName.trim()).join('/'));
+ fetchDirectoryElementPath(directory).then((res: ElementAttributes[]) => {
+ setActiveDirectoryName(res.map((element: ElementAttributes) => element.elementName.trim()).join('/'));
});
}
}, [directory]);
diff --git a/src/components/directoryItemSelector/DirectoryItemSelector.tsx b/src/components/directoryItemSelector/DirectoryItemSelector.tsx
index edcf8343..0b55d74f 100644
--- a/src/components/directoryItemSelector/DirectoryItemSelector.tsx
+++ b/src/components/directoryItemSelector/DirectoryItemSelector.tsx
@@ -13,6 +13,7 @@ import { ElementType } from '../../utils/types/elementType';
import { TreeViewFinder, TreeViewFinderNodeProps, TreeViewFinderProps } from '../treeViewFinder/TreeViewFinder';
import { useSnackMessage } from '../../hooks/useSnackMessage';
import { fetchDirectoryContent, fetchElementsInfos, fetchRootFolders } from '../../services';
+import { ElementAttributes } from '../../utils';
const styles = {
icon: (theme: Theme) => ({
@@ -22,35 +23,49 @@ const styles = {
}),
};
-function sameRights(a: any, b: any) {
- if (!a && !b) {
+// TODO: check avec Kevin / Sylvain
+type ElementAttributesBase = {
+ elementUuid: ElementAttributes['elementUuid'] | null;
+ subdirectoriesCount: ElementAttributes['subdirectoriesCount'];
+ parentUuid: ElementAttributes['parentUuid'];
+ children: ElementAttributes['children'];
+};
+
+function sameRights(
+ sourceAccessRights: ElementAttributes['accessRights'],
+ accessRightsToCompare: ElementAttributes['accessRights']
+) {
+ if (!sourceAccessRights && !accessRightsToCompare) {
return true;
}
- if (!a || !b) {
+ if (!sourceAccessRights || !accessRightsToCompare) {
return false;
}
- return a.isPrivate === b.isPrivate;
+ return sourceAccessRights.isPrivate === accessRightsToCompare.isPrivate;
}
-function flattenDownNodes(n: any, cef: (n: any) => any[]): any[] {
+function flattenDownNodes(n: T, cef: (n: T) => T[]): T[] {
const subs = cef(n);
if (subs.length === 0) {
return [n];
}
- return Array.prototype.concat([n], ...subs.map((sn: any) => flattenDownNodes(sn, cef)));
+ return Array.prototype.concat([n], ...subs.map((sn) => flattenDownNodes(sn, cef)));
}
-function refreshedUpNodes(m: any[], nn: any): any[] {
- if (!nn?.elementUuid) {
+function refreshedUpNodes(
+ nodeMap: Record,
+ newElement: ElementAttributesBase
+): ElementAttributesBase[] {
+ if (!newElement?.elementUuid) {
return [];
}
- if (nn.parentUuid === null) {
- return [nn];
+ if (newElement.parentUuid === null) {
+ return [newElement];
}
- const parent = m[nn.parentUuid];
- const nextChildren = parent.children.map((c: any) => (c.elementUuid === nn.elementUuid ? nn : c));
+ const parent = nodeMap[newElement.parentUuid];
+ const nextChildren = parent.children.map((c) => (c.elementUuid === newElement.elementUuid ? newElement : c));
const nextParent = { ...parent, children: nextChildren };
- return [nn, ...refreshedUpNodes(m, nextParent)];
+ return [newElement, ...refreshedUpNodes(nodeMap, nextParent)];
}
/**
@@ -60,10 +75,15 @@ function refreshedUpNodes(m: any[], nn: any): any[] {
* @param nodeId uuid of the node to update children, may be null or undefined (means root)
* @param children new value of the node children (shallow nodes)
*/
-function updatedTree(prevRoots: any[], prevMap: any, nodeId: UUID | null, children: any[]) {
+function updatedTree(
+ prevRoots: ElementAttributes[],
+ prevMap: Record,
+ nodeId: UUID | null,
+ children: ElementAttributes[]
+) {
const nextChildren = children
.sort((a, b) => a.elementName.localeCompare(b.elementName))
- .map((n: any) => {
+ .map((n) => {
const pn = prevMap[n.elementUuid];
if (!pn) {
return { ...n, children: [], parentUuid: nodeId };
@@ -89,15 +109,12 @@ function updatedTree(prevRoots: any[], prevMap: any, nodeId: UUID | null, childr
});
const prevChildren = nodeId ? prevMap[nodeId]?.children : prevRoots;
- if (
- prevChildren?.length === nextChildren.length &&
- prevChildren.every((e: any, i: number) => e === nextChildren[i])
- ) {
+ if (prevChildren?.length === nextChildren.length && prevChildren.every((e, i) => e === nextChildren[i])) {
return [prevRoots, prevMap];
}
const nextUuids = new Set(children ? children.map((n) => n.elementUuid) : []);
- const prevUuids = prevChildren ? prevChildren.map((n: any) => n.elementUuid) : [];
+ const prevUuids = prevChildren ? prevChildren.map((n) => n.elementUuid) : [];
const mayNodeId = nodeId ? [nodeId] : [];
const nonCopyUuids = new Set([
@@ -117,7 +134,7 @@ function updatedTree(prevRoots: any[], prevMap: any, nodeId: UUID | null, childr
...prevNode,
children: nextChildren,
subdirectoriesCount: nextChildren.length,
- };
+ } satisfies ElementAttributesBase;
const nextMap = Object.fromEntries([
...Object.entries(prevMap).filter(([k]) => !nonCopyUuids.has(k)),
@@ -169,12 +186,12 @@ export function DirectoryItemSelector({
...otherTreeViewFinderProps
}: Readonly) {
const [data, setData] = useState([]);
- const [rootDirectories, setRootDirectories] = useState([]);
- const nodeMap = useRef({});
- const dataRef = useRef([]);
+ const [rootDirectories, setRootDirectories] = useState([]);
+ const nodeMap = useRef>({});
+ const dataRef = useRef([]);
dataRef.current = data;
- const rootsRef = useRef([]);
+ const rootsRef = useRef([]);
rootsRef.current = rootDirectories;
const { snackError } = useSnackMessage();
const contentFilter = useCallback(() => new Set([ElementType.DIRECTORY, ...types]), [types]);
@@ -193,7 +210,7 @@ export function DirectoryItemSelector({
}, []);
const convertRoots = useCallback(
- (newRoots: any[]): any[] => {
+ (newRoots: ElementAttributes[]) => {
return newRoots.map((e) => {
return {
id: e.elementUuid,
@@ -211,7 +228,7 @@ export function DirectoryItemSelector({
);
const addToDirectory = useCallback(
- (nodeId: UUID, content: any[]) => {
+ (nodeId: UUID, content: ElementAttributes[]) => {
const [nrs, mdr] = updatedTree(rootsRef.current, nodeMap.current, nodeId, content);
setRootDirectories(nrs);
nodeMap.current = mdr;
diff --git a/src/components/filter/FilterCreationDialog.tsx b/src/components/filter/FilterCreationDialog.tsx
index a4811708..77e8c88c 100644
--- a/src/components/filter/FilterCreationDialog.tsx
+++ b/src/components/filter/FilterCreationDialog.tsx
@@ -6,7 +6,7 @@
*/
import { useCallback } from 'react';
-import { Resolver, useForm } from 'react-hook-form';
+import { FieldValues, Resolver, useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import { UUID } from 'crypto';
import { saveCriteriaBasedFilter, saveExpertFilter, saveExplicitNamingFilter } from './utils/filterApi';
@@ -84,7 +84,7 @@ export function FilterCreationDialog({
const isValidating = errors.root?.isValidating;
const onSubmit = useCallback(
- (filterForm: any) => {
+ (filterForm: FieldValues) => {
if (filterForm[FieldConstants.FILTER_TYPE] === FilterType.EXPLICIT_NAMING.id) {
saveExplicitNamingFilter(
filterForm[FILTER_EQUIPMENTS_ATTRIBUTES],
@@ -93,7 +93,7 @@ export function FilterCreationDialog({
filterForm[FieldConstants.NAME],
filterForm[FieldConstants.DESCRIPTION],
null,
- (error: any) => {
+ (error?: string) => {
snackError({
messageTxt: error,
});
@@ -102,7 +102,7 @@ export function FilterCreationDialog({
activeDirectory
);
} else if (filterForm[FieldConstants.FILTER_TYPE] === FilterType.CRITERIA_BASED.id) {
- saveCriteriaBasedFilter(filterForm, activeDirectory, onClose, (error: any) => {
+ saveCriteriaBasedFilter(filterForm, activeDirectory, onClose, (error?: string) => {
snackError({
messageTxt: error,
});
@@ -117,7 +117,7 @@ export function FilterCreationDialog({
true,
activeDirectory,
onClose,
- (error: any) => {
+ (error?: string) => {
snackError({
messageTxt: error,
});
diff --git a/src/components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.tsx b/src/components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.tsx
index fe4f7a91..dc9e2ce1 100644
--- a/src/components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.tsx
+++ b/src/components/filter/criteriaBased/CriteriaBasedFilterEditionDialog.tsx
@@ -8,7 +8,7 @@
import { yupResolver } from '@hookform/resolvers/yup';
import { UUID } from 'crypto';
import { useCallback, useEffect, useState } from 'react';
-import { useForm } from 'react-hook-form';
+import { FieldError, useForm } from 'react-hook-form';
import { useSnackMessage } from '../../../hooks/useSnackMessage';
import { saveFilter } from '../../../services/explore';
import { FetchStatus } from '../../../utils/constants/fetchStatus';
@@ -32,6 +32,7 @@ const formSchema = yup
})
.required();
+type FormSchemaType = yup.InferType;
export interface CriteriaBasedFilterEditionDialogProps {
id: string;
name: string;
@@ -74,7 +75,7 @@ export function CriteriaBasedFilterEditionDialog({
formState: { errors },
} = formMethods;
- const nameError: any = errors[FieldConstants.NAME];
+ const nameError: FieldError | undefined = errors[FieldConstants.NAME];
const isValidating = errors.root?.isValidating;
// Fetch the filter data from back-end if necessary and fill the form with it
@@ -90,7 +91,7 @@ export function CriteriaBasedFilterEditionDialog({
...backToFrontTweak(response),
});
})
- .catch((error: any) => {
+ .catch((error: { message?: string }) => {
setDataFetchStatus(FetchStatus.FETCH_ERROR);
snackError({
messageTxt: error.message,
@@ -101,7 +102,7 @@ export function CriteriaBasedFilterEditionDialog({
}, [id, name, open, reset, snackError, getFilterById]);
const onSubmit = useCallback(
- (filterForm: any) => {
+ (filterForm: FormSchemaType) => {
saveFilter(frontToBackTweak(id, filterForm), filterForm[FieldConstants.NAME])
.then(() => {
if (selectionForCopy.sourceItemUuid === id) {
diff --git a/src/components/filter/criteriaBased/criteriaBasedFilterUtils.ts b/src/components/filter/criteriaBased/criteriaBasedFilterUtils.ts
index c5b48b2d..a74b6ccd 100644
--- a/src/components/filter/criteriaBased/criteriaBasedFilterUtils.ts
+++ b/src/components/filter/criteriaBased/criteriaBasedFilterUtils.ts
@@ -17,7 +17,7 @@ import {
} from '../../inputs/reactHookForm/numbers/RangeInput';
import { FreePropertiesTypes } from './FilterFreeProperties';
-export const getCriteriaBasedSchema = (extraFields: any) => ({
+export const getCriteriaBasedSchema = (extraFields: Record) => ({
[FieldConstants.CRITERIA_BASED]: yup.object().shape({
[FieldConstants.COUNTRIES]: yup.array().of(yup.string()),
[FieldConstants.COUNTRIES_1]: yup.array().of(yup.string()),
@@ -29,7 +29,7 @@ export const getCriteriaBasedSchema = (extraFields: any) => ({
...extraFields,
}),
});
-export const getCriteriaBasedFormData = (criteriaValues: any, extraFields: any) => ({
+export const getCriteriaBasedFormData = (criteriaValues: any, extraFields: Record) => ({
[FieldConstants.CRITERIA_BASED]: {
[FieldConstants.COUNTRIES]: criteriaValues?.[FieldConstants.COUNTRIES] ?? [],
[FieldConstants.COUNTRIES_1]: criteriaValues?.[FieldConstants.COUNTRIES_1] ?? [],
diff --git a/src/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.tsx b/src/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.tsx
index 60eea448..59410420 100644
--- a/src/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.tsx
+++ b/src/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.tsx
@@ -9,7 +9,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
import { UUID } from 'crypto';
import PropTypes from 'prop-types';
import { useCallback, useEffect, useState } from 'react';
-import { useForm } from 'react-hook-form';
+import { SubmitHandler, useForm, UseFormReturn } from 'react-hook-form';
import { v4 as uuid4 } from 'uuid';
import { useSnackMessage } from '../../../hooks/useSnackMessage';
import { FieldConstants } from '../../../utils/constants/fieldConstants';
@@ -34,6 +34,7 @@ const formSchema = yup
})
.required();
+type FormSchemaType = yup.InferType;
export interface ExplicitNamingFilterEditionDialogProps {
id: string;
name: string;
@@ -67,7 +68,7 @@ export function ExplicitNamingFilterEditionDialog({
const [dataFetchStatus, setDataFetchStatus] = useState(FetchStatus.IDLE);
// default values are set via reset when we fetch data
- const formMethods = useForm({
+ const formMethods: UseFormReturn = useForm({
resolver: yupResolver(formSchema),
});
@@ -105,10 +106,10 @@ export function ExplicitNamingFilterEditionDialog({
}
}, [id, name, open, reset, snackError, getFilterById]);
- const onSubmit = useCallback(
- (filterForm: any) => {
+ const onSubmit = useCallback>(
+ (filterForm) => {
saveExplicitNamingFilter(
- filterForm[FILTER_EQUIPMENTS_ATTRIBUTES],
+ filterForm[FILTER_EQUIPMENTS_ATTRIBUTES] ?? [],
false,
filterForm[FieldConstants.EQUIPMENT_TYPE],
filterForm[FieldConstants.NAME],
diff --git a/src/components/filter/utils/filterApi.ts b/src/components/filter/utils/filterApi.ts
index 318ff3af..54411e7f 100644
--- a/src/components/filter/utils/filterApi.ts
+++ b/src/components/filter/utils/filterApi.ts
@@ -20,7 +20,7 @@ export const saveExplicitNamingFilter = (
name: string,
description: string,
id: string | null,
- setCreateFilterErr: (value: any) => void,
+ setCreateFilterErr: (value?: string) => void,
handleClose: () => void,
activeDirectory?: UUID,
token?: string
diff --git a/src/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.tsx b/src/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.tsx
index 173b0fb3..094fcd30 100644
--- a/src/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.tsx
+++ b/src/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.tsx
@@ -111,6 +111,7 @@ export function CustomAgGridTable({
stopEditingWhenCellsLoseFocus,
...props
}: CustomAgGridTableProps) {
+ // FIXME: right type => Theme --> not defined there ( gridStudy and gridExplore definition not the same )
const theme: any = useTheme();
const [gridApi, setGridApi] = useState(null);
const [selectedRows, setSelectedRows] = useState([]);