From 6e548af435b7ea5c8987e80899b74e140afc3657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Jervidalo?= Date: Fri, 3 Nov 2017 10:57:25 +0100 Subject: [PATCH] fix(pipeline_template): Build execution title/numbers was rendered twice --- .../executionBuild/ExecutionBuildLink.tsx | 5 +-- .../executionBuild/ExecutionBuildTitle.tsx | 39 ++++++------------- .../src/pipeline/config/pipelineConfigurer.js | 5 ++- 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/app/scripts/modules/core/src/delivery/executionBuild/ExecutionBuildLink.tsx b/app/scripts/modules/core/src/delivery/executionBuild/ExecutionBuildLink.tsx index 8edff0bbc40..e8d7241d97c 100644 --- a/app/scripts/modules/core/src/delivery/executionBuild/ExecutionBuildLink.tsx +++ b/app/scripts/modules/core/src/delivery/executionBuild/ExecutionBuildLink.tsx @@ -4,7 +4,6 @@ import { BindAll } from 'lodash-decorators'; import { IExecution } from 'core/domain'; import { ReactInjector } from 'core/reactShims'; -import { ExecutionBuildTitle } from './ExecutionBuildTitle'; import './ExecutionBuildLink.less'; @@ -40,7 +39,7 @@ export class ExecutionBuildLink extends React.Component - + {this.props.execution.trigger.parentPipelineName} )} { this.props.execution.buildInfo && this.props.execution.buildInfo.number && ( @@ -50,7 +49,7 @@ export class ExecutionBuildLink extends React.Component - + Build #{this.props.execution.buildInfo.number} )} diff --git a/app/scripts/modules/core/src/delivery/executionBuild/ExecutionBuildTitle.tsx b/app/scripts/modules/core/src/delivery/executionBuild/ExecutionBuildTitle.tsx index 09ae6502051..d43c8e88f0a 100644 --- a/app/scripts/modules/core/src/delivery/executionBuild/ExecutionBuildTitle.tsx +++ b/app/scripts/modules/core/src/delivery/executionBuild/ExecutionBuildTitle.tsx @@ -1,20 +1,3 @@ -/* - * Copyright 2017 Schibsted ASA. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - import * as React from 'react'; import { BindAll } from 'lodash-decorators'; @@ -23,7 +6,6 @@ import { react2angular } from 'react2angular'; import { IExecutionBuildLinkProps } from './ExecutionBuildLink'; import { timestamp } from 'core/utils' -import { ReactInjector } from 'core/reactShims'; export interface IExecutionBuildTitleProps extends IExecutionBuildLinkProps { defaultToTimestamp?: boolean; @@ -36,26 +18,27 @@ export class ExecutionBuildTitle extends React.Component - { this.props.execution.trigger.parentPipelineName && + { this.hasParentPipeline && ( {this.props.execution.trigger.parentPipelineName} - } - { this.props.execution.buildInfo && this.props.execution.buildInfo.number && + )} + { this.hasBuildNumber && !this.hasParentPipeline && ( Build #{this.props.execution.buildInfo.number} - } - { this.props.defaultToTimestamp && !this.props.execution.trigger.parentPipelineName && !this.props.execution.buildInfo && + )} + { this.props.defaultToTimestamp && !this.hasParentPipeline && !this.hasBuildNumber && ( {timestamp(this.props.execution.startTime)} - } + )} ); } diff --git a/app/scripts/modules/core/src/pipeline/config/pipelineConfigurer.js b/app/scripts/modules/core/src/pipeline/config/pipelineConfigurer.js index 4b9a8c47a71..1dcc37c7213 100644 --- a/app/scripts/modules/core/src/pipeline/config/pipelineConfigurer.js +++ b/app/scripts/modules/core/src/pipeline/config/pipelineConfigurer.js @@ -33,8 +33,8 @@ module.exports = angular.module('spinnaker.core.pipeline.config.pipelineConfigur templateUrl: require('./pipelineConfigurer.html'), }; }) - .controller('PipelineConfigurerCtrl', function($scope, $uibModal, $timeout, $window, $q, - pipelineConfigValidator, pipelineTemplateService, executionService, + .controller('PipelineConfigurerCtrl', function($scope, $uibModal, $timeout, $window, $q, pipelineConfigValidator, + pipelineTemplateService, executionService, executionsTransformer, pipelineConfigService, viewStateCache, overrideRegistry, $location) { // For standard pipelines, a 'renderablePipeline' is just the pipeline config. // For templated pipelines, a 'renderablePipeline' is the pipeline template plan, and '$scope.pipeline' is the template config. @@ -374,6 +374,7 @@ module.exports = angular.module('spinnaker.core.pipeline.config.pipelineConfigur this.getPipelineExecutions = () => { executionService.getExecutionsForConfigIds($scope.pipeline.application, $scope.pipeline.id, 5) .then(executions => { + executions.forEach(execution => executionsTransformer.addBuildInfo(execution)); $scope.pipelineExecutions = executions; if ($scope.plan && $scope.plan.executionId) { $scope.currentExecution = _.find($scope.pipelineExecutions, { id: $scope.plan.executionId });