Skip to content

Commit

Permalink
fix todos
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Apr 10, 2020
1 parent 4af7814 commit 10b9210
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -50,16 +50,16 @@ export const PipelineForm: React.FunctionComponent<Props> = ({
const [isVersionVisible, setIsVersionVisible] = useState<boolean>(false);
const [isOnFailureEditorVisible, setIsOnFailureEditorVisible] = useState<boolean>(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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -18,8 +19,7 @@ export const PipelinesCreate: React.FunctionComponent<RouteComponentProps> = ({
const [isSaving, setIsSaving] = useState<boolean>(false);
const [saveError, setSaveError] = useState<any>(null);

const onSave = async (pipeline: any) => {
// TODO fix TS
const onSave = async (pipeline: Pipeline) => {
setIsSaving(true);
setSaveError(null);

Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/ingest_pipelines/public/shared_imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export {
Form,
getUseField,
ValidationFuncArg,
FormData,
} from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib';

export {
Expand Down

0 comments on commit 10b9210

Please sign in to comment.