mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 19:35:02 -02:30
Merge pull request #2585 from marshmalien/fix/2545/forks-capacity-adjuster-slider
Show fork value on capacity adjuster slider
This commit is contained in:
@@ -278,9 +278,10 @@
|
|||||||
height: 1px;
|
height: 1px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&::-webkit-slider-thumb {
|
&::-webkit-slider-thumb {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
background: @at-color-input-slider-thumb;
|
background-color: @at-color-input-slider-thumb;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -288,6 +289,24 @@
|
|||||||
margin-top: -7px;
|
margin-top: -7px;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=range]::-moz-range-thumb {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
background-color: @at-color-input-slider-thumb;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
height: 16px;
|
||||||
|
width: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=range]::-moz-range-track {
|
||||||
|
background: @at-color-input-slider-track;
|
||||||
|
cursor: pointer;
|
||||||
|
height: 1px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=range][disabled] {
|
input[type=range][disabled] {
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ function CapacityAdjuster (templateUrl, ProcessErrors, Wait, strings) {
|
|||||||
templateUrl: templateUrl('instance-groups/capacity-adjuster/capacity-adjuster'),
|
templateUrl: templateUrl('instance-groups/capacity-adjuster/capacity-adjuster'),
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
replace: true,
|
replace: true,
|
||||||
link: function(scope) {
|
link: function(scope, el, attrs, controller) {
|
||||||
|
const capacityAdjusterController = controller;
|
||||||
const adjustment_values = [{
|
const adjustment_values = [{
|
||||||
label: strings.get('capacityAdjuster.CPU'),
|
label: strings.get('capacityAdjuster.CPU'),
|
||||||
value: scope.state.cpu_capacity,
|
value: scope.state.cpu_capacity,
|
||||||
@@ -18,32 +19,48 @@ function CapacityAdjuster (templateUrl, ProcessErrors, Wait, strings) {
|
|||||||
|
|
||||||
scope.min_capacity = _.min(adjustment_values, 'value');
|
scope.min_capacity = _.min(adjustment_values, 'value');
|
||||||
scope.max_capacity = _.max(adjustment_values, 'value');
|
scope.max_capacity = _.max(adjustment_values, 'value');
|
||||||
},
|
|
||||||
controller: function($http) {
|
|
||||||
const vm = this || {};
|
|
||||||
|
|
||||||
vm.slide = (state) => {
|
capacityAdjusterController.init();
|
||||||
Wait('start');
|
|
||||||
const data = {
|
|
||||||
"capacity_adjustment": `${state.capacity_adjustment}`
|
|
||||||
};
|
|
||||||
const req = {
|
|
||||||
method: 'PUT',
|
|
||||||
url: state.url,
|
|
||||||
data
|
|
||||||
};
|
|
||||||
$http(req)
|
|
||||||
.catch(({data, status}) => {
|
|
||||||
ProcessErrors(data, status, null, {
|
|
||||||
hdr: 'Error!',
|
|
||||||
msg: 'Call failed. Return status: ' + status
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
Wait('stop');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
controller: ['$scope', '$http', 'InstanceGroupsStrings',
|
||||||
|
function($scope, $http, strings) {
|
||||||
|
const vm = this || {};
|
||||||
|
vm.strings = strings;
|
||||||
|
|
||||||
|
function computeForks () {
|
||||||
|
$scope.forks = Math.floor($scope.min_capacity.value + ($scope.max_capacity.value - $scope.min_capacity.value) * $scope.state.capacity_adjustment);
|
||||||
|
}
|
||||||
|
|
||||||
|
vm.init = () => {
|
||||||
|
computeForks();
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.slide = (state) => {
|
||||||
|
Wait('start');
|
||||||
|
|
||||||
|
computeForks();
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
"capacity_adjustment": `${state.capacity_adjustment}`
|
||||||
|
};
|
||||||
|
const req = {
|
||||||
|
method: 'PUT',
|
||||||
|
url: state.url,
|
||||||
|
data
|
||||||
|
};
|
||||||
|
$http(req)
|
||||||
|
.catch(({data, status}) => {
|
||||||
|
ProcessErrors(data, status, null, {
|
||||||
|
hdr: 'Error!',
|
||||||
|
msg: 'Call failed. Return status: ' + status
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
Wait('stop');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
],
|
||||||
controllerAs: 'vm'
|
controllerAs: 'vm'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<div class="CapacityAdjuster">
|
<div class="CapacityAdjuster">
|
||||||
<span class="CapacityAdjuster-valueLabel">{{ state.capacity_adjustment }}</span>
|
<span class="CapacityAdjuster-valueLabel">
|
||||||
|
{{ forks }} {{:: vm.strings.get('capacityAdjuster.FORKS')}}
|
||||||
|
</span>
|
||||||
<div class="at-InputSlider">
|
<div class="at-InputSlider">
|
||||||
<p>{{min_capacity.label}} {{min_capacity.value}}</p>
|
<p>{{min_capacity.label}} {{min_capacity.value}}</p>
|
||||||
<input string-to-number
|
<input string-to-number
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ function InstanceGroupsStrings (BaseString) {
|
|||||||
|
|
||||||
ns.capacityAdjuster = {
|
ns.capacityAdjuster = {
|
||||||
CPU: t.s('CPU'),
|
CPU: t.s('CPU'),
|
||||||
RAM: t.s('RAM')
|
RAM: t.s('RAM'),
|
||||||
|
FORKS: t.s('Forks')
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.jobs = {
|
ns.jobs = {
|
||||||
|
|||||||
Reference in New Issue
Block a user