Add partition and security. Update global config

Change-Id: Ica6b59083bfa2f8df3c5b94b0a7edd73b52b2adc
This commit is contained in:
jiahuay 2014-06-24 11:02:40 -07:00
parent 245d71608d
commit b00149d8e5
17 changed files with 1249 additions and 389 deletions

View File

@ -26,3 +26,42 @@ html {
.nowrap {
white-space: nowrap;
}
.action {
cursor: pointer;
}
.action i {
padding-top: 7px;
}
.role-tag {
background-color: #91b8d0;
color: #fff;
display: inline-block;
font-size: 13px;
font-weight: normal;
margin-bottom: 3px;
margin-right: 3px;
padding: 4px 22px 5px 9px;
position: relative;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.15);
transition: all 0.2s ease 0s;
vertical-align: baseline;
white-space: nowrap;
}
.alert-dismissable .close {
color: inherit;
position: relative;
right: -17px !important;
top: 0 !important;
}
select {
padding-left: 1px !important;
}
.opacity-zero {
opacity: 0;
}
.margin-bottom-10 {
margin-bottom: 10px;
}
.max-width-200 {
max-width: 200px;
}

View File

@ -0,0 +1,76 @@
{
"showall": [{
"title": "Host MAC Addr",
"field": "mac",
"visible": true
}, {
"title": "Switch IP",
"field": "switch_ip",
"visible": true
}, {
"title": "Port",
"field": "port",
"visible": true
}, {
"title": "VLAN",
"field": "vlan",
"visible": true
}, {
"title": "Hostname",
"field": "hostname",
"visible": true
}, {
"title": "Clusters",
"field": "clusters",
"visible": true
}, {
"title": "OS",
"field": "os",
"visible": true
}, {
"title": "OS Reinstall",
"field": "os_installed",
"visible": true
}, {
"title": "State",
"field": "state",
"visible": true
}],
"showless": [{
"title": "Host MAC Addr",
"field": "mac",
"visible": true
}, {
"title": "Switch IP",
"field": "switch_ip",
"visible": true
}, {
"title": "Port",
"field": "port",
"visible": true
}, {
"title": "VLAN",
"field": "vlan",
"visible": false
}, {
"title": "Hostname",
"field": "hostname",
"visible": true
}, {
"title": "Clusters",
"field": "clusters",
"visible": false
}, {
"title": "OS",
"field": "os",
"visible": false
}, {
"title": "OS Reinstall",
"field": "os_installed",
"visible": false
}, {
"title": "State",
"field": "state",
"visible": false
}]
}

View File

@ -1,113 +1,113 @@
{
"os_and_ts": [{
"id": 1,
"title": "Server Selection",
"state": "active",
"template": "src/app/wizard/server_selection.tpl.html",
"description": "Select the servers you want to use for OpenStack"
}, {
"id": 2,
"title": "OS Global Config",
"state": "",
"template": "src/app/wizard/global.tpl.html",
"description": ""
}, {
"id": 3,
"title": "Network",
"state": "",
"template": "src/app/wizard/network.tpl.html",
"description": ""
}, {
"id": 4,
"title": "Partition",
"state": "",
"template": "src/app/wizard/partition.tpl.html",
"description": ""
}, {
"id": 5,
"title": "Security",
"state": "",
"template": "src/app/wizard/security.tpl.html",
"description": ""
}, {
"id": 6,
"title": "Role Assignment",
"state": "",
"template": "src/app/wizard/role_assignment.tpl.html",
"description": ""
}, {
"id": 7,
"title": "Network Mapping",
"state": "",
"template": "src/app/wizard/network_mapping.tpl.html",
"description": ""
}, {
"id": 8,
"title": "Review",
"state": "",
"template": "src/app/wizard/review.tpl.html",
"description": ""
}],
"os": [{
"id": 1,
"title": "Server Selection",
"state": "active",
"template": "templates/server_selection.html"
}, {
"id": 2,
"title": "Timezone & Language",
"state": "",
"template": "templates/timezone_language.html"
}, {
"id": 3,
"title": "Partition",
"state": "",
"template": "templates/partition.html"
}, {
"id": 4,
"title": "Network",
"state": "",
"template": "templates/network.html"
}, {
"id": 5,
"title": "Host Configuration",
"state": "",
"template": "templates/host_config.html"
}, {
"id": 6,
"title": "Security",
"state": "",
"template": "templates/security.html"
}, {
"id": 7,
"title": "Review",
"state": "",
"template": "templates/review.html"
}],
"ts": [{
"id": 1,
"title": "Server Selection",
"state": "active",
"template": "templates/server_selection.html"
}, {
"id": 2,
"title": "Security",
"state": "",
"template": "templates/security.html"
}, {
"id": 3,
"title": "Role Assignment",
"state": "",
"template": "templates/role_assignment.html"
}, {
"id": 4,
"title": "Network Mapping",
"state": "",
"template": "templates/network_mapping.html"
}, {
"id": 5,
"title": "Review",
"state": "",
"template": "templates/review.html"
}]
}
"os_and_ts": [{
"id": 1,
"title": "Server Selection",
"state": "active",
"template": "src/app/wizard/server_selection.tpl.html",
"description": "Select the servers you want to use for OpenStack"
}, {
"id": 2,
"title": "OS Global Config",
"state": "",
"template": "src/app/wizard/global.tpl.html",
"description": ""
}, {
"id": 3,
"title": "Network",
"state": "",
"template": "src/app/wizard/network.tpl.html",
"description": ""
}, {
"id": 4,
"title": "Partition",
"state": "",
"template": "src/app/wizard/partition.tpl.html",
"description": ""
}, {
"id": 5,
"title": "Security",
"state": "",
"template": "src/app/wizard/security.tpl.html",
"description": ""
}, {
"id": 6,
"title": "Role Assignment",
"state": "",
"template": "src/app/wizard/role_assignment.tpl.html",
"description": ""
}, {
"id": 7,
"title": "Network Mapping",
"state": "",
"template": "src/app/wizard/network_mapping.tpl.html",
"description": ""
}, {
"id": 8,
"title": "Review",
"state": "",
"template": "src/app/wizard/review.tpl.html",
"description": ""
}],
"os": [{
"id": 1,
"title": "Server Selection",
"state": "active",
"template": "templates/server_selection.html"
}, {
"id": 2,
"title": "Timezone & Language",
"state": "",
"template": "templates/timezone_language.html"
}, {
"id": 3,
"title": "Partition",
"state": "",
"template": "templates/partition.html"
}, {
"id": 4,
"title": "Network",
"state": "",
"template": "templates/network.html"
}, {
"id": 5,
"title": "Host Configuration",
"state": "",
"template": "templates/host_config.html"
}, {
"id": 6,
"title": "Security",
"state": "",
"template": "templates/security.html"
}, {
"id": 7,
"title": "Review",
"state": "",
"template": "templates/review.html"
}],
"ts": [{
"id": 1,
"title": "Server Selection",
"state": "active",
"template": "templates/server_selection.html"
}, {
"id": 2,
"title": "Security",
"state": "",
"template": "templates/security.html"
}, {
"id": 3,
"title": "Role Assignment",
"state": "",
"template": "templates/role_assignment.html"
}, {
"id": 4,
"title": "Network Mapping",
"state": "",
"template": "templates/network_mapping.html"
}, {
"id": 5,
"title": "Review",
"state": "",
"template": "templates/review.html"
}]
}

View File

@ -21,7 +21,7 @@
<!--<script type="text/javascript" src="../vendor/angular/angular-resource.min.js"></script>-->
<script type="text/javascript" src="vendor/angular-ui-router/angular-ui-router.min.js"></script>
<script type="text/javascript" src="vendor/angular-bootstrap/ui-bootstrap-tpls-0.11.0.min.js"></script>
<script type="text/javascript" src="vendor/angular-xeditable/xeditable.min.js"></script>
<script type="text/javascript" src="vendor/ng-table/ng-table.min.js"></script>
<script type="text/javascript" src="src/app/app.js"></script>
<script type="text/javascript" src="src/app/appDev.js"></script>

View File

@ -57,10 +57,14 @@ app.service('dataService', ['$http', 'settings',
return $http.get(settings.metadataUrlBase + '/adapter_config');
};
this.getAllServersInfo = function() {
this.getServers = function() {
return $http.get(settings.apiUrlBase + '/servers');
};
this.getServerColumns = function() {
return $http.get(settings.metadataUrlBase + '/machine_host_columns.json');
}
this.getMonitoringNav = function() {
return $http.get(settings.metadataUrlBase + '/monitoring_nav.json');
};
@ -77,9 +81,17 @@ app.service('dataService', ['$http', 'settings',
return $http.get(settings.apiUrlBase + '/clusters');
};
this.updateClusterConfig = function (id, config) {
this.updateClusterConfig = function(id, config) {
return $http.put(settings.apiUrlBase + '/clusters/' + id + '/config', angular.toJson(config));
};
this.getClusterSubnetConfig = function(id) {
return $http.get(settings.apiUrlBase + '/clusters/' + id + '/subnet-config');
};
this.postClusterSubnetConfig = function(id, subnet_config) {
return $http.post(settings.apiUrlBase + '/clusters/' + id + '/subnet-config', angular.toJson(subnet_config));
}
}
]);
@ -94,7 +106,57 @@ app.factory('wizardFactory', [
wizard.getClusterInfo = function() {
return wizard.cluster;
};
wizard.setSteps = function(steps) {
wizard.steps = steps;
};
wizard.getSteps = function() {
return wizard.steps;
};
wizard.setStepCommit = function(stepId, commitState, message) {
angular.forEach(wizard.steps, function(step) {
if(step.id == stepId) {
step.commit = commitState;
step.message = message;
}
})
};
wizard.getStepCommit = function(stepId) {
angular.forEach(wizard.steps, function(step) {
if(step.id == stepId) {
return step;
}
})
}
wizard.setServers = function(servers) {
wizard.servers = servers;
};
wizard.getServers = function() {
return wizard.servers;
};
wizard.setAdapter = function(adapter) {
wizard.adapter = adapter;
};
wizard.getAdapter = function() {
return wizard.adapter;
};
/*
wizard.setSubnetworks = function(subnetworks) {
wizard.subnetworks = subnetworks;
};
wizard.getSubnetworks = function() {
return wizard.subnetworks;
};
*/
return wizard;
}
]);

View File

@ -14,7 +14,19 @@ compassAppDev.run(function($httpBackend, settings, $http) {
"display": "OpenStack",
"os_installer": "cobbler",
"package_installer": "chef",
"roles": ["compute", "controller", "metering", "network", "storage"],
"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"
}],
"compatible_os": [{
"name": "CentOs",
"os_id": 1
@ -28,7 +40,16 @@ compassAppDev.run(function($httpBackend, settings, $http) {
"display": "Hadoop",
"os_installer": "cobbler",
"package_installer": "chef",
"roles": ["compute", "controller", "network", "storage"],
"roles": [{
"display_name": "Compute",
"name": "os-compute-worker"
}, {
"display_name": "Controller",
"name": "os-controller"
}, {
"display_name": "Network",
"name": "os-network"
}],
"compatible_os": [{
"name": "CentOs",
"os_id": 1
@ -41,35 +62,57 @@ compassAppDev.run(function($httpBackend, settings, $http) {
console.log(method, url);
var servers = [{
"id": 1,
"Host MAC": "28.e5.ee.47.14.92",
"Switch IP": "172.29.8.40",
"Vlan": "1",
"Port": "1",
"Hostname": "sv-1",
"Cluster": ["cluster1", "cluster2"],
"OS": "CentOS",
"Target System": ["CentOS", "OpenStack"],
"State": "Installing"
"mac": "28.e5.ee.47.14.92",
"switch_ip": "172.29.8.40",
"vlan": "1",
"port": "1",
"hostname": "sv-1",
"clusters": ["cluster1", "cluster2"],
"os": "CentOS",
"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"
}],
"network": {},
"state": "Installing"
}, {
"id": 2,
"Host MAC": "28.e5.ee.47.a2.93",
"Switch IP": "172.29.8.40",
"Vlan": "2",
"Port": "2",
"Hostname": "sv-2",
"Cluster": ["cluster1"],
"OS": "CentOS",
"Target System": ["CentOS"],
"State": "Successful"
"mac": "28.e5.ee.47.a2.93",
"switch_ip": "172.29.8.40",
"vlan": "2",
"port": "2",
"hostname": "sv-2",
"clusters": ["cluster1"],
"os": "CentOS",
"roles": [{
"display_name": "Network",
"name": "os-network"
}, {
"display_name": "Storage",
"name": "os-block-storage-worker"
}],
"network": {},
"state": "Successful"
}];
console.log(servers);
return [200, servers, {}];
});
$httpBackend.whenPOST(settings.apiUrlBase + '/clusters').respond(function(method, url, data) {
console.log(method, url, data);
var postData = JSON.parse(data)
var mockResponse = {
"id": 1,
"name": "cluster_01",
"name": postData.name,
"adapter_id": 1,
"os_id": 1,
"editable": true,
@ -122,9 +165,32 @@ compassAppDev.run(function($httpBackend, settings, $http) {
return [200, clusters, {}];
});
$httpBackend.whenPUT(settings.apiUrlBase + '/clusters/1/config').respond(function(method, url, data) {
$httpBackend.whenPUT(/\.*\/clusters\/[1-9][0-9]*\/config/).respond(function(method, url, data) {
console.log(method, url, data);
return [200, {}, {}];
});
$httpBackend.whenGET(/\.*\/clusters\/[1-9][0-9]*\/subnet-config/).respond(function(method, url, data) {
console.log(method, url);
var subnetworks = [{
"subnet_id": 1,
"name": "net1",
"subnet": "192.168.1.0",
"netmask": "255.255.255.0",
}, {
"subnet_id": 2,
"name": "net2",
"subnet": "172.165.1.0",
"netmask": "255.255.255.0",
}
];
return [200, subnetworks, {}];
});
$httpBackend.whenPOST(/\.*\/clusters\/[1-9][0-9]*\/subnet-config/).respond(function(method, url, data) {
console.log(method, url, data);
return [200, {}, {}];
});
});

View File

@ -31,25 +31,25 @@
<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}">
<div class="form-group" ng-class="{'has-error':createClusterForm.targetsystem.$error.required&& !createClusterForm.clustername.$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">
<select name="targetsystem" class="width-100" ng-model="cluster.adapter_id" required>
<option ng-repeat="adapter in adapters" value="{{adapter.id}}"> {{adapter.display}}</option>
<option value=""></option>
<option ng-repeat="adapter in allAdapters" value="{{adapter.id}}"> {{adapter.display}}</option>
</select>
</div>
<div class="help-block col-xs-12 col-sm-reset inline"> Required </div>
</div>
<div class="form-group">
<div class="form-group" ng-class="{'has-error':createClusterForm.targetsystem.$error.required&& !createClusterForm.clustername.$pristine}">
<label class="col-xs-12 col-sm-3 control-label no-padding-right">OS</label>
<div class="col-xs-12 col-sm-5">
<select name="os" class="width-100" ng-model="cluster.os_id" required>
<option value=""></option>
<option ng-repeat="os in compatible_os" value="{{os.os_id}}"> {{os.name}}</option>
</select>
</div>
<div class="help-block col-xs-12 col-sm-reset inline"> Required </div>

View File

@ -62,21 +62,8 @@ angular.module('compass.cluster', [
.controller('createClusterCtrl', ['$scope', '$state', '$modal', '$log', 'dataService', 'wizardFactory',
function($scope, $state, $modal, $log, dataService, wizardFactory) {
dataService.getAdapters().success(function(data) {
$scope.adapters = data;
$scope.compatible_os = [];
$scope.allAdapters = data;
$scope.cluster = {};
$scope.cluster.name = "";
$scope.cluster.adapter_id = $scope.adapters[0].id;
$scope.$watch('cluster.adapter_id', function() {
angular.forEach($scope.adapters, function(adapter) {
if (adapter.id == $scope.cluster.adapter_id) {
$scope.compatible_os = adapter.compatible_os;
console.log($scope.compatible_os);
}
})
});
$scope.open = function(size) {
var modalInstance = $modal.open({
@ -84,14 +71,11 @@ angular.module('compass.cluster', [
controller: ModalInstanceCtrl,
size: size,
resolve: {
adapters: function() {
return $scope.adapters;
allAdapters: function() {
return $scope.allAdapters;
},
cluster: function() {
return $scope.cluster;
},
compatible_os: function() {
return $scope.compatible_os;
}
}
});
@ -100,22 +84,33 @@ angular.module('compass.cluster', [
$scope.cluster = cluster;
dataService.createCluster(cluster).success(function(data, status) {
wizardFactory.setClusterInfo(data);
angular.forEach($scope.allAdapters, function(adapter) {
if(adapter.id == $scope.cluster.adapter_id) {
wizardFactory.setAdapter(adapter);
}
})
$state.go('wizard');
$scope.cluster = {};
});
}, function() {
console.log("modal cancelled");
// modal cancelled
});
};
});
}
]);
var ModalInstanceCtrl = function($scope, $modalInstance, adapters, cluster, compatible_os) {
$scope.adapters = adapters;
var ModalInstanceCtrl = function($scope, $modalInstance, allAdapters, cluster) {
$scope.allAdapters = allAdapters;
$scope.cluster = cluster;
$scope.compatible_os = compatible_os;
$scope.$watch('cluster.adapter_id', function() {
angular.forEach($scope.allAdapters, function(adapter) {
if (adapter.id == $scope.cluster.adapter_id) {
$scope.compatible_os = adapter.compatible_os;
}
})
});
$scope.ok = function() {
$scope.result = 'ok';

View File

@ -10,13 +10,137 @@
<div class="row">
<div class="col-xs-12">
<form id="generalForm" class="form-horizontal" role="form">
<div class="form-group" ng-repeat="(key, data) in os_global_config['general']">
<!-- Use metadata to generate the form. might be used later -->
<!--<div class="form-group" ng-repeat="(key, data) in os_global_config['general']">
<div ng-if="key!='_self'">
<label class="col-sm-4 control-label no-padding-right">{{data.display}}</label>
<div class="col-sm-8">
<input type="text" class="col-xs-10 col-sm-5" placeholder="{{data.display}}" name="{{key}}" popover-title="Help" popover="{{data.description}}" popover-trigger="focus" popover-placement="right">
</div>
</div>
</div>-->
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">HTTP Proxy</label>
<div class="col-sm-8">
<input ng-model="general.http_proxy" type="text" class="col-xs-10 col-sm-5" placeholder="HTTP Proxy" name="http_proxy">
</div>
</div>
</div>
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">NTP Server</label>
<div class="col-sm-8">
<input ng-model="general.ntp_server" type="text" class="col-xs-10 col-sm-5" placeholder="NTP Server" name="ntp_server">
</div>
</div>
</div>
<div ng-repeat="dns_server in general.dns_servers track by $index" class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">
<span ng-if="$index==0">DNS Servers</span>
</label>
<div class="col-sm-8">
<input ng-model="general.dns_servers[$index]" type="text" class="col-xs-10 col-sm-5" placeholder="DNS Server" name="dns_servers">
<span class="col-xs-2 col-sm-3">
<!--Add Action-->
<span class="action" ng-click="addDNSServer()">
<i class="fa fa-plus-circle bigger-140 blue"></i>
</span>
<!--Remove Action-->
<span ng-show="general.dns_servers.length > 1" class="action" ng-click="general.dns_servers.splice($index,1)">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
</span>
</div>
</div>
</div>
<div ng-repeat="search_path in general.search_path track by $index" class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">
<span ng-if="$index==0">Search Path</span>
</label>
<div class="col-sm-8">
<input ng-model="general.search_path[$index]" type="text" class="col-xs-10 col-sm-5" placeholder="Search Path" name="search_path">
<span class="col-xs-2 col-sm-3">
<!--Add Action-->
<span class="action" ng-click="addSearchPath()">
<i class="fa fa-plus-circle bigger-140 blue"></i>
</span>
<!--Remove Action-->
<span ng-show="general.search_path.length > 1" class="action" ng-click="general.search_path.splice($index,1)">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
</span>
</div>
</div>
</div>
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">Domain</label>
<div class="col-sm-8">
<input ng-model="general.domain" type="text" class="col-xs-10 col-sm-5" placeholder="Domain" name="domain">
</div>
</div>
</div>
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">Gateway</label>
<div class="col-sm-8">
<input ng-model="general.gateway" type="text" class="col-xs-10 col-sm-5" placeholder="Gateway" name="gateway">
</div>
</div>
</div>
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">Timezone</label>
<div class="col-sm-8">
<select ng-model="general.timezone" name="timezone" class="col-xs-10 col-sm-5">
<option value="-12.0">(GMT -12:00) Eniwetok, Kwajalein</option>
<option value="-11.0">(GMT -11:00) Midway Island, Samoa</option>
<option value="-10.0">(GMT -10:00) Hawaii</option>
<option value="-9.0">(GMT -9:00) Alaska</option>
<option value="-8.0">(GMT -8:00) Pacific Time (US &amp; Canada)</option>
<option value="-7.0">(GMT -7:00) Mountain Time (US &amp; Canada)</option>
<option value="-6.0">(GMT -6:00) Central Time (US &amp; Canada), Mexico City</option>
<option value="-5.0">(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima</option>
<option value="-4.0">(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz</option>
<option value="-3.5">(GMT -3:30) Newfoundland</option>
<option value="-3.0">(GMT -3:00) Brazil, Buenos Aires, Georgetown</option>
<option value="-2.0">(GMT -2:00) Mid-Atlantic</option>
<option value="-1.0">(GMT -1:00 hour) Azores, Cape Verde Islands</option>
<option value="0.0">(GMT) Western Europe Time, London, Lisbon, Casablanca</option>
<option value="1.0">(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris</option>
<option value="2.0">(GMT +2:00) Kaliningrad, South Africa</option>
<option value="3.0">(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option>
<option value="3.5">(GMT +3:30) Tehran</option>
<option value="4.0">(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</option>
<option value="4.5">(GMT +4:30) Kabul</option>
<option value="5.0">(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option>
<option value="5.5">(GMT +5:30) Bombay, Calcutta, Madras, New Delhi</option>
<option value="5.75">(GMT +5:45) Kathmandu</option>
<option value="6.0">(GMT +6:00) Almaty, Dhaka, Colombo</option>
<option value="7.0">(GMT +7:00) Bangkok, Hanoi, Jakarta</option>
<option value="8.0">(GMT +8:00) Beijing, Perth, Singapore, Hong Kong</option>
<option value="9.0">(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option>
<option value="9.5">(GMT +9:30) Adelaide, Darwin</option>
<option value="10.0">(GMT +10:00) Eastern Australia, Guam, Vladivostok</option>
<option value="11.0">(GMT +11:00) Magadan, Solomon Islands, New Caledonia</option>
<option value="12.0">(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">Language</label>
<div class="col-sm-8">
<select ng-model="general.language" name="language" class="col-xs-10 col-sm-5">
<option value="en">English</option>
<option value="cn">Chinese</option>
</select>
</div>
</div>
</div>
</form>
</div>
@ -31,7 +155,7 @@
<div class="col-lg-2">
</div>
<div class="col-lg-8">
<table class="table table-hover table-striped nowrap">
<table class="table table-hover nowrap">
<thead>
<tr>
<th>Name</th>
@ -41,51 +165,25 @@
</tr>
</thead>
<tbody>
<tr>
<td>
<input ng-model="newsubnetwork.name" type="text" placeholder="Name" required>
</td>
<td>
<input ng-model="newsubnetwork.subnet" type="text" placeholder="Subnet" required>
</td>
<td>
<input ng-model="newsubnetwork.netmask" type="text" placeholder="Netmask" required>
</td>
<td>
<button ng-click="addSubnetwork()" class="btn btn-info btn-sm" formnovalidate>Add</button>
</td>
</tr>
<tr ng-repeat="sub in subnetworks">
<td>
<span ng-hide="editSubnetworkMode">{{sub.name}}</span>
<input type="text" ng-show="editSubnetworkMode" ng-model="sub.name" ng-required />
<input type="text" ng-model="sub.name" placeholder="Name" />
</td>
<td>
<span ng-hide="editSubnetworkMode">{{sub.subnet}}</span>
<input type="text" ng-show="editSubnetworkMode" ng-model="sub.subnet" ng-required />
<input type="text" ng-model="sub.subnet" placeholder="Subnet" />
</td>
<td>
<span ng-hide="editSubnetworkMode">{{sub.netmask}}</span>
<input type="text" ng-show="editSubnetworkMode" ng-model="sub.netmask" ng-required />
<input type="text" ng-model="sub.netmask" placeholder="Netmask" />
</td>
<td>
<!--edit button-->
<button ng-hide="editSubnetworkMode" ng-click="editSubnetworkMode = true; " class="btn btn-xs btn-success">
<i class="ace-icon fa fa-pencil bigger-120"></i>
</button>
<!--delete button-->
<button ng-hide="editSubnetworkMode" ng-click="subnetworks.splice($index,1)" class="btn btn-xs btn-danger">
<i class="ace-icon fa fa-trash-o bigger-120"></i>
</button>
<!--save button-->
<button ng-show="editSubnetworkMode" ng-click="editSubnetworkMode = false" class="btn btn-xs btn-primary">
<i class="ace-icon fa fa-check bigger-120"></i>
</button>
<!--cancel button-->
<button ng-show="editSubnetworkMode" ng-click="editSubnetworkMode = false; cancel()" class="btn btn-xs btn-default">
<i class="ace-icon fa fa-times bigger-120"></i>
</button>
<!--Add Action-->
<span class="action" ng-click="addSubnetwork()">
<i class="fa fa-plus-circle bigger-140 blue"></i>
</span>
<!--Remove Action-->
<span ng-show="subnetworks.length > 1" class="action" ng-click="removeSubnetwork($index)">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
</td>
</tr>
@ -106,7 +204,7 @@
<div class="col-lg-2">
</div>
<div class="col-lg-8">
<table class="table table-hover table-striped nowrap">
<table class="table table-hover nowrap">
<thead>
<tr>
<th>Name</th>
@ -117,58 +215,28 @@
</tr>
</thead>
<tbody>
<tr>
<tr ng-repeat="route in routingtable">
<td>
<input ng-model="newrouting.name" type="text" placeholder="Name" required>
<input type="text" ng-model="route.name" placeholder="Name" />
</td>
<td>
<input ng-model="newrouting.subnet" type="text" placeholder="Subnet" required>
<input type="text" ng-model="route.subnet" placeholder="Subnet" />
</td>
<td>
<input ng-model="newrouting.netmask" type="text" placeholder="Netmask" required>
<input type="text" ng-model="route.netmask" placeholder="Netmask" />
</td>
<td>
<input ng-model="newrouting.gateway" type="text" placeholder="Gateway" required>
</td>
<td>
<button ng-click="addRouting()" class="btn btn-info btn-sm" formnovalidate>Add</button>
</td>
</tr>
<tr ng-repeat="routing in routingtable">
<td>
<span ng-hide="editRoutingtableMode">{{routing.name}}</span>
<input type="text" ng-show="editRoutingtableMode" ng-model="routing.name" ng-required />
<input type="text" ng-model="route.gateway" placeholder="Gateway" />
</td>
<td>
<span ng-hide="editRoutingtableMode">{{routing.subnet}}</span>
<input type="text" ng-show="editRoutingtableMode" ng-model="routing.subnet" ng-required />
</td>
<td>
<span ng-hide="editRoutingtableMode">{{routing.netmask}}</span>
<input type="text" ng-show="editRoutingtableMode" ng-model="routing.netmask" ng-required />
</td>
<td>
<span ng-hide="editRoutingtableMode">{{routing.gateway}}</span>
<input type="text" ng-show="editRoutingtableMode" ng-model="routing.gateway" ng-required />
</td>
<td>
<!--edit button-->
<button ng-hide="editRoutingtableMode" ng-click="editRoutingtableMode = true; " class="btn btn-xs btn-success">
<i class="ace-icon fa fa-pencil bigger-120"></i>
</button>
<!--delete button-->
<button ng-hide="editRoutingtableMode" ng-click="routingtable.splice($index,1)" class="btn btn-xs btn-danger">
<i class="ace-icon fa fa-trash-o bigger-120"></i>
</button>
<!--save button-->
<button ng-show="editRoutingtableMode" ng-click="editRoutingtableMode = false" class="btn btn-xs btn-primary">
<i class="ace-icon fa fa-check bigger-120"></i>
</button>
<!--cancel button-->
<button ng-show="editRoutingtableMode" ng-click="editRoutingtableMode = false; cancel()" class="btn btn-xs btn-default">
<i class="ace-icon fa fa-times bigger-120"></i>
</button>
<!--Add Action-->
<span class="action" ng-click="addRoute()">
<i class="fa fa-plus-circle bigger-140 blue"></i>
</span>
<!--Remove Action-->
<span ng-show="routingtable.length > 1" class="action" ng-click="removeRoute($index)">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
</td>
</tr>

View File

@ -1 +1,95 @@
network
<div ng-controller="networkCtrl">
<div class="row">
<div class="pull-left">
<form name="addInterfaceForm">
<div class="input-group">
<input ng-model="newInterface" type="text" placeholder="Interface" class="form-control" required>
<span class="input-group-btn">
<button type="button" class="btn btn-sm btn-info" ng-disabled="addInterfaceForm.$invalid" ng-click="addInterface(newInterface)">
Add
</button>
</span>
</div>
</form>
</div>
<div class="pull-left">
<span class="input-icon">
<input type="text" placeholder="Search" ng-model="search">
<i class="ace-icon fa fa-search blue"></i>
</span>
</div>
<div class="pull-left">
<button ng-click="autofill()" type="button" class="btn btn-sm btn-primary">
Autofill
</button>
</div>
<div class="pull-right">
<!-- Column Show / Hide button -->
<div class="btn-group" dropdown>
<button type="button" class="btn btn-white btn-default dropdown-toggle">
Column Show / Hide
<span class="ace-icon fa fa-caret-down icon-on-right"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li ng-repeat="column in server_columns" ng-click="column.visible=!column.visible">
<a class="action">
<span ng-class="{'opacity-zero': !column.visible}">
<i class="ace-icon fa fa-check blue"></i>
</span>
{{column.title}}
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="row">
<table ng-table="tableParams" class="table table-hover table-striped">
<thead>
<tr>
<th></th>
<th ng-repeat="column in server_columns" ng-show="column.visible" class="sortable" ng-class="{
'sort-asc': tableParams.isSortBy(column.field, 'asc'),
'sort-desc': tableParams.isSortBy(column.field, 'desc')
}" ng-click="tableParams.sorting(column.field, tableParams.isSortBy(column.field, 'asc') ? 'desc' : 'asc')">
{{column.title}}
</th>
<th ng-repeat="interface in interfaces" ng-mouseover="deleteView=true" ng-mouseleave="deleteView=false">
{{interface}}
<span ng-class="{'opacity-zero': !deleteView}" ng-click="deleteInterface(interface)" class="action"><i class="ace-icon fa fa-times-circle bigger-120 red"></i> </span>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="server in $data | filter:search" ng-init="serverIndex = $index">
<td>
<input ng-model="server.checked" type="checkbox">
</td>
<td ng-repeat="column in server_columns" ng-show="column.visible" sortable="column.field">
<span ng-if="column.field=='hostname'">
<input ng-model="server[column.field]" placeholder="Hostname" class="form-control margin-bottom-10 max-width-200" type="text">
</span>
<span ng-if="column.field!='hostname'">
{{server[column.field]}}
</span>
</td>
<td ng-repeat="interface in interfaces" ng-init="server.network[interface]={};">
<input ng-model="server.network[interface].ip" placeholder="IP Address" class="form-control margin-bottom-10 max-width-200" type="text">
<select ng-model="server.network[interface].subnet_id" class="form-control margin-bottom-10 max-width-200">
<option ng-repeat="sub in subnetworks" value="{{sub.subnet_id}}">
Subnetwork: {{sub.name}}
</option>
</select>
<span>
<!--TODO: validate management network (each sv can only have one mgmt network) -->
<!--radio not working here to bind model-->
<input ng-model="server.network[interface].is_mgmt" name="mgmt-{{serverIndex}}" type="checkbox"> Is Mgmt Network
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -1 +1,64 @@
network mapping
<div ng-controller="networkCtrl">
<div class="row">
<div class="pull-left">
<span class="input-icon">
<input type="text" placeholder="Search" ng-model="search">
<i class="ace-icon fa fa-search blue"></i>
</span>
</div>
<div class="pull-right">
</div>
</div>
<div class="row">{{servers}}
<table class="table table-hover table-striped">
<thead>
<tr>
<th>
<input type="checkbox">
</th>
<th>Host MAC</th>
<th>Switch IP</th>
<th>Port</th>
<th>Hostname</th>
<th>Management Network</th>
<th>Tenant Network</th>
<th>Storage Network</th>
<th>Public Network</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="server in servers | filter:search">
<td>
<input ng-model="server.checked" type="checkbox">
</td>
<td>{{server["mac"]}}</td>
<td>{{server["switch_ip"]}}</td>
<td>{{server["port"]}}</td>
<td>{{server["hostname"]}}</td>
<td>
<select ng-model="server.management">
<option ng-repeat="interface in interfaces" value="{{interface}}">{{interface}}</option>
</select>
</td>
<td>
<select ng-model="server.tenant">
<option ng-repeat="interface in interfaces" value="{{interface}}">{{interface}}</option>
</select>
</td>
<td>
<select ng-model="server.storage">
<option ng-repeat="interface in interfaces" value="{{interface}}">{{interface}}</option>
</select>
</td>
<td>
<select ng-model="server.public">
<option ng-repeat="interface in interfaces" value="{{interface}}">{{interface}}</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -1,89 +1,40 @@
<div class="row">
<div class="col-sm-8">
<div class="center">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-xs-3">
<span>
Mount Point
</span>
</div>
<div class="col-xs-3">
<span>
Size Percentage
</span>
</div>
<div class="col-xs-3">
<span>
Max Size
</span>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-xs-3">
<span>
<input type="text" class="input-medium" id="form-field-1">
</span>
</div>
<div class="col-xs-3">
<span>
<input type="text" class="input-medium" id="form-field-2">
</span>
</div>
<div class="col-xs-3">
<span>
<input type="text" class="input-medium" id="form-field-3">
</span>
</div>
<div class="col-xs-1">
<span>
<i class="fa fa-plus-circle bigger-140 blue"></i>
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-xs-3">
<span>
<input type="text" class="input-medium" id="form-field-1">
</span>
</div>
<div class="col-xs-3">
<span>
<input type="text" class="input-medium" id="form-field-2">
</span>
</div>
<div class="col-xs-3">
<span>
<input type="text" class="input-medium" id="form-field-3">
</span>
</div>
<div class="col-xs-1">
<span>
<i class="fa fa-plus-circle bigger-140 blue"></i>
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<table class="table table-hover nowrap">
<thead>
<tr>
<th>Mount Point</th>
<th>Size Percentage (%)</th>
<th>Max Size (G)</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-if="partition.length > 0" ng-repeat="pa in partition track by $index">
<td>
<input ng-model="pa.mount_point" type="text" placeholder="Mount Point" class="input-medium">
</td>
<td>
<input ng-model="pa.size_percentage" type="text" placeholder="Size Percentage" class="input-medium">
</td>
<td>
<input ng-model="pa.max_size" type="text" placeholder="Max Size" class="input-medium">
</td>
<td>
<!--Add Action-->
<span class="action" ng-click="addPartition()">
<i class="fa fa-plus-circle bigger-140 blue"></i>
</span>
<!--Remove Action-->
<span ng-show="partition.length > 1" class="action" ng-click="partition.splice($index,1)">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-4">
<div style="height: 200px; width: 200px; background: pink;"></div>
<span>sm-3</span>
<div class="col-lg-4">
<!--TODO: Partition pie chart-->
</div>
</div>

View File

@ -1 +1,58 @@
role assignment
<div ng-controller="roleAssignCtrl">
<div class="row">
<div class="pull-left">
<span class="input-icon">
<input type="text" placeholder="Search" ng-model="search">
<i class="ace-icon fa fa-search blue"></i>
</span>
</div>
<div class="pull-right">
<div class="btn-group" dropdown>
<button type="button" class="btn btn-info dropdown-toggle">
Assign Roles
<span class="ace-icon fa fa-caret-down icon-on-right"></span>
</button>
<ul class="dropdown-menu dropdown-info dropdown-menu-right" role="menu">
<li ng-repeat="role in roles">
<a href value="{{role.name}}" ng-click="assignRole(role)">{{role.display_name}}</a>
</li>
</ul>
</div>
</div>
</div>
<div class="row">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>
<input type="checkbox">
</th>
<th>Host MAC</th>
<th>Switch IP</th>
<th>Port</th>
<th>Hostname</th>
<th>Roles</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="server in servers | filter:search">
<td>
<input ng-model="server.checked" type="checkbox">
</td>
<td>{{server["mac"]}}</td>
<td>{{server["switch_ip"]}}</td>
<td>{{server["port"]}}</td>
<td>{{server["hostname"]}}</td>
<td>
<alert ng-repeat="role in server['roles']" class="role-tag" close="removeRole(server, role)">
{{role.display_name}}
</alert>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -38,8 +38,52 @@
<i class="ace-icon fa fa-angle-right" ng-class="{'fa-angle-down': status2.open, 'fa-angle-right': !status2.open}"></i> OpenStack Services Credentials
</accordion-heading>
<div class="row">
<div class="col-xs-12">
<div class="col-lg-2">
</div>
<div class="col-lg-8">
<table class="table table-hover nowrap">
<thead>
<tr>
<th>Service</th>
<th>Username</th>
<th>Password</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(service, credential) in service_credentials" inlineEdit>
<td>
<span ng-hide="editServiceMode">{{service}}</span>
<input ng-show="editServiceMode" ng-model="service" placeholder="Service" type="text" ng-required />
</td>
<td>
<span ng-hide="editServiceMode">{{credential.username}}</span>
<input ng-show="editServiceMode" ng-model="credential.username" placeholder="Username" type="text" ng-required />
</td>
<td>
<span ng-hide="editServiceMode">{{credential.password}}</span>
<input ng-show="editServiceMode" ng-model="credential.password" placeholder="Password" type="password" ng-required />
<input ng-show="editServiceMode" placeholder="Confirm Password" type="password" ng-required />
</td>
<td>
<!--edit button-->
<button ng-hide="editServiceMode" ng-click="editServiceMode = true; edit()" class="btn btn-xs btn-success">
<i class="ace-icon fa fa-pencil bigger-120"></i>
</button>
<!--save button-->
<button ng-show="editServiceMode" ng-click="editServiceMode = false; save()" class="btn btn-xs btn-primary">
<i class="ace-icon fa fa-check bigger-120"></i>
</button>
<!--cancel button-->
<button ng-show="editServiceMode" ng-click="editServiceMode = false; cancel()" class="btn btn-xs btn-default">
<i class="ace-icon fa fa-times bigger-120"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-lg-2">
</div>
</div>
</accordion-group>
@ -50,7 +94,47 @@
</accordion-heading>
<div class="row">
<div class="col-xs-12">
<table class="table table-hover nowrap">
<thead>
<tr>
<th>Service</th>
<th>Username</th>
<th>Password</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(service, credential) in management_credentials" inlineEdit>
<td>
<span ng-hide="editMgntMode">{{service}}</span>
<input ng-show="editMgntMode" ng-model="service" placeholder="Service" type="text" ng-required />
</td>
<td>
<span ng-hide="editMgntMode">{{credential.username}}</span>
<input ng-show="editMgntMode" ng-model="credential.username" placeholder="Username" type="text" ng-required />
</td>
<td>
<span ng-hide="editMgntMode">{{credential.password}}</span>
<input ng-show="editMgntMode" ng-model="credential.password" placeholder="Password" type="password" ng-required />
<input ng-show="editMgntMode" placeholder="Confirm Password" type="password" ng-required />
</td>
<td>
<!--edit button-->
<button ng-hide="editMgntMode" ng-click="editMgntMode = true; edit()" class="btn btn-xs btn-success">
<i class="ace-icon fa fa-pencil bigger-120"></i>
</button>
<!--save button-->
<button ng-show="editMgntMode" ng-click="editMgntMode = false; save()" class="btn btn-xs btn-primary">
<i class="ace-icon fa fa-check bigger-120"></i>
</button>
<!--cancel button-->
<button ng-show="editMgntMode" ng-click="editMgntMode = false; cancel()" class="btn btn-xs btn-default">
<i class="ace-icon fa fa-times bigger-120"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</accordion-group>

View File

@ -1,30 +1,62 @@
<table id="sv-selection" class="table table-hover table-striped">
<thead>
<tr>
<th>Host MAC</th>
<th>Switch IP</th>
<th>Port</th>
<th>Hostname</th>
<th>Cluster</th>
<th>OS</th>
<th>OS Installation</th>
<th>Target System</th>
<th>State</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="server in servers">
<td>{{server["Host MAC"]}}</td>
<td>{{server["Switch IP"]}}</td>
<td>{{server["Port"]}}</td>
<td>{{server["Hostname"]}}</td>
<td>{{server["Cluster"]}}</td>
<td>{{server["OS"]}}</td>
<td>
<div class="svSelectCtrl">
<div class="row">
<div class="pull-left">
<span class="input-icon">
<input type="text" placeholder="Search" ng-model="search">
<i class="ace-icon fa fa-search blue"></i>
</span>
</div>
<div class="pull-right">
<div class="checkbox">
<label>
<input type="checkbox" class="ace">
<span class="lbl">Show Only Selected Servers</span>
</label>
</div>
</div>
</div>
</td>
<td>{{server["Target System"]}}</td>
<td>{{server["State"]}}</td>
</tr>
</tbody>
</table>
<div class="row">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>
<input type="checkbox" ng-model="selectall" ng-change="selectAllServers(selectall)">
</th>
<th>Host MAC</th>
<th>Switch IP</th>
<th>Port</th>
<th>Hostname</th>
<th>Cluster</th>
<th>OS</th>
<th>OS Installation</th>
<th>Target System</th>
<th>State</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="server in allservers | filter:search">
<td>
<input ng-model="server.selected" type="checkbox">
</td>
<td>{{server["mac"]}}</td>
<td>{{server["switch_ip"]}}</td>
<td>{{server["port"]}}</td>
<td>{{server["hostname"]}}</td>
<td>{{server["cluster"]}}</td>
<td>{{server["os"]}}</td>
<td>
<span ng-if="server['os']">
<input type="checkbox" ng-model="server.reinstallos">Reinstall OS
</span>
<span ng-if="!server['os']">
-
</span>
</td>
<td>{{server["adapter"]}}</td>
<td>{{server["state"]}}</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -1,6 +1,7 @@
angular.module('compass.wizard', [
'ui.router',
'ui.bootstrap'
'ui.bootstrap',
'ngTable'
])
.config(function config($stateProvider) {
@ -13,8 +14,8 @@ angular.module('compass.wizard', [
})
.controller('wizardCtrl', function($scope, dataService, wizardFactory) {
$scope.wizardCluster = wizardFactory.getClusterInfo();
$scope.clusterInfo = wizardFactory.getClusterInfo();
console.info("$scope.clusterInfo", $scope.clusterInfo)
// current step for create-cluster wizard
$scope.currentStep = 1;
@ -23,6 +24,7 @@ angular.module('compass.wizard', [
dataService.getWizardSteps().success(function(data) {
// get the wizard steps for os, ts or os_and_ts
$scope.steps = data["os_and_ts"];
wizardFactory.setSteps($scope.steps);
// change ui steps css if currentStep changes
$scope.$watch('currentStep', function(newStep, oldStep) {
@ -41,26 +43,72 @@ angular.module('compass.wizard', [
// go to next step
$scope.stepForward = function() {
if ($scope.steps[$scope.currentStep - 1].title == "OS Global Config") {
var general_config = $('#generalForm').serializeObject();
if ($scope.steps[$scope.currentStep - 1].title == "Server Selection") {
var selectedServers = [];
var noSelection = true;
angular.forEach($scope.allservers, function(sv) {
if (sv.selected) {
noSelection = false;
selectedServers.push(sv);
}
})
if (noSelection) {
alert("Please select at least one server");
} else {
//TODO: api call - add host
wizardFactory.setServers(selectedServers);
console.info("wizardFactory.getServers", wizardFactory.getServers());
$scope.next();
}
} else if ($scope.steps[$scope.currentStep - 1].title == "OS Global Config") {
//var general_config = $('#generalForm').serializeObject();
//$scope.general = general_config;
var global_os_config = {
"os_config": {
"global": general_config,
"global": $scope.general,
"subnetworks": $scope.subnetworks,
"route_table": $scope.routingtable
}
};
console.log(global_os_config);
//TODO modify api call
dataService.updateClusterConfig(1, global_os_config).success(function(data) {
if ($scope.currentStep < $scope.steps.length)
$scope.currentStep = $scope.currentStep + 1;
console.info("success")
$scope.next();
})
} else if ($scope.steps[$scope.currentStep - 1].title == "Partition") {
var partitionData = {};
angular.forEach($scope.partition, function(pa) {
console.log(pa);
if (partitionData[pa.mount_point] !== undefined) {
if (!partitionData[pa.mount_point].push) {
partitionData[pa.mount_point] = [partitionData[pa.mount_point]];
}
partitionData[pa.mount_point].push({
"size_percentage": pa.size_percentage,
"max_size": pa.max_size
} || {});
} else {
partitionData[pa.mount_point] = {
"size_percentage": pa.size_percentage,
"max_size": pa.max_size
} || {};
}
});
dataService.updateClusterConfig(1, partitionData).success(function(data) {
$scope.next();
})
} else {
if ($scope.currentStep < $scope.steps.length)
$scope.currentStep = $scope.currentStep + 1;
$scope.next();
}
};
$scope.next = function() {
if ($scope.currentStep < $scope.steps.length)
$scope.currentStep = $scope.currentStep + 1;
}
// go to previous step
$scope.stepBackward = function() {
if ($scope.currentStep > 1)
@ -72,12 +120,31 @@ angular.module('compass.wizard', [
$scope.currentStep = stepId;
};
});
dataService.getAllServersInfo().success(function(data) {
$scope.servers = data;
dataService.getServers().success(function(data) {
$scope.allservers = data;
});
//For Server Selection Section
$scope.selectall = false;
$scope.selectAllServers = function(flag) {
if (flag) {
angular.forEach($scope.allservers, function(sv) {
sv.selected = true;
})
} else {
angular.forEach($scope.allservers, function(sv) {
sv.selected = false;
})
}
}
//TODO: show only selected servers
dataService.getAdapterConfig().success(function(data) {
$scope.os_global_config = data['os_config']['centos']['global'];
//console.log("###", $scope.os_global_config);
@ -90,24 +157,227 @@ angular.module('compass.wizard', [
'adapter_security': adapter_security
};
//console.log($scope.security);
});
//For General Section
$scope.general = {
"dns_servers": [""],
"search_path": [""]
};
$scope.addDNSServer = function() {
$scope.general['dns_servers'].push("");
}
$scope.addSearchPath = function() {
$scope.general['search_path'].push("");
}
//For Subnetworks Section
$scope.subnetworks = [];
$scope.newsubnetwork = {};
$scope.addSubnetwork = function() {
$scope.subnetworks.push($scope.newsubnetwork);
$scope.newsubnetwork = {};
$scope.subnetworks.push({});
console.log($scope.subnetworks);
};
$scope.removeSubnetwork = function(index) {
$scope.subnetworks.splice(index, 1)
};
$scope.$watch('subnetworks', function() {
if ($scope.subnetworks.length == 0) {
$scope.subnetworks.push({});
}
}, true);
//For Routing Table Section
$scope.routingtable = [];
$scope.newrouting = {};
$scope.addRouting = function() {
$scope.routingtable.push($scope.newrouting);
$scope.newrouting = {};
$scope.addRoute = function() {
$scope.routingtable.push({});
console.log($scope.routingtable);
};
$scope.removeRoute = function(index) {
$scope.routingtable.splice(index, 1)
};
$scope.$watch('routingtable', function() {
if ($scope.routingtable.length == 0) {
$scope.routingtable.push({});
}
}, true);
//For Partition Section
$scope.partition = []
$scope.addPartition = function() {
$scope.partition.push({});
console.log($scope.partition);
};
$scope.$watch('partition', function() {
if ($scope.partition.length == 0) {
$scope.partition.push({});
}
}, true);
//For Service Credentials Section
$scope.service_credentials = {
"rabbitmq": {
"username": "guest",
"password": "guest"
},
"compute": {
"username": "nova",
"password": "nova"
},
"dashboard": {
"username": "dashboard",
"password": "dashboard"
},
"identity": {
"username": "keystone",
"password": "keystone"
},
"image": {
"username": "glance",
"password": "glance"
},
"metering": {
"username": "ceilometer",
"password": "ceilometer"
},
"super": {
"username": "root",
"password": "root"
},
"volumn": {
"username": "cinder",
"password": "cinder"
}
};
//For management console credentials
$scope.management_credentials = {
"admin": {
"username": "admin",
"password": "admin"
},
"compute": {
"username": "nova",
"password": "nova"
},
"dashboard": {
"username": "dashboard",
"password": "dashboard"
},
"image": {
"username": "glance",
"password": "glance"
},
"metering": {
"username": "ceilometer",
"password": "ceilometer"
},
"network": {
"username": "quantum",
"password": "quantum"
},
"object-store": {
"username": "swift",
"password": "swift"
},
"volumn": {
"username": "cinder",
"password": "cinder"
}
}
})
.controller('roleAssignCtrl', function($scope, wizardFactory) {
$scope.servers = wizardFactory.getServers();
console.info("~~~~~", wizardFactory.getServers());
$scope.roles = wizardFactory.getAdapter().roles;
$scope.removeRole = function(server, role) {
var serverIndex = $scope.servers.indexOf(server);
var roleIndex = $scope.servers[serverIndex].roles.indexOf(role);
$scope.servers[serverIndex].roles.splice(roleIndex, 1);
};
$scope.assignRole = function(role) {
// get selected servers and assign role to them
var roleExist = false;
for (var i = 0; i < $scope.servers.length; i++) {
if ($scope.servers[i].checked) {
for (var j = 0; j < $scope.servers[i].roles.length; j++) {
if (role.name == $scope.servers[i].roles[j].name) {
roleExist = true;
}
}
}
if (!roleExist) {
$scope.servers[i].roles.push(role);
} else {
roleExist = false;
}
}
};
})
.controller('networkCtrl', function($scope, wizardFactory, dataService, $filter, ngTableParams) {
var cluster = wizardFactory.getClusterInfo();
$scope.servers = wizardFactory.getServers();
dataService.getServerColumns().success(function(data) {
console.info(data)
$scope.server_columns = data.showless;
});
dataService.getClusterSubnetConfig(cluster.id).success(function(data) {
$scope.subnetworks = data;
});
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: $scope.servers.length // count per page
}, {
counts: [], // hide count-per-page box
total: $scope.servers.length, // length of data
getData: function($defer, params) {
// use build-in angular filter
var orderedData = params.sorting() ?
$filter('orderBy')($scope.servers, params.orderBy()) : $scope.servers;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
$scope.interfaces = ["eth0", "eth1", "eth2", "eth3"];
$scope.addInterface = function(newInterface) {
var isExist = false;
angular.forEach($scope.interfaces, function(interface) {
if (interface == newInterface) {
isExist = true;
alert("This interface already exists. Please try another one");
}
})
if (!isExist) {
$scope.interfaces.push(newInterface);
}
$scope.newInterface = "";
};
$scope.deleteInterface = function(delInterface) {
var delIndex = $scope.interfaces.indexOf(delInterface);
$scope.interfaces.splice(delIndex, 1);
angular.forEach($scope.servers, function(sv) {
delete sv.network[delInterface];
})
}
$scope.autofill = function() {
//TODO: add auto fill
alert("Autofill coming soon");
}
})

3
v2/vendor/ng-table/ng-table.min.js vendored Normal file

File diff suppressed because one or more lines are too long