You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2018/09/13 12:08:17 UTC
[ambari] branch branch-2.7 updated: AMBARI-24627 "Host is in
Maintenance mode" text is not displayed in UI after maintenance mode is
turned on
This is an automated email from the ASF dual-hosted git repository.
atkach pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push:
new fe00ba6 AMBARI-24627 "Host is in Maintenance mode" text is not displayed in UI after maintenance mode is turned on
fe00ba6 is described below
commit fe00ba6729d667f4b0450fc74d63c5781884ea98
Author: Andrii Tkach <at...@apache.org>
AuthorDate: Thu Sep 13 12:38:13 2018 +0300
AMBARI-24627 "Host is in Maintenance mode" text is not displayed in UI after maintenance mode is turned on
---
ambari-web/app/models/host.js | 2 +-
ambari-web/app/models/host_component.js | 12 +++++++++-
ambari-web/app/views/main/host/details.js | 2 +-
ambari-web/test/models/host_component_test.js | 34 +++++++++++++++++++++------
4 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/ambari-web/app/models/host.js b/ambari-web/app/models/host.js
index 258f348..3e9893f 100644
--- a/ambari-web/app/models/host.js
+++ b/ambari-web/app/models/host.js
@@ -216,7 +216,7 @@ App.Host = DS.Model.extend({
'ALERT': 'health-status-DEAD-ORANGE'
};
return statusMap[this.get('healthStatus')] || 'health-status-DEAD-YELLOW';
- }.property('healthStatus'),
+ }.property('healthStatus', 'passiveState'),
healthIconClass: Em.computed.getByKey('healthIconClassMap', 'healthClass', ''),
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index 40db612..55122b7 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -116,7 +116,17 @@ App.HostComponent = DS.Model.extend({
* User friendly host component status
* @returns {String}
*/
- isActive: Em.computed.equal('passiveState', 'OFF'),
+ isActive: function() {
+ let passiveState = this.get('passiveState');
+ if (passiveState === 'IMPLIED_FROM_HOST') {
+ passiveState = this.get('host.passiveState');
+ } else if (passiveState === 'IMPLIED_FROM_SERVICE') {
+ passiveState = this.get('service.passiveState');
+ } else if (passiveState === 'IMPLIED_FROM_SERVICE_AND_HOST') {
+ return this.get('service.passiveState') === 'OFF' && this.get('host.passiveState') === 'OFF';
+ }
+ return passiveState === 'OFF';
+ }.property('passiveState', 'host.passiveState', 'service.passiveState'),
/**
* Determine if passiveState is implied from host or/and service
diff --git a/ambari-web/app/views/main/host/details.js b/ambari-web/app/views/main/host/details.js
index 524142c..3e9099a 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -96,7 +96,7 @@ App.MainHostDetailsView = Em.View.extend({
label: this.t('host.host.details.checkHost')
});
return result;
- }.property('controller.content', 'isActive', 'controller.content.isNotHeartBeating'),
+ }.property('controller.content', 'controller.content.isActive', 'controller.content.isNotHeartBeating'),
didInsertElement: function () {
var self = this;
diff --git a/ambari-web/test/models/host_component_test.js b/ambari-web/test/models/host_component_test.js
index 2dac475..b058db7 100644
--- a/ambari-web/test/models/host_component_test.js
+++ b/ambari-web/test/models/host_component_test.js
@@ -146,21 +146,41 @@ describe('App.HostComponent', function() {
});
});
- App.TestAliases.testAsComputedEqual(hc, 'isActive', 'passiveState', 'OFF');
-
App.TestAliases.testAsComputedIfThenElse(hc, 'passiveTooltip', 'isActive', '', Em.I18n.t('hosts.component.passive.mode'));
describe('#isActive', function() {
- it('passiveState is ON', function() {
- hc.set('passiveState', "ON");
- hc.propertyDidChange('isActive');
- expect(hc.get('isActive')).to.be.false;
- });
it('passiveState is OFF', function() {
hc.set('passiveState', "OFF");
hc.propertyDidChange('isActive');
expect(hc.get('isActive')).to.be.true;
});
+ it('passiveState is IMPLIED_FROM_HOST', function() {
+ hc.set('passiveState', "IMPLIED_FROM_HOST");
+ hc.set('host', {
+ passiveState: 'OFF'
+ });
+ hc.propertyDidChange('isActive');
+ expect(hc.get('isActive')).to.be.true;
+ });
+ it('passiveState is IMPLIED_FROM_SERVICE', function() {
+ hc.set('passiveState', "IMPLIED_FROM_SERVICE");
+ hc.set('service', {
+ passiveState: 'OFF'
+ });
+ hc.propertyDidChange('isActive');
+ expect(hc.get('isActive')).to.be.true;
+ });
+ it('passiveState is IMPLIED_FROM_SERVICE_AND_HOST', function() {
+ hc.set('passiveState', "IMPLIED_FROM_SERVICE_AND_HOST");
+ hc.set('host', {
+ passiveState: 'OFF'
+ });
+ hc.set('service', {
+ passiveState: 'OFF'
+ });
+ hc.propertyDidChange('isActive');
+ expect(hc.get('isActive')).to.be.true;
+ });
});
describe('#statusClass', function() {