|
@@ -43,9 +43,6 @@ App.ServerValidatorMixin = Em.Mixin.create({
|
|
|
*/
|
|
|
recommendationsConfigs: null,
|
|
|
|
|
|
- loadAdditionalinfo: function() {
|
|
|
- return !(this.get('content.hosts') && this.get('content.hosts').length);
|
|
|
- }.property('content.hosts'),
|
|
|
/**
|
|
|
* by default loads data from model otherwise must be overridden as computed property
|
|
|
* refer to \assets\data\stacks\HDP-2.1\recommendations_configs.json to learn structure
|
|
@@ -55,8 +52,8 @@ App.ServerValidatorMixin = Em.Mixin.create({
|
|
|
hostNames: function() {
|
|
|
return this.get('content.hosts')
|
|
|
? Object.keys(this.get('content.hosts'))
|
|
|
- : this.get('allHostNames');
|
|
|
- }.property('content.hosts', 'allHostNames'),
|
|
|
+ : App.get('allHostNames');
|
|
|
+ }.property('content.hosts', 'App.allHostNames'),
|
|
|
|
|
|
allHostNames: [],
|
|
|
/**
|
|
@@ -139,21 +136,14 @@ App.ServerValidatorMixin = Em.Mixin.create({
|
|
|
console.error('Load recommendations failed');
|
|
|
},
|
|
|
|
|
|
- serverSideValidation: function() {
|
|
|
+ serverSideValidation: function () {
|
|
|
var deferred = $.Deferred();
|
|
|
if (!App.get('supports.serverRecommendValidate')) {
|
|
|
deferred.resolve();
|
|
|
} else {
|
|
|
this.set('configValidationFailed', false);
|
|
|
- if (this.get('loadAdditionalinfo')) {
|
|
|
- var self = this;
|
|
|
- this.getHostNames().always(function() {
|
|
|
- if (self.get('configValidationFailed')) {
|
|
|
- self.warnUser(deferred);
|
|
|
- } else {
|
|
|
- self.runServerSideValidation(deferred);
|
|
|
- }
|
|
|
- });
|
|
|
+ if (this.get('configValidationFailed')) {
|
|
|
+ this.warnUser(deferred);
|
|
|
} else {
|
|
|
this.runServerSideValidation(deferred);
|
|
|
}
|
|
@@ -161,37 +151,6 @@ App.ServerValidatorMixin = Em.Mixin.create({
|
|
|
return deferred;
|
|
|
},
|
|
|
|
|
|
- getHostNames: function() {
|
|
|
- var self = this;
|
|
|
-
|
|
|
- if (self.get('isInstaller')) {
|
|
|
- // In installer wizard 'hosts.all' AJAX will not work cause cluster haven't been created yet
|
|
|
- var hosts = [];
|
|
|
- for (var host in self.get('content.hosts')) {
|
|
|
- hosts.push(host);
|
|
|
- }
|
|
|
- self.set("allHostNames", hosts);
|
|
|
- var deferred = $.Deferred();
|
|
|
- deferred.resolve();
|
|
|
- return deferred;
|
|
|
- } else {
|
|
|
- return App.ajax.send({
|
|
|
- name: 'hosts.all',
|
|
|
- sender: self,
|
|
|
- success: 'getHostNamesSuccess',
|
|
|
- error: 'getHostNamesError'
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- getHostNamesSuccess: function(data) {
|
|
|
- this.set("allHostNames", data.items.mapProperty("Hosts.host_name"));
|
|
|
- },
|
|
|
-
|
|
|
- getHostNamesError: function() {
|
|
|
- this.set('configValidationFailed', true);
|
|
|
- console.error('failed to load hostNames');
|
|
|
- },
|
|
|
/**
|
|
|
* @method serverSideValidation
|
|
|
* send request to validate configs
|