forked from openstack/cloudkitty-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudkitty.controller.js
More file actions
47 lines (37 loc) · 1.57 KB
/
cloudkitty.controller.js
File metadata and controls
47 lines (37 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(function () {
'use strict';
angular
.module('horizon.dashboard.cloudkitty')
.controller('CloudkittyStepController', CloudkittyStepController);
CloudkittyStepController.$inject = [
'$scope',
'horizon.framework.widgets.wizard.events',
'$http',
'$window'
];
function CloudkittyStepController($scope, wizardEvents, $http, $window) {
var onSwitch = $scope.$on(wizardEvents.ON_SWITCH, function(evt, args) {
if(!$scope.model.newInstanceSpec.flavor) return false;
var disk_total = $scope.model.newInstanceSpec.flavor.ephemeral + $scope.model.newInstanceSpec.flavor.disk;
var desc_form = {
'metadata': {
'flavor_name': $scope.model.newInstanceSpec.flavor.name,
'flavor_id': $scope.model.newInstanceSpec.flavor.id,
'source_type': $scope.model.newInstanceSpec.source_type.type,
'source_val': $scope.model.newInstanceSpec.source[0].id,
'image_id': $scope.model.newInstanceSpec.source[0].id,
},
'vcpus': $scope.model.newInstanceSpec.flavor.vcpus,
'disk': $scope.model.newInstanceSpec.flavor.disk,
'ephemeral': $scope.model.newInstanceSpec.flavor.ephemeral,
'disk_total': disk_total,
'disk_total_display': disk_total,
'ram': $scope.model.newInstanceSpec.flavor.ram,
}
var form_data = [{"desc": desc_form, "volume": $scope.model.newInstanceSpec.instance_count}];
$http.post($window.WEBROOT + 'project/rating/quote', form_data).then(function(res, status) {
$scope.price = res.data;
});
});
}
})();