mirror of
https://github.com/ansible/awx.git
synced 2026-03-29 14:55:09 -02:30
* Fix bug where capacity_adjustment sets to "1.00" when instance is toggled * Hookup websockets for instance group jobs and instance jobs * Add Wait spinner to Capacity_Adjuster, Instance association modal, and Instance group delete * Add updateDataset event listener to update instance and instanceGroups list after smartSearch query
57 lines
1.6 KiB
JavaScript
57 lines
1.6 KiB
JavaScript
function CapacityAdjuster (templateUrl, ProcessErrors, Wait) {
|
|
return {
|
|
scope: {
|
|
state: '='
|
|
},
|
|
templateUrl: templateUrl('instance-groups/capacity-adjuster/capacity-adjuster'),
|
|
restrict: 'E',
|
|
replace: true,
|
|
link: function(scope) {
|
|
const adjustment_values = [{
|
|
label: 'CPU',
|
|
value: scope.state.cpu_capacity,
|
|
},{
|
|
label: 'RAM',
|
|
value: scope.state.mem_capacity
|
|
}];
|
|
|
|
scope.min_capacity = _.min(adjustment_values, 'value');
|
|
scope.max_capacity = _.max(adjustment_values, 'value');
|
|
|
|
},
|
|
controller: function($http) {
|
|
const vm = this || {};
|
|
|
|
vm.slide = (state) => {
|
|
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');
|
|
});
|
|
};
|
|
},
|
|
controllerAs: 'vm'
|
|
};
|
|
}
|
|
|
|
CapacityAdjuster.$inject = [
|
|
'templateUrl',
|
|
'ProcessErrors',
|
|
'Wait'
|
|
];
|
|
|
|
export default CapacityAdjuster; |