From 10b9210e968b6c0bee81f0312dc025fc6ed3ca2b Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Fri, 10 Apr 2020 13:55:46 -0400 Subject: [PATCH] fix todos --- .../components/pipeline_form/pipeline_form.tsx | 8 ++++---- .../sections/pipelines_create/pipelines_create.tsx | 4 ++-- x-pack/plugins/ingest_pipelines/public/shared_imports.ts | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form.tsx index 6335e34e460af..1ee6665773a2e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form.tsx @@ -24,7 +24,7 @@ import { SectionError } from '../section_error'; import { pipelineFormSchema } from './schema'; interface Props { - onSave: (pipeline: any) => void; // todo fix TS + onSave: (pipeline: Pipeline) => void; isSaving: boolean; saveError: any; defaultValue?: Pipeline; @@ -50,16 +50,16 @@ export const PipelineForm: React.FunctionComponent = ({ const [isVersionVisible, setIsVersionVisible] = useState(false); const [isOnFailureEditorVisible, setIsOnFailureEditorVisible] = useState(false); - const setDataAndValidation: FormConfig['onSubmit'] = (formData, isValid) => { + const handleSave: FormConfig['onSubmit'] = (formData, isValid) => { if (isValid) { - onSave(formData); + onSave(formData as Pipeline); } }; const { form } = useForm({ schema: pipelineFormSchema, defaultValue, - onSubmit: setDataAndValidation, + onSubmit: handleSave, }); return ( diff --git a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_create/pipelines_create.tsx b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_create/pipelines_create.tsx index 182511360c5fc..5571bebfbac74 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_create/pipelines_create.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_create/pipelines_create.tsx @@ -9,6 +9,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiPageBody, EuiPageContent, EuiSpacer, EuiTitle } from '@elastic/eui'; import { BASE_PATH } from '../../../../common/constants'; +import { Pipeline } from '../../../../common/types'; import { useKibana } from '../../../shared_imports'; import { PipelineForm } from '../../components'; @@ -18,8 +19,7 @@ export const PipelinesCreate: React.FunctionComponent = ({ const [isSaving, setIsSaving] = useState(false); const [saveError, setSaveError] = useState(null); - const onSave = async (pipeline: any) => { - // TODO fix TS + const onSave = async (pipeline: Pipeline) => { setIsSaving(true); setSaveError(null); diff --git a/x-pack/plugins/ingest_pipelines/public/shared_imports.ts b/x-pack/plugins/ingest_pipelines/public/shared_imports.ts index e57e16dd87e72..3067d06174ba7 100644 --- a/x-pack/plugins/ingest_pipelines/public/shared_imports.ts +++ b/x-pack/plugins/ingest_pipelines/public/shared_imports.ts @@ -24,6 +24,7 @@ export { Form, getUseField, ValidationFuncArg, + FormData, } from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export {