Skip to content

Commit

Permalink
fix(core/pipeline): Force rebake not displayed for templated pipelines (
Browse files Browse the repository at this point in the history
#7558)

This fix was first introduced in #5854, but went MIA when the manual execution modal was converted to React.
  • Loading branch information
jervi authored and christopherthielen committed Oct 24, 2019
1 parent 81eaac6 commit 17bf82a
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ import {
ITrigger,
} from 'core/domain';
import { AppNotificationsService } from 'core/notification/AppNotificationsService';
import { ArtifactList, ITriggerTemplateComponentProps, PipelineTemplateV2Service } from 'core/pipeline';
import {
ArtifactList,
IPipelineTemplateConfig,
ITriggerTemplateComponentProps,
PipelineTemplateV2Service,
} from 'core/pipeline';
import { Registry } from 'core/registry';
import { SETTINGS } from 'core/config/settings';
import { UrlParser } from 'core/navigation/urlParser';

import { ManualExecutionFieldLayout } from './layout/ManualExecutionFieldLayout';
import { PipelineOptions } from './PipelineOptions';
import { PipelineTemplateReader } from 'core/pipeline/config/templates/PipelineTemplateReader';
import { CurrentlyRunningExecutions } from './CurrentlyRunningExecutions';
import { StageManualComponents } from './StageManualComponents';
import { Triggers } from './Triggers';
Expand Down Expand Up @@ -205,7 +211,7 @@ export class ManualExecutionModal extends React.Component<IManualExecutionModalP
currentPipelineExecutions,
pipelineNotifications: pipeline.notifications || [],
});
this.setState({ stageComponents: this.getManualExecutionComponents(pipeline.stages) });
this.parseManualExecution(pipeline);
}
};

Expand All @@ -219,11 +225,19 @@ export class ManualExecutionModal extends React.Component<IManualExecutionModalP
});
};

private getManualExecutionComponents = (
stages: IStage[],
): Array<React.ComponentType<ITriggerTemplateComponentProps>> => {
private parseManualExecution = (pipeline: IPipeline): void => {
if (pipeline.type === 'templatedPipeline' && (pipeline.stages === undefined || pipeline.stages.length === 0)) {
PipelineTemplateReader.getPipelinePlan(pipeline as IPipelineTemplateConfig)
.then(plan => this.setStageComponentsForManualExecution(plan.stages))
.catch(() => this.setStageComponentsForManualExecution(pipeline.stages));
} else {
this.setStageComponentsForManualExecution(pipeline.stages);
}
};

private setStageComponentsForManualExecution = (stages: IStage[]): void => {
const additionalComponents = stages.map(stage => Registry.pipeline.getManualExecutionComponentForStage(stage));
return uniq(compact(additionalComponents));
this.setState({ stageComponents: uniq(compact(additionalComponents)) });
};

private formatTriggers = (triggers: ITrigger[]): ITrigger[] => {
Expand Down

0 comments on commit 17bf82a

Please sign in to comment.