You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/01/30 13:55:32 UTC
ambari git commit: AMBARI-9413 Once all hivemetastore servers are
delete unable to add a new hive metastore. (ababiichuk)
Repository: ambari
Updated Branches:
refs/heads/trunk cb4df42ff -> 30e491797
AMBARI-9413 Once all hivemetastore servers are delete unable to add a new hive metastore. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/30e49179
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/30e49179
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/30e49179
Branch: refs/heads/trunk
Commit: 30e4917970dc0dd7f27a1a443775bd273bb87186
Parents: cb4df42
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Fri Jan 30 14:40:20 2015 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Fri Jan 30 14:40:31 2015 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/main/service/item.js | 2 +-
.../main/host/details/host_component_view.js | 15 +++++++-
.../host/details/host_component_view_test.js | 38 ++++++++++++++++++++
3 files changed, 53 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/30e49179/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index c8dbf92..4cf26d5 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -569,7 +569,7 @@ App.MainServiceItemController = Em.Controller.extend({
*/
addComponent: function (componentName) {
var self = this;
- var component = App.HostComponent.find().findProperty('componentName', componentName);
+ var component = App.StackServiceComponent.find().findProperty('componentName', componentName);
var componentDisplayName = component.get('displayName');
self.loadHostsWithoutComponent(componentName);
http://git-wip-us.apache.org/repos/asf/ambari/blob/30e49179/ambari-web/app/views/main/host/details/host_component_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details/host_component_view.js b/ambari-web/app/views/main/host/details/host_component_view.js
index 9f4929d..190c95c 100644
--- a/ambari-web/app/views/main/host/details/host_component_view.js
+++ b/ambari-web/app/views/main/host/details/host_component_view.js
@@ -197,10 +197,23 @@ App.HostComponentView = Em.View.extend({
* @type {bool}
*/
isDeleteComponentDisabled: function () {
- return ![App.HostComponentStatus.stopped, App.HostComponentStatus.unknown, App.HostComponentStatus.install_failed, App.HostComponentStatus.upgrade_failed, App.HostComponentStatus.init].contains(this.get('workStatus'));
+ var stackComponentCount = App.StackServiceComponent.find(this.get('hostComponent.componentName')).get('minToInstall');
+ var installedCount = this.componentCounter();
+ return (installedCount <= stackComponentCount)
+ || ![App.HostComponentStatus.stopped, App.HostComponentStatus.unknown, App.HostComponentStatus.install_failed, App.HostComponentStatus.upgrade_failed, App.HostComponentStatus.init].contains(this.get('workStatus'));
}.property('workStatus'),
/**
+ * gets number of current component that are applied to the cluster;
+ * @returns {Number}
+ */
+ componentCounter: function() {
+ return App.StackServiceComponent.find(this.get('hostComponent.componentName')).get('isMaster')
+ ? App.HostComponent.find().filterProperty('componentName', this.get('content.componentName')).length
+ : App.SlaveComponent.find().findProperty('componentName', this.get('content.componentName')).get('totalCount');
+ },
+
+ /**
* Check if component may be reassinged to another host
* @type {bool}
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/30e49179/ambari-web/test/views/main/host/details/host_component_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/details/host_component_view_test.js b/ambari-web/test/views/main/host/details/host_component_view_test.js
index 2887b02..2cb5105 100644
--- a/ambari-web/test/views/main/host/details/host_component_view_test.js
+++ b/ambari-web/test/views/main/host/details/host_component_view_test.js
@@ -223,18 +223,56 @@ describe('App.HostComponentView', function() {
describe('#isDeleteComponentDisabled', function() {
+ beforeEach(function() {
+ sinon.stub(hostComponentView, 'componentCounter', function() {
+ return 1;
+ });
+ sinon.stub(App.StackServiceComponent, 'find', function(component) {
+ var min = component == 'comp0' ? 0 : 1;
+ return Em.Object.create({minToInstall: min});
+ });
+ });
+ afterEach(function() {
+ hostComponentView.componentCounter.restore();
+ App.StackServiceComponent.find.restore();
+ });
+
var tests = ['INSTALLED', 'UNKNOWN', 'INSTALL_FAILED', 'UPGRADE_FAILED', 'INIT'];
var testE = false;
var defaultE = true;
App.HostComponentStatus.getStatusesList().forEach(function(status) {
it(status, function() {
+ App.store.load(App.StackServiceComponent, {
+ id: 1,
+ component_name: 'comp0'
+ });
+ hostComponentView.get('hostComponent').set('componentName', 'comp0');
hostComponentView.get('hostComponent').set('workStatus', status);
var e = tests.contains(status) ? testE : defaultE;
expect(hostComponentView.get('isDeleteComponentDisabled')).to.equal(e);
});
});
+ it('delete is disabled because min cardinality 1', function() {
+ App.store.load(App.StackServiceComponent, {
+ id: 2,
+ component_name: 'comp1'
+ });
+ hostComponentView.get('hostComponent').set('componentName', 'comp1');
+ hostComponentView.get('hostComponent').set('workStatus', 'INSTALLED');
+ expect(hostComponentView.get('isDeleteComponentDisabled')).to.equal(true);
+ });
+
+ it('delete is enabled because min cardinality 0', function() {
+ App.store.load(App.StackServiceComponent, {
+ id: 2,
+ component_name: 'comp0'
+ });
+ hostComponentView.get('hostComponent').set('componentName', 'comp0');
+ hostComponentView.get('hostComponent').set('workStatus', 'INSTALLED');
+ expect(hostComponentView.get('isDeleteComponentDisabled')).to.equal(false);
+ });
});
describe('#componentTextStatus', function() {