|
@@ -18,6 +18,7 @@
|
|
|
|
|
|
|
|
|
|
var App = require('app');
|
|
var App = require('app');
|
|
|
|
+var lazyLoading = require('utils/lazy_loading');
|
|
App.AddServiceController = App.WizardController.extend({
|
|
App.AddServiceController = App.WizardController.extend({
|
|
|
|
|
|
name: 'addServiceController',
|
|
name: 'addServiceController',
|
|
@@ -78,21 +79,6 @@ App.AddServiceController = App.WizardController.extend({
|
|
*/
|
|
*/
|
|
loadConfirmedHosts: function(){
|
|
loadConfirmedHosts: function(){
|
|
var hosts = this.getDBProperty('hosts');
|
|
var hosts = this.getDBProperty('hosts');
|
|
- if(!hosts){
|
|
|
|
- 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
|
|
|
|
- };
|
|
|
|
- });
|
|
|
|
- this.setDBProperty('hosts', hosts);
|
|
|
|
- }
|
|
|
|
|
|
|
|
this.set('content.hosts', hosts);
|
|
this.set('content.hosts', hosts);
|
|
console.log('AddServiceController.loadConfirmedHosts: loaded hosts', hosts);
|
|
console.log('AddServiceController.loadConfirmedHosts: loaded hosts', hosts);
|
|
@@ -161,33 +147,44 @@ App.AddServiceController = App.WizardController.extend({
|
|
* @param stepController App.WizardStep5Controller
|
|
* @param stepController App.WizardStep5Controller
|
|
*/
|
|
*/
|
|
saveMasterComponentHosts: function (stepController) {
|
|
saveMasterComponentHosts: function (stepController) {
|
|
- var obj = stepController.get('selectedServicesMasters');
|
|
|
|
- var masterComponentHosts = [];
|
|
|
|
- var installedComponents = App.HostComponent.find();
|
|
|
|
|
|
|
|
|
|
+ App.ajax.send({
|
|
|
|
+ name: 'host_components.all',
|
|
|
|
+ sender: this,
|
|
|
|
+ data: {
|
|
|
|
+ clusterName: App.get('clusterName'),
|
|
|
|
+ stepController: stepController
|
|
|
|
+ },
|
|
|
|
+ success: 'saveMasterComponentHostsSuccessCallback'
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ saveMasterComponentHostsSuccessCallback: function (response, request, data) {
|
|
|
|
+ var obj = data.stepController.get('selectedServicesMasters');
|
|
|
|
+ var masterComponentHosts = [];
|
|
obj.forEach(function (_component) {
|
|
obj.forEach(function (_component) {
|
|
- masterComponentHosts.push({
|
|
|
|
- display_name: _component.display_name,
|
|
|
|
- component: _component.component_name,
|
|
|
|
- hostName: _component.selectedHost,
|
|
|
|
- serviceId: _component.serviceId,
|
|
|
|
- isInstalled: installedComponents.someProperty('componentName', _component.component_name)
|
|
|
|
- });
|
|
|
|
|
|
+ masterComponentHosts.push({
|
|
|
|
+ display_name: _component.display_name,
|
|
|
|
+ component: _component.component_name,
|
|
|
|
+ hostName: _component.selectedHost,
|
|
|
|
+ serviceId: _component.serviceId,
|
|
|
|
+ isInstalled: response.items.someProperty('HostRoles.component_name', _component.component_name)
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
|
|
console.log("AddServiceController.saveMasterComponentHosts: saved hosts ", masterComponentHosts);
|
|
console.log("AddServiceController.saveMasterComponentHosts: saved hosts ", masterComponentHosts);
|
|
this.setDBProperty('masterComponentHosts', masterComponentHosts);
|
|
this.setDBProperty('masterComponentHosts', masterComponentHosts);
|
|
- this.set('content.masterComponentHosts', masterComponentHosts);
|
|
|
|
-
|
|
|
|
- this.set('content.skipMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
|
|
|
|
- this.get('isStepDisabled').findProperty('step', 2).set('value', this.get('content.skipMasterStep'));
|
|
|
|
- },
|
|
|
|
|
|
+ this.set('content.masterComponentHosts', []);
|
|
|
|
+ lazyLoading.run({
|
|
|
|
+ initSize: 20,
|
|
|
|
+ chunkSize: 50,
|
|
|
|
+ delay: 50,
|
|
|
|
+ destination: this.get('content.masterComponentHosts'),
|
|
|
|
+ source: masterComponentHosts,
|
|
|
|
+ context: this
|
|
|
|
+ });
|
|
|
|
|
|
- /**
|
|
|
|
- * Load master component hosts data for using in required step controllers
|
|
|
|
- */
|
|
|
|
- loadMasterComponentHosts: function () {
|
|
|
|
- this._super();
|
|
|
|
this.set('content.skipMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
|
|
this.set('content.skipMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
|
|
this.get('isStepDisabled').findProperty('step', 2).set('value', this.get('content.skipMasterStep'));
|
|
this.get('isStepDisabled').findProperty('step', 2).set('value', this.get('content.skipMasterStep'));
|
|
},
|
|
},
|
|
@@ -238,11 +235,22 @@ App.AddServiceController = App.WizardController.extend({
|
|
*/
|
|
*/
|
|
loadSlaveComponentHosts: function () {
|
|
loadSlaveComponentHosts: function () {
|
|
var slaveComponentHosts = this.getDBProperty('slaveComponentHosts');
|
|
var slaveComponentHosts = this.getDBProperty('slaveComponentHosts');
|
|
|
|
+ var message = 'AddServiceController.loadSlaveComponentHosts: loaded hosts ';
|
|
|
|
+ this.set('content.slaveComponentHosts', []);
|
|
if(!slaveComponentHosts){
|
|
if(!slaveComponentHosts){
|
|
- slaveComponentHosts = this.getSlaveComponentHosts();
|
|
|
|
|
|
+ this.getSlaveComponentHosts(this, 'content.slaveComponentHosts', message);
|
|
|
|
+ } else {
|
|
|
|
+ this.set('content.slaveComponentHosts', []);
|
|
|
|
+ lazyLoading.run({
|
|
|
|
+ initSize: 20,
|
|
|
|
+ chunkSize: 50,
|
|
|
|
+ delay: 50,
|
|
|
|
+ destination: this.get('content.slaveComponentHosts'),
|
|
|
|
+ source: slaveComponentHosts,
|
|
|
|
+ context: this
|
|
|
|
+ });
|
|
|
|
+ console.log(message, slaveComponentHosts);
|
|
}
|
|
}
|
|
- this.set("content.slaveComponentHosts", slaveComponentHosts);
|
|
|
|
- console.log("AddServiceController.loadSlaveComponentHosts: loaded hosts ", slaveComponentHosts);
|
|
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -250,23 +258,43 @@ App.AddServiceController = App.WizardController.extend({
|
|
* @param stepController step4WizardController
|
|
* @param stepController step4WizardController
|
|
*/
|
|
*/
|
|
saveClients: function(stepController){
|
|
saveClients: function(stepController){
|
|
|
|
+
|
|
|
|
+ App.ajax.send({
|
|
|
|
+ name: 'host_components.all',
|
|
|
|
+ sender: this,
|
|
|
|
+ data: {
|
|
|
|
+ clusterName: App.get('clusterName'),
|
|
|
|
+ stepController: stepController
|
|
|
|
+ },
|
|
|
|
+ success: 'saveClientsSuccessCallback'
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ saveClientsSuccessCallback: function (response, request, data) {
|
|
var clients = [];
|
|
var clients = [];
|
|
var serviceComponents = App.StackServiceComponent.find();
|
|
var serviceComponents = App.StackServiceComponent.find();
|
|
- var hostComponents = App.HostComponent.find();
|
|
|
|
-
|
|
|
|
- stepController.get('content').filterProperty('isSelected',true).forEach(function (_service) {
|
|
|
|
|
|
+ data.stepController.get('content').filterProperty('isSelected',true).forEach(function (_service) {
|
|
var client = serviceComponents.filterProperty('serviceName', _service.serviceName).findProperty('isClient', true);
|
|
var client = serviceComponents.filterProperty('serviceName', _service.serviceName).findProperty('isClient', true);
|
|
if (client) {
|
|
if (client) {
|
|
clients.pushObject({
|
|
clients.pushObject({
|
|
component_name: client.get('componentName'),
|
|
component_name: client.get('componentName'),
|
|
display_name: client.get('displayName'),
|
|
display_name: client.get('displayName'),
|
|
- isInstalled: hostComponents.filterProperty('componentName', client.get('componentName')).length > 0
|
|
|
|
|
|
+ isInstalled: response.items.filterProperty('HostRoles.component_name', client.get('componentName')).length > 0
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}, this);
|
|
}, this);
|
|
|
|
|
|
this.setDBProperty('clientInfo', clients);
|
|
this.setDBProperty('clientInfo', clients);
|
|
- this.set('content.clients', clients);
|
|
|
|
|
|
+ this.set('content.clients', []);
|
|
|
|
+ lazyLoading.run({
|
|
|
|
+ initSize: 20,
|
|
|
|
+ chunkSize: 50,
|
|
|
|
+ delay: 50,
|
|
|
|
+ destination: this.get('content.clients'),
|
|
|
|
+ source: clients,
|
|
|
|
+ context: this
|
|
|
|
+ });
|
|
console.log("AddServiceController.saveClients: saved list ", clients);
|
|
console.log("AddServiceController.saveClients: saved list ", clients);
|
|
},
|
|
},
|
|
|
|
|