From f1deec3e420545a9d2c4175769ae297b24f1f972 Mon Sep 17 00:00:00 2001 From: Christos Nasikas Date: Fri, 28 Jun 2024 13:16:09 +0300 Subject: [PATCH] Fix types --- .../cases/public/components/case_form_fields/tags.test.tsx | 4 ++-- .../cases/public/components/case_form_fields/title.test.tsx | 4 ++-- .../plugins/cases/public/components/create/form_context.tsx | 4 ++-- x-pack/plugins/cases/public/components/create/utils.test.ts | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/cases/public/components/case_form_fields/tags.test.tsx b/x-pack/plugins/cases/public/components/case_form_fields/tags.test.tsx index 4826e6368875e7..78f0cfce49f5f9 100644 --- a/x-pack/plugins/cases/public/components/case_form_fields/tags.test.tsx +++ b/x-pack/plugins/cases/public/components/case_form_fields/tags.test.tsx @@ -13,12 +13,12 @@ import userEvent from '@testing-library/user-event'; import type { FormHook } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import { useForm, Form } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import { Tags } from './tags'; -import type { CreateCaseFormSchema } from '../create/schema'; import { schema } from '../create/schema'; import type { AppMockRenderer } from '../../common/mock'; import { createAppMockRenderer, TestProviders } from '../../common/mock'; import { useGetTags } from '../../containers/use_get_tags'; import { MAX_LENGTH_PER_TAG } from '../../../common/constants'; +import type { CaseFormFieldsSchemaProps } from './schema'; jest.mock('../../common/lib/kibana'); jest.mock('../../containers/use_get_tags'); @@ -30,7 +30,7 @@ describe('Tags', () => { let appMockRender: AppMockRenderer; const MockHookWrapperComponent: FC> = ({ children }) => { - const { form } = useForm({ + const { form } = useForm({ defaultValue: { tags: [] }, schema: { tags: schema.tags, diff --git a/x-pack/plugins/cases/public/components/case_form_fields/title.test.tsx b/x-pack/plugins/cases/public/components/case_form_fields/title.test.tsx index f8232d39a9dc5d..73e6c19f90118f 100644 --- a/x-pack/plugins/cases/public/components/case_form_fields/title.test.tsx +++ b/x-pack/plugins/cases/public/components/case_form_fields/title.test.tsx @@ -13,14 +13,14 @@ import { act } from '@testing-library/react'; import type { FormHook } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import { useForm, Form } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import { Title } from './title'; -import type { CreateCaseFormSchema } from '../create/schema'; import { schema } from '../create/schema'; +import type { CaseFormFieldsSchemaProps } from './schema'; describe('Title', () => { let globalForm: FormHook; const MockHookWrapperComponent: FC> = ({ children }) => { - const { form } = useForm({ + const { form } = useForm({ defaultValue: { title: 'My title' }, schema: { title: schema.title, diff --git a/x-pack/plugins/cases/public/components/create/form_context.tsx b/x-pack/plugins/cases/public/components/create/form_context.tsx index ec668297663a2c..54198f8510e5e1 100644 --- a/x-pack/plugins/cases/public/components/create/form_context.tsx +++ b/x-pack/plugins/cases/public/components/create/form_context.tsx @@ -7,7 +7,6 @@ import React, { useCallback } from 'react'; import { Form, useForm } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; -import type { CreateCaseFormSchema } from './schema'; import { schema } from './schema'; import { usePostCase } from '../../containers/use_post_case'; import { usePostPushToService } from '../../containers/use_post_push_to_service'; @@ -21,6 +20,7 @@ import { useGetSupportedActionConnectors } from '../../containers/configure/use_ import { useCreateCaseWithAttachmentsTransaction } from '../../common/apm/use_cases_transactions'; import { useApplication } from '../../common/lib/kibana/use_application'; import { createFormSerializer, createFormDeserializer, getInitialCaseValue } from './utils'; +import type { CaseFormFieldsSchemaProps } from '../case_form_fields/schema'; interface Props { afterCaseCreated?: ( @@ -113,7 +113,7 @@ export const FormContext: React.FC = ({ options: { stripEmptyFields: false }, schema, onSubmit: submitCase, - serializer: (data: CreateCaseFormSchema) => + serializer: (data: CaseFormFieldsSchemaProps) => createFormSerializer( connectors, { diff --git a/x-pack/plugins/cases/public/components/create/utils.test.ts b/x-pack/plugins/cases/public/components/create/utils.test.ts index 932fc1e481c29b..6b8c9c9017fc4c 100644 --- a/x-pack/plugins/cases/public/components/create/utils.test.ts +++ b/x-pack/plugins/cases/public/components/create/utils.test.ts @@ -148,6 +148,7 @@ describe('utils', () => { connectorId: '', fields: { incidentTypes: null, severityCode: null }, customFields: {}, + syncAlerts: false, }; const serializedFormData = { title: 'title',