Add flavor in wizard

Change-Id: I77c433a4e7bc0b1ed5077f59439d39750f6ed865
This commit is contained in:
jiahuay 2014-08-15 17:14:19 -07:00
parent 723190803f
commit 8ba0dd710a
5 changed files with 131 additions and 55 deletions

View File

@ -23,18 +23,37 @@ compassAppDev.run(function($httpBackend, settings, $http) {
"display": "OpenStack",
"os_installer": "cobbler",
"package_installer": "chef",
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
"flavors": [{
"display_name": "allinone",
"id": 1,
"name": "allinone",
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}, {
"display_name": "Storage",
"name": "os-block-storage-worker"
}]
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}, {
"display_name": "Storage",
"name": "os-block-storage-worker"
"display_name": "multiroles",
"id": 2,
"name": "multiroles",
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}]
}],
"supported_oses": [{
"name": "CentOs",
@ -49,20 +68,14 @@ compassAppDev.run(function($httpBackend, settings, $http) {
"display": "Hadoop",
"os_installer": "cobbler",
"package_installer": "chef",
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}],
"supported_oses": [{
"name": "CentOs",
"os_id": 1
}]
}, {
"name": "Ubuntu",
"os_id": 2
}],
"flavors": []
}];
return [200, adapters, {}];
});
@ -75,18 +88,37 @@ compassAppDev.run(function($httpBackend, settings, $http) {
"display": "OpenStack",
"os_installer": "cobbler",
"package_installer": "chef",
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
"flavors": [{
"display_name": "allinone",
"id": 1,
"name": "allinone",
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}, {
"display_name": "Storage",
"name": "os-block-storage-worker"
}]
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}, {
"display_name": "Storage",
"name": "os-block-storage-worker"
"display_name": "multiroles",
"id": 2,
"name": "multiroles",
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}]
}],
"supported_oses": [{
"name": "CentOs",
@ -388,6 +420,22 @@ compassAppDev.run(function($httpBackend, settings, $http) {
"adapter_id": 1,
"os_id": 1,
"editable": true,
"flavor": {
"id": 1,
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}, {
"display_name": "Storage",
"name": "os-block-storage-worker"
}]
},
"create_by": "user@someemail.com",
"create_at": "2014-3-25 12:00:00",
"updated_at": "2014-3-26 13:00:00",
@ -399,6 +447,7 @@ compassAppDev.run(function($httpBackend, settings, $http) {
return [201, mockResponse, {}];
});
$httpBackend.whenGET(/\.*\/clusters\/[1-9][0-9]*\/state/).respond(function(method, url, data) {
console.log(method, url, data);
var states = ["UNINITIALIZED", "INITIALIZED", "INSTALLING", "SUCCESSFUL", "ERROR"];
@ -526,7 +575,23 @@ compassAppDev.run(function($httpBackend, settings, $http) {
"create_by": "user@someemail.com",
"create_at": "2014-3-25 12:00:00",
"updated_at": "2014-3-26 13:00:00",
" links": [{
"flavor": {
"id": 1,
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}, {
"display_name": "Storage",
"name": "os-block-storage-worker"
}]
},
"links": [{
"href": "/clusters/" + id,
"rel": "self"
}, {

View File

@ -31,7 +31,7 @@
<div ng-show="createClusterForm.clustername.$error.required" class="help-block col-xs-12 col-sm-reset inline"> Required</div>
</div>
<div class="form-group" ng-class="{'has-error':createClusterForm.targetsystem.$error.required&& !createClusterForm.clustername.$pristine}">
<div class="form-group" ng-class="{'has-error':createClusterForm.targetsystem.$error.required&& !createClusterForm.targetsystem.$pristine}">
<label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">Target System</label>
<div class="col-xs-12 col-sm-5">
@ -43,7 +43,7 @@
<div class="help-block col-xs-12 col-sm-reset inline"> Required </div>
</div>
<div class="form-group" ng-class="{'has-error':createClusterForm.targetsystem.$error.required&& !createClusterForm.clustername.$pristine}">
<div class="form-group" ng-class="{'has-error':createClusterForm.targetsystem.$error.required&& !createClusterForm.targetsystem.$pristine}">
<label class="col-xs-12 col-sm-3 control-label no-padding-right">OS</label>
<div class="col-xs-12 col-sm-5">
@ -54,6 +54,18 @@
</div>
<div class="help-block col-xs-12 col-sm-reset inline"> Required </div>
</div>
<div class="form-group" ng-hide="flavors.length == 0" ng-class="{'has-error':createClusterForm.flavors.$error.required&& !createClusterForm.flavors.$pristine}">
<label class="col-xs-12 col-sm-3 control-label no-padding-right">Flavor</label>
<div class="col-xs-12 col-sm-5">
<select name="os" class="width-100" ng-model="cluster.flavor_id">
<option value=""></option>
<option ng-repeat="flavor in flavors" value="{{flavor.id}}"> {{flavor.display_name}}</option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">

View File

@ -388,6 +388,7 @@ var ModalInstanceCtrl = function($scope, $modalInstance, allAdapters, cluster) {
angular.forEach($scope.allAdapters, function(adapter) {
if (adapter.id == $scope.cluster.adapter_id) {
$scope.supported_oses = adapter.supported_oses;
$scope.flavors = adapter.flavors;
}
})
});

View File

@ -984,11 +984,7 @@ angular.module('compass.wizard', [
.controller('roleAssignCtrl', function($scope, wizardFactory, dataService, $filter, ngTableParams, sortingService, $q, usSpinnerService) {
var cluster = wizardFactory.getClusterInfo();
$scope.servers = wizardFactory.getServers();
dataService.getAdapter(cluster.adapter_id).success(function(data) {
wizardFactory.setAdapter(data);
$scope.roles = data.roles;
});
$scope.roles = cluster.flavor.roles;
dataService.getServerColumns().success(function(data) {
$scope.server_columns = data.showless;

View File

@ -39,13 +39,27 @@
Prev
</button>
</div>
<button ng-click="stepForward()" class="btn btn-success btn-next">
<span ng-if="currentStep<steps.length">
<button ng-click="startSpin(); stepForward()" class="btn btn-success btn-next">
Next
<i class="ace-icon fa fa-arrow-right icon-on-right"></i>
</button>
</span>
<span ng-if="currentStep==steps.length">
<button ng-click="deploy()" class="btn btn-success btn-next">
<span>Deploy</span>
</button>
</span>
<!--button ng-click="stepForward()" class="btn btn-success btn-next">
<span ng-if="currentStep<steps.length">
Next
<i class="ace-icon fa fa-arrow-right icon-on-right"></i>
</span>
<span ng-if="currentStep==steps.length">Deploy</span>
</button>
</button-->
</div>
</div>
@ -67,18 +81,6 @@
</div>
</div>
<span ng-if="currentStep<steps.length">
<button ng-click="startSpin(); stepForward()" class="btn btn-success btn-next">
Next
<i class="ace-icon fa fa-arrow-right icon-on-right"></i>
</button>
</span>
<span ng-if="currentStep==steps.length">
<button ng-click="deploy()" class="btn btn-success btn-next">
<span>Deploy</span>
</button>
</span>
</div>
</div>