From 428282d879c93ebeac72187760add035561f3d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Jervidalo?= Date: Mon, 16 Oct 2017 15:48:21 +0200 Subject: [PATCH] feat(pipeline_template): Better support for templated pipelines with dynamic sources * Add "Edit configuration as JSON" link for templated pipelines (this partially reverts https://github.com/spinnaker/deck/pull/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 --- .../src/pipeline/config/actions/pipelineConfigActions.html | 2 ++ .../modules/core/src/pipeline/config/pipelineConfigurer.js | 4 ++-- .../templates/configurePipelineTemplateModal.controller.ts | 2 +- .../src/pipeline/config/templates/pipelineTemplate.service.ts | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/scripts/modules/core/src/pipeline/config/actions/pipelineConfigActions.html b/app/scripts/modules/core/src/pipeline/config/actions/pipelineConfigActions.html index 9cb364ffbe2..f1b771de1a0 100644 --- a/app/scripts/modules/core/src/pipeline/config/actions/pipelineConfigActions.html +++ b/app/scripts/modules/core/src/pipeline/config/actions/pipelineConfigActions.html @@ -12,6 +12,8 @@
  • Show JSON
  • Edit as JSON
  • +
  • Show configuration JSON
  • +
  • Edit configuration as JSON
  • Loading History...
  • Show Revision History
  • No version history found
  • diff --git a/app/scripts/modules/core/src/pipeline/config/pipelineConfigurer.js b/app/scripts/modules/core/src/pipeline/config/pipelineConfigurer.js index a25f9a84963..89cf9861293 100644 --- a/app/scripts/modules/core/src/pipeline/config/pipelineConfigurer.js +++ b/app/scripts/modules/core/src/pipeline/config/pipelineConfigurer.js @@ -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'); diff --git a/app/scripts/modules/core/src/pipeline/config/templates/configurePipelineTemplateModal.controller.ts b/app/scripts/modules/core/src/pipeline/config/templates/configurePipelineTemplateModal.controller.ts index 84bd51fbb36..4e81af50bc3 100644 --- a/app/scripts/modules/core/src/pipeline/config/templates/configurePipelineTemplateModal.controller.ts +++ b/app/scripts/modules/core/src/pipeline/config/templates/configurePipelineTemplateModal.controller.ts @@ -109,7 +109,7 @@ export class ConfigurePipelineTemplateModalController implements IController { } private loadTemplate(): IPromise { - return ReactInjector.pipelineTemplateService.getPipelineTemplateFromSourceUrl(this.source) + return ReactInjector.pipelineTemplateService.getPipelineTemplateFromSourceUrl(this.source, this.pipelineId) .then(template => { this.template = template }); } diff --git a/app/scripts/modules/core/src/pipeline/config/templates/pipelineTemplate.service.ts b/app/scripts/modules/core/src/pipeline/config/templates/pipelineTemplate.service.ts index a90b9e041e1..30c905ece4d 100644 --- a/app/scripts/modules/core/src/pipeline/config/templates/pipelineTemplate.service.ts +++ b/app/scripts/modules/core/src/pipeline/config/templates/pipelineTemplate.service.ts @@ -79,8 +79,8 @@ export class PipelineTemplateService { 'ngInject'; } - public getPipelineTemplateFromSourceUrl(source: string): IPromise { - return this.API.one('pipelineTemplates').one('resolve').withParams({source}).get() + public getPipelineTemplateFromSourceUrl(source: string, pipelineConfigId: String = null): IPromise { + return this.API.one('pipelineTemplates').one('resolve').withParams({source: source, pipelineConfigId: pipelineConfigId}).get() .then((template: IPipelineTemplate) => { template.selfLink = source; return template;