From 6bba3dacf16071f2ce0ac5519bfc2a38e684704f Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Mon, 13 Apr 2020 10:43:01 -0400 Subject: [PATCH] address review feedback --- .../components/pipeline_form/pipeline_form.tsx | 2 +- .../application/components/pipeline_form/schema.tsx | 8 ++++---- .../sections/pipelines_create/pipelines_create.tsx | 2 +- .../ingest_pipelines/public/application/services/api.ts | 2 +- .../plugins/ingest_pipelines/server/routes/api/create.ts | 2 +- .../apis/management/ingest_pipelines/ingest_pipelines.ts | 4 ++-- 6 files changed, 10 insertions(+), 10 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 1ee6665773a2e..855612c1582e3 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 @@ -204,7 +204,7 @@ export const PipelineForm: React.FunctionComponent = ({ <> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/schema.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/schema.tsx index 47db507c0bf37..247922d2378dc 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/schema.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/schema.tsx @@ -74,8 +74,8 @@ export const pipelineFormSchema: FormSchema = { label: i18n.translate('xpack.ingestPipelines.form.processorsFieldLabel', { defaultMessage: 'Processors', }), - serializer: processors => parseJson(processors), - deserializer: processors => stringifyJson(processors), + serializer: parseJson, + deserializer: stringifyJson, validations: [ { validator: emptyField( @@ -97,8 +97,8 @@ export const pipelineFormSchema: FormSchema = { label: i18n.translate('xpack.ingestPipelines.form.onFailureFieldLabel', { defaultMessage: 'On-failure processors (optional)', }), - serializer: onFailureProcessors => parseJson(onFailureProcessors), - deserializer: onFailureProcessors => stringifyJson(onFailureProcessors), + serializer: parseJson, + deserializer: stringifyJson, validations: [ { validator: ({ value }: ValidationFuncArg) => { 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 5571bebfbac74..6589d57994dbe 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 @@ -46,7 +46,7 @@ export const PipelinesCreate: React.FunctionComponent = ({

diff --git a/x-pack/plugins/ingest_pipelines/public/application/services/api.ts b/x-pack/plugins/ingest_pipelines/public/application/services/api.ts index 4af86a38bb523..92673109b037e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/services/api.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/services/api.ts @@ -57,7 +57,7 @@ export class ApiService { public async createPipeline(pipeline: Pipeline) { const result = await this.sendRequest({ path: API_BASE_PATH, - method: 'put', + method: 'post', body: JSON.stringify(pipeline), }); diff --git a/x-pack/plugins/ingest_pipelines/server/routes/api/create.ts b/x-pack/plugins/ingest_pipelines/server/routes/api/create.ts index 013681fa2f4b7..cad29a2fe555d 100644 --- a/x-pack/plugins/ingest_pipelines/server/routes/api/create.ts +++ b/x-pack/plugins/ingest_pipelines/server/routes/api/create.ts @@ -23,7 +23,7 @@ export const registerCreateRoute = ({ license, lib: { isEsError }, }: RouteDependencies): void => { - router.put( + router.post( { path: API_BASE_PATH, validate: { diff --git a/x-pack/test/api_integration/apis/management/ingest_pipelines/ingest_pipelines.ts b/x-pack/test/api_integration/apis/management/ingest_pipelines/ingest_pipelines.ts index 2b2a64302d839..7c5a97f715869 100644 --- a/x-pack/test/api_integration/apis/management/ingest_pipelines/ingest_pipelines.ts +++ b/x-pack/test/api_integration/apis/management/ingest_pipelines/ingest_pipelines.ts @@ -23,7 +23,7 @@ export default function({ getService }: FtrProviderContext) { it('should create a pipeline', async () => { const { body } = await supertest - .put(API_BASE_PATH) + .post(API_BASE_PATH) .set('kbn-xsrf', 'xxx') .send({ name: PIPELINE_ID, @@ -54,7 +54,7 @@ export default function({ getService }: FtrProviderContext) { it('should not allow creation of an existing pipeline', async () => { const { body } = await supertest - .put(API_BASE_PATH) + .post(API_BASE_PATH) .set('kbn-xsrf', 'xxx') .send({ name: PIPELINE_ID,