Skip to content

Commit

Permalink
fix(rerun): Hiding re-run as strategies should not be re-run (spinnak…
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmquach authored and mergify[bot] committed Oct 30, 2019
1 parent 8d478a0 commit 98e8a4b
Showing 1 changed file with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface ISingleExecutionDetailsProps {

export interface ISingleExecutionDetailsState {
execution: IExecution;
pipelineConfig?: IPipeline;
sortFilter: ISortFilter;
stateNotFound: boolean;
}
Expand Down Expand Up @@ -76,6 +77,12 @@ export class SingleExecutionDetails extends React.Component<
this.executionLoader.unsubscribe();
}
this.setState({ execution });

app.pipelineConfigs.activate();
app.pipelineConfigs.ready().then(() => {
const pipelineConfig = app.pipelineConfigs.data.find((p: IPipeline) => p.id === execution.pipelineConfigId);
this.setState({ pipelineConfig });
});
},
() => {
this.setState({ execution: null, stateNotFound: true });
Expand Down Expand Up @@ -130,24 +137,22 @@ export class SingleExecutionDetails extends React.Component<

private rerunExecution = (execution: IExecution) => {
const { app } = this.props;
app.pipelineConfigs.activate();
app.pipelineConfigs.ready().then(() => {
const pipeline = app.pipelineConfigs.data.find((p: IPipeline) => p.id === execution.pipelineConfigId);
ManualExecutionModal.show({
pipeline: pipeline,
application: app,
trigger: execution.trigger,
}).then(command => {
const { executionService } = ReactInjector;
executionService.startAndMonitorPipeline(app, command.pipelineName, command.trigger);
ReactInjector.$state.go('^.^.executions');
});
const { pipelineConfig: pipeline } = this.state;

ManualExecutionModal.show({
pipeline: pipeline,
application: app,
trigger: execution.trigger,
}).then(command => {
const { executionService } = ReactInjector;
executionService.startAndMonitorPipeline(app, command.pipelineName, command.trigger);
ReactInjector.$state.go('^.^.executions');
});
};

public render() {
const { app } = this.props;
const { execution, sortFilter, stateNotFound } = this.state;
const { execution, pipelineConfig, sortFilter, stateNotFound } = this.state;

const defaultExecutionParams = { application: app.name, executionId: execution ? execution.id : '' };
const executionParams = ReactInjector.$state.params.executionParams || defaultExecutionParams;
Expand Down Expand Up @@ -216,9 +221,12 @@ export class SingleExecutionDetails extends React.Component<
pipelineConfig={null}
standalone={true}
showDurations={sortFilter.showDurations}
onRerun={() => {
this.rerunExecution(execution);
}}
onRerun={
pipelineConfig &&
(() => {
this.rerunExecution(execution);
})
}
/>
</div>
</div>
Expand Down

0 comments on commit 98e8a4b

Please sign in to comment.