-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
151 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
serverGroup/configure/serverGroupCapacitySelector.directive.js
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
serverGroup/configure/serverGroupCapacitySelector.directive.spec.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="clearfix"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<titus-server-group-capacity-selector command="command"></titus-server-group-capacity-selector> | ||
</div> | ||
</div> | ||
</div> |
70 changes: 70 additions & 0 deletions
70
serverGroup/configure/wizard/capacity/capacitySelector.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<div ng-if="!$ctrl.command.viewState.useSimpleCapacity"> | ||
<div class="form-group"> | ||
<div class="col-md-12"> | ||
<p>Sets up auto-scaling for this server group.</p> | ||
<p>To disable auto-scaling, use the <a href ng-click="$ctrl.setSimpleCapacity(true)">Simple Mode</a>.</p> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group" | ||
ng-if="!$ctrl.command.viewState.readOnlyFields.useSourceCapacity && $ctrl.command.viewState.mode === 'editPipeline'"> | ||
<div class="col-md-3 sm-label-right">Capacity</div> | ||
<div class="col-md-9 radio"> | ||
<label> | ||
<input type="radio" | ||
ng-model="$ctrl.command.useSourceCapacity" | ||
ng-value="true" | ||
id="useSourceCapacityTrue" | ||
ng-change="$ctrl.useSourceCapacityUpdated()"/> | ||
Copy the capacity from the current server group | ||
<help-field key="serverGroupCapacity.useSourceCapacityTrue"></help-field> | ||
</label> | ||
</div> | ||
<div class="col-md-9 col-md-offset-3 radio" ng-if="$ctrl.command.useSourceCapacity" style="padding-left: 35px"> | ||
<div> | ||
If no current server group is found, | ||
<select ng-model="$ctrl.command.preferSourceCapacity" | ||
ng-options="option.value as option.label for option in $ctrl.preferSourceCapacityOptions"/> | ||
</div> | ||
<div ng-if="$ctrl.command.preferSourceCapacity"> | ||
<b>Fallback values</b> | ||
<div ng-include="$ctrl.minMaxDesiredTemplate"></div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-md-9 col-md-offset-3 radio"> | ||
<label> | ||
<input type="radio" | ||
ng-model="$ctrl.command.useSourceCapacity" | ||
ng-value="false" | ||
id="useSourceCapacityFalse" | ||
ng-change="$ctrl.useSourceCapacityUpdated()"/> | ||
Let me specify the capacity | ||
<help-field key="serverGroupCapacity.useSourceCapacityFalse"></help-field> | ||
</label> | ||
</div> | ||
</div> | ||
<div ng-if="!$ctrl.command.useSourceCapacity || $ctrl.command.viewState.mode !== 'editPipeline'"> | ||
<div class="col-md-9 col-md-offset-3"> | ||
<div ng-include="$ctrl.minMaxDesiredTemplate"></div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div ng-if="$ctrl.command.viewState.useSimpleCapacity"> | ||
<div class="form-group"> | ||
<div class="col-md-12"> | ||
<p>Sets min, max, and desired instance counts to the same value.</p> | ||
|
||
<p> To allow true auto-scaling, use the <a href ng-click="$ctrl.setSimpleCapacity(false)">Advanced Mode</a>.</p> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right">Number of Instances</div> | ||
<div class="col-md-2"><input type="number" ng-change="$ctrl.setMinMax($ctrl.command.capacity.desired)" | ||
class="form-control input-sm" | ||
ng-model="$ctrl.command.capacity.desired" | ||
min="0" | ||
required/></div> | ||
</div> | ||
</div> |
38 changes: 38 additions & 0 deletions
38
serverGroup/configure/wizard/capacity/capacitySelector.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { module } from 'angular'; | ||
|
||
export const CAPACITY_SELECTOR = 'spinnaker.titus.serverGroup.configure.wizard.capacity.selector'; | ||
module(CAPACITY_SELECTOR, []) | ||
.component('titusServerGroupCapacitySelector', { | ||
bindings: { | ||
command: '=', | ||
}, | ||
templateUrl: require('./capacitySelector.component.html'), | ||
controller: function () { | ||
this.minMaxDesiredTemplate = require('./minMaxDesiredFields.template.html'); | ||
|
||
this.preferSourceCapacityOptions = [ | ||
{ label: 'fail the stage', value: undefined }, | ||
{ label: 'use fallback values', value: true }, | ||
]; | ||
|
||
this.useSourceCapacityUpdated = () => { | ||
if (!this.command.useSourceCapacity) { | ||
delete this.command.preferSourceCapacity; | ||
} | ||
}; | ||
|
||
this.setSimpleCapacity = (simpleCapacity: boolean) => { | ||
this.command.viewState.useSimpleCapacity = simpleCapacity; | ||
this.command.useSourceCapacity = false; | ||
this.setMinMax(this.command.capacity.desired); | ||
}; | ||
|
||
this.setMinMax = (newVal: number) => { | ||
if (this.command.viewState.useSimpleCapacity) { | ||
this.command.capacity.min = newVal; | ||
this.command.capacity.max = newVal; | ||
this.command.useSourceCapacity = false; | ||
} | ||
}; | ||
} | ||
}); |
32 changes: 32 additions & 0 deletions
32
serverGroup/configure/wizard/capacity/minMaxDesiredFields.template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<div> | ||
<div class="form-group row"> | ||
<div class="col-md-2">Min</div> | ||
<div class="col-md-2">Max</div> | ||
<div class="col-md-2">Desired</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-2"> | ||
<input type="number" | ||
class="form-control input-sm" | ||
ng-model="$ctrl.command.capacity.min" | ||
min="0" | ||
max="{{$ctrl.command.capacity.max}}" | ||
required/> | ||
</div> | ||
<div class="col-md-2"> | ||
<input type="number" | ||
class="form-control input-sm" | ||
ng-model="$ctrl.command.capacity.max" | ||
min="{{$ctrl.command.capacity.min}}" | ||
required/> | ||
</div> | ||
<div class="col-md-2"> | ||
<input type="number" | ||
class="form-control input-sm" | ||
ng-model="$ctrl.command.capacity.desired" | ||
min="{{$ctrl.command.capacity.min}}" | ||
max="{{$ctrl.command.capacity.max}}" | ||
required/> | ||
</div> | ||
</div> | ||
</div> |