|
@@ -31,12 +31,7 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
|
|
|
hideBackButton: true,
|
|
|
|
|
|
content: Em.Object.create({
|
|
|
- controllerName: 'highAvailabilityWizardController',
|
|
|
- cluster: null,
|
|
|
- hosts: null,
|
|
|
- services: null,
|
|
|
- slaveComponentHosts: null,
|
|
|
- masterComponentHosts: null
|
|
|
+ controllerName: 'highAvailabilityWizardController'
|
|
|
}),
|
|
|
|
|
|
/**
|
|
@@ -47,116 +42,6 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
|
|
|
return jQuery.extend({}, this.get('clusterStatusTemplate'), {name: App.router.getClusterName()});
|
|
|
},
|
|
|
|
|
|
- /**
|
|
|
- * Load services data from server.
|
|
|
- */
|
|
|
- loadServicesFromServer: function() {
|
|
|
- var displayOrderConfig = require('data/services');
|
|
|
- var apiUrl = App.get('stack2VersionURL');
|
|
|
- var apiService = this.loadServiceComponents(displayOrderConfig, apiUrl);
|
|
|
- //
|
|
|
- apiService.forEach(function(item, index){
|
|
|
- apiService[index].isSelected = App.Service.find().someProperty('id', item.serviceName);
|
|
|
- apiService[index].isDisabled = apiService[index].isSelected;
|
|
|
- apiService[index].isInstalled = apiService[index].isSelected;
|
|
|
- });
|
|
|
- this.set('content.services', apiService);
|
|
|
- App.db.setService(apiService);
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * Load confirmed hosts.
|
|
|
- * Will be used at <code>Assign Masters(step5)</code> step
|
|
|
- */
|
|
|
- loadConfirmedHosts: function(){
|
|
|
- var hosts = App.db.getHosts();
|
|
|
- if(!hosts || !hosts.length){
|
|
|
- var hosts = {};
|
|
|
-
|
|
|
- App.Host.find().forEach(function(item){
|
|
|
- hosts[item.get('id')] = {
|
|
|
- name: item.get('id'),
|
|
|
- cpu: item.get('cpu'),
|
|
|
- memory: item.get('memory'),
|
|
|
- disk_info: item.get('diskInfo'),
|
|
|
- bootStatus: "REGISTERED",
|
|
|
- isInstalled: true
|
|
|
- };
|
|
|
- });
|
|
|
- App.db.setHosts(hosts);
|
|
|
- }
|
|
|
-
|
|
|
- this.set('content.hosts', hosts);
|
|
|
- console.log('ReassignMasterController.loadConfirmedHosts: loaded hosts', hosts);
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * Load master component hosts data for using in required step controllers
|
|
|
- */
|
|
|
- loadMasterComponentHosts: function () {
|
|
|
- var masterComponentHosts = App.db.getMasterComponentHosts();
|
|
|
- if(!masterComponentHosts){
|
|
|
- masterComponentHosts = [];
|
|
|
- App.HostComponent.find().filterProperty('isMaster', true).forEach(function(item){
|
|
|
- masterComponentHosts.push({
|
|
|
- component: item.get('componentName'),
|
|
|
- hostName: item.get('host.hostName'),
|
|
|
- isInstalled: true
|
|
|
- })
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
- this.set("content.masterComponentHosts", masterComponentHosts);
|
|
|
- console.log("ReassignMasterController.loadMasterComponentHosts: loaded hosts ", masterComponentHosts);
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * save status of the cluster.
|
|
|
- * @param clusterStatus object with status,requestId fields.
|
|
|
- */
|
|
|
- saveClusterStatus: function (clusterStatus) {
|
|
|
- var oldStatus = this.toObject(this.get('content.cluster'));
|
|
|
- clusterStatus = jQuery.extend(oldStatus, clusterStatus);
|
|
|
- if (clusterStatus.requestId) {
|
|
|
- clusterStatus.requestId.forEach(function (requestId) {
|
|
|
- if (clusterStatus.oldRequestsId.indexOf(requestId) === -1) {
|
|
|
- clusterStatus.oldRequestsId.push(requestId)
|
|
|
- }
|
|
|
- }, this);
|
|
|
- }
|
|
|
- this.set('content.cluster', clusterStatus);
|
|
|
- this.save('cluster');
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * Save Master Component Hosts data to Main Controller
|
|
|
- * @param stepController App.WizardStep5Controller
|
|
|
- */
|
|
|
- saveMasterComponentHosts: function (stepController) {
|
|
|
- var obj = stepController.get('selectedServicesMasters');
|
|
|
- var masterComponentHosts = [];
|
|
|
- obj.forEach(function (_component) {
|
|
|
- masterComponentHosts.push({
|
|
|
- display_name: _component.get('display_name'),
|
|
|
- component: _component.get('component_name'),
|
|
|
- hostName: _component.get('selectedHost'),
|
|
|
- serviceId: _component.get('serviceId'),
|
|
|
- isCurNameNode: _component.get('isCurNameNode'),
|
|
|
- isAddNameNode: _component.get('isAddNameNode'),
|
|
|
- isInstalled: true
|
|
|
- });
|
|
|
- });
|
|
|
- App.db.setMasterComponentHosts(masterComponentHosts);
|
|
|
- this.set('content.masterComponentHosts', masterComponentHosts);
|
|
|
- },
|
|
|
-
|
|
|
- loadComponentToReassign: function () {
|
|
|
- var masterComponent = App.db.getMasterToReassign();
|
|
|
- if (masterComponent) {
|
|
|
- this.set('content.reassign', masterComponent);
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
/**
|
|
|
* Load data for all steps until <code>current step</code>
|
|
|
*/
|
|
@@ -166,9 +51,6 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
|
|
|
case '4':
|
|
|
case '3':
|
|
|
case '2':
|
|
|
- this.loadServicesFromServer();
|
|
|
- this.loadMasterComponentHosts();
|
|
|
- this.loadConfirmedHosts();
|
|
|
case '1':
|
|
|
this.load('cluster');
|
|
|
}
|