diff --git a/src/components/filter/expert/ExpertFilterEditionDialog.tsx b/src/components/filter/expert/ExpertFilterEditionDialog.tsx index f7695158..301320fb 100644 --- a/src/components/filter/expert/ExpertFilterEditionDialog.tsx +++ b/src/components/filter/expert/ExpertFilterEditionDialog.tsx @@ -6,17 +6,15 @@ */ import { yupResolver } from '@hookform/resolvers/yup'; -import { UUID } from 'crypto'; import { useCallback, useEffect, useState } from 'react'; import { useForm } from 'react-hook-form'; import { useSnackMessage } from '../../../hooks/useSnackMessage'; import { FetchStatus } from '../../../utils/constants/fetchStatus'; import { FieldConstants } from '../../../utils/constants/fieldConstants'; -import { ElementExistsType } from '../../../utils/types/elementType'; import yup from '../../../utils/yupConfig'; import { CustomMuiDialog } from '../../dialogs/customMuiDialog/CustomMuiDialog'; import { FilterType, NO_ITEM_SELECTION_FOR_COPY } from '../constants/FilterConstants'; -import { ItemSelectionForCopy } from '../filter.type'; +import { FilterProps } from '../filter.type'; import { FilterForm } from '../FilterForm'; import { saveExpertFilter } from '../utils/filterApi'; import { EXPERT_FILTER_QUERY, expertFilterSchema } from './ExpertFilterForm'; @@ -34,21 +32,8 @@ const formSchema = yup }) .required(); -export interface ExpertFilterEditionDialogProps { - id: string; - name: string; - titleId: string; - open: boolean; - onClose: () => void; - broadcastChannel: BroadcastChannel; - itemSelectionForCopy: ItemSelectionForCopy; - setItemSelectionForCopy: (selection: ItemSelectionForCopy) => void; +export interface ExpertFilterEditionDialogProps extends FilterProps { getFilterById: (id: string) => Promise<{ [prop: string]: any }>; - elementUuid: UUID; - activeDirectory?: UUID; - elementExists?: ElementExistsType; - language?: string; - description?: string; } export function ExpertFilterEditionDialog({ diff --git a/src/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.tsx b/src/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.tsx index 988d0a48..85cce83d 100644 --- a/src/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.tsx +++ b/src/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.tsx @@ -6,7 +6,6 @@ */ import { yupResolver } from '@hookform/resolvers/yup'; -import { UUID } from 'crypto'; import PropTypes from 'prop-types'; import { useCallback, useEffect, useState } from 'react'; import { SubmitHandler, useForm, UseFormReturn } from 'react-hook-form'; @@ -19,11 +18,10 @@ import { saveExplicitNamingFilter } from '../utils/filterApi'; import { explicitNamingFilterSchema, FILTER_EQUIPMENTS_ATTRIBUTES } from './ExplicitNamingFilterForm'; import { FetchStatus } from '../../../utils/constants/fetchStatus'; -import { ElementExistsType } from '../../../utils/types/elementType'; import { FilterForm } from '../FilterForm'; import { FilterType, NO_ITEM_SELECTION_FOR_COPY } from '../constants/FilterConstants'; -import { ItemSelectionForCopy } from '../filter.type'; import { MAX_CHAR_DESCRIPTION } from '../../../utils/constants/UIconstants'; +import { FilterProps } from '../filter.type'; const formSchema = yup .object() @@ -37,21 +35,8 @@ const formSchema = yup .required(); type FormSchemaType = yup.InferType; -export interface ExplicitNamingFilterEditionDialogProps { - id: string; - name: string; - titleId: string; - open: boolean; - onClose: () => void; - broadcastChannel: BroadcastChannel; - itemSelectionForCopy: ItemSelectionForCopy; - setItemSelectionForCopy: (selection: ItemSelectionForCopy) => void; +export interface ExplicitNamingFilterEditionDialogProps extends FilterProps { getFilterById: (id: string) => Promise; - elementUuid: UUID; - activeDirectory?: UUID; - elementExists?: ElementExistsType; - language?: string; - description?: string; } export function ExplicitNamingFilterEditionDialog({ diff --git a/src/components/filter/filter.type.ts b/src/components/filter/filter.type.ts index 361dffa7..eb076ccf 100644 --- a/src/components/filter/filter.type.ts +++ b/src/components/filter/filter.type.ts @@ -6,6 +6,7 @@ */ import { UUID } from 'crypto'; +import { ElementExistsType } from '../../utils'; /** * Represent an item/object in directories. @@ -18,3 +19,19 @@ export type ItemSelectionForCopy = { parentDirectoryUuid: UUID | null; specificTypeItem: string | null; }; + +export interface FilterProps { + id: string; + name: string; + titleId: string; + open: boolean; + onClose: () => void; + broadcastChannel: BroadcastChannel; + itemSelectionForCopy: ItemSelectionForCopy; + setItemSelectionForCopy: (selection: ItemSelectionForCopy) => void; + elementUuid: UUID; + activeDirectory?: UUID; + elementExists?: ElementExistsType; + language?: string; + description?: string; +}