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 2013/12/27 16:08:33 UTC
git commit: AMBARI-4187 Disable redundant calls to server. (atkach)
Updated Branches:
refs/heads/trunk 37d59a55e -> 44f03fb18
AMBARI-4187 Disable redundant calls to server. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/44f03fb1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/44f03fb1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/44f03fb1
Branch: refs/heads/trunk
Commit: 44f03fb18d212cac319e45207c17d438530a4209
Parents: 37d59a5
Author: atkach <at...@hortonworks.com>
Authored: Fri Dec 27 17:08:24 2013 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Fri Dec 27 17:08:24 2013 +0200
----------------------------------------------------------------------
ambari-web/app/models/host.js | 2 +-
ambari-web/app/views/common/table_view.js | 22 +++---
ambari-web/app/views/main/host/summary.js | 14 ++--
ambari-web/test/views/wizard/step9_view_test.js | 75 +++++++++++++-------
4 files changed, 72 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/44f03fb1/ambari-web/app/models/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host.js b/ambari-web/app/models/host.js
index 9a4992f..91fe812 100644
--- a/ambari-web/app/models/host.js
+++ b/ambari-web/app/models/host.js
@@ -63,7 +63,7 @@ App.Host = DS.Model.extend({
componentsWithStaleConfigsCount: function() {
return this.get('hostComponents').filterProperty('staleConfigs', true).length;
- }.property('hostComponents.@each'),
+ }.property('hostComponents.@each.staleConfigs'),
publicHostNameFormatted: function() {
return this.get('publicHostName').length < 43 ? this.get('publicHostName') : this.get('publicHostName').substr(0, 40) + '...';
http://git-wip-us.apache.org/repos/asf/ambari/blob/44f03fb1/ambari-web/app/views/common/table_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js
index ad2b4b8..e80c4d8 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -44,9 +44,13 @@ App.TableView = Em.View.extend({
var name = this.get('controller.name');
this.set('startIndexOnLoad', App.db.getStartIndex(name));
- self.dataLoading().done(function (initValue) {
- self.set('displayLength', initValue);
- });
+ if (App.db.getDisplayLength(name)) {
+ this.set('displayLength', App.db.getDisplayLength(name));
+ } else {
+ self.dataLoading().done(function (initValue) {
+ self.set('displayLength', initValue);
+ });
+ }
var filterConditions = App.db.getFilterConditions(name);
if (filterConditions) {
@@ -205,7 +209,10 @@ App.TableView = Em.View.extend({
}),
rowsPerPageSelectView: Em.Select.extend({
- content: ['10', '25', '50']
+ content: ['10', '25', '50'],
+ change: function () {
+ this.get('parentView').saveDisplayLength();
+ }
}),
// start index for displayed content on the page
@@ -277,13 +284,12 @@ App.TableView = Em.View.extend({
saveDisplayLength: function() {
var self = this;
Em.run.next(function() {
- //App.db.setDisplayLength(self.get('controller.name'), self.get('displayLength'));
- var key = self.displayLengthKey();
+ App.db.setDisplayLength(self.get('controller.name'), self.get('displayLength'));
if (!App.testMode) {
- self.postUserPref(key, self.get('displayLength'));
+ self.postUserPref(self.displayLengthKey(), self.get('displayLength'));
}
});
- }.observes('displayLength'),
+ },
saveStartIndex: function() {
if (this.get('filteringComplete')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/44f03fb1/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index 6f22732..6e8891e 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -71,17 +71,17 @@ App.MainHostSummaryView = Em.View.extend({
loadDecommissionNodesList: function () {
var self = this;
var clusterName = App.router.get('clusterController.clusterName');
- var persistUrl = App.apiPrefix + '/persist';
+ var persistUrl = App.apiPrefix + '/persist/decommissionDataNodesTag';
var clusterUrl = App.apiPrefix + '/clusters/' + clusterName;
var getConfigAjax = {
type: 'GET',
url: persistUrl,
dataType: 'json',
timeout: App.timeout,
- success: function (data) {
- if (data && data.decommissionDataNodesTag) {
+ success: function (decommissionDataNodesTag) {
+ if (decommissionDataNodesTag) {
// We know the tag which contains the decommisioned nodes.
- var configsUrl = clusterUrl + '/configurations?type=hdfs-exclude-file&tag=' + data.decommissionDataNodesTag;
+ var configsUrl = clusterUrl + '/configurations?type=hdfs-exclude-file&tag=' + decommissionDataNodesTag;
var decomNodesAjax = {
type: 'GET',
url: configsUrl,
@@ -120,11 +120,13 @@ App.MainHostSummaryView = Em.View.extend({
}
}
}
- }
+ };
jQuery.ajax(getConfigAjax);
},
didInsertElement: function () {
- this.loadDecommissionNodesList();
+ if (this.get('content.hostComponents').someProperty('componentName', 'DATANODE')) {
+ this.loadDecommissionNodesList();
+ }
this.addToolTip();
},
addToolTip: function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/44f03fb1/ambari-web/test/views/wizard/step9_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step9_view_test.js b/ambari-web/test/views/wizard/step9_view_test.js
index 4bf01b7..abd6595 100644
--- a/ambari-web/test/views/wizard/step9_view_test.js
+++ b/ambari-web/test/views/wizard/step9_view_test.js
@@ -25,23 +25,31 @@ describe('App.HostStatusView', function () {
p: 'isFailed',
tests: [
{
- controller: {isStepCompleted: true},
- obj: {status: 'failed'},
+ obj: {
+ status: 'failed',
+ progress: 100
+ },
e: true
},
{
- controller: {isStepCompleted: false},
- obj: {status: 'failed'},
+ obj: {
+ status: 'failed',
+ progress: 99
+ },
e: false
},
{
- controller: {isStepCompleted: true},
- obj: {status: 'success'},
+ obj: {
+ status: 'success',
+ progress: 100
+ },
e: false
},
{
- controller: {isStepCompleted: false},
- obj: {status: 'success'},
+ obj: {
+ status: 'success',
+ progress: 99
+ },
e: false
}
]
@@ -50,23 +58,31 @@ describe('App.HostStatusView', function () {
p: 'isSuccess',
tests: [
{
- controller: {isStepCompleted: true},
- obj: {status: 'success'},
+ obj: {
+ status: 'success',
+ progress: 100
+ },
e: true
},
{
- controller: {isStepCompleted: false},
- obj: {status: 'success'},
+ obj: {
+ status: 'success',
+ progress: 99
+ },
e: false
},
{
- controller: {isStepCompleted: true},
- obj: {status: 'failed'},
+ obj: {
+ status: 'failed',
+ progress: 100
+ },
e: false
},
{
- controller: {isStepCompleted: false},
- obj: {status: 'failed'},
+ obj: {
+ status: 'failed',
+ progress: 99
+ },
e: false
}
]
@@ -75,23 +91,31 @@ describe('App.HostStatusView', function () {
p: 'isWarning',
tests: [
{
- controller: {isStepCompleted: true},
- obj: {status: 'warning'},
+ obj: {
+ status: 'warning',
+ progress: 100
+ },
e: true
},
{
- controller: {isStepCompleted: false},
- obj: {status: 'warning'},
+ obj: {
+ status: 'warning',
+ progress: 99
+ },
e: false
},
{
- controller: {isStepCompleted: true},
- obj: {status: 'failed'},
+ obj: {
+ status: 'failed',
+ progress: 100
+ },
e: false
},
{
- controller: {isStepCompleted: false},
- obj: {status: 'failed'},
+ obj: {
+ status: 'failed',
+ progress: 99
+ },
e: false
}
]
@@ -101,8 +125,7 @@ describe('App.HostStatusView', function () {
describe(test.p, function() {
test.tests.forEach(function(t) {
var hostStatusView = App.HostStatusView.create();
- it('controller.isStepCompleted = ' + t.controller.isStepCompleted + '; obj.status = ' + t.obj.status, function() {
- hostStatusView.set('controller', t.controller);
+ it('obj.progress = ' + t.obj.progress + '; obj.status = ' + t.obj.status, function() {
hostStatusView.set('obj', t.obj);
expect(hostStatusView.get(test.p)).to.equal(t.e);
});