Skip to content

Commit

Permalink
fix(core/pipeline): Support expressions for pipeline name in the pipe…
Browse files Browse the repository at this point in the history
…line stage
  • Loading branch information
christopherthielen committed Jan 29, 2019
1 parent 6f608a0 commit 95b1f5c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</ui-select>
</stage-config-field>
<stage-config-field label="Pipeline">
<input ng-model="stage.pipeline" class="form-control input-sm" ng-if="stage.application.includes('${')" />
<div ng-if="stage.application && viewState.pipelinesLoaded && !stage.application.includes('${')">
<input ng-model="stage.pipeline" class="form-control input-sm" ng-if="stage.pipeline.includes('${') || stage.application.includes('${')" />
<div ng-if="stage.application && viewState.pipelinesLoaded && stage !== null && !stage.pipeline.includes('${') && !stage.application.includes('${')">
<ui-select class="form-control input-sm"
ng-model="stage.pipeline">
<ui-select-match placeholder="Select a pipeline...">{{$select.selected.name}}</ui-select-match>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,10 @@ module.exports = angular
function initializeMasters() {
if ($scope.stage.application && !$scope.stage.application.includes('${')) {
PipelineConfigService.getPipelinesForApplication($scope.stage.application).then(function(pipelines) {
$scope.pipelines = _.filter(pipelines, function(pipeline) {
return pipeline.id !== $scope.pipeline.id;
});
if (
!_.find(pipelines, function(pipeline) {
return pipeline.id === $scope.stage.pipeline;
})
) {
$scope.pipelines = _.filter(pipelines, pipeline => pipeline.id !== $scope.pipeline.id);
const pipelineId = $scope.stage.pipeline;
const isFound = _.find(pipelines, pipeline => pipeline.id === pipelineId);
if (!isFound && pipelineId && !pipelineId.includes('${')) {
$scope.stage.pipeline = null;
}
$scope.viewState.pipelinesLoaded = true;
Expand All @@ -75,10 +71,13 @@ module.exports = angular
}

function updatePipelineConfig() {
if ($scope.stage && $scope.stage.application && $scope.stage.pipeline) {
var config = _.find($scope.pipelines, function(pipeline) {
return pipeline.id === $scope.stage.pipeline;
});
const pipeline = $scope.stage && $scope.stage.pipeline;
if (pipeline && pipeline.includes('${')) {
return;
}

if ($scope.stage && $scope.stage.application && pipeline) {
const config = _.find($scope.pipelines, pipeline => pipeline.id === $scope.stage.pipeline);
if (config && config.parameterConfig) {
if (!$scope.stage.pipelineParameters) {
$scope.stage.pipelineParameters = {};
Expand Down

0 comments on commit 95b1f5c

Please sign in to comment.