Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): Surface invalid params for a pipeline stage #6668

Merged
merged 3 commits into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ <h4 class="text-left">Pipeline Parameters</h4>
</label>
</div>
</div>
<div ng-if="invalidParameters.length" class="horizontal center sp-margin-l-top" style="width: 100%">
<div class="alert alert-danger vertical">
<p>
<i class="fa fa-exclamation-triangle"></i>
The following parameters are not accepted by the pipeline but are still set in the stage configuration:
</p>
<ul>
<li ng-repeat="paramName in invalidParameters">
{{paramName}}
</li>
</ul>
<button class="self-right passive" ng-click="pipelineStageCtrl.removeInvalidParameters()">Remove all</button>
</div>
</div>
</div>
<stage-config-field label="Wait for results" help-key="pipeline.waitForCompletion">
<input type="checkbox" class="input-sm" name="waitForCompletion" ng-model="stage.waitForCompletion" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ module.exports = angular
}
$scope.pipelineParameters = config.parameterConfig;
$scope.userSuppliedParameters = $scope.stage.pipelineParameters;

if ($scope.pipelineParameters) {
const acceptedPipelineParams = $scope.pipelineParameters.map(param => param.name);
$scope.invalidParameters = Object.keys($scope.userSuppliedParameters).filter(
paramName => !acceptedPipelineParams.includes(paramName),
);
}

$scope.useDefaultParameters = {};
_.each($scope.pipelineParameters, function(property) {
if (!(property.name in $scope.stage.pipelineParameters) && property.default !== null) {
Expand Down Expand Up @@ -119,6 +127,15 @@ module.exports = angular
}
};

this.removeInvalidParameters = function() {
$scope.invalidParameters.forEach(param => {
if ($scope.stage.pipelineParameters[param] !== 'undefined') {
delete $scope.stage.pipelineParameters[param];
}
});
$scope.invalidParameters = [];
};

$scope.$watch('stage.application', initializeMasters);
$scope.$watch('stage.pipeline', updatePipelineConfig);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

.artifact-select .Select-arrow-zone {
border-left: 1px solid rgb(204, 204, 204);
border-left: 1px solid var(--color-alto);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbwsg This gets rid of the lint warning. Hope this ok. (They are the same color)

background-image: url('~Select2/select2x2.png');
background-size: 60px 40px;
width: 17px;
Expand Down