Skip to content

Commit

Permalink
fix(travis stage): Trigger component not working properly
Browse files Browse the repository at this point in the history
Fixed by properly converting the 'travis-trigger-options' directive into a component in a more "typescripty" way and replacing 'bindToController' with 'bindings'
  • Loading branch information
jervi committed Mar 31, 2017
1 parent a2cd846 commit f55b298
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<travis-trigger-options command="vm.command"></travis-trigger-options>
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ module(TRAVIS_TRIGGER, [
formatLabel: (trigger: IBuildTrigger) => {
return $q.when(`(Travis) ${trigger.master}: ${trigger.job}`);
},
selectorTemplate: '<travis-trigger-options command="vm.command"></travis-trigger-options>',
selectorTemplate: require('./selectorTemplate.html'),
};
}).controller('TravisTriggerCtrl', TravisTrigger);
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {mock, IScope, IQProvider, IQService, IControllerService, IRootScopeServi
import {IgorService} from 'core/ci/igor.service';
import {IBuild} from 'core/domain/IBuild';
import {IBuildTrigger} from 'core/domain/ITrigger';
import {TRAVIS_TRIGGER_OPTIONS_COMPONENT, TravisTriggerOptions} from './travisTriggerOptions.component';
import {TRAVIS_TRIGGER_OPTIONS_COMPONENT, TravisTriggerOptionsController} from './travisTriggerOptions.component';

interface ICommand {
trigger: IBuildTrigger;
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('Travis Trigger: TravisTriggerOptionsCtrl', () => {
}));

const initialize = () => {
return $ctrl(TravisTriggerOptions, {
return $ctrl(TravisTriggerOptionsController, {
igorService: igorService,
$scope: $scope,
}, {command: command});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {module, IScope} from 'angular';
import {module, IScope, IComponentOptions} from 'angular';

import {IGOR_SERVICE, IgorService} from 'core/ci/igor.service';
import {IBuild} from 'core/domain/IBuild';
Expand All @@ -9,7 +9,7 @@ interface IViewState {
selectedBuild: IBuild;
}

export class TravisTriggerOptions {
export class TravisTriggerOptionsController {
public viewState: IViewState;
public command: any;
public builds: IBuild[];
Expand Down Expand Up @@ -65,17 +65,16 @@ export class TravisTriggerOptions {
};
}

class TravisTriggerOptionsComponent implements IComponentOptions {
public bindings: any = {
command: '='
};
public templateUrl = require('./travisTriggerOptions.component.html');
public controller: any = TravisTriggerOptionsController;
}

export const TRAVIS_TRIGGER_OPTIONS_COMPONENT = 'spinnaker.core.pipeline.config.triggers.travis.options.component';

module(TRAVIS_TRIGGER_OPTIONS_COMPONENT, [
IGOR_SERVICE
]).component('travisTriggerOptions', () => {
return {
restrict: 'E',
templateUrl: require('./travisTriggerOptions.component.html'),
bindToController: {
command: '=',
},
controller: 'TravisTriggerOptionsCtrl',
scope: {}
};
}).controller('TravisTriggerOptionsCtrl', TravisTriggerOptions);
]).component('travisTriggerOptions', new TravisTriggerOptionsComponent());

0 comments on commit f55b298

Please sign in to comment.