Author: yusaku
Date: Fri Jan 11 03:14:13 2013
New Revision: 1431848
URL: http://svn.apache.org/viewvc?rev=1431848&view=rev
Log:
AMBARI-1157. Host component operation causes lags in status/action pulldown
update. (yusaku)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js
incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js
incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js
incubator/ambari/trunk/ambari-web/app/models/component.js
incubator/ambari/trunk/ambari-web/app/models/host.js
incubator/ambari/trunk/ambari-web/app/models/host_component.js
incubator/ambari/trunk/ambari-web/app/models/service.js
incubator/ambari/trunk/ambari-web/app/views/main/host/summary.js
Modified: incubator/ambari/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Jan 11 03:14:13 2013
@@ -692,6 +692,9 @@ AMBARI-666 branch (unreleased changes)
BUG FIXES
+ AMBARI-1157. Host component operation causes lags in status/action pulldown
+ update. (yusaku)
+
AMBARI-1144. Cannot save changes to ZooKeeper configuration.
(Arun Kandregula via yusaku)
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js Fri
Jan 11 03:14:13 2013
@@ -74,7 +74,7 @@ App.MainHostDetailsController = Em.Contr
});
},
- startComponent: function(event){
+ startComponent: function (event) {
var self = this;
App.ModalPopup.show({
header: Em.I18n.t('hosts.host.start.popup.header'),
@@ -96,7 +96,7 @@ App.MainHostDetailsController = Em.Contr
console.log('Send request for STARTING successfully');
- if(App.testMode){
+ if (App.testMode) {
component.set('workStatus', App.Component.Status.starting);
setTimeout(function(){
component.set('workStatus', App.Component.Status.started);
@@ -126,7 +126,7 @@ App.MainHostDetailsController = Em.Contr
}
});
},
- stopComponent: function(event){
+ stopComponent: function (event) {
var self = this;
App.ModalPopup.show({
header: Em.I18n.t('hosts.host.start.popup.header'),
@@ -147,12 +147,12 @@ App.MainHostDetailsController = Em.Contr
console.log('Send request for STOPPING successfully');
- if(App.testMode){
+ if (App.testMode) {
component.set('workStatus', App.Component.Status.stopping);
setTimeout(function(){
component.set('workStatus', App.Component.Status.stopped);
},10000);
- } else{
+ } else {
App.router.get('clusterController').loadUpdatedStatus();
App.router.get('backgroundOperationsController.eventsArray').push({
"when" : function(controller){
Modified: incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js Fri Jan
11 03:14:13 2013
@@ -108,5 +108,18 @@ App.QuickDataMapper = App.ServerDataMapp
pathArr.splice(0, 1);
}
return current;
+ },
+
+ calculateState: function (json) {
+ var stateEqual = (json.desired_status != json.work_status);
+ if (stateEqual) {
+ if (json.desired_status == 'STARTED' && json.work_status == 'INSTALLED')
{
+ json.work_status = 'STARTING';
+ } else if (json.desired_status == 'INSTALLED' && json.work_status ==
'STARTED') {
+ json.work_status = 'STOPPING';
+ }
+ }
+
+ return json;
}
});
Modified: incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js Fri Jan 11
03:14:13 2013
@@ -127,7 +127,6 @@ App.servicesMapper = App.QuickDataMapper
// page must be careful because, it will randomly
// pick a host.
work_status: 'host_components[0].HostRoles.state',
- desired_status: 'host_components[0].HostRoles.desired_state',
host_id: 'host_components[0].HostRoles.host_name'
},
@@ -209,7 +208,6 @@ App.servicesMapper = App.QuickDataMapper
if (component && component.get('isLoaded')) { // UPDATE
if (componentJson.work_status) {
component.set('workStatus', componentJson.work_status);
- component.set('desiredStatus', componentJson.desired_status);
}
if (componentJson.host_id) {
component.set('host', App.Host.find(componentJson.host_id));
@@ -233,12 +231,12 @@ App.servicesMapper = App.QuickDataMapper
}, this);
var newHostComponents = [];
result.forEach(function(hcJson){
+ hcJson = this.calculateState(hcJson);
hcJson.id = hcJson.component_name + '_' + hcJson.host_id;
var component = App.HostComponent.find(hcJson.id);
if (component && component.get('isLoaded')) { // UPDATE
if (hcJson.work_status) {
component.set('workStatus', hcJson.work_status);
- component.set('desiredStatus', hcJson.desired_status);
}
if (hcJson.component_name) {
component.set('componentName', hcJson.component_name);
@@ -252,7 +250,7 @@ App.servicesMapper = App.QuickDataMapper
} else {
newHostComponents.push(hcJson);
}
- });
+ }, this);
if (newHostComponents.length > 0) {
App.store.loadMany(this.get('model3'), newHostComponents);
}
Modified: incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js Fri Jan 11
03:14:13 2013
@@ -24,8 +24,7 @@ App.statusMapper = App.QuickDataMapper.c
config2:{
id:'ServiceComponentInfo.component_name',
- work_status:'host_components[0].HostRoles.state',
- desired_status: 'host_components[0].HostRoles.desired_state'
+ work_status:'host_components[0].HostRoles.state'
},
config3:{
@@ -73,7 +72,6 @@ App.statusMapper = App.QuickDataMapper.c
var component = components.findProperty('id', item.id);
if(component){
component.set('workStatus', item.work_status);
- component.set('desiredStatus', item.desired_status);
}
})
@@ -91,10 +89,10 @@ App.statusMapper = App.QuickDataMapper.c
result.forEach(function(item){
var hostComponent = hostComponents.findProperty('id', item.id);
if(hostComponent){
+ item = this.calculateState(item);
hostComponent.set('workStatus', item.work_status);
- hostComponent.set('desiredStatus', item.desired_status);
}
- })
+ }, this)
}
}
});
Modified: incubator/ambari/trunk/ambari-web/app/models/component.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/component.js?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/component.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/component.js Fri Jan 11
03:14:13 2013
@@ -33,9 +33,7 @@ App.Component = DS.Model.extend({
//host_id: DS.attr('string'),
workStatus: DS.attr('string'),
-
- desiredStatus: DS.attr('string'),
-
+
isMaster: function () {
switch (this.get('componentName')) {
case 'NAMENODE':
Modified: incubator/ambari/trunk/ambari-web/app/models/host.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/host.js?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/host.js Fri Jan 11 03:14:13
2013
@@ -129,8 +129,8 @@ App.Host = DS.Model.extend({
if (!this.get('isLoaded') || this.get('isSaving')) {
} else {
var status;
- var masterComponents = this.get('components').filterProperty('isMaster',
true);
- var masterComponentsRunning =
masterComponents.everyProperty('workStatus', App.Component.Status.started);
+ var masterComponents =
this.get('hostComponents').filterProperty('isMaster', true);
+ var masterComponentsRunning =
masterComponents.everyProperty('workStatus', App.HostComponent.Status.started);
if (this.get('isNotHeartBeating')) {
status = 'DEAD-YELLOW';
} else if (masterComponentsRunning) {
@@ -145,7 +145,7 @@ App.Host = DS.Model.extend({
}
}
return 'health-status-' + healthStatus;
- }.property('healthStatus', '[email protected]')
+ }.property('healthStatus', '[email protected]')
});
App.Host.FIXTURES = [];
\ No newline at end of file
Modified: incubator/ambari/trunk/ambari-web/app/models/host_component.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/host_component.js?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/host_component.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/host_component.js Fri Jan 11
03:14:13 2013
@@ -20,7 +20,6 @@ var App = require('app');
App.HostComponent = DS.Model.extend({
workStatus: DS.attr('string'),
- desiredStatus: DS.attr('string'),
componentName: DS.attr('string'),
host: DS.belongsTo('App.Host'),
service: DS.belongsTo('App.Service'),
Modified: incubator/ambari/trunk/ambari-web/app/models/service.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/service.js?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/service.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/service.js Fri Jan 11 03:14:13
2013
@@ -38,23 +38,17 @@ App.Service = DS.Model.extend({
}.property('healthStatus'),
healthStatus: function () {
- var components = this.get('components').filterProperty('isMaster', true);
- if (components.everyProperty('workStatus', App.Component.Status.started)) {
- if (components.someProperty('desiredStatus',
App.Component.Status.stopped)) {
- return 'red-blinking';
- }
+ var components = this.get('hostComponents').filterProperty('isMaster',
true);
+ if (components.everyProperty('workStatus',
App.HostComponent.Status.started)) {
return 'green';
- } else if (components.someProperty('workStatus',
App.Component.Status.starting)) {
+ } else if (components.someProperty('workStatus',
App.HostComponent.Status.starting)) {
return 'green-blinking';
- } else if (components.someProperty('workStatus',
App.Component.Status.stopped)) {
- if (components.someProperty('desiredStatus',
App.Component.Status.started)) {
- return 'green-blinking';
- }
+ } else if (components.someProperty('workStatus',
App.HostComponent.Status.stopped)) {
return 'red';
} else {
return 'red-blinking';
}
- }.property('[email protected]'),
+ }.property('[email protected]'),
isStopped: function () {
var components = this.get('components');
Modified: incubator/ambari/trunk/ambari-web/app/views/main/host/summary.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/host/summary.js?rev=1431848&r1=1431847&r2=1431848&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/host/summary.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/host/summary.js Fri Jan 11
03:14:13 2013
@@ -122,6 +122,11 @@ App.MainHostSummaryView = Em.View.extend
ComponentView: Em.View.extend({
content: null,
+ didInsertElement: function () {
+ if (this.get('isInProgress')) {
+ this.doBlinking();
+ }
+ },
hostComponent: function(){
var hostComponent = null;
var serviceComponent = this.get('content');
@@ -132,31 +137,13 @@ App.MainHostSummaryView = Em.View.extend
return hostComponent;
}.property('content', 'App.router.mainHostDetailsController.content'),
workStatus: function(){
- var componentName = this.get('content.componentName');
- var hostComponent = this.get('hostComponent');
- if (App.router.get('backgroundOperationsController.allOperationsCount'))
{
- var task =
App.router.get('backgroundOperationsController').getTasksByRole(componentName);
- if(!Ember.empty(task)){
- if (task[0].start_time == -1 && task[0].command == 'START') {
- this.content.set('workStatus', App.HostComponent.Status.starting);
- if (hostComponent) {
- hostComponent.set('workStatus',
App.HostComponent.Status.starting);
- }
- } else if (task[0].start_time == -1 && task[0].command == 'STOP') {
- this.content.set('workStatus', App.HostComponent.Status.stopping);
- if (hostComponent) {
- hostComponent.set('workStatus',
App.HostComponent.Status.stopping);
- }
- }
- }
- }
-
var workStatus = this.get('content.workStatus');
+ var hostComponent = this.get('hostComponent');
if(hostComponent){
workStatus = hostComponent.get('workStatus');
}
return workStatus;
- }.property('hostComponent.workStatus',
'App.route.backgroundOperationsController.allOperationsCount'),
//'content.workStatus',
+ }.property('content.workStatus','hostComponent.workStatus'),
statusClass: function(){
var statusClass = null;
if(this.get('isDataNode')){
@@ -208,6 +195,10 @@ App.MainHostSummaryView = Em.View.extend
isStart : function() {
return (this.get('workStatus') === App.Component.Status.started ||
this.get('workStatus') === App.Component.Status.starting);
}.property('workStatus'),
+
+ isInProgress : function() {
+ return (this.get('workStatus') === App.Component.Status.stopping ||
this.get('workStatus') === App.Component.Status.starting);
+ }.property('workStatus'),
/**
* Shows whether we need to show Decommision/Recomission buttons
*/