Merge "Updated dashboard for Angular" into stable/mitaka
This commit is contained in:
commit
29e6269b25
6
cloudkittydashboard/enabled/_31000_cloudkitty.py
Normal file
6
cloudkittydashboard/enabled/_31000_cloudkitty.py
Normal file
@ -0,0 +1,6 @@
|
||||
FEATURE = 'cloudkitty'
|
||||
|
||||
ADD_ANGULAR_MODULES = [
|
||||
'horizon.dashboard.cloudkitty',
|
||||
]
|
||||
AUTO_DISCOVER_STATIC_FILES = True
|
@ -0,0 +1,44 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('horizon.dashboard.cloudkitty')
|
||||
.controller('CloudkittyStepController', CloudkittyStepController);
|
||||
|
||||
CloudkittyStepController.$inject = [
|
||||
'$scope',
|
||||
'horizon.framework.widgets.wizard.events',
|
||||
'$http'
|
||||
];
|
||||
|
||||
function CloudkittyStepController($scope, wizardEvents, $http) {
|
||||
|
||||
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 = {
|
||||
'flavor': $scope.model.newInstanceSpec.flavor.name,
|
||||
'flavor_id': $scope.model.newInstanceSpec.flavor.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,
|
||||
'source_type': $scope.model.newInstanceSpec.source_type.type,
|
||||
'source_val': $scope.model.newInstanceSpec.source[0].id,
|
||||
'image_id': $scope.model.newInstanceSpec.source[0].id,
|
||||
}
|
||||
|
||||
var form_data = [{"service": "compute", "desc": desc_form, "volume": $scope.model.newInstanceSpec.instance_count}];
|
||||
|
||||
$http.post('/dashboard/project/rating/quote', form_data).then(function(res, status) {
|
||||
$scope.price = res.data;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
@ -0,0 +1,26 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var ck = angular.module('horizon.dashboard.cloudkitty', ['horizon.dashboard.project.workflow']).config(config)
|
||||
|
||||
config.$inject = [
|
||||
'$provide',
|
||||
'$windowProvider'
|
||||
];
|
||||
|
||||
function config($provide, $windowProvider) {
|
||||
|
||||
$provide.decorator("horizon.dashboard.project.workflow.launch-instance.workflow", ['$delegate', function ($delegate) {
|
||||
var workflow = $delegate;
|
||||
workflow.append({
|
||||
formName: 'CloudkittyForm',
|
||||
templateUrl: '/dashboard/static/cloudkitty/templates/cloudkitty-step.html',
|
||||
helpUrl: '/dashboard/static/cloudkitty/templates/cloudkitty-help.html',
|
||||
title: 'Price'
|
||||
});
|
||||
return workflow;
|
||||
}]);
|
||||
|
||||
}
|
||||
|
||||
})();
|
10
cloudkittydashboard/static/cloudkitty/js/cloudkitty.spec.js
Normal file
10
cloudkittydashboard/static/cloudkitty/js/cloudkitty.spec.js
Normal file
@ -0,0 +1,10 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
describe('horizon.dashboard.cloudkitty', function () {
|
||||
it('should be defined', function () {
|
||||
expect(angular.module('horizon.dashboard.cloudkitty')).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<h1>Price for instance(s)</h1>
|
||||
</div>
|
@ -0,0 +1,6 @@
|
||||
<div class="ck" ng-controller="CloudkittyStepController as ctrl">
|
||||
<h3>Price</h3>
|
||||
<p>
|
||||
<span id="price">{$ price | currency $}</span>
|
||||
</p>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user