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

feat(core/pipeline): Support grouping stages that have a 'group' property #4117

Merged
merged 1 commit into from
Sep 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions app/scripts/modules/core/src/delivery/delivery.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const angular = require('angular');

import { DELIVERY_STATES } from './delivery.states';
import { EXECUTION_DETAILS_COMPONENT } from './details/executionDetails.component';
import { EXECUTION_DETAILS_CONTROLLER } from './details/executionDetails.controller';
import { BUILD_DISPLAY_NAME_FILTER } from './executionBuild/buildDisplayName.filter';
import { EXECUTION_BUILD_NUMBER_COMPONENT } from './executionBuild/executionBuildNumber.component';
import { EXECUTION_COMPONENT } from './executionGroup/execution/execution.component';
Expand All @@ -15,8 +16,7 @@ import { CORE_DELIVERY_DETAILS_SINGLEEXECUTIONDETAILS } from './details/singleEx


module.exports = angular.module('spinnaker.delivery', [

require('./details/executionDetails.controller.js'),
EXECUTION_DETAILS_CONTROLLER,
CORE_DELIVERY_DETAILS_SINGLEEXECUTIONDETAILS,
EXECUTION_COMPONENT,
EXECUTION_GROUPS_COMPONENT,
Expand Down
5 changes: 1 addition & 4 deletions app/scripts/modules/core/src/delivery/delivery.states.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,14 @@ module(DELIVERY_STATES, [
// replacing the URL
const executionDetails: INestedState = {
name: 'execution',
url: '/:executionId?refId&stage&step&details&stageId',
url: '/:executionId?refId&stage&subStage&step&details&stageId',
params: {
stage: {
value: '0',
},
step: {
value: '0',
},
refId: {
value: null,
}
},
data: {
pageTitleDetails: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { IComponentOptions, module } from 'angular';

import { ExecutionDetailsController } from './executionDetails.controller';

import './executionDetails.less';

export class ExecutionDetailsComponent implements IComponentOptions {
Expand All @@ -8,7 +10,8 @@ export class ExecutionDetailsComponent implements IComponentOptions {
application: '<',
standalone: '<'
};
public controller = 'executionDetails as ctrl';
public controller = ExecutionDetailsController;
public controllerAs = 'ctrl';
public templateUrl: string = require('./executionDetails.html');

}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { IControllerService, IRootScopeService, IScope, auto, mock } from 'angular';
import { EXECUTION_DETAILS_CONTROLLER, ExecutionDetailsController } from './executionDetails.controller';

import { IStage } from 'core/domain';

describe('Controller: ExecutionDetails', () => {
let $scope: IScope;
let controller: ExecutionDetailsController;
let pipelineConfig: any;

beforeEach(mock.module(
EXECUTION_DETAILS_CONTROLLER,
($provide: auto.IProvideService) => {
$provide.service('pipelineConfig', () => {
return { getStageConfig: (stage: IStage) => stage };
});
}
));

beforeEach(mock.inject(($controller: IControllerService,
$rootScope: IRootScopeService,
_pipelineConfig_: any) => {
$scope = $rootScope.$new();
controller = $controller(ExecutionDetailsController, {
$scope: $scope
});
controller.execution = { isRunning: false } as any;
controller.application = { attributes: { enableRestartRunningExecutions: false } } as any;

pipelineConfig = _pipelineConfig_;
}));

describe('isRestartable', () => {
it('returns false when no stage config', () => {
expect(controller.isRestartable()).toBe(false);
});

it('returns false when stage is not restartable', () => {
expect(controller.isRestartable({restartable: false} as any)).toBe(false);
});

it('returns false when stage is already restarting', () => {
expect(controller.isRestartable({restartable: true, isRestarting: true} as any)).toBe(false);
});

it('returns true when stage is restartable', () => {
expect(controller.isRestartable({restartable: true} as any)).toBe(true);
});

it('returns true when stage is running, is restartable and enableRestartRunningExecutions=true', () => {
controller.execution.isRunning = true;
controller.application.attributes.enableRestartRunningExecutions = true;
$scope.$digest();
expect(controller.isRestartable({restartable: true} as any)).toBe(true);
});
});

});
Loading