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 2014/01/09 12:08:01 UTC
git commit: AMBARI-4245 Optimize relations in model for Service and
Dashboard page. (atkach)
Updated Branches:
refs/heads/trunk a45eb1aa2 -> 06c971ea3
AMBARI-4245 Optimize relations in model for Service and Dashboard page. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/06c971ea
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/06c971ea
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/06c971ea
Branch: refs/heads/trunk
Commit: 06c971ea3c65e1f44851d1e739f085d1927a48e8
Parents: a45eb1a
Author: atkach <at...@hortonworks.com>
Authored: Thu Jan 9 13:07:59 2014 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Thu Jan 9 13:07:59 2014 +0200
----------------------------------------------------------------------
ambari-web/app/models/service/hbase.js | 6 +--
ambari-web/app/models/service/hdfs.js | 9 ++--
ambari-web/app/models/service/mapreduce.js | 4 +-
ambari-web/app/models/service/yarn.js | 6 +--
.../app/views/main/dashboard/service/hbase.js | 12 ++---
.../app/views/main/dashboard/service/hdfs.js | 53 ++++++++------------
.../views/main/dashboard/service/mapreduce.js | 12 ++---
.../app/views/main/dashboard/service/yarn.js | 22 ++++----
.../main/dashboard/widgets/datanode_live.js | 12 ++---
.../dashboard/widgets/node_managers_live.js | 6 +--
.../main/dashboard/widgets/tasktracker_live.js | 6 +--
.../app/views/main/service/info/summary.js | 39 +-------------
12 files changed, 68 insertions(+), 119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/models/service/hbase.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/hbase.js b/ambari-web/app/models/service/hbase.js
index 19c349d..5638a3d 100644
--- a/ambari-web/app/models/service/hbase.js
+++ b/ambari-web/app/models/service/hbase.js
@@ -20,9 +20,9 @@ var App = require('app');
App.HBaseService = App.Service.extend({
version: DS.attr('string'),
master: DS.belongsTo('App.Host'),
- regionServers: function(){
- return this.get('hostComponents').filterProperty('componentName', 'HBASE_REGIONSERVER').mapProperty('host');
- }.property('hostComponents.length'),
+ regionServers: function () {
+ return this.get('hostComponents').filterProperty('componentName', 'HBASE_REGIONSERVER');
+ }.property('hostComponents.@each'),
masterStartTime: DS.attr('number'),
masterActiveTime: DS.attr('number'),
averageLoad: DS.attr('number'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/models/service/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/hdfs.js b/ambari-web/app/models/service/hdfs.js
index b5a5323..8d890f6 100644
--- a/ambari-web/app/models/service/hdfs.js
+++ b/ambari-web/app/models/service/hdfs.js
@@ -24,9 +24,12 @@ App.HDFSService = App.Service.extend({
activeNameNode: DS.belongsTo('App.Host'),
standbyNameNode: DS.belongsTo('App.Host'),
standbyNameNode2: DS.belongsTo('App.Host'),
- dataNodes: function(){
- return this.get('hostComponents').filterProperty('componentName', 'DATANODE').mapProperty('host');
- }.property('hostComponents.length'),
+ dataNodes: function () {
+ return this.get('hostComponents').filterProperty('componentName', 'DATANODE');
+ }.property('hostComponents.@each'),
+ journalNodes: function () {
+ return this.get('hostComponents').filterProperty('componentName', 'JOURNALNODE');
+ }.property('hostComponents.@each'),
nameNodeStartTime: DS.attr('number'),
jvmMemoryHeapUsed: DS.attr('number'),
jvmMemoryHeapMax: DS.attr('number'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/models/service/mapreduce.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/mapreduce.js b/ambari-web/app/models/service/mapreduce.js
index 88dc095..804d2a2 100644
--- a/ambari-web/app/models/service/mapreduce.js
+++ b/ambari-web/app/models/service/mapreduce.js
@@ -22,8 +22,8 @@ App.MapReduceService = App.Service.extend({
jobHistoryServer: DS.belongsTo('App.Host'),
jobTracker: DS.belongsTo('App.Host'),
taskTrackers: function () {
- return this.get('hostComponents').filterProperty('componentName', 'TASKTRACKER').mapProperty('host');
- }.property('hostComponents.length'),
+ return this.get('hostComponents').filterProperty('componentName', 'TASKTRACKER');
+ }.property('hostComponents.@each'),
jobTrackerStartTime: DS.attr('number'),
jobTrackerHeapUsed: DS.attr('number'),
jobTrackerHeapMax: DS.attr('number'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/models/service/yarn.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/yarn.js b/ambari-web/app/models/service/yarn.js
index 831320c..9f03dc6 100644
--- a/ambari-web/app/models/service/yarn.js
+++ b/ambari-web/app/models/service/yarn.js
@@ -21,9 +21,9 @@ var objectUtils = require('utils/object_utils');
App.YARNService = App.Service.extend({
version: DS.attr('string'),
resourceManagerNode: DS.belongsTo('App.Host'),
- nodeManagerNodes: function(){
- return this.get('hostComponents').filterProperty('componentName', 'NODEMANAGER').mapProperty('host');
- }.property('hostComponents.length'),
+ nodeManagerNodes: function () {
+ return this.get('hostComponents').filterProperty('componentName', 'NODEMANAGER');
+ }.property('hostComponents.@each'),
nodeManagerLiveNodes: DS.hasMany('App.Host'),
nodeManagersCountActive: DS.attr('number'),
nodeManagersCountUnhealthy: DS.attr('number'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/views/main/dashboard/service/hbase.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/hbase.js b/ambari-web/app/views/main/dashboard/service/hbase.js
index 744ecf9..e3d858d 100644
--- a/ambari-web/app/views/main/dashboard/service/hbase.js
+++ b/ambari-web/app/views/main/dashboard/service/hbase.js
@@ -27,7 +27,7 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
*/
masters: function () {
return this.get('service.hostComponents').filterProperty('isMaster', true);
- }.property('service.hostComponents.@each'),
+ }.property('service.hostComponents.length'),
/**
* Passive master components
*/
@@ -40,8 +40,8 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
liveRegionServers: function () {
- return App.HostComponent.find().filterProperty('componentName', 'HBASE_REGIONSERVER').filterProperty("workStatus","STARTED");
- }.property('service.hostComponents.@each'),
+ return this.get('service.regionServers').filterProperty("workStatus", "STARTED");
+ }.property('service.regionServers.@each.workStatus'),
regionServesText: function () {
if (this.get('service.regionServers.length') == 0) {
@@ -55,8 +55,8 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
regionServersLiveTextView: App.ComponentLiveTextView.extend({
liveComponents: function() {
- return App.HostComponent.find().filterProperty('componentName', 'HBASE_REGIONSERVER').filterProperty("workStatus","STARTED").get('length');
- }.property("service.hostComponents.@each"),
+ return this.get('service.regionServers').filterProperty("workStatus","STARTED").get('length');
+ }.property('service.regionServers.@each.workStatus'),
totalComponents: function() {
return this.get("service.regionServers.length");
}.property("service.regionServers.length")
@@ -139,7 +139,7 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
}.property("service.masterActiveTime"),
regionServerComponent: function () {
- return App.HostComponent.find().findProperty('componentName', 'HBASE_REGIONSERVER');
+ return this.get('service.regionServers').objectAt(0);
}.property()
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/views/main/dashboard/service/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/hdfs.js b/ambari-web/app/views/main/dashboard/service/hdfs.js
index c6be5b3..da5241e 100644
--- a/ambari-web/app/views/main/dashboard/service/hdfs.js
+++ b/ambari-web/app/views/main/dashboard/service/hdfs.js
@@ -44,49 +44,36 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
return comp.get('isMaster') && comp.get('componentName') !== 'JOURNALNODE';
});
return masters;
- }.property('service')
+ }.property('parentView.service.hostComponents')
}),
- dataNodesLive: function(){
- return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED");
- }.property('service.hostComponents.@each'),
- dataNodesDead: function(){
- return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","INSTALLED");
- }.property('service.hostComponents.@each'),
-
- dataNodeHostText: function () {
- if (this.get("service.dataNodes").length == 0) {
- return '';
- } else if (this.get("service.dataNodes").length > 1) {
- return Em.I18n.t('services.service.summary.viewHosts');
- } else {
- return Em.I18n.t('services.service.summary.viewHost');
- }
- }.property("service"),
+ dataNodesLive: function () {
+ return this.get('service.dataNodes').filterProperty("workStatus", "STARTED");
+ }.property('service.dataNodes.@each.workStatus'),
+ dataNodesDead: function () {
+ return this.get('service.dataNodes').filterProperty("workStatus", "INSTALLED");
+ }.property('service.dataNodes.@each.workStatus'),
showJournalNodes: function () {
- return App.HostComponent.find().filterProperty('componentName', 'JOURNALNODE').get('length') > 0;
- }.property('service.hostComponents.@each'),
+ return this.get('service.journalNodes.length') > 0;
+ }.property('service.journalNodes.length'),
dataNodesLiveTextView: App.ComponentLiveTextView.extend({
- liveComponents: function() {
- return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED").get("length");
- }.property("service.hostComponents.@each"),
+ liveComponents: function () {
+ return this.get('service.dataNodes').filterProperty("workStatus", "STARTED").get("length");
+ }.property("service.dataNodes.@each.workStatus"),
totalComponents: function() {
return this.get("service.dataNodes.length");
}.property("service.dataNodes.length")
}),
journalNodesLiveTextView: App.ComponentLiveTextView.extend({
- allJournalNodes: function () {
- return App.HostComponent.find().filterProperty('componentName', 'JOURNALNODE')
- }.property('service.hostComponents.@each'),
- liveComponents: function() {
- return this.get('allJournalNodes').filterProperty("workStatus","STARTED").get("length");
- }.property("allJournalNodes"),
- totalComponents: function() {
- return this.get('allJournalNodes').get("length");
- }.property("allJournalNodes")
+ liveComponents: function () {
+ return this.get('service.journalNodes').filterProperty("workStatus", "STARTED").get("length");
+ }.property("service.journalNodes.@each.workStatus"),
+ totalComponents: function () {
+ return this.get('service.journalNodes.length');
+ }.property("service.journalNodes.length")
}),
dfsTotalBlocks: function(){
@@ -164,11 +151,11 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
}.property('service.capacityUsed', 'service.capacityTotal'),
dataNodeComponent: function () {
- return App.HostComponent.find().findProperty('componentName', 'DATANODE');
+ return this.get('service.dataNodes').objectAt(0);
}.property(),
journalNodeComponent: function () {
- return App.HostComponent.find().findProperty('componentName', 'JOURNALNODE');
+ return this.get('service.journalNodes').objectAt(0);
}.property(),
safeModeStatus: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/views/main/dashboard/service/mapreduce.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/mapreduce.js b/ambari-web/app/views/main/dashboard/service/mapreduce.js
index 4714d19..214dac2 100644
--- a/ambari-web/app/views/main/dashboard/service/mapreduce.js
+++ b/ambari-web/app/views/main/dashboard/service/mapreduce.js
@@ -70,16 +70,16 @@ App.MainDashboardServiceMapreduceView = App.MainDashboardServiceView.extend({
trackersSummary: function () {
var svc = this.get('service');
- var liveCount = App.HostComponent.find().filterProperty('componentName', 'TASKTRACKER').filterProperty("workStatus","STARTED").length;
+ var liveCount = svc.get('taskTrackers').filterProperty("workStatus", "STARTED").length;
var totalCount = svc.get('taskTrackers').get('length');
var template = this.t('dashboard.services.mapreduce.trackersSummary');
return template.format(liveCount, totalCount);
- }.property('service.aliveTrackers.length', 'service.taskTrackers.length'),
+ }.property('service.aliveTrackers.length', 'service.taskTrackers.@each.workStatus'),
trackersLiveTextView: App.ComponentLiveTextView.extend({
- liveComponents: function() {
- return App.HostComponent.find().filterProperty('componentName', 'TASKTRACKER').filterProperty("workStatus","STARTED").get("length");
- }.property("service.hostComponents.@each", "service.aliveTrackers.length"),
+ liveComponents: function () {
+ return this.get('service.taskTrackers').filterProperty("workStatus", "STARTED").get("length");
+ }.property("service.taskTrackers.@each.workStatus"),
totalComponents: function() {
return this.get("service.taskTrackers.length");
}.property('service.taskTrackers.length')
@@ -135,6 +135,6 @@ App.MainDashboardServiceMapreduceView = App.MainDashboardServiceView.extend({
}.property('service.mapSlots', 'service.reduceSlots', 'service.aliveTrackers'),
taskTrackerComponent: function () {
- return App.HostComponent.find().findProperty('componentName', 'TASKTRACKER');
+ return this.get('service.taskTrackers').objectAt(0);
}.property()
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/views/main/dashboard/service/yarn.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/yarn.js b/ambari-web/app/views/main/dashboard/service/yarn.js
index 2f792d3..8e7751e 100644
--- a/ambari-web/app/views/main/dashboard/service/yarn.js
+++ b/ambari-web/app/views/main/dashboard/service/yarn.js
@@ -41,11 +41,11 @@ App.MainDashboardServiceYARNView = App.MainDashboardServiceView.extend({
}.property('service.nodeManagerNodes'),
nodeManagerComponent: function () {
- return App.HostComponent.find().findProperty('componentName', 'NODEMANAGER');
- }.property('service.hostComponents.@each'),
+ return this.get('service.nodeManagerNodes').objectAt(0);
+ }.property(),
yarnClientComponent: function () {
- return App.HostComponent.find().findProperty('componentName', 'YARN_CLIENT');
+ return this.get('service.hostComponents').findProperty('componentName', 'YARN_CLIENT');
}.property(),
hasManyYarnClients: function () {
@@ -65,10 +65,6 @@ App.MainDashboardServiceYARNView = App.MainDashboardServiceView.extend({
return this.t('services.service.summary.notRunning');
}.property("service.resourceManagerStartTime"),
- nodeManagersLive: function () {
- return App.HostComponent.find().filterProperty('componentName', 'NODEMANAGER').filterProperty("workStatus","STARTED");
- }.property('service.hostComponents.@each'),
-
nodeManagerText: function () {
if(!this.get("nodeManagerComponent") || this.get("nodeManagerComponent.length") == 0){
return '';
@@ -80,12 +76,12 @@ App.MainDashboardServiceYARNView = App.MainDashboardServiceView.extend({
}.property("nodeManagerComponent"),
nodeManagersLiveTextView: App.ComponentLiveTextView.extend({
- liveComponents: function() {
- return App.HostComponent.find().filterProperty('componentName', 'NODEMANAGER').filterProperty("workStatus","STARTED").get("length");
- }.property("service.hostComponents.@each"),
- totalComponents: function() {
- return App.HostComponent.find().filterProperty('componentName', 'NODEMANAGER').get("length");
- }.property("service.hostComponents.@each")
+ liveComponents: function () {
+ return this.get('service.nodeManagerNodes').filterProperty("workStatus", "STARTED").get("length");
+ }.property("service.nodeManagerNodes.@each.workStatus"),
+ totalComponents: function () {
+ return this.get('service.nodeManagerNodes.length');
+ }.property("service.nodeManagerNodes.length")
}),
nodeManagersStatus: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/views/main/dashboard/widgets/datanode_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/datanode_live.js b/ambari-web/app/views/main/dashboard/widgets/datanode_live.js
index 3adab13..227da27 100644
--- a/ambari-web/app/views/main/dashboard/widgets/datanode_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/datanode_live.js
@@ -41,12 +41,12 @@ App.DataNodeUpView = App.TextDashboardWidgetView.extend({
thresh2: 70,
maxValue: 100,
- dataNodesLive: function(){
- return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED");
- }.property('model.hostComponents.@each'),
- dataNodesDead: function(){
- return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","INSTALLED");
- }.property('model.hostComponents.@each'),
+ dataNodesLive: function () {
+ return this.get('model.dataNodes').filterProperty("workStatus", "STARTED");
+ }.property('model.dataNodes.@each.workStatus'),
+ dataNodesDead: function () {
+ return this.get('model.dataNodes').filterProperty("workStatus", "INSTALLED");
+ }.property('model.dataNodes.@each.workStatus'),
data: function () {
if ( !this.get('model.dataNodes.length')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js b/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
index d6330ef..172520b 100644
--- a/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
@@ -46,9 +46,9 @@ App.NodeManagersLiveView = App.TextDashboardWidgetView.extend({
thresh2: 70,
maxValue: 100,
- nodeManagersLive: function(){
- return App.HostComponent.find().filterProperty('componentName', 'NODEMANAGER').filterProperty("workStatus","STARTED");
- }.property('model.hostComponents.@each'),
+ nodeManagersLive: function () {
+ return this.get('model.nodeManagerNodes').filterProperty("workStatus", "STARTED");
+ }.property('model.nodeManagerNodes.@each.workStatus'),
data: function () {
var nodeManagers = this.get('model.nodeManagerNodes.length');
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js b/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js
index 7420340..2bbf432 100644
--- a/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js
@@ -39,9 +39,9 @@ App.TaskTrackerUpView = App.TextDashboardWidgetView.extend({
thresh2: 70,
maxValue: 100,
- taskTrackersLive: function(){
- return App.HostComponent.find().filterProperty('componentName', 'TASKTRACKER').filterProperty("workStatus","STARTED");
- }.property('model.hostComponents.@each'),
+ taskTrackersLive: function () {
+ return this.get('model.taskTrackers').filterProperty("workStatus", "STARTED");
+ }.property('model.taskTrackers.@each.workStatus'),
data: function () {
if (!this.get('model.taskTrackers.length')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/06c971ea/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index c87c26e..12d650d 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -242,44 +242,6 @@ App.MainServiceInfoSummaryView = Em.View.extend({
},
/**
- * Array of the hostComponents for service
- */
- components: [],
-
- /**
- * Copy hostComponents from controller to view to avoid flickering Summary block while data is updating in the controller
- * rand - just marker in the Service model for determining that Service was updated (value changes in the service_mapper)
- */
- hostComponentsUpd: function() {
- var components = [];
- this.get('controller.content.hostComponents').forEach(function(component) {
- var obj = {};
- for(var prop in component){
- if( component.hasOwnProperty(prop)
- && prop.indexOf('__ember') < 0
- && prop.indexOf('_super') < 0
- && Ember.typeOf(component.get(prop)) !== 'function'
- ) {
- obj[prop] = component.get(prop);
- }
- }
- obj.displayName = component.get('displayName'); // this is computed property and wasn't copied in the top block of code
- // suppressing MySQL server from being displayed, because Ambari always installs MySQL server no matter what
- // database type is selected, and shows an incorrect link in the summary to point to the host that's hosting
- // the MySQL server
- if (component.get('componentName') !== 'MYSQL_SERVER') {
- components.push(obj);
- }
- });
- this.set('components', components);
-
- },
-
- _hostComponentsUpd: function() {
- Ember.run.once(this, 'hostComponentsUpd');
- }.observes('controller.content.rand', 'controller.content.hostComponents.@each.isMaster', 'controller.content.hostComponents.@each.host'),
-
- /**
* Wrapper for displayName. used to render correct display name for mysql_server
*/
componentNameView: Ember.View.extend({
@@ -456,6 +418,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
}.property('App.router.clusterController.gangliaUrl', 'service.serviceName'),
didInsertElement:function () {
+ //TODO delegate style calculation to css
// We have to make the height of the Alerts section
// match the height of the Summary section.
var summaryTable = document.getElementById('summary-info');