You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/08/12 13:21:01 UTC
[1/5] ambari git commit: Revert "AMBARI-12713. Empty Alert groups
dropdown after page refresh (onechiporenko)"
Repository: ambari
Updated Branches:
refs/heads/branch-2.1.1 b761b90ba -> 1a7a02c4a
Revert "AMBARI-12713. Empty Alert groups dropdown after page refresh (onechiporenko)"
This reverts commit bd6e95ffdd51b941b9add382ca29fa6bbb6a5a10.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5c2a7927
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5c2a7927
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5c2a7927
Branch: refs/heads/branch-2.1.1
Commit: 5c2a7927112fbcbd02db602cbc79d1dfaefd393a
Parents: b761b90
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Aug 12 14:19:10 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Aug 12 14:19:10 2015 +0300
----------------------------------------------------------------------
ambari-web/app/templates/main/alerts.hbs | 2 --
ambari-web/package.json | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5c2a7927/ambari-web/app/templates/main/alerts.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts.hbs b/ambari-web/app/templates/main/alerts.hbs
index 33bc908..2547ad9 100644
--- a/ambari-web/app/templates/main/alerts.hbs
+++ b/ambari-web/app/templates/main/alerts.hbs
@@ -23,9 +23,7 @@
{{/isAccessible}}
<div id="alert-groups-filter" class="pull-left advanced-header-table groups-filter">
-{{#if App.router.clusterController.isAlertsLoaded}}
{{view view.alertGroupFilterView}}
-{{/if}}
</div>
<div id="alerts">
http://git-wip-us.apache.org/repos/asf/ambari/blob/5c2a7927/ambari-web/package.json
----------------------------------------------------------------------
diff --git a/ambari-web/package.json b/ambari-web/package.json
index 6a3aa7e..d18b162 100644
--- a/ambari-web/package.json
+++ b/ambari-web/package.json
@@ -1,7 +1,7 @@
{
"name": "Ambari",
"description": "Front-end package for the Apache Ambari Project",
- "version": "2.1.2",
+ "version": "2.1.0",
"homepage": "http://ambari.apache.org/",
"repository": {
"type": "git",
[4/5] ambari git commit: Revert "AMBARI-12717. Ambari UI with 10K+
alerts on the cluster becomes unresponsive after opening alerts popup
(onechiporenko)"
Posted by al...@apache.org.
Revert "AMBARI-12717. Ambari UI with 10K+ alerts on the cluster becomes unresponsive after opening alerts popup (onechiporenko)"
This reverts commit 959874c2a2caca8ff0df319f31cb7a5b6c2b53c3.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bf809c19
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bf809c19
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bf809c19
Branch: refs/heads/branch-2.1.1
Commit: bf809c19dd9243d0965ac6a54220b6865fbb4bb1
Parents: fc71869
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Aug 12 14:20:09 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Aug 12 14:20:09 2015 +0300
----------------------------------------------------------------------
.../main/alerts/alert_instances_controller.js | 42 ++++++++------------
.../common/modal_popups/alerts_popup.hbs | 4 +-
2 files changed, 18 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bf809c19/ambari-web/app/controllers/main/alerts/alert_instances_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/alert_instances_controller.js b/ambari-web/app/controllers/main/alerts/alert_instances_controller.js
index 0117104..391c326 100644
--- a/ambari-web/app/controllers/main/alerts/alert_instances_controller.js
+++ b/ambari-web/app/controllers/main/alerts/alert_instances_controller.js
@@ -27,18 +27,11 @@ App.MainAlertInstancesController = Em.Controller.extend({
/**
* @type {App.AlertInstance[]}
*/
- unhealthyAlertInstances: [],
-
- updateUnhealthyAlertInstances: function () {
- Em.run.once(this, this.updateUnhealthyAlertInstancesOnce);
- }.observes('content.[]'),
-
- updateUnhealthyAlertInstancesOnce: function() {
- var alertInstances = App.AlertInstance.find().filter(function (item) {
+ unhealthyAlertInstances: function () {
+ return App.AlertInstance.find().filter(function (item) {
return ['CRITICAL', 'WARNING'].contains(item.get('state'));
});
- this.set('unhealthyAlertInstances', alertInstances);
- },
+ }.property('content.[]'),
/**
* Are alertInstances loaded
@@ -124,11 +117,9 @@ App.MainAlertInstancesController = Em.Controller.extend({
* @method loadAlertInstances
*/
loadAlertInstances: function () {
- this.setProperties({
- isLoaded: false,
- sourceType: null,
- sourceName: null
- });
+ this.set('isLoaded', false);
+ this.set('sourceType', null);
+ this.set('sourceName', null);
this.fetchAlertInstances();
},
@@ -139,11 +130,9 @@ App.MainAlertInstancesController = Em.Controller.extend({
* @method loadAlertInstancesByHost
*/
loadAlertInstancesByHost: function (hostName) {
- this.setProperties({
- isLoaded: false,
- sourceType: 'HOST',
- sourceName: hostName
- });
+ this.set('isLoaded', false);
+ this.set('sourceType', 'HOST');
+ this.set('sourceName', hostName);
this.fetchAlertInstances();
},
@@ -154,11 +143,9 @@ App.MainAlertInstancesController = Em.Controller.extend({
* @method loadAlertInstancesByAlertDefinition
*/
loadAlertInstancesByAlertDefinition: function (definitionId) {
- this.setProperties({
- isLoaded: false,
- sourceType: 'ALERT_DEFINITION',
- sourceName: definitionId
- });
+ this.set('isLoaded', false);
+ this.set('sourceType', 'ALERT_DEFINITION');
+ this.set('sourceName', definitionId);
this.fetchAlertInstances();
},
@@ -184,7 +171,7 @@ App.MainAlertInstancesController = Em.Controller.extend({
getAlertInstancesSuccessCallback: function (json) {
App.alertInstanceMapper.map(json);
this.set('isLoaded', true);
- this.toggleProperty('reload');
+ this.set('reload', !this.get('reload'));
},
/**
@@ -212,6 +199,8 @@ App.MainAlertInstancesController = Em.Controller.extend({
return Em.I18n.t('alerts.fastAccess.popup.header').format(this.get('alertsNumber'));
}.property('alertsNumber'),
+ definitionsController: this,
+
classNames: ['sixty-percent-width-modal', 'alerts-popup'],
secondary: Em.I18n.t('alerts.fastAccess.popup.body.showmore'),
@@ -354,6 +343,7 @@ App.MainAlertInstancesController = Em.Controller.extend({
didInsertElement: function () {
this.filter();
+ this.ensureTooltip();
this.addObserver('filteringComplete', this, this.overlayObserver);
this.overlayObserver();
return this._super();
http://git-wip-us.apache.org/repos/asf/ambari/blob/bf809c19/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs b/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
index 5b235de..2e57a50 100644
--- a/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
+++ b/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
@@ -42,10 +42,10 @@
{{alertInstance.text}}
</div>
</div>
- <div class="status-col" {{bindAttr title="alertInstance.lastTriggered"}}>
+ <div class="status-col" rel="alert-status-tooltip" {{bindAttr title="alertInstance.lastTriggered"}}>
<span>
<span class="status-icon">{{{alertInstance.status}}}</span>
- <time>{{alertInstance.lastTriggeredForFormatted}}</time>
+ <time class="timeago" {{bindAttr data-original-title="alertInstance.lastTriggeredVerboseDisplay"}}>{{alertInstance.lastTriggeredForFormatted}}</time>
</span>
</div>
</div>
[3/5] ambari git commit: Revert "AMBARI-12715. FE: Adding 1000 hosts
to config group takes 50-60 seconds to process (onechiporenko)"
Posted by al...@apache.org.
Revert "AMBARI-12715. FE: Adding 1000 hosts to config group takes 50-60 seconds to process (onechiporenko)"
This reverts commit 591709e7ea89da9170902927e4b64851dd163a1b.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fc718690
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fc718690
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fc718690
Branch: refs/heads/branch-2.1.1
Commit: fc7186903465b90235a9d3f2dba21af3863c31f1
Parents: 1f2870c
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Aug 12 14:19:56 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Aug 12 14:19:56 2015 +0300
----------------------------------------------------------------------
.../service/manage_config_groups_controller.js | 18 +++++------
.../manage_config_groups_controller_test.js | 32 --------------------
2 files changed, 9 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/fc718690/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
index d29b470..e1d44ca 100644
--- a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
+++ b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
@@ -479,32 +479,32 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, {
},
/**
- * Remove selected hosts from default group (<code>selectedConfigGroup.parentConfigGroup</code>) and add them to the <code>selectedConfigGroup</code>
+ * add hosts callback
* @param {string[]} selectedHosts
* @method addHostsCallback
*/
addHostsCallback: function (selectedHosts) {
if (selectedHosts) {
var group = this.get('selectedConfigGroup');
- var parentGroupHosts = group.get('parentConfigGroup.hosts');
- var newHostsForParentGroup = parentGroupHosts.filter(function(hostName) {
- return !selectedHosts.contains(hostName);
+ selectedHosts.forEach(function (hostName) {
+ group.get('hosts').pushObject(hostName);
+ group.get('parentConfigGroup.hosts').removeObject(hostName);
});
- group.get('hosts').pushObjects(selectedHosts);
- group.set('parentConfigGroup.hosts', newHostsForParentGroup);
}
},
/**
- * Delete hosts from <code>selectedConfigGroup</code> and move them to the Default group (<code>selectedConfigGroup.parentConfigGroup</code>)
+ * delete hosts from group
* @method deleteHosts
*/
deleteHosts: function () {
if (this.get('isDeleteHostsDisabled')) {
return;
}
- var hosts = this.get('selectedHosts').slice();
- this.get('selectedConfigGroup.parentConfigGroup.hosts').pushObjects(hosts);
+ this.get('selectedHosts').slice().forEach(function (hostName) {
+ this.get('selectedConfigGroup.parentConfigGroup.hosts').pushObject(hostName);
+ this.get('selectedConfigGroup.hosts').removeObject(hostName);
+ }, this);
this.set('selectedHosts', []);
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/fc718690/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js b/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
index b45f7ab..a1812c8 100644
--- a/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
+++ b/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
@@ -18,14 +18,12 @@
var App = require('app');
var c;
-
describe('App.ManageConfigGroupsController', function() {
var controller = App.ManageConfigGroupsController.create({});
beforeEach(function() {
c = App.ManageConfigGroupsController.create({});
});
-
var manageConfigGroupsController = App.ManageConfigGroupsController.create({});
describe('#addConfigGroup', function() {
@@ -159,34 +157,4 @@ describe('App.ManageConfigGroupsController', function() {
});
- describe('#deleteConfigGroup', function () {
-
- beforeEach(function() {
-
- var defaultGroup = Em.Object.create({
- hosts: ['h2', 'h3'],
- isDefault: true
- });
-
- var selectedGroup = Em.Object.create({
- hosts: ['h1'],
- parentConfigGroup: defaultGroup
- });
-
- c.reopen({
- configGroups: [defaultGroup, selectedGroup],
- selectedConfigGroup: selectedGroup
- });
- });
-
- it('after deleting some config group, Default should be selected', function () {
-
- c.deleteConfigGroup();
-
- expect(c.get('selectedConfigGroup.hosts')).to.include.members(['h1','h2','h3']);
- expect(c.get('selectedConfigGroup.isDefault')).to.be.true;
- });
-
- });
-
});
[2/5] ambari git commit: Revert "AMBARI-12714. FE: Adding 100
definitions to the alert group takes to much time (onechiporenko)"
Posted by al...@apache.org.
Revert "AMBARI-12714. FE: Adding 100 definitions to the alert group takes to much time (onechiporenko)"
This reverts commit 6067dfaccf067e77dbdacce423ebf3c68d2e5bb7.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1f2870cd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1f2870cd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1f2870cd
Branch: refs/heads/branch-2.1.1
Commit: 1f2870cd0c90229348a6f5658b9c57db2b47952c
Parents: 5c2a792
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Aug 12 14:19:41 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Aug 12 14:19:41 2015 +0300
----------------------------------------------------------------------
.../alerts/manage_alert_groups_controller.js | 39 +++++++++-----------
.../manage_alert_groups_controller_test.js | 3 +-
2 files changed, 20 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1f2870cd/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js b/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
index 2ca2536..b2ead3f 100644
--- a/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
+++ b/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
@@ -163,15 +163,13 @@ App.ManageAlertGroupsController = Em.Controller.extend({
* @method loadAlertNotifications
*/
loadAlertNotifications: function () {
- this.setProperties({
- isLoaded: false,
- alertGroups: [],
- originalAlertGroups: [],
- selectedAlertGroup: null,
- isRemoveButtonDisabled: true,
- isRenameButtonDisabled: true,
- isDuplicateButtonDisabled: true
- });
+ this.set('isLoaded', false);
+ this.set('alertGroups', []);
+ this.set('originalAlertGroups', []);
+ this.set('selectedAlertGroup', null);
+ this.set('isRemoveButtonDisabled', true);
+ this.set('isRenameButtonDisabled', true);
+ this.set('isDuplicateButtonDisabled', true);
return App.ajax.send({
name: 'alerts.notifications',
sender: this,
@@ -246,12 +244,10 @@ App.ManageAlertGroupsController = Em.Controller.extend({
notifications: targets
});
});
- this.setProperties({
- alertGroups: alertGroups,
- isLoaded: true,
- originalAlertGroups: this.copyAlertGroups(alertGroups),
- selectedAlertGroup: this.get('alertGroups')[0]
- });
+ this.set('alertGroups', alertGroups);
+ this.set('isLoaded', true);
+ this.set('originalAlertGroups', this.copyAlertGroups(this.get('alertGroups')));
+ this.set('selectedAlertGroup', this.get('alertGroups')[0]);
},
/**
@@ -261,11 +257,9 @@ App.ManageAlertGroupsController = Em.Controller.extend({
buttonObserver: function () {
var selectedAlertGroup = this.get('selectedAlertGroup');
var flag = selectedAlertGroup && selectedAlertGroup.get('default');
- this.setProperties({
- isRemoveButtonDisabled: flag,
- isRenameButtonDisabled: flag,
- isDuplicateButtonDisabled: false
- });
+ this.set('isRemoveButtonDisabled', flag);
+ this.set('isRenameButtonDisabled', flag);
+ this.set('isDuplicateButtonDisabled', false);
}.observes('selectedAlertGroup'),
/**
@@ -439,7 +433,10 @@ App.ManageAlertGroupsController = Em.Controller.extend({
addDefinitionsCallback: function (selectedDefs) {
var group = this.get('selectedAlertGroup');
if (selectedDefs) {
- group.get('definitions').pushObjects(selectedDefs);
+ var alertGroupDefs = group.get('definitions');
+ selectedDefs.forEach(function (defObj) {
+ alertGroupDefs.pushObject(defObj);
+ }, this);
}
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/1f2870cd/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js b/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
index dc1fc1f..67d3397 100644
--- a/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
@@ -212,7 +212,8 @@ describe('App.ManageAlertGroupsController', function () {
};
var result = function (originalDefs, addedDefs) {
- return originalDefs.concat(addedDefs);
+ var result = originalDefs.concat(addedDefs);
+ return result;
};
var tests = [
[5/5] ambari git commit: Revert "AMBARI-12721. Assign Slaves and
Clients. Table timings issue (onechiporenko)"
Posted by al...@apache.org.
Revert "AMBARI-12721. Assign Slaves and Clients. Table timings issue (onechiporenko)"
This reverts commit 382294fca86facbf561362a410fc01c0b6c966b6.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1a7a02c4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1a7a02c4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1a7a02c4
Branch: refs/heads/branch-2.1.1
Commit: 1a7a02c4ae39c2a2ded55653352e7d39c5340f5c
Parents: bf809c1
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Aug 12 14:20:20 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Aug 12 14:20:20 2015 +0300
----------------------------------------------------------------------
.../app/controllers/wizard/step6_controller.js | 21 +-
ambari-web/app/mixins/common/blueprint.js | 10 +-
ambari-web/app/templates/wizard/step6.hbs | 36 +--
ambari-web/app/utils/blueprint.js | 219 +++++--------------
ambari-web/app/views/wizard/step6_view.js | 34 +--
ambari-web/test/utils/blueprint_test.js | 37 ++++
ambari-web/test/views/wizard/step6_view_test.js | 9 +-
7 files changed, 149 insertions(+), 217 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a7a02c4/ambari-web/app/controllers/wizard/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js
index 893ec24..6d77f89 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -519,6 +519,9 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, {
callServerSideValidation: function (successCallback) {
var self = this;
+ // We do not want to disable Next due to server validation issues - hence commented out line below
+ // self.set('submitDisabled', true);
+
var selectedServices = App.StackService.find().filterProperty('isSelected').mapProperty('serviceName');
var installedServices = App.StackService.find().filterProperty('isInstalled').mapProperty('serviceName');
var services = installedServices.concat(selectedServices).uniq();
@@ -537,11 +540,9 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, {
var invisibleMasters = [];
if (this.get('isInstallerWizard')) {
invisibleMasters = App.StackServiceComponent.find().filterProperty("isMaster").filterProperty("isShownOnInstallerAssignMasterPage", false).mapProperty("componentName");
+ } else if (this.get('isAddServiceWizard')) {
+ invisibleMasters = App.StackServiceComponent.find().filterProperty("isMaster").filterProperty("isShownOnAddServiceAssignMasterPage", false).mapProperty("componentName");
}
- else
- if (this.get('isAddServiceWizard')) {
- invisibleMasters = App.StackServiceComponent.find().filterProperty("isMaster").filterProperty("isShownOnAddServiceAssignMasterPage", false).mapProperty("componentName");
- }
var selectedClientComponents = self.get('content.clients').mapProperty('component_name');
var alreadyInstalledClients = App.get('components.clients').reject(function (c) {
@@ -552,18 +553,16 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, {
var invisibleBlueprint = blueprintUtils.filterByComponents(this.get('content.recommendations'), invisibleComponents);
masterBlueprint = blueprintUtils.mergeBlueprints(masterBlueprint, invisibleBlueprint);
+ } else if (this.get('isAddHostWizard')) {
+ masterBlueprint = self.getCurrentMasterSlaveBlueprint();
+ hostNames = hostNames.concat(App.Host.find().mapProperty("hostName")).uniq();
+ slaveBlueprint = blueprintUtils.addComponentsToBlueprint(slaveBlueprint, invisibleSlavesAndClients);
}
- else
- if (this.get('isAddHostWizard')) {
- masterBlueprint = self.getCurrentMasterSlaveBlueprint();
- hostNames = hostNames.concat(App.Host.find().mapProperty("hostName")).uniq();
- slaveBlueprint = blueprintUtils.addComponentsToBlueprint(slaveBlueprint, invisibleSlavesAndClients);
- }
var bluePrintsForValidation = blueprintUtils.mergeBlueprints(masterBlueprint, slaveBlueprint);
this.set('content.recommendationsHostGroups', bluePrintsForValidation);
- return App.ajax.send({
+ App.ajax.send({
name: 'config.validations',
sender: self,
data: {
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a7a02c4/ambari-web/app/mixins/common/blueprint.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/blueprint.js b/ambari-web/app/mixins/common/blueprint.js
index 4889b3d..938fca9 100644
--- a/ambari-web/app/mixins/common/blueprint.js
+++ b/ambari-web/app/mixins/common/blueprint.js
@@ -53,16 +53,16 @@ App.BlueprintMixin = Em.Mixin.create({
},
/**
- * Returns blueprint for all currently installed slave and client components
+ * returns blueprint for all currenlty installed slave and client components
*/
getCurrentSlaveBlueprint: function () {
var self = this;
var fullBlueprint = self.getCurrentMasterSlaveBlueprint();
- var components = App.StackServiceComponent.find().filter(function (c) {
- return c.get('isSlave') || c.get('isClient');
- }).mapProperty("componentName");
+ var slaveComponents = App.StackServiceComponent.find().filterProperty("isSlave").mapProperty("componentName");
+ var clientComponents = App.StackServiceComponent.find().filterProperty("isClient").mapProperty("componentName");
+ var slaveAndClientComponents = slaveComponents.concat(clientComponents);
- return blueprintUtils.filterByComponents(fullBlueprint, components);
+ return blueprintUtils.filterByComponents(fullBlueprint, slaveAndClientComponents);
}
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a7a02c4/ambari-web/app/templates/wizard/step6.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step6.hbs b/ambari-web/app/templates/wizard/step6.hbs
index 29ed76c..215dc2b 100644
--- a/ambari-web/app/templates/wizard/step6.hbs
+++ b/ambari-web/app/templates/wizard/step6.hbs
@@ -17,15 +17,15 @@
}}
<div id="step6">
- <h2>{{t installer.step6.header}}</h2>
+ <h2>{{view.title}}</h2>
<div class="alert alert-info">{{{view.label}}}</div>
{{#if anyGeneralIssues}}
- <div class="alert alert-error">
- {{t installer.step6.validationSlavesAndClients.hasIssues}}
- <a href="javascript:void(null);" {{action openSlavesAndClientsIssues target="controller"}}>{{t installer.step6.validationSlavesAndClients.click}}</a>
- {{t installer.step6.validationSlavesAndClients.forDetails}}
- </div>
+ <div class="alert alert-error">
+ {{t installer.step6.validationSlavesAndClients.hasIssues}}
+ <a href="javascript:void(null);" {{action openSlavesAndClientsIssues target="controller"}}>{{t installer.step6.validationSlavesAndClients.click}}</a>
+ {{t installer.step6.validationSlavesAndClients.forDetails}}
+ </div>
{{/if}}
<div class="pre-scrollable">
@@ -46,6 +46,7 @@
</tr>
</thead>
<tbody>
+ {{#if view.pageContent}}
{{#each host in view.pageContent}}
<tr>
{{#view App.WizardStep6HostView hostBinding="host" }}
@@ -63,19 +64,18 @@
</td>
{{/each}}
</tr>
- {{#if host.anyMessage}}
- <tr>
- <td {{bindAttr colspan="view.columnCount"}} class="no-borders">
- {{#each errorMsg in host.errorMessages}}
- <div class="alert alert-error">{{errorMsg}}</div>
- {{/each}}
- {{#each warnMsg in host.warnMessages}}
- <div class="alert alert-warning">{{warnMsg}}</div>
- {{/each}}
- </td>
- </tr>
- {{/if}}
+ <tr {{bindAttr class="host.anyMessage::hidden"}}>
+ <td {{bindAttr colspan="view.columnCount"}} class="no-borders">
+ {{#each errorMsg in host.errorMessages}}
+ <div class="alert alert-error">{{errorMsg}}</div>
+ {{/each}}
+ {{#each warnMsg in host.warnMessages}}
+ <div class="alert alert-warning">{{warnMsg}}</div>
+ {{/each}}
+ </td>
+ </tr>
{{/each}}
+ {{/if}}
</tbody>
</table>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a7a02c4/ambari-web/app/utils/blueprint.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/blueprint.js b/ambari-web/app/utils/blueprint.js
index 687c7fd..6ccd86c 100644
--- a/ambari-web/app/utils/blueprint.js
+++ b/ambari-web/app/utils/blueprint.js
@@ -17,23 +17,17 @@
*/
module.exports = {
-
mergeBlueprints: function(masterBlueprint, slaveBlueprint) {
- console.time('mergeBlueprints');
var self = this;
// Check edge cases
if (!slaveBlueprint && !masterBlueprint) {
throw 'slaveBlueprint or masterBlueprint should not be empty';
+ } else if (slaveBlueprint && !masterBlueprint) {
+ return slaveBlueprint;
+ } else if (!slaveBlueprint && masterBlueprint) {
+ return masterBlueprint;
}
- else
- if (slaveBlueprint && !masterBlueprint) {
- return slaveBlueprint;
- }
- else
- if (!slaveBlueprint && masterBlueprint) {
- return masterBlueprint;
- }
// Work with main case (both blueprint are presented)
var matches = self.matchGroups(masterBlueprint, slaveBlueprint);
@@ -43,109 +37,53 @@ module.exports = {
blueprint_cluster_binding: { host_groups: [] }
};
- var tmpObj = {hosts: [], components: []};
- var masterBluePrintHostGroupsCluster = this.blueprintToObject(masterBlueprint, 'blueprint_cluster_binding.host_groups');
- var slaveBluePrintHostGroupsCluster = this.blueprintToObject(slaveBlueprint, 'blueprint_cluster_binding.host_groups');
- var masterBluePrintHostGroupsBlueprint = this.blueprintToObject(masterBlueprint, 'blueprint.host_groups');
- var slaveBluePrintHostGroupsBlueprint = this.blueprintToObject(slaveBlueprint, 'blueprint.host_groups');
+ matches.forEach(function(match, i){
+ var group_name = 'host-group-' + (i+1);
- matches.forEach(function (match, i) {
- var group_name = 'host-group-' + (i + 1);
-
- var masterComponents = match.g1 ? Em.getWithDefault(masterBluePrintHostGroupsBlueprint, match.g1, tmpObj).components : [];
- var slaveComponents = match.g2 ? Em.getWithDefault(slaveBluePrintHostGroupsBlueprint, match.g2, tmpObj).components : [];
+ var masterComponents = self.getComponentsFromBlueprintByGroupName(masterBlueprint, match.g1);
+ var slaveComponents = self.getComponentsFromBlueprintByGroupName(slaveBlueprint, match.g2);
res.blueprint.host_groups.push({
name: group_name,
components: masterComponents.concat(slaveComponents)
});
- var hosts = match.g1 ? Em.getWithDefault(masterBluePrintHostGroupsCluster, match.g1, tmpObj).hosts :
- Em.getWithDefault(slaveBluePrintHostGroupsCluster, match.g2, tmpObj).hosts;
-
res.blueprint_cluster_binding.host_groups.push({
name: group_name,
- hosts: hosts
+ hosts: self.getHostsFromBlueprintByGroupName(match.g1 ? masterBlueprint : slaveBlueprint, match.g1 ? match.g1 : match.g2)
});
});
- console.timeEnd('mergeBlueprints');
return res;
},
- /**
- * Convert <code>blueprint</code>-object to the array with keys equal to the host-groups names
- * Used to improve performance when user try to search value in the blueprint using host-group name as search-field
- * Example:
- * Before:
- * <pre>
- * // blueprint
- * {
- * blueprint: {
- * host_groups: [
- * {
- * components: [{}, {}, ...],
- * name: 'n1'
- * },
- * {
- * components: [{}, {}, ...],
- * name: 'n2'
- * }
- * ]
- * },
- * blueprint_cluster_binding: {
- * host_groups: [
- * {
- * hosts: [{}, {}, ...],
- * name: 'n1'
- * },
- * {
- * hosts: [{}, {}, ...],
- * name: 'n2'
- * }
- * ]
- * }
- * }
- * </pre>
- * Return:
- * <pre>
- * // field = 'blueprint_cluster_binding.host_groups'
- * {
- * n1: {
- * hosts: [{}, {}, ...],
- * name: 'n1'
- * },
- * n2: {
- * hosts: [{}, {}, ...],
- * name: 'n2'
- * }
- * }
- *
- * // field = 'blueprint.host_groups'
- * {
- * n1: {
- * components: [{}, {}, ...],
- * name: 'n1'
- * },
- * n2: {
- * components: [{}, {}, ...],
- * name: 'n2'
- * }
- * }
- * </pre>
- * @param {object} blueprint
- * @param {string} field
- * @returns {object}
- */
- blueprintToObject: function(blueprint, field) {
- var ret = {};
- var valueToMap = Em.get(blueprint, field);
- if (!Array.isArray(valueToMap)) {
- return ret;
+ getHostsFromBlueprint: function(blueprint) {
+ return blueprint.blueprint_cluster_binding.host_groups.mapProperty("hosts").reduce(function(prev, curr){ return prev.concat(curr); }, []).mapProperty("fqdn");
+ },
+
+ getHostsFromBlueprintByGroupName: function(blueprint, groupName) {
+ if (groupName) {
+ var group = blueprint.blueprint_cluster_binding.host_groups.find(function(g) {
+ return g.name === groupName;
+ });
+
+ if (group) {
+ return group.hosts;
+ }
}
- valueToMap.forEach(function(n) {
- ret[Em.get(n, 'name')] = n;
- });
- return ret;
+ return [];
+ },
+
+ getComponentsFromBlueprintByGroupName: function(blueprint, groupName) {
+ if (groupName) {
+ var group = blueprint.blueprint.host_groups.find(function(g) {
+ return g.name === groupName;
+ });
+
+ if (group) {
+ return group.components;
+ }
+ }
+ return [];
},
matchGroups: function(masterBlueprint, slaveBlueprint) {
@@ -165,7 +103,6 @@ module.exports = {
},
matchGroupsWithLeft: function(groups1, groups2, groups1_used, groups2_used, res, inverse) {
- var gs2 = this.groupsToObject(groups2);
for (var i = 0; i < groups1.length; i++) {
if (groups1_used[i]) {
continue;
@@ -174,10 +111,20 @@ module.exports = {
var group1 = groups1[i];
groups1_used[i] = true;
- var group2 = gs2[group1.hosts.mapProperty('fqdn').join(',')];
- if (group2) {
- groups2_used[group2.index] = true;
- }
+ var group2 = groups2.find(function(g2, index) {
+ if (group1.hosts.length != g2.hosts.length) {
+ return false;
+ }
+
+ for (var gi = 0; gi < group1.hosts.length; gi++) {
+ if (group1.hosts[gi].fqdn != g2.hosts[gi].fqdn) {
+ return false;
+ }
+ }
+
+ groups2_used[index] = true;
+ return true;
+ });
var item = {};
@@ -186,8 +133,7 @@ module.exports = {
if (group2) {
item.g1 = group2.name;
}
- }
- else {
+ } else {
item.g1 = group1.name;
if (group2) {
item.g2 = group2.name;
@@ -195,69 +141,12 @@ module.exports = {
}
res.push(item);
}
-
- // remove unneeded property
- groups2.forEach(function(group) {
- delete group.index;
- });
- },
-
- /**
- * Convert array of objects to the one object to improve performance with searching objects in the provided array
- * Example:
- * Before:
- * <pre>
- * // groups
- * [
- * {
- * hosts: [
- * {fqdn: 'h1'}, {fqdn: 'h2'}
- * ],
- * name: 'n1'
- * },
- * {
- * hosts: [
- * {fqdn: 'h3'}, {fqdn: 'h4'}
- * ]
- * }
- * ]
- * </pre>
- * Return:
- * <pre>
- * {
- * 'h1,h2': {
- * hosts: [
- * {fqdn: 'h1'}, {fqdn: 'h2'}
- * ],
- * name: 'n1',
- * index: 0
- * },
- * 'h3,h4': {
- * hosts: [
- * {fqdn: 'h3'}, {fqdn: 'h4'}
- * ],
- * name: 'n2',
- * index: 1
- * }
- * }
- * </pre>
- * @param {{hosts: object[], name: string}[]} groups
- * @returns {object}
- */
- groupsToObject: function (groups) {
- var ret = {};
- groups.forEach(function (group, index) {
- var key = group.hosts.mapProperty('fqdn').join(',');
- ret[key] = group;
- ret[key].index = index;
- });
- return ret;
},
/**
* Remove from blueprint all components expect given components
- * @param {object} blueprint
- * @param {string[]} components
+ * @param blueprint
+ * @param [string] components
*/
filterByComponents: function(blueprint, components) {
if (!blueprint) {
@@ -289,7 +178,7 @@ module.exports = {
},
addComponentsToBlueprint: function(blueprint, components) {
- var res = JSON.parse(JSON.stringify(blueprint));
+ var res = JSON.parse(JSON.stringify(blueprint))
res.blueprint.host_groups.forEach(function(group) {
components.forEach(function(component) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a7a02c4/ambari-web/app/views/wizard/step6_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step6_view.js b/ambari-web/app/views/wizard/step6_view.js
index 379912e..2c590b0 100644
--- a/ambari-web/app/views/wizard/step6_view.js
+++ b/ambari-web/app/views/wizard/step6_view.js
@@ -23,8 +23,10 @@ App.WizardStep6View = App.TableView.extend({
templateName: require('templates/wizard/step6'),
+ title: '',
+
/**
- * Number of visible rows
+ * Numbe rof visible rows
* @type {string}
*/
displayLength: "25",
@@ -46,12 +48,16 @@ App.WizardStep6View = App.TableView.extend({
}.property('content'),
/**
- * Set <code>label</code> and do <code>loadStep</code>
+ * Set <code>label</code>, <code>title</code> and do <code>loadStep</code>
* @method didInsertElement
*/
didInsertElement: function () {
+ var controller = this.get('controller');
+ this.set('title', Em.I18n.t('installer.step6.header'));
this.setLabel();
- this.get('controller').loadStep();
+
+ App.tooltip($('body'), {selector: '[rel=tooltip]'});
+ controller.loadStep();
},
/**
@@ -89,14 +95,18 @@ App.WizardStep6View = App.TableView.extend({
columnCount: function() {
var hosts = this.get('controller.hosts');
- return (hosts && hosts.length > 0) ? hosts[0].get('checkboxes').length + 1 : 1;
+ if (hosts && hosts.length > 0) {
+ var checkboxes = hosts[0].get('checkboxes');
+ return checkboxes.length + 1;
+ }
+ return 1;
}.property('controller.hosts.@each.checkboxes')
});
App.WizardStep6HostView = Em.View.extend({
/**
- * Bound <code>host</code> object
+ * Binded <code>host</code> object
* @type {object}
*/
host: null,
@@ -108,18 +118,16 @@ App.WizardStep6HostView = Em.View.extend({
* @method didInsertElement
*/
didInsertElement: function () {
+ var components = this.get('controller').getMasterComponentsForHost(this.get('host.hostName'));
+ components = components.map(function (_component) {
+ return App.format.role(_component);
+ });
+ components = components.join(" /\n");
App.popover(this.$(), {
title: Em.I18n.t('installer.step6.wizardStep6Host.title').format(this.get('host.hostName')),
- content: this.get('controller').getMasterComponentsForHost(this.get('host.hostName')).map(function (_component) {
- return App.format.role(_component);
- }).join("<br />"),
+ content: components,
placement: 'right',
trigger: 'hover'
});
- },
-
- willDestroyElement: function() {
- this.$().popover('destroy');
}
-
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a7a02c4/ambari-web/test/utils/blueprint_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/blueprint_test.js b/ambari-web/test/utils/blueprint_test.js
index 29072a3..cc6b932 100644
--- a/ambari-web/test/utils/blueprint_test.js
+++ b/ambari-web/test/utils/blueprint_test.js
@@ -95,6 +95,43 @@ describe('utils/blueprint', function() {
}
};
+ describe('#getHostsFromBlueprint', function() {
+ it('should extract all hosts from blueprint', function() {
+ expect(blueprintUtils.getHostsFromBlueprint(masterBlueprint)).to.deep.equal(["host1", "host2", "host3"]);
+ });
+ });
+
+ describe('#getHostsFromBlueprintByGroupName', function() {
+ it('should extract hosts from blueprint by given group name', function() {
+ expect(blueprintUtils.getHostsFromBlueprintByGroupName(masterBlueprint, "host-group-1")).to.deep.equal([
+ { fqdn: "host1" },
+ { fqdn: "host2" }
+ ]);
+ });
+
+ it('should return empty array if group with given name doesn\'t exist', function() {
+ expect(blueprintUtils.getHostsFromBlueprintByGroupName(masterBlueprint, "not an existing group")).to.deep.equal([]);
+ });
+ });
+
+ describe('#getComponentsFromBlueprintByGroupName', function() {
+ it('should extract all components from blueprint for given host', function() {
+ expect(blueprintUtils.getComponentsFromBlueprintByGroupName(masterBlueprint, "host-group-1")).to.deep.equal([
+ { name: "ZOOKEEPER_SERVER" },
+ { name: "NAMENODE" },
+ { name: "HBASE_MASTER" }
+ ]);
+ });
+
+ it('should return empty array if group doesn\'t exists', function() {
+ expect(blueprintUtils.getComponentsFromBlueprintByGroupName(masterBlueprint, "not an existing group")).to.deep.equal([]);
+ });
+
+ it('should return empty array if group name isn\'t valid', function() {
+ expect(blueprintUtils.getComponentsFromBlueprintByGroupName(masterBlueprint, undefined)).to.deep.equal([]);
+ });
+ });
+
describe('#matchGroups', function() {
it('should compose same host group into pairs', function() {
expect(blueprintUtils.matchGroups(masterBlueprint, slaveBlueprint)).to.deep.equal([
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a7a02c4/ambari-web/test/views/wizard/step6_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step6_view_test.js b/ambari-web/test/views/wizard/step6_view_test.js
index b905a2d..082d153 100644
--- a/ambari-web/test/views/wizard/step6_view_test.js
+++ b/ambari-web/test/views/wizard/step6_view_test.js
@@ -50,30 +50,29 @@ describe('App.WizardStep6View', function() {
});
describe('#didInsertElement', function() {
-
beforeEach(function() {
sinon.stub(view.get('controller'), 'loadStep', Em.K);
sinon.stub(App, 'tooltip', Em.K);
sinon.stub(view, 'setLabel', Em.K);
});
-
afterEach(function() {
view.get('controller').loadStep.restore();
App.tooltip.restore();
view.setLabel.restore();
});
-
it('should call loadStep', function() {
view.didInsertElement();
expect(view.get('controller').loadStep.calledOnce).to.equal(true);
});
-
+ it('should create tooltip', function() {
+ view.didInsertElement();
+ expect(App.tooltip.calledOnce).to.equal(true);
+ });
it('should call setLabel if not controller.isMasters', function() {
view.set('controller.isMasters', false);
view.didInsertElement();
expect(view.setLabel.calledOnce).to.equal(true);
});
-
});
describe('#setLabel', function() {