Skip to content

Commit

Permalink
deduplicate yup
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-WorkGH committed Aug 12, 2024
1 parent e35b633 commit 0140385
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import {
getCriteriaBasedSchema,
PARAM_LANGUAGE,
useSnackMessage,
yup,
} from '@gridsuite/commons-ui';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
import { yupResolver } from '@hookform/resolvers/yup';
import ContingencyListCreationForm from './contingency-list-creation-form';
import { getContingencyListEmptyFormData, getFormContent } from '../contingency-list-utils';
import yup from '../../../utils/yup-config';
import { getExplicitNamingSchema } from '../explicit-naming/explicit-naming-form';
import { ContingencyListType } from '../../../../utils/elementType';
import { useParameterState } from '../../parameters-dialog';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import {
getCriteriaBasedSchema,
PARAM_LANGUAGE,
useSnackMessage,
yup,
} from '@gridsuite/commons-ui';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
import { yupResolver } from '@hookform/resolvers/yup';
import { useEffect, useState } from 'react';
import {
getContingencyListEmptyFormData,
getCriteriaBasedFormDataFromFetchedElement,
} from '../../contingency-list-utils';
import yup from 'components/utils/yup-config';
import CriteriaBasedEditionForm from './criteria-based-edition-form';
import { useDispatch, useSelector } from 'react-redux';
import { noSelectionForCopy } from 'utils/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { CustomMuiDialog, FieldConstants, useSnackMessage } from '@gridsuite/commons-ui';
import { CustomMuiDialog, FieldConstants, useSnackMessage, yup } from '@gridsuite/commons-ui';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
import { yupResolver } from '@hookform/resolvers/yup';
import { useEffect, useState } from 'react';
import {
getContingencyListEmptyFormData,
getExplicitNamingFormDataFromFetchedElement,
} from '../../contingency-list-utils';
import yup from 'components/utils/yup-config';
import { getExplicitNamingEditSchema } from '../../explicit-naming/explicit-naming-form';
import ExplicitNamingEditionForm from './explicit-naming-edition-form';
import { prepareContingencyListForBackend } from 'components/dialogs/contingency-list-helper';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { CustomMuiDialog, FieldConstants, useSnackMessage } from '@gridsuite/commons-ui';
import { CustomMuiDialog, FieldConstants, useSnackMessage, yup } from '@gridsuite/commons-ui';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
import { yupResolver } from '@hookform/resolvers/yup';
import { useEffect, useState } from 'react';
import { getContingencyListEmptyFormData, getScriptFormDataFromFetchedElement } from '../../contingency-list-utils';
import yup from 'components/utils/yup-config';
import ScriptEditionForm from './script-edition-form';
import { useDispatch, useSelector } from 'react-redux';
import { noSelectionForCopy } from 'utils/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@

import { useIntl } from 'react-intl';
import React, { useCallback, useMemo } from 'react';
import yup from '../../../utils/yup-config';
import { makeDefaultRowData } from '../contingency-list-utils';
import ChipsArrayEditor from '../../../utils/rhf-inputs/ag-grid-table-rhf/cell-editors/chips-array-editor';
import { ContingencyListType } from 'utils/elementType';
import { v4 as uuid4 } from 'uuid';
import { FieldConstants, gridItem, CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from '@gridsuite/commons-ui';
import {
CustomAgGridTable,
FieldConstants,
gridItem,
ROW_DRAGGING_SELECTION_COLUMN_DEF,
yup,
} from '@gridsuite/commons-ui';

export const getExplicitNamingSchema = (id) => {
return {
Expand Down
3 changes: 1 addition & 2 deletions src/components/dialogs/copy-to-script-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
*/
import { FunctionComponent, useCallback, useEffect, useState } from 'react';
import { useIntl } from 'react-intl';
import yup from 'components/utils/yup-config';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import { CircularProgress, Grid } from '@mui/material';
import { CustomMuiDialog, ElementType, FieldConstants, UniqueNameInput } from '@gridsuite/commons-ui';
import { CustomMuiDialog, ElementType, FieldConstants, UniqueNameInput, yup } from '@gridsuite/commons-ui';
import { useSelector } from 'react-redux';
import { UUID } from 'crypto';
import { AppState } from '../../redux/reducer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import yup from '../../utils/yup-config';
import { FieldConstants } from '@gridsuite/commons-ui';
import { FieldConstants, yup } from '@gridsuite/commons-ui';

export const getCreateCaseDialogFormValidationDefaultValues = () => ({
[FieldConstants.CASE_NAME]: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Grid } from '@mui/material';
import { addUploadingElement, removeUploadingElement } from '../../../redux/actions';
import UploadNewCase from '../commons/upload-new-case';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
import { yupResolver } from '@hookform/resolvers/yup';
import {
createCaseDialogFormValidationSchema,
getCreateCaseDialogFormValidationDefaultValues,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import yup from '../../utils/yup-config';
import { FieldConstants } from '@gridsuite/commons-ui';
import { FieldConstants, yup } from '@gridsuite/commons-ui';

export const getCreateStudyDialogFormDefaultValues = ({
directory = '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
createStudyDialogFormValidationSchema,
getCreateStudyDialogFormDefaultValues,
} from './create-study-dialog-utils';
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
import { yupResolver } from '@hookform/resolvers/yup';
import PrefilledNameInput from '../commons/prefilled-name-input';
import { handleMaxElementsExceededError } from '../../utils/rest-errors';
import { caseSrv, exploreSrv, networkConversionSrv } from '../../../services';
Expand Down
23 changes: 0 additions & 23 deletions src/components/utils/yup-config.js

This file was deleted.

0 comments on commit 0140385

Please sign in to comment.