Skip to content

Commit

Permalink
refactor(*): More execution details refactoring (spinnaker#4324)
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Reynolds authored Oct 24, 2017
1 parent ce13de5 commit ababde6
Show file tree
Hide file tree
Showing 34 changed files with 49 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = angular.module('spinnaker.amazon.pipeline.stage.aws.resizeAsgSt
alias: 'resizeAsg',
cloudProvider: 'aws',
templateUrl: require('./resizeAsgStage.html'),
executionConfigSections: ['resizeServerGroupConfig', 'taskStatus'],
executionStepLabelUrl: require('./resizeAsgStepLabel.html'),
accountExtractor: (stage) => [stage.context.credentials],
configAccountExtractor: (stage) => [stage.credentials],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module.exports = angular.module('spinnaker.amazon.pipeline.stage.scaleDownCluste
provides: 'scaleDownCluster',
cloudProvider: 'aws',
templateUrl: require('./scaleDownClusterStage.html'),
executionConfigSections: ['scaleDownClusterConfig', 'taskStatus'],
accountExtractor: (stage) => [stage.context.credentials],
configAccountExtractor: (stage) => [stage.credentials],
validators: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module.exports = angular.module('spinnaker.cf.pipeline.stage.resizeAsgStage', [
alias: 'resizeAsg',
cloudProvider: 'cf',
templateUrl: require('./resizeAsgStage.html'),
executionConfigSections: ['resizeServerGroupConfig', 'taskStatus'],
executionStepLabelUrl: require('./resizeAsgStepLabel.html'),
validators: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = angular.module('spinnaker.cf.pipeline.stage.scaleDownClusterSta
provides: 'scaleDownCluster',
cloudProvider: 'cf',
templateUrl: require('./scaleDownClusterStage.html'),
executionConfigSections: ['scaleDownClusterConfig', 'taskStatus'],
accountExtractor: (stage) => [stage.context.credentials],
configAccountExtractor: (stage) => [stage.credentials],
validators: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export class PipelineConfigProvider implements IServiceProvider {
if (parent.executionDetailsUrl && !stageType.executionDetailsUrl) {
stageType.executionDetailsUrl = parent.executionDetailsUrl;
}
if (parent.executionConfigSections && !stageType.executionConfigSections) {
stageType.executionConfigSections = parent.executionConfigSections;
}
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ export class BaseExecutionDetailsCtrl {
this.initialize();
}

protected setScopeConfigSections(sections: string[]): void {
this.$scope.configSections = sections;
}

protected initialize(): void {
this.executionDetailsSectionService.synchronizeSection(this.$scope.configSections, () => this.initialized());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div ng-controller="destroyAsgExecutionDetailsCtrl">
<div ng-controller="BaseExecutionDetailsCtrl">
<execution-details-section-nav sections="configSections"></execution-details-section-nav>
<div class="step-section-details" ng-if="detailsSection === 'destroyServerGroupConfig'">
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { module } from 'angular';

import { DESTROY_ASG_EXECUTION_DETAILS_CTRL } from './templates/destroyAsgExecutionDetails.controller';
import { PIPELINE_CONFIG_PROVIDER, PipelineConfigProvider } from 'core/pipeline/config/pipelineConfigProvider';

export const DESTROY_ASG_STAGE = 'spinnaker.core.pipeline.stage.destroyAsg';

module(DESTROY_ASG_STAGE, [
DESTROY_ASG_EXECUTION_DETAILS_CTRL,
PIPELINE_CONFIG_PROVIDER,
])
.config((pipelineConfigProvider: PipelineConfigProvider) => {
pipelineConfigProvider.registerStage({
executionDetailsUrl: require('./templates/destroyAsgExecutionDetails.template.html'),
executionConfigSections: ['destroyServerGroupConfig', 'taskStatus'],
executionDetailsUrl: require('./destroyAsgExecutionDetails.template.html'),
useBaseProvider: true,
key: 'destroyServerGroup',
label: 'Destroy Server Group',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div ng-controller="disableAsgExecutionDetailsCtrl">
<div ng-controller="BaseExecutionDetailsCtrl">
<execution-details-section-nav sections="configSections"></execution-details-section-nav>
<div class="step-section-details" ng-if="detailsSection === 'disableServerGroupConfig'">
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { module } from 'angular';

import { DISABLE_ASG_EXECUTION_DETAILS_CTRL } from './templates/disableAsgStage.controller';
import { PIPELINE_CONFIG_PROVIDER, PipelineConfigProvider } from 'core/pipeline/config/pipelineConfigProvider';

export const DISABLE_ASG_STAGE_MODULE = 'spinnaker.core.pipeline.stage.disableAsg';

module(DISABLE_ASG_STAGE_MODULE, [
DISABLE_ASG_EXECUTION_DETAILS_CTRL,
PIPELINE_CONFIG_PROVIDER,
])
.config((pipelineConfigProvider: PipelineConfigProvider) => {
pipelineConfigProvider.registerStage({
useBaseProvider: true,
executionDetailsUrl: require('./templates/disableAsgExecutionDetails.template.html'),
executionConfigSections: ['disableServerGroupConfig', 'taskStatus'],
executionDetailsUrl: require('./disableAsgExecutionDetails.template.html'),
key: 'disableServerGroup',
label: 'Disable Server Group',
description: 'Disables a server group',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div ng-controller="enableAsgExecutionDetailsCtrl">
<div ng-controller="BaseExecutionDetailsCtrl">
<execution-details-section-nav sections="configSections"></execution-details-section-nav>
<div class="step-section-details" ng-if="detailsSection === 'enableServerGroupConfig'">
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { module } from 'angular';

import { ENABLE_ASG_EXECUTION_DETAILS_CTRL } from './templates/enableAsgStage.controller';
import { PIPELINE_CONFIG_PROVIDER, PipelineConfigProvider } from 'core/pipeline/config/pipelineConfigProvider';

export const ENABLE_ASG_STAGE_MODULE = 'spinnaker.core.pipeline.stage.enableAsg';
export const ENABLE_ASG_STAGE = 'spinnaker.core.pipeline.stage.enableAsg';

module(ENABLE_ASG_STAGE_MODULE, [
ENABLE_ASG_EXECUTION_DETAILS_CTRL,
module(ENABLE_ASG_STAGE, [
PIPELINE_CONFIG_PROVIDER,
]).config((pipelineConfigProvider: PipelineConfigProvider) => {
pipelineConfigProvider.registerStage({
useBaseProvider: true,
executionDetailsUrl: require('./templates/enableAsgExecutionDetails.template.html'),
executionConfigSections: ['enableServerGroupConfig', 'taskStatus'],
executionDetailsUrl: require('./enableAsgExecutionDetails.template.html'),
key: 'enableServerGroup',
label: 'Enable Server Group',
description: 'Enables a server group',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module(RESIZE_ASG_STAGE, [
])
.config((pipelineConfigProvider: PipelineConfigProvider) => {
pipelineConfigProvider.registerStage({
executionConfigSections: ['resizeServerGroupConfig', 'taskStatus'],
executionDetailsUrl: require('./resizeAsgExecutionDetails.html'),
useBaseProvider: true,
key: 'resizeServerGroup',
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { module } from 'angular';

import { PIPELINE_CONFIG_PROVIDER, PipelineConfigProvider } from 'core/pipeline/config/pipelineConfigProvider';

export const SCALE_DOWN_CLUSTER_STAGE = 'spinnaker.core.pipeline.stage.scaleDownClusterStage';
module(SCALE_DOWN_CLUSTER_STAGE, [
PIPELINE_CONFIG_PROVIDER
])
.config((pipelineConfigProvider: PipelineConfigProvider) => {
pipelineConfigProvider.registerStage({
executionConfigSections: ['scaleDownClusterConfig', 'taskStatus'],
executionDetailsUrl: require('./scaleDownClusterExecutionDetails.html'),
useBaseProvider: true,
key: 'scaleDownCluster',
label: 'Scale Down Cluster',
description: 'Scales down a cluster',
strategy: true,
});
});

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
import { module } from 'angular';

const angular = require('angular');
import { SCRIPT_EXECUTION_DETAILS_CONTROLLER } from './scriptExecutionDetails.controller';

module.exports = angular.module('spinnaker.core.pipeline.stage.script', [
export const SCRIPT_STAGE_MODULE = 'spinnaker.core.pipeline.stage.script';
module(SCRIPT_STAGE_MODULE, [
require('./scriptStage.js').name,
SCRIPT_EXECUTION_DETAILS_CONTROLLER,
]);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div ng-controller="shrinkClusterExecutionDetailsCtrl">
<div ng-controller="BaseExecutionDetailsCtrl">
<execution-details-section-nav sections="configSections"></execution-details-section-nav>
<div class="step-section-details" ng-if="detailsSection === 'shrinkClusterConfig'">
<div class="row">
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module(SHRINK_CLUSTER_STAGE, [
])
.config((pipelineConfigProvider: PipelineConfigProvider) => {
pipelineConfigProvider.registerStage({
executionDetailsUrl: require('./templates/shrinkClusterExecutionDetails.template.html'),
executionConfigSections: ['shrinkClusterConfig', 'taskStatus'],
executionDetailsUrl: require('./shrinkClusterExecutionDetails.template.html'),
useBaseProvider: true,
key: 'shrinkCluster',
label: 'Shrink Cluster',
Expand Down

This file was deleted.

14 changes: 8 additions & 6 deletions app/scripts/modules/core/src/pipeline/pipelines.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import { COPY_STAGE_MODAL_CONTROLLER } from './config/copyStage/copyStage.modal.
import { CREATE_LOAD_BALANCER_STAGE } from './config/stages/createLoadBalancer/createLoadBalancerStage.module';
import { DESTROY_ASG_STAGE } from './config/stages/destroyAsg/destroyAsgStage';
import { DISABLE_ASG_STAGE_MODULE } from './config/stages/disableAsg/disableAsgStage.module';
import { ENABLE_ASG_STAGE_MODULE } from './config/stages/enableAsg/enableAsgStage.module';
import { ENABLE_ASG_STAGE } from './config/stages/enableAsg/enableAsgStage';
import { FIND_AMI_STAGE } from './config/stages/findAmi/findAmiStage';
import { GROUP_STAGE_MODULE } from './config/stages/group/groupStage.module';
import { RESIZE_ASG_STAGE } from './config/stages/resizeAsg/resizeAsgStage';
import { SHRINK_CLUSTER_STAGE_MODULE } from './config/stages/shrinkCluster/shrinkClusterStage.module';
import { SCALE_DOWN_CLUSTER_STAGE } from './config/stages/scaleDownCluster/scaleDownClusterStage';
import { SCRIPT_STAGE_MODULE } from './config/stages/script/scriptStage.module';
import { SHRINK_CLUSTER_STAGE } from './config/stages/shrinkCluster/shrinkClusterStage';
import { STAGE_CORE_MODULE } from './config/stages/core/stage.core.module';
import { TRAVIS_STAGE_MODULE } from './config/stages/travis/travisStage.module';
import { UNMATCHED_STAGE_TYPE_STAGE } from './config/stages/unmatchedStageTypeStage/unmatchedStageTypeStage';
Expand All @@ -39,7 +41,7 @@ module.exports = angular.module('spinnaker.core.pipeline', [
DESTROY_ASG_STAGE,
DISABLE_ASG_STAGE_MODULE,
require('./config/stages/disableCluster/disableClusterStage.module').name,
ENABLE_ASG_STAGE_MODULE,
ENABLE_ASG_STAGE,
require('./config/stages/executionWindows/executionWindowsStage.module').name,
FIND_AMI_STAGE,
require('./config/stages/findImageFromTags/findImageFromTagsStage.module').name,
Expand All @@ -49,9 +51,9 @@ module.exports = angular.module('spinnaker.core.pipeline', [
require('./config/stages/pipeline/pipelineStage.module').name,
RESIZE_ASG_STAGE,
require('./config/stages/runJob/runJobStage.module').name,
require('./config/stages/scaleDownCluster/scaleDownClusterStage.module').name,
require('./config/stages/script/scriptStage.module').name,
SHRINK_CLUSTER_STAGE_MODULE,
SCALE_DOWN_CLUSTER_STAGE,
SCRIPT_STAGE_MODULE,
SHRINK_CLUSTER_STAGE,
WAIT_STAGE_MODULE,
require('./config/stages/waitForParentTasks/waitForParentTasks').name,
CREATE_LOAD_BALANCER_STAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = angular.module('spinnaker.gce.pipeline.stage..resizeAsgStage',
provides: 'resizeServerGroup',
cloudProvider: 'gce',
templateUrl: require('./resizeAsgStage.html'),
executionConfigSections: ['resizeServerGroupConfig', 'taskStatus'],
executionStepLabelUrl: require('./resizeAsgStepLabel.html'),
accountExtractor: (stage) => [stage.context.credentials],
configAccountExtractor: (stage) => [stage.credentials],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = angular.module('spinnaker.gce.pipeline.stage..scaleDownClusterS
provides: 'scaleDownCluster',
cloudProvider: 'gce',
templateUrl: require('./scaleDownClusterStage.html'),
executionConfigSections: ['scaleDownClusterConfig', 'taskStatus'],
accountExtractor: (stage) => [stage.context.credentials],
configAccountExtractor: (stage) => [stage.credentials],
validators: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = angular.module('spinnaker.kubernetes.pipeline.stage.resizeStage
cloudProvider: 'kubernetes',
templateUrl: require('./resizeStage.html'),
executionDetailsUrl: require('./resizeExecutionDetails.html'),
executionConfigSections: ['resizeServerGroupConfig', 'taskStatus'],
executionStepLabelUrl: require('./resizeStepLabel.html'),
validators: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module.exports = angular.module('spinnaker.kubernetes.pipeline.stage.scaleDownCl
cloudProvider: 'kubernetes',
templateUrl: require('./scaleDownClusterStage.html'),
executionDetailsUrl: require('./scaleDownClusterExecutionDetails.html'),
executionConfigSections: ['scaleDownClusterConfig', 'taskStatus'],
validators: [
{ type: 'requiredField', fieldName: 'cluster' },
{ type: 'requiredField', fieldName: 'remainingFullSizeServerGroups', fieldLabel: 'Keep [X] full size Server Groups'},
Expand Down
Loading

0 comments on commit ababde6

Please sign in to comment.