Skip to content

Commit

Permalink
fix(core/pipeline): exclude correlation IDs (and more) when re-running (
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Munson committed Sep 6, 2019
1 parent f245761 commit 3e76186
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import { Formik, Form } from 'formik';
import { Modal } from 'react-bootstrap';
import { Observable, Subject } from 'rxjs';
import { assign, clone, compact, extend, get, head, uniq, isArray } from 'lodash';
import { assign, clone, compact, extend, get, head, uniq, isArray, pickBy } from 'lodash';

import { SubmitButton, ModalClose } from 'core/modal';
import { Application } from 'core/application';
Expand Down Expand Up @@ -54,6 +54,8 @@ export interface IManualExecutionModalState {
triggers: ITrigger[];
}

const TRIGGER_FIELDS_TO_EXCLUDE = ['correlationId', 'eventId', 'executionId'];

export class ManualExecutionModal extends React.Component<IManualExecutionModalProps, IManualExecutionModalState> {
private formikRef = React.createRef<Formik<any>>();
private destroy$ = new Subject();
Expand Down Expand Up @@ -256,7 +258,10 @@ export class ManualExecutionModal extends React.Component<IManualExecutionModalP
const triggers = this.formatTriggers(pipeline && pipeline.triggers ? pipeline.triggers : []);
let trigger: ITrigger;
if (this.props.trigger) {
trigger = clone(this.props.trigger);
// Certain fields like correlationId will cause unexepcted behavior if used to trigger
// a different execution, others are just left unused. Let's exclude them.
trigger = pickBy(this.props.trigger, (_, key) => !TRIGGER_FIELDS_TO_EXCLUDE.includes(key));

if (trigger.type === 'manual' && triggers.length) {
trigger.type = head(triggers).type;
}
Expand Down

0 comments on commit 3e76186

Please sign in to comment.