Add support of ScalingPolicy
Change-Id: I9cc4e8097e0be5ae9d6420cd60eeb4e4b7be2f1c Story: #2002028 Task: #19669
This commit is contained in:
parent
a65f0928bb
commit
4b0fcd3016
@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="55" height="55" viewBox="0 0 55 55">
|
||||||
|
<rect id="backgroundrect" width="100%" height="100%" x="0" y="0" fill="none" stroke="none" class="" style=""/><g class="currentLayer" style=""><title>Layer 1</title><path d="M42.1771287043557,41.60010476176677 v-20.074996256989024 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h20.07495656319317 q0.2398662089352129,0 0.41515305392632923,-0.17528719158216585 t0.17528684499111694,-0.4151538747998659 zm2.3617595956697843,-20.074996256989024 v20.074996256989024 q0,1.2177846994129382 -0.8672086015349999,2.084995015661544 t-2.084990893052231,0.8672103162486069 h-20.07495656319317 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 zm-7.085278787009353,-7.085292796584362 v2.952205331910151 h-2.3617595956697843 v-2.952205331910151 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h2.9521994945872314 v2.3617642655281212 h-2.9521994945872314 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 z" id="svg_1" class="" stroke="#3f51b5" stroke-opacity="1" fill="#3f51b5" fill-opacity="1"/></g><g><title>Layer 2</title>
|
||||||
|
<g><text x="25" y="40" style="fill: #3f51b5; stroke: #3f51b5; font-size: 20px;font-family:Helvetica;" id="svg_1" class="">P</text></g>
|
||||||
|
<g id="svg_3">
|
||||||
|
<circle class="frame" r="25" style="fill:none;fill-opacity=0.0;stroke-width:3;stroke:#3f51b5" cy="27.75" cx="27.5" id="svg_2"/>
|
||||||
|
</g></g></svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="55" height="55" viewBox="0 0 55 55">
|
||||||
|
<rect id="backgroundrect" width="100%" height="100%" x="0" y="0" fill="none" stroke="none" class="" style=""/><g class="currentLayer" style=""><title>Layer 1</title><path d="M42.1771287043557,41.60010476176677 v-20.074996256989024 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h20.07495656319317 q0.2398662089352129,0 0.41515305392632923,-0.17528719158216585 t0.17528684499111694,-0.4151538747998659 zm2.3617595956697843,-20.074996256989024 v20.074996256989024 q0,1.2177846994129382 -0.8672086015349999,2.084995015661544 t-2.084990893052231,0.8672103162486069 h-20.07495656319317 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 zm-7.085278787009353,-7.085292796584362 v2.952205331910151 h-2.3617595956697843 v-2.952205331910151 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h2.9521994945872314 v2.3617642655281212 h-2.9521994945872314 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 z" id="svg_1" class="" stroke="#808080" stroke-opacity="1" fill="#808080" fill-opacity="1"/></g><g><title>Layer 2</title>
|
||||||
|
<g><text x="25" y="40" style="fill: #808080; stroke: #808080; font-size: 20px;font-family:Helvetica;" id="svg_1" class="">P</text></g>
|
||||||
|
<g id="svg_3">
|
||||||
|
<circle class="frame" r="25" style="fill:none;fill-opacity=0.0;stroke-width:3;stroke:#808080" cy="27.75" cx="27.5" id="svg_2"/>
|
||||||
|
</g></g></svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="55" height="55" viewBox="0 0 55 55">
|
||||||
|
<rect id="backgroundrect" width="100%" height="100%" x="0" y="0" fill="none" stroke="none" class="" style=""/><g class="currentLayer" style=""><title>Layer 1</title><path d="M42.1771287043557,41.60010476176677 v-20.074996256989024 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h20.07495656319317 q0.2398662089352129,0 0.41515305392632923,-0.17528719158216585 t0.17528684499111694,-0.4151538747998659 zm2.3617595956697843,-20.074996256989024 v20.074996256989024 q0,1.2177846994129382 -0.8672086015349999,2.084995015661544 t-2.084990893052231,0.8672103162486069 h-20.07495656319317 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 zm-7.085278787009353,-7.085292796584362 v2.952205331910151 h-2.3617595956697843 v-2.952205331910151 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h2.9521994945872314 v2.3617642655281212 h-2.9521994945872314 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 z" id="svg_1" class="" stroke="green" stroke-opacity="1" fill="green" fill-opacity="1"/></g><g><title>Layer 2</title>
|
||||||
|
<g><text x="25" y="40" style="fill: green; stroke: green; font-size: 20px;font-family:Helvetica;" id="svg_1" class="">P</text></g>
|
||||||
|
<g id="svg_3">
|
||||||
|
<circle class="frame" r="25" style="fill:none;fill-opacity=0.0;stroke-width:3;stroke:green" cy="27.75" cx="27.5" id="svg_2"/>
|
||||||
|
</g></g></svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="55" height="55" viewBox="0 0 55 55">
|
||||||
|
<rect id="backgroundrect" width="100%" height="100%" x="0" y="0" fill="none" stroke="none" class="" style=""/><g class="currentLayer" style=""><title>Layer 1</title><path d="M42.1771287043557,41.60010476176677 v-20.074996256989024 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h20.07495656319317 q0.2398662089352129,0 0.41515305392632923,-0.17528719158216585 t0.17528684499111694,-0.4151538747998659 zm2.3617595956697843,-20.074996256989024 v20.074996256989024 q0,1.2177846994129382 -0.8672086015349999,2.084995015661544 t-2.084990893052231,0.8672103162486069 h-20.07495656319317 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 zm-7.085278787009353,-7.085292796584362 v2.952205331910151 h-2.3617595956697843 v-2.952205331910151 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h2.9521994945872314 v2.3617642655281212 h-2.9521994945872314 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 z" id="svg_1" class="" stroke="#C82128" stroke-opacity="1" fill="#C82128" fill-opacity="1"/></g><g><title>Layer 2</title>
|
||||||
|
<g><text x="25" y="40" style="fill: #C82128; stroke: #C82128; font-size: 20px;font-family:Helvetica;" id="svg_1" class="">P</text></g>
|
||||||
|
<g id="svg_3">
|
||||||
|
<circle class="frame" r="25" style="fill:none;fill-opacity=0.0;stroke-width:3;stroke:#C82128" cy="27.75" cx="27.5" id="svg_2"/>
|
||||||
|
</g></g></svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,58 @@
|
|||||||
|
<md-tabs md-dynamic-height md-stretch-tabs="always" md-border-bottom>
|
||||||
|
<md-tab label="Properties" >
|
||||||
|
<md-content layout-padding>
|
||||||
|
|
||||||
|
<md-input-container class="md-block" flex-gt-xs>
|
||||||
|
<label>Adjustment Type</label>
|
||||||
|
<md-select ng-model="$ctrl.scalingpolicy.adjustment_type" name="adjustment_type" aria-label="Adjustment Type" required>
|
||||||
|
<md-option ng-repeat="at in adjustment_types" ng-value="at.value">{$ at.name $}</md-option>
|
||||||
|
</md-select>
|
||||||
|
</md-input-container>
|
||||||
|
|
||||||
|
<md-input-container class="md-block" flex-gt-xs>
|
||||||
|
<label>Scaling Adjustment</label>
|
||||||
|
<input ng-model="$ctrl.scalingpolicy.scaling_adjustment" name="scaling_adjustment" type="number" required/>
|
||||||
|
<div ng-messages="$ctrl.formReference.scaling_adjustment.$error" role="alert" multiple>
|
||||||
|
<div ng-message="number">You did not enter a valid number.</div>
|
||||||
|
<div ng-message="required">You must supply a scaling adjustment size.</div>
|
||||||
|
</div>
|
||||||
|
</md-input-container>
|
||||||
|
|
||||||
|
<md-input-container class="md-block" flex-gt-xs>
|
||||||
|
<label>Auto Scaling Group</label>
|
||||||
|
<input ng-model="$ctrl.scalingpolicy.auto_scaling_group_id" name="auto_scaling_group_id" type="text" ng-pattern="auto_scaling_group_id_pattern" ng-disabled="auto_scaling_group_id_disabled" required/>
|
||||||
|
<div ng-messages="$ctrl.formReference.auto_scaling_group_id.$error" role="alert" multiple>
|
||||||
|
<div ng-message="pattern">You must supply a valid ID.</div>
|
||||||
|
<div ng-message="required">You must supply a auto scaling group ID.</div>
|
||||||
|
</div>
|
||||||
|
</md-input-container>
|
||||||
|
|
||||||
|
<md-input-container class="md-block" flex-gt-xs>
|
||||||
|
<label>Cooldown</label>
|
||||||
|
<input ng-model="$ctrl.scalingpolicy.cooldown" name="cooldown" type="number" min="0"/>
|
||||||
|
<div ng-messages="$ctrl.formReference.cooldown.$error" role="alert" multiple>
|
||||||
|
<div ng-message="number">You did not enter a valid number.</div>
|
||||||
|
<div ng-message="min">You did not enter a positive number.</div>
|
||||||
|
</div>
|
||||||
|
</md-input-container>
|
||||||
|
|
||||||
|
<md-input-container class="md-block" flex-gt-xs>
|
||||||
|
<label>Min Adjustment Step</label>
|
||||||
|
<input ng-model="$ctrl.scalingpolicy.min_adjustment_step" name="min_adjustment_step" type="number" ng-pattern="validate_integer" min="0" ng-disabled="min_adj_step_disabled"/>
|
||||||
|
<div ng-messages="$ctrl.formReference.min_adjustment_step.$error" role="alert" multiple>
|
||||||
|
<div ng-message="number">You did not enter a valid integer.</div>
|
||||||
|
<div ng-message="min">You did not enter a positive number.</div>
|
||||||
|
<div ng-message="pattern">You must supply an integer.</div>
|
||||||
|
</div>
|
||||||
|
</md-input-container>
|
||||||
|
|
||||||
|
</md-content>
|
||||||
|
</md-tab>
|
||||||
|
|
||||||
|
<md-tab label="Depends on">
|
||||||
|
<md-content layout-padding>
|
||||||
|
<depends-on dependson='dependson'></depends-on>
|
||||||
|
</md-content>
|
||||||
|
</md-tab>
|
||||||
|
|
||||||
|
</md-tabs>
|
@ -0,0 +1,130 @@
|
|||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/* OS::Heat::ScalingPolicy
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
angular.module('horizon.dashboard.project.heat_dashboard.template_generator')
|
||||||
|
.value('osHeatScalingPolicySettings',
|
||||||
|
{
|
||||||
|
resource_key: "OS__Heat__ScalingPolicy",
|
||||||
|
admin: false,
|
||||||
|
icon: {
|
||||||
|
class: 'fa-clone',
|
||||||
|
name: 'OS::Heat::ScalingPolicy',
|
||||||
|
code: '\uf24d',
|
||||||
|
color: '#0bb238'
|
||||||
|
},
|
||||||
|
label: 'name',
|
||||||
|
modal_component: '<os-heat-scalingpolicy scalingpolicy="resource" dependson="dependson" connectedoptions="connectedoptions" form-reference="resourceForm"></os-heat-scalingpolicy>',
|
||||||
|
edge_settings: {
|
||||||
|
'OS__Heat__AutoScalingGroup': {
|
||||||
|
'type': 'property',
|
||||||
|
'property': 'auto_scaling_group_id',
|
||||||
|
'limit': 1,
|
||||||
|
'occupied': false, //* whether can be connected to any other resource */
|
||||||
|
'lonely': false, //* whether can be connected to one more other resource */
|
||||||
|
'modal': null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
necessary_properties: ['adjustment_type', 'scaling_adjustment', 'auto_scaling_group_id']
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Register the resource to globals
|
||||||
|
angular.module('horizon.dashboard.project.heat_dashboard.template_generator')
|
||||||
|
.run(['osHeatScalingPolicySettings','hotgenGlobals', function(osHeatScalingPolicySettings, hotgenGlobals){
|
||||||
|
hotgenGlobals.update_resource_icons(
|
||||||
|
osHeatScalingPolicySettings.resource_key ,
|
||||||
|
osHeatScalingPolicySettings.icon);
|
||||||
|
|
||||||
|
hotgenGlobals.update_resource_components(
|
||||||
|
osHeatScalingPolicySettings.resource_key,
|
||||||
|
osHeatScalingPolicySettings.modal_component);
|
||||||
|
|
||||||
|
hotgenGlobals.update_node_labels(
|
||||||
|
osHeatScalingPolicySettings.resource_key,
|
||||||
|
osHeatScalingPolicySettings.label);
|
||||||
|
|
||||||
|
hotgenGlobals.update_edge_directions(
|
||||||
|
osHeatScalingPolicySettings.resource_key,
|
||||||
|
osHeatScalingPolicySettings.edge_settings);
|
||||||
|
}]);
|
||||||
|
|
||||||
|
|
||||||
|
// Define <os-heat-scalingpolicy> controller
|
||||||
|
function osHeatScalingPolicyController($scope, hotgenGlobals, hotgenNotify, validationRules) {
|
||||||
|
this.$onInit = function(){
|
||||||
|
$scope.dependson = this.dependson;
|
||||||
|
$scope.min_adj_step_disabled = false;
|
||||||
|
if (this.scalingpolicy.adjustment_type !=='percent_change_in_capacity'){
|
||||||
|
this.scalingpolicy.min_adjustment_step = '';
|
||||||
|
$scope.min_adj_step_disabled = true;
|
||||||
|
}
|
||||||
|
$scope.auto_scaling_group_id_disabled = false;
|
||||||
|
$scope.auto_scaling_group_id_pattern = $scope.validate_uuid4;
|
||||||
|
if (this.connectedoptions.auto_scaling_group_id){
|
||||||
|
for (var idx in this.connectedoptions.auto_scaling_group_id){
|
||||||
|
this.scalingpolicy.auto_scaling_group_id = this.connectedoptions.auto_scaling_group_id[idx].value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$scope.auto_scaling_group_id_disabled = true;
|
||||||
|
$scope.auto_scaling_group_id_pattern = "";
|
||||||
|
} else{
|
||||||
|
if (this.scalingpolicy.auto_scaling_group_id && this.scalingpolicy.auto_scaling_group_id.indexOf('get_resource') >= 0){
|
||||||
|
// no edge with AutoScalingGroup but still holding get_resource dependency,
|
||||||
|
// consider edge is removed and empty auto_scaling_group_id
|
||||||
|
this.scalingpolicy.auto_scaling_group_id = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.auto_scaling_group_id_disabled = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.validate_integer = validationRules['integer'];
|
||||||
|
$scope.validate_uuid4= validationRules['uuid4'];
|
||||||
|
$scope.controller = this;
|
||||||
|
$scope.adjustment_types = [
|
||||||
|
{'value': 'change_in_capacity', 'name': 'Change in Capacity'},
|
||||||
|
{'value': 'exact_capacity', 'name': 'Exact Capacity'},
|
||||||
|
{'value': 'percent_change_in_capacity', 'name': 'Percent Change in Capacity'},
|
||||||
|
];
|
||||||
|
|
||||||
|
$scope.$watch('controller.scalingpolicy.adjustment_type', function(newValue, oldValue){
|
||||||
|
if (oldValue === newValue){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (newValue === 'percent_change_in_capacity'){
|
||||||
|
$scope.min_adj_step_disabled = false;
|
||||||
|
} else{
|
||||||
|
$scope.controller.scalingpolicy.min_adjustment_step = '';
|
||||||
|
$scope.min_adj_step_disabled = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function osHeatScalingPolicyPath (basePath){
|
||||||
|
return basePath + 'js/resources/os__heat__scalingpolicy/os__heat__scalingpolicy.html';
|
||||||
|
}
|
||||||
|
|
||||||
|
osHeatScalingPolicyController.$inject = ['$scope', 'hotgenGlobals', 'hotgenNotify',
|
||||||
|
'horizon.dashboard.project.heat_dashboard.template_generator.validationRules',
|
||||||
|
];
|
||||||
|
|
||||||
|
osHeatScalingPolicyPath.$inject = ['horizon.dashboard.project.heat_dashboard.template_generator.basePath'];
|
||||||
|
|
||||||
|
angular.module('horizon.dashboard.project.heat_dashboard.template_generator')
|
||||||
|
.component('osHeatScalingpolicy', {
|
||||||
|
templateUrl: osHeatScalingPolicyPath,
|
||||||
|
controller: osHeatScalingPolicyController,
|
||||||
|
bindings: {
|
||||||
|
'scalingpolicy': '=',
|
||||||
|
'dependson': '=',
|
||||||
|
'connectedoptions': '<',
|
||||||
|
'formReference': '<',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,93 @@
|
|||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
describe('component os-heat-scalingpolicy', function(){
|
||||||
|
|
||||||
|
beforeEach(module('horizon.dashboard.project.heat_dashboard.template_generator'));
|
||||||
|
|
||||||
|
beforeEach(module('appTemplates'));
|
||||||
|
|
||||||
|
var $scope, $isolateScope, $compile;
|
||||||
|
var hotgenGlobals;
|
||||||
|
var element;
|
||||||
|
|
||||||
|
beforeEach(inject(function($injector) {
|
||||||
|
$scope = $injector.get('$rootScope').$new();
|
||||||
|
$compile = $injector.get('$compile');
|
||||||
|
|
||||||
|
$scope.resource = {};
|
||||||
|
$scope.dependson = [];
|
||||||
|
$scope.resourceForm = {};
|
||||||
|
$scope.connectedoptions = [];
|
||||||
|
|
||||||
|
// element will enable you to test your directive's element on the DOM
|
||||||
|
element = $compile(angular.element('<os-heat-scalingpolicy scalingpolicy="resource" '+
|
||||||
|
'dependson="dependson" connectedoptions="connectedoptions" '+
|
||||||
|
'form-reference="resourceForm">'+
|
||||||
|
'</os-heat-scalingpolicy>'))($scope);
|
||||||
|
|
||||||
|
// Digest needs to be called to set any values on the directive's scope
|
||||||
|
$scope.$digest();
|
||||||
|
|
||||||
|
$isolateScope = element.isolateScope();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('find tab title Properties', function() {
|
||||||
|
expect(element.find('span').html()).toContain("Properties");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('find tab title with connectedoptions set', function() {
|
||||||
|
$scope.resource = {auto_scaling_group_id: 'auto-scaling-group-uuid'}
|
||||||
|
$scope.connectedoptions = {auto_scaling_group_id: [{value: 'auto-scaling-group-uuid'}],
|
||||||
|
};
|
||||||
|
|
||||||
|
element = $compile(angular.element('<os-heat-scalingpolicy scalingpolicy="resource" '+
|
||||||
|
'dependson="dependson" connectedoptions="connectedoptions" '+
|
||||||
|
'form-reference="resourceForm">'+
|
||||||
|
'</os-heat-scalingpolicy>'))($scope);
|
||||||
|
|
||||||
|
$scope.$digest();
|
||||||
|
|
||||||
|
$isolateScope = element.isolateScope();
|
||||||
|
|
||||||
|
expect(element.find('span').html()).toContain("Properties");
|
||||||
|
expect($isolateScope.$ctrl.scalingpolicy.auto_scaling_group_id).toEqual('auto-scaling-group-uuid');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('find tab title with auto_scaling_group_id set', function() {
|
||||||
|
$scope.resource = {auto_scaling_group_id: '{ get_resource: AutoScalingGroup_1 }'}
|
||||||
|
|
||||||
|
element = $compile(angular.element('<os-heat-scalingpolicy scalingpolicy="resource" '+
|
||||||
|
'dependson="dependson" connectedoptions="connectedoptions" '+
|
||||||
|
'form-reference="resourceForm">'+
|
||||||
|
'</os-heat-scalingpolicy>'))($scope);
|
||||||
|
|
||||||
|
$scope.$digest();
|
||||||
|
$isolateScope = element.isolateScope();
|
||||||
|
expect(element.find('span').html()).toContain("Properties");
|
||||||
|
expect($isolateScope.$ctrl.scalingpolicy.auto_scaling_group_id).toEqual('');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('find tab title with adjustment type set', function() {
|
||||||
|
$scope.resource = {adjustment_type: 'percent_change_in_capacity'}
|
||||||
|
element = $compile(angular.element('<os-heat-scalingpolicy scalingpolicy="resource" '+
|
||||||
|
'dependson="dependson" connectedoptions="connectedoptions" '+
|
||||||
|
'form-reference="resourceForm">'+
|
||||||
|
'</os-heat-scalingpolicy>'))($scope);
|
||||||
|
$scope.$digest();
|
||||||
|
$isolateScope = element.isolateScope();
|
||||||
|
expect(element.find('span').html()).toContain("Properties");
|
||||||
|
|
||||||
|
$scope.resource = {adjustment_type: 'change_in_capacity'}
|
||||||
|
element = $compile(angular.element('<os-heat-scalingpolicy scalingpolicy="resource" '+
|
||||||
|
'dependson="dependson" connectedoptions="connectedoptions" '+
|
||||||
|
'form-reference="resourceForm">'+
|
||||||
|
'</os-heat-scalingpolicy>'))($scope);
|
||||||
|
$scope.$digest();
|
||||||
|
$isolateScope = element.isolateScope();
|
||||||
|
expect(element.find('span').html()).toContain("Properties");
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="55" height="55" viewBox="0 0 55 55">
|
||||||
|
<rect id="backgroundrect" width="100%" height="100%" x="0" y="0" fill="none" stroke="none" class="" style=""/><g class="currentLayer" style=""><title>Layer 1</title><path d="M42.1771287043557,41.60010476176677 v-20.074996256989024 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h20.07495656319317 q0.2398662089352129,0 0.41515305392632923,-0.17528719158216585 t0.17528684499111694,-0.4151538747998659 zm2.3617595956697843,-20.074996256989024 v20.074996256989024 q0,1.2177846994129382 -0.8672086015349999,2.084995015661544 t-2.084990893052231,0.8672103162486069 h-20.07495656319317 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 zm-7.085278787009353,-7.085292796584362 v2.952205331910151 h-2.3617595956697843 v-2.952205331910151 q0,-0.2398666832176999 -0.17528684499111694,-0.4151538747998659 t-0.41515305392632923,-0.17528719158216585 h-20.07495656319317 q-0.2398662089352129,0 -0.41515305392632923,0.17528719158216585 t-0.17528684499111694,0.4151538747998659 v20.074996256989024 q0,0.2398666832176999 0.17528684499111694,0.4151538747998659 t0.41515305392632923,0.17528719158216585 h2.9521994945872314 v2.3617642655281212 h-2.9521994945872314 q-1.2177822915172334,0 -2.084990893052231,-0.8672103162486069 t-0.8672086015349999,-2.084995015661544 v-20.074996256989024 q0,-1.2177846994129382 0.8672086015349999,-2.084995015661544 t2.084990893052231,-0.8672103162486069 h20.07495656319317 q1.2177822915172334,0 2.084990893052231,0.8672103162486069 t0.8672086015349999,2.084995015661544 z" id="svg_1" class="" stroke="#000000" stroke-opacity="1" fill="#000000" fill-opacity="1"/></g><g><title>Layer 2</title>
|
||||||
|
<g><text x="25" y="40" style="fill: #000000; stroke: #000; font-size: 20px;font-family:Helvetica;" id="svg_1" class="">P</text></g>
|
||||||
|
<g id="svg_3">
|
||||||
|
<circle class="frame" r="25" style="fill:none;fill-opacity=0.0;stroke-width:3;stroke:black" cy="27.75" cx="27.5" id="svg_2"/>
|
||||||
|
</g></g></svg>
|
After Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue
Block a user