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 2017/11/08 13:29:45 UTC
ambari git commit: AMBARI-22382 Integrate Host-component maintenance
state and stale configs with websocket events. (atkach)
Repository: ambari
Updated Branches:
refs/heads/branch-3.0-perf 4656f1d4e -> 1577f2f06
AMBARI-22382 Integrate Host-component maintenance state and stale configs with websocket events. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1577f2f0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1577f2f0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1577f2f0
Branch: refs/heads/branch-3.0-perf
Commit: 1577f2f0624f26377137be1924ddbba011f3ae35
Parents: 4656f1d
Author: Andrii Tkach <at...@apache.org>
Authored: Wed Nov 8 14:42:37 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Wed Nov 8 14:42:37 2017 +0200
----------------------------------------------------------------------
.../socket/host_component_status_mapper.js | 10 ++++--
.../socket/host_component_status_mapper_test.js | 32 ++++++++++++++------
2 files changed, 30 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1577f2f0/ambari-web/app/mappers/socket/host_component_status_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/socket/host_component_status_mapper.js b/ambari-web/app/mappers/socket/host_component_status_mapper.js
index 0d253d4..8244e67 100644
--- a/ambari-web/app/mappers/socket/host_component_status_mapper.js
+++ b/ambari-web/app/mappers/socket/host_component_status_mapper.js
@@ -19,15 +19,19 @@ var App = require('app');
App.hostComponentStatusMapper = App.QuickDataMapper.create({
+ config: {
+ workStatus: 'currentState',
+ staleConfigs: 'staleConfigs',
+ passiveState: 'maintenanceState'
+ },
+
/**
* @param {object} event
*/
map: function (event) {
event.hostComponents.forEach((componentState) => {
const hostComponent = App.HostComponent.find(componentState.componentName + '_' + componentState.hostName);
- if (hostComponent.get('isLoaded')) {
- hostComponent.set('workStatus', componentState.currentState);
- }
+ this.updatePropertiesByConfig(hostComponent, componentState, this.config);
});
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1577f2f0/ambari-web/test/mappers/socket/host_component_status_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/socket/host_component_status_mapper_test.js b/ambari-web/test/mappers/socket/host_component_status_mapper_test.js
index eab309e..5aa59d8 100644
--- a/ambari-web/test/mappers/socket/host_component_status_mapper_test.js
+++ b/ambari-web/test/mappers/socket/host_component_status_mapper_test.js
@@ -25,8 +25,21 @@ describe('App.hostComponentStatusMapper', function () {
describe('#map', function() {
var hc = Em.Object.create({
workStatus: 'INSTALLED',
+ staleConfigs: false,
+ passiveState: 'ON',
isLoaded: true
});
+ const event = {
+ hostComponents: [
+ {
+ componentName: 'C1',
+ hostName: 'host1',
+ currentState: 'STARTED',
+ staleConfigs: false,
+ maintenanceState: 'OFF'
+ }
+ ]
+ };
beforeEach(function() {
sinon.stub(App.HostComponent, 'find').returns(hc);
});
@@ -35,17 +48,18 @@ describe('App.hostComponentStatusMapper', function () {
});
it('host-component should have STARTED status', function() {
- const event = {
- hostComponents: [
- {
- componentName: 'C1',
- hostName: 'host1',
- currentState: 'STARTED'
- }
- ]
- };
App.hostComponentStatusMapper.map(event);
expect(hc.get('workStatus')).to.be.equal('STARTED');
});
+
+ it('host-component should have staleConfigs false', function() {
+ App.hostComponentStatusMapper.map(event);
+ expect(hc.get('staleConfigs')).to.be.false;
+ });
+
+ it('host-component should have maintenanceState OFF', function() {
+ App.hostComponentStatusMapper.map(event);
+ expect(hc.get('passiveState')).to.be.equal('OFF');
+ });
});
});