Do not require id & description when creating a logstash pipeline (#76616)

* do not requie id & desc

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

* no id in tests

* remove another wrong id usage
This commit is contained in:
Mikhail Shustov 2020-09-04 21:28:59 +03:00 committed by GitHub
parent b3a85c546d
commit db67eb0b29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 9 deletions

View file

@ -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(

View file

@ -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>;
}
@ -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>;

View file

@ -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' })),
}),

View file

@ -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 {} }',
})

View file

@ -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 {} }',
})