Skip to content

Commit

Permalink
chore(angularjs): Do not use .component('foo', new Foo())
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Feb 21, 2019
1 parent 14bf52b commit 3ffa4fb
Show file tree
Hide file tree
Showing 96 changed files with 757 additions and 765 deletions.
4 changes: 2 additions & 2 deletions app/scripts/modules/amazon/src/reactShims/aws.ngReact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import IInjectorService = angular.auto.IInjectorService;

import { ReactInject } from '@spinnaker/core';

import { ScalingPolicyDetailsSummary } from 'amazon/serverGroup/details/scalingPolicy/detailsSummary.component';
import { scalingPolicyDetailsSummary } from 'amazon/serverGroup/details/scalingPolicy/detailsSummary.component';
import { IScalingPolicySummaryProps } from 'amazon/serverGroup/details/scalingPolicy/ScalingPolicySummary';

// prettier-ignore
export class AwsNgReactInjector extends ReactInject {
public $injectorProxy = {} as IInjectorService;

// Reactified components
public ScalingPolicySummary: React.ComponentClass<IScalingPolicySummaryProps> = angular2react('scalingPolicySummary', new ScalingPolicyDetailsSummary(), this.$injectorProxy) as any;
public ScalingPolicySummary: React.ComponentClass<IScalingPolicySummaryProps> = angular2react('scalingPolicySummary', scalingPolicyDetailsSummary, this.$injectorProxy) as any;

public initialize($injector: IInjectorService) {
const realInjector: { [key: string]: Function } = $injector as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export class ScalingPolicyDetailsSummaryController implements IController {
}
}

export class ScalingPolicyDetailsSummary implements IComponentOptions {
public bindings: any = {
export const scalingPolicyDetailsSummary: IComponentOptions = {
bindings: {
policy: '<',
serverGroup: '<',
application: '<',
};
public controller = ScalingPolicyDetailsSummaryController;
public template = `<div ng-include src="$ctrl.templateUrl"></div>`;
}
},
controller: ScalingPolicyDetailsSummaryController,
template: `<div ng-include src="$ctrl.templateUrl"></div>`
};

export const DETAILS_SUMMARY = 'spinnaker.amazon.scalingPolicy.details.summary.component';
module(DETAILS_SUMMARY, []).component('scalingPolicySummary', new ScalingPolicyDetailsSummary());
module(DETAILS_SUMMARY, []).component('scalingPolicySummary', scalingPolicyDetailsSummary);
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { module, IComponentOptions } from 'angular';

class AppengineComponentUrlDetailsComponent implements IComponentOptions {
public bindings: any = { component: '<' };
public template = `
const appengineComponentUrlDetailsComponent: IComponentOptions = {
bindings: { component: '<' },
template: `
<dt>HTTPS</dt>
<dl class="small">
<a href="{{$ctrl.component.httpsUrl}}" target="_blank">{{$ctrl.component.httpsUrl}}</a>
Expand All @@ -17,12 +17,12 @@ class AppengineComponentUrlDetailsComponent implements IComponentOptions {
tool-tip="'Copy URL to clipboard'"
text="$ctrl.component.httpUrl"></copy-to-clipboard>
</dl>
`;
}
`
};

export const APPENGINE_COMPONENT_URL_DETAILS = 'spinnaker.appengine.componentUrlDetails.component';

module(APPENGINE_COMPONENT_URL_DETAILS, []).component(
'appengineComponentUrlDetails',
new AppengineComponentUrlDetailsComponent(),
appengineComponentUrlDetailsComponent,
);
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ class AppengineConditionalDescriptionListItemCtrl implements IController {
}
}

class AppengineConditionalDescriptionListItem implements IComponentOptions {
public bindings: any = { label: '@', key: '@', component: '<' };
public transclude: any = {
const appengineConditionalDescriptionListItem: IComponentOptions = {
bindings: { label: '@', key: '@', component: '<' },
transclude: {
keyLabel: '?keyText',
valueLabel: '?valueLabel',
};
public template = `
},
template: `
<dt ng-if="$ctrl.component[$ctrl.key]">{{$ctrl.label}}<span ng-transclude="keyLabel"></span></dt>
<dd ng-if="$ctrl.component[$ctrl.key]">{{$ctrl.component[$ctrl.key]}}<span ng-transclude="valueLabel"></span></dd>
`;
public controller: any = AppengineConditionalDescriptionListItemCtrl;
}
`,
controller: AppengineConditionalDescriptionListItemCtrl
};

export const APPENGINE_CONDITIONAL_DESCRIPTION_LIST_ITEM = 'spinnaker.appengine.conditionalDescriptionListItem';

module(APPENGINE_CONDITIONAL_DESCRIPTION_LIST_ITEM, []).component(
'appengineConditionalDtDd',
new AppengineConditionalDescriptionListItem(),
appengineConditionalDescriptionListItem,
);
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { module } from 'angular';

class AppengineLoadBalancerMessageComponent implements ng.IComponentOptions {
public bindings: any = { showCreateMessage: '<', columnOffset: '@', columns: '@' };
public templateUrl: string = require('./loadBalancerMessage.component.html');
}
const appengineLoadBalancerMessageComponent: ng.IComponentOptions = {
bindings: { showCreateMessage: '<', columnOffset: '@', columns: '@' },
templateUrl: require('./loadBalancerMessage.component.html')
};

export const APPENGINE_LOAD_BALANCER_CREATE_MESSAGE = 'spinnaker.appengine.loadBalancer.createMessage.component';

module(APPENGINE_LOAD_BALANCER_CREATE_MESSAGE, []).component(
'appengineLoadBalancerMessage',
new AppengineLoadBalancerMessageComponent(),
appengineLoadBalancerMessageComponent,
);
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class AppengineLoadBalancerAdvancedSettingsCtrl implements IController {
}
}

class AppengineLoadBalancerAdvancedSettingsComponent implements IComponentOptions {
public bindings: any = { loadBalancer: '=', application: '<' };
public template = `
const appengineLoadBalancerAdvancedSettingsComponent: IComponentOptions = {
bindings: { loadBalancer: '=', application: '<' },
template: `
<ng-form name="advancedSettingsForm">
<div class="row">
<div class="form-group">
Expand All @@ -42,13 +42,13 @@ class AppengineLoadBalancerAdvancedSettingsComponent implements IComponentOption
</div>
</div>
</ng-form>
`;
public controller: any = AppengineLoadBalancerAdvancedSettingsCtrl;
}
`,
controller: AppengineLoadBalancerAdvancedSettingsCtrl
};

export const APPENGINE_LOAD_BALANCER_ADVANCED_SETTINGS = 'spinnaker.appengine.loadBalancer.advancedSettings.component';

module(APPENGINE_LOAD_BALANCER_ADVANCED_SETTINGS, []).component(
'appengineLoadBalancerAdvancedSettings',
new AppengineLoadBalancerAdvancedSettingsComponent(),
appengineLoadBalancerAdvancedSettingsComponent,
);
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class AppengineAllocationConfigurationRowCtrl implements IController {
}
}

class AppengineAllocationConfigurationRowComponent implements IComponentOptions {
public bindings: any = {
const appengineAllocationConfigurationRowComponent: IComponentOptions = {
bindings: {
allocationDescription: '<',
removeAllocation: '&',
serverGroupOptions: '<',
onAllocationChange: '&',
};
public template = `
},
template: `
<div class="form-group">
<div class="row">
<div class="col-md-7">
Expand Down Expand Up @@ -56,13 +56,13 @@ class AppengineAllocationConfigurationRowComponent implements IComponentOptions
</div>
</div>
</div>
`;
public controller: any = AppengineAllocationConfigurationRowCtrl;
}
`,
controller: AppengineAllocationConfigurationRowCtrl
};

export const APPENGINE_ALLOCATION_CONFIGURATION_ROW = 'spinnaker.appengine.allocationConfigurationRow.component';

module(APPENGINE_ALLOCATION_CONFIGURATION_ROW, []).component(
'appengineAllocationConfigurationRow',
new AppengineAllocationConfigurationRowComponent(),
appengineAllocationConfigurationRowComponent,
);
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ class AppengineLoadBalancerSettingsController implements IController {
}
}

class AppengineLoadBalancerSettingsComponent implements ng.IComponentOptions {
public bindings: any = { loadBalancer: '=', forPipelineConfig: '<', application: '<' };
public controller: any = AppengineLoadBalancerSettingsController;
public templateUrl: string = require('./basicSettings.component.html');
}
const appengineLoadBalancerSettingsComponent: ng.IComponentOptions = {
bindings: { loadBalancer: '=', forPipelineConfig: '<', application: '<' },
controller: AppengineLoadBalancerSettingsController,
templateUrl: require('./basicSettings.component.html')
};

export const APPENGINE_LOAD_BALANCER_BASIC_SETTINGS = 'spinnaker.appengine.loadBalancerSettings.component';

module(APPENGINE_LOAD_BALANCER_BASIC_SETTINGS, []).component(
'appengineLoadBalancerBasicSettings',
new AppengineLoadBalancerSettingsComponent(),
appengineLoadBalancerSettingsComponent,
);
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class AppengineStageAllocationLabelCtrl implements IController {
}
}

class AppengineStageAllocationLabel implements IComponentOptions {
public bindings: any = { allocationDescription: '<' };
public controller: any = AppengineStageAllocationLabelCtrl;
public template = `<input ng-model="$ctrl.inputViewValue" type="text" class="form-control input-sm" readonly/>`;
}
const appengineStageAllocationLabel: IComponentOptions = {
bindings: { allocationDescription: '<' },
controller: AppengineStageAllocationLabelCtrl,
template: `<input ng-model="$ctrl.inputViewValue" type="text" class="form-control input-sm" readonly/>`
};

class AppengineStageAllocationConfigurationRowCtrl implements IController {
public allocationDescription: IAppengineAllocationDescription;
Expand Down Expand Up @@ -85,22 +85,22 @@ class AppengineStageAllocationConfigurationRowCtrl implements IController {
}
}

class AppengineStageAllocationConfigurationRow implements IComponentOptions {
public bindings: any = {
const appengineStageAllocationConfigurationRow: IComponentOptions = {
bindings: {
application: '<',
region: '@',
account: '@',
allocationDescription: '<',
removeAllocation: '&',
serverGroupOptions: '<',
onAllocationChange: '&',
};
public controller: any = AppengineStageAllocationConfigurationRowCtrl;
public templateUrl = require('./stageAllocationConfigurationRow.component.html');
}
},
controller: AppengineStageAllocationConfigurationRowCtrl,
templateUrl: require('./stageAllocationConfigurationRow.component.html')
};

export const APPENGINE_STAGE_ALLOCATION_CONFIGURATION_ROW =
'spinnaker.appengine.stageAllocationConfigurationRow.component';
module(APPENGINE_STAGE_ALLOCATION_CONFIGURATION_ROW, [])
.component('appengineStageAllocationConfigurationRow', new AppengineStageAllocationConfigurationRow())
.component('appengineStageAllocationLabel', new AppengineStageAllocationLabel());
.component('appengineStageAllocationConfigurationRow', appengineStageAllocationConfigurationRow)
.component('appengineStageAllocationLabel', appengineStageAllocationLabel);
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ class AppengineConfigFileConfigurerCtrl implements IController {
}
}

class AppengineConfigFileConfigurerComponent implements ng.IComponentOptions {
public bindings: any = { command: '=' };
public controller: any = AppengineConfigFileConfigurerCtrl;
public templateUrl = require('./configFiles.component.html');
}
const appengineConfigFileConfigurerComponent: ng.IComponentOptions = {
bindings: { command: '=' },
controller: AppengineConfigFileConfigurerCtrl,
templateUrl: require('./configFiles.component.html')
};

export const APPENGINE_CONFIG_FILE_CONFIGURER = 'spinnaker.appengine.configFileConfigurer.component';
module(APPENGINE_CONFIG_FILE_CONFIGURER, []).component(
'appengineConfigFileConfigurer',
new AppengineConfigFileConfigurerComponent(),
appengineConfigFileConfigurerComponent,
);
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { module } from 'angular';

class AppengineDynamicBranchLabelComponent implements ng.IComponentOptions {
public bindings: any = { trigger: '<' };
public template = `
const appengineDynamicBranchLabelComponent: ng.IComponentOptions = {
bindings: { trigger: '<' },
template: `
<span ng-if="$ctrl.trigger.type === 'git'">
Resolved at runtime by <b>{{$ctrl.trigger.source}}</b> trigger: {{$ctrl.trigger.project}}/{{$ctrl.trigger.slug}}<span ng-if="$ctrl.trigger.branch">:{{$ctrl.trigger.branch}}</span>
</span>
<span ng-if="$ctrl.trigger.type === 'jenkins'">
Resolved at runtime by <b>Jenkins</b> trigger: {{$ctrl.trigger.master}}/{{$ctrl.trigger.job}}
</span>
`;
}
`
};

export const APPENGINE_DYNAMIC_BRANCH_LABEL = 'spinnaker.appengine.dynamicBranchLabel.component';
module(APPENGINE_DYNAMIC_BRANCH_LABEL, []).component(
'appengineDynamicBranchLabel',
new AppengineDynamicBranchLabelComponent(),
appengineDynamicBranchLabelComponent,
);
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ class CanaryAnalysisNameSelectorController implements IController {
}
}

class CanaryAnalysisNameSelectorComponent implements IComponentOptions {
public bindings: any = {
const canaryAnalysisNameSelectorComponent: IComponentOptions = {
bindings: {
model: '=',
className: '@',
};
public controller: any = CanaryAnalysisNameSelectorController;
public templateUrl: string = require('./canaryAnalysisNameSelector.component.html');
}
},
controller: CanaryAnalysisNameSelectorController,
templateUrl: require('./canaryAnalysisNameSelector.component.html')
};

export const CANARY_ANALYSIS_NAME_SELECTOR_COMPONENT = 'spinnaker.canary.canaryAnalysisNameSelector.component';
module(CANARY_ANALYSIS_NAME_SELECTOR_COMPONENT, []).component(
'canaryAnalysisNameSelector',
new CanaryAnalysisNameSelectorComponent(),
canaryAnalysisNameSelectorComponent,
);
14 changes: 7 additions & 7 deletions app/scripts/modules/core/src/account/accountTag.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class AccountTagController implements IController {
}
}

export class AccountTagComponent implements IComponentOptions {
public bindings: any = {
export const accountTagComponent: IComponentOptions = {
bindings: {
account: '<',
};
public controller: any = AccountTagController;
public template = '<span class="account-tag account-tag-{{$ctrl.accountType}}">{{$ctrl.account}}</span>';
}
},
controller: AccountTagController,
template: '<span class="account-tag account-tag-{{$ctrl.accountType}}">{{$ctrl.account}}</span>'
};

export const ACCOUNT_TAG_COMPONENT = 'spinnaker.core.account.accountTag';
module(ACCOUNT_TAG_COMPONENT, []).component('accountTag', new AccountTagComponent());
module(ACCOUNT_TAG_COMPONENT, []).component('accountTag', accountTagComponent);
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ export class DataSourceEditorController implements IController {
}
}

class ApplicationDataSourceEditorComponent implements ng.IComponentOptions {
public bindings: any = {
const applicationDataSourceEditorComponent: ng.IComponentOptions = {
bindings: {
application: '=',
};
public controller: any = DataSourceEditorController;
public templateUrl: string = require('./applicationDataSourceEditor.component.html');
}
},
controller: DataSourceEditorController,
templateUrl: require('./applicationDataSourceEditor.component.html')
};

export const APPLICATION_DATA_SOURCE_EDITOR = 'spinnaker.core.application.config.applicationDataSourceEditor';
module(APPLICATION_DATA_SOURCE_EDITOR, []).component(
'applicationDataSourceEditor',
new ApplicationDataSourceEditorComponent(),
applicationDataSourceEditorComponent,
);
Loading

0 comments on commit 3ffa4fb

Please sign in to comment.