Skip to content

Commit

Permalink
Do not require id & description when creating a logstash pipeline (#7…
Browse files Browse the repository at this point in the history
…6616) (#76814)

* do not requie id & desc

* remove id validation, it's not used in logic anyway

* no id in tests

* remove another wrong id usage
  • Loading branch information
mshustov authored Sep 5, 2020
1 parent 77e8ecc commit b6f9df7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ class PipelineEditorUi extends React.Component {

onPipelineSave = () => {
const { pipelineService, toastNotifications, intl } = this.props;
const { id } = this.state.pipeline;
const { id, ...pipelineToStore } = this.state.pipeline;
return pipelineService
.savePipeline({
id,
upstreamJSON: this.state.pipeline,
upstreamJSON: pipelineToStore,
})
.then(() => {
toastNotifications.addSuccess(
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/logstash/server/models/pipeline/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import { i18n } from '@kbn/i18n';

interface PipelineOptions {
id: string;
description: string;
description?: string;
pipeline: string;
username?: string;
settings?: Record<string, any>;
}

interface DownstreamPipeline {
description: string;
description?: string;
pipeline: string;
settings?: Record<string, any>;
}
Expand All @@ -27,7 +27,7 @@ interface DownstreamPipeline {
*/
export class Pipeline {
public readonly id: string;
public readonly description: string;
public readonly description?: string;
public readonly username?: string;
public readonly pipeline: string;
private readonly settings: Record<string, any>;
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/logstash/server/routes/pipeline/save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export function registerPipelineSaveRoute(router: IRouter, security?: SecurityPl
id: schema.string(),
}),
body: schema.object({
id: schema.string(),
description: schema.string(),
description: schema.maybe(schema.string()),
pipeline: schema.string(),
settings: schema.maybe(schema.object({}, { unknowns: 'allow' })),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default function ({ getService }: FtrProviderContext) {
.put('/api/logstash/pipeline/fast_generator')
.set('kbn-xsrf', 'xxx')
.send({
id: 'fast_generator',
description: 'foobar baz',
pipeline: 'input { generator {} }\n\n output { stdout {} }',
})
Expand Down
1 change: 0 additions & 1 deletion x-pack/test/api_integration/apis/logstash/pipeline/save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default function ({ getService }: FtrProviderContext) {
.put('/api/logstash/pipeline/fast_generator')
.set('kbn-xsrf', 'xxx')
.send({
id: 'fast_generator',
description: 'foobar baz',
pipeline: 'input { generator {} }\n\n output { stdout {} }',
})
Expand Down

0 comments on commit b6f9df7

Please sign in to comment.