Skip to content

Commit

Permalink
feat(pipeline_template): Better support for templated pipelines with …
Browse files Browse the repository at this point in the history
…dynamic sources

* Add "Edit configuration as JSON" link for templated pipelines (this partially reverts spinnaker#4192)
* Don't display error message when editing templated pipelines with dynamic source - real fix in Orca
* Render execution graph when editing templated pipelines with dynamic source - real fix in Orca
  • Loading branch information
jervi committed Oct 19, 2017
1 parent fb225f1 commit c0d0b00
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

<li ng-if="pipeline.locked"><a href ng-click="pipelineConfigurerCtrl.editPipelineJson()">Show JSON</a></li>
<li ng-if="!pipeline.locked"><a href ng-click="pipelineConfigurerCtrl.editPipelineJson()">Edit as JSON</a></li>
<li ng-if="pipeline.locked"><a href ng-click="pipelineConfigurerCtrl.editPipelineJson(true)">Show configuration JSON</a></li>
<li ng-if="!pipeline.locked && isTemplatedPipeline"><a href ng-click="pipelineConfigurerCtrl.editPipelineJson(true)">Edit configuration as JSON</a></li>
<li ng-if="viewState.loadingHistory"><a class="disabled"><em>Loading History...</em></a></li>
<li ng-if="!viewState.loadingHistory && viewState.hasHistory"><a href ng-click="pipelineConfigurerCtrl.showHistory()">Show Revision History</a></li>
<li ng-if="!viewState.loadingHistory && !viewState.hasHistory"><a class="disabled">No version history found</a></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ module.exports = angular.module('spinnaker.core.pipeline.config.pipelineConfigur
}).catch(() => {});
};

this.editPipelineJson = () => {
this.editPipelineJson = (editPipelineConfiguration = false) => {
$uibModal.open({
templateUrl: require('./actions/json/editPipelineJsonModal.html'),
controller: EditPipelineJsonModalCtrl,
controllerAs: '$ctrl',
size: 'lg modal-fullscreen',
resolve: {
pipeline: () => $scope.renderablePipeline,
pipeline: () => editPipelineConfiguration ? $scope.pipeline : $scope.renderablePipeline,
}
}).result.then(() => {
$scope.$broadcast('pipeline-json-edited');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class ConfigurePipelineTemplateModalController implements IController {
}

private loadTemplate(): IPromise<void> {
return ReactInjector.pipelineTemplateService.getPipelineTemplateFromSourceUrl(this.source)
return ReactInjector.pipelineTemplateService.getPipelineTemplateFromSourceUrl(this.source, this.pipelineId)
.then(template => { this.template = template });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export class PipelineTemplateService {
'ngInject';
}

public getPipelineTemplateFromSourceUrl(source: string): IPromise<IPipelineTemplate> {
return this.API.one('pipelineTemplates').one('resolve').withParams({source}).get()
public getPipelineTemplateFromSourceUrl(source: string, pipelineConfigId: String = null): IPromise<IPipelineTemplate> {
return this.API.one('pipelineTemplates').one('resolve').withParams({source: source, pipelineConfigId: pipelineConfigId}).get()
.then((template: IPipelineTemplate) => {
template.selfLink = source;
return template;
Expand Down

0 comments on commit c0d0b00

Please sign in to comment.