You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2018/04/05 09:40:17 UTC
[ambari] branch trunk updated: AMBARI-23462 NN federation related
fixes for host details page. (ababiichuk)
This is an automated email from the ASF dual-hosted git repository.
ababiichuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 000333c AMBARI-23462 NN federation related fixes for host details page. (ababiichuk)
000333c is described below
commit 000333c5ec2f3a9568a8b56020faf81421c4a515
Author: aBabiichuk <ab...@hortonworks.com>
AuthorDate: Thu Apr 5 12:40:14 2018 +0300
AMBARI-23462 NN federation related fixes for host details page. (ababiichuk)
---
.../app/controllers/global/update_controller.js | 64 ++++++++++++++++++----
ambari-web/app/mappers/hosts_mapper.js | 18 +-----
ambari-web/app/mappers/service_metrics_mapper.js | 29 +++++-----
.../main/dashboard/widgets/namenode_widget.js | 11 +++-
ambari-web/app/models/host.js | 10 ----
.../templates/main/dashboard/widgets/uptime.hbs | 20 ++++---
.../views/main/dashboard/widgets/hdfs_capacity.js | 8 +--
.../app/views/main/dashboard/widgets/hdfs_links.js | 2 +-
.../views/main/dashboard/widgets/namenode_heap.js | 4 +-
.../views/main/dashboard/widgets/namenode_rpc.js | 2 +-
.../main/dashboard/widgets/namenode_uptime.js | 2 +-
ambari-web/app/views/main/host/summary.js | 36 +++++++++---
.../main/service/info/summary/hdfs/widgets.js | 40 +++++++-------
.../main/dashboard/widgets/namenode_rpc_test.js | 13 +++--
14 files changed, 151 insertions(+), 108 deletions(-)
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 80af63e..fbaa9bf 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -16,7 +16,8 @@
* limitations under the License.
*/
-var App = require('app');
+const App = require('app');
+const stringUtils = require('utils/string_utils');
App.UpdateController = Em.Controller.extend({
name: 'updateController',
@@ -71,6 +72,11 @@ App.UpdateController = Em.Controller.extend({
'HDFS': 'host_components/metrics/dfs/namenode/ClusterId'
},
+ nameNodeMetricsModelProperties: [
+ 'jvm_memory_heap_max_values', 'jvm_memory_heap_used_values', 'capacity_used_values', 'capacity_total_values',
+ 'capacity_remaining_values', 'capacity_non_dfs_used_values', 'name_node_rpc_values', 'name_node_start_time_values'
+ ],
+
/**
* @type {string}
*/
@@ -235,14 +241,7 @@ App.UpdateController = Em.Controller.extend({
hostDetailsParams = ',Hosts/os_arch,Hosts/os_type,metrics/cpu/cpu_system,metrics/cpu/cpu_user,' +
'metrics/memory/mem_total,metrics/memory/mem_free',
nameNodeMetrics = 'host_components/metrics/dfs/namenode/ClusterId,' +
- 'host_components/metrics/dfs/FSNamesystem/HAState,' +
- 'host_components/metrics/jvm/HeapMemoryMax,host_components/metrics/jvm/HeapMemoryUsed,' +
- 'host_components/metrics/dfs/FSNamesystem/CapacityUsed,' +
- 'host_components/metrics/dfs/FSNamesystem/CapacityTotal,' +
- 'host_components/metrics/dfs/FSNamesystem/CapacityRemaining,' +
- 'host_components/metrics/dfs/FSNamesystem/CapacityNonDFSUsed,' +
- 'host_components/metrics/rpc/client/RpcQueueTime_avg_time,' +
- 'host_components/metrics/runtime/StartTime,';
+ 'host_components/metrics/dfs/FSNamesystem/HAState,';
url = url.replace("<stackVersions>", stackVersionInfo);
url = url.replace("<metrics>", loadMetricsSeparately ? "" : "metrics/disk,metrics/load/load_one,");
@@ -380,9 +379,27 @@ App.UpdateController = Em.Controller.extend({
* @returns {$.ajax|null}
*/
loadHostsMetric: function (queryParams) {
- var realUrl = '/hosts?fields=metrics/disk/disk_free,metrics/disk/disk_total,metrics/load/load_one&minimal_response=true';
-
- if (App.Service.find('AMBARI_METRICS').get('isStarted')) {
+ const isAmbariMetricsStarted = App.Service.find('AMBARI_METRICS').get('isStarted'),
+ hostDetailsParam = queryParams.findProperty('isHostDetails'),
+ currentHostName = hostDetailsParam && hostDetailsParam.value[0],
+ isHostWithNameNode = currentHostName && App.HostComponent.find(`NAMENODE_${currentHostName}`).get('isLoaded');
+ if (isAmbariMetricsStarted || isHostWithNameNode) {
+ let realUrl = '/hosts?fields=',
+ realUrlFields = [];
+ if (isAmbariMetricsStarted) {
+ realUrlFields.push('metrics/disk/disk_free', 'metrics/disk/disk_total', 'metrics/load/load_one');
+ }
+ if (isHostWithNameNode) {
+ realUrlFields.push(
+ 'host_components/metrics/dfs/namenode/ClusterId', 'host_components/metrics/jvm/HeapMemoryMax',
+ 'host_components/metrics/jvm/HeapMemoryUsed', 'host_components/metrics/dfs/FSNamesystem/CapacityUsed',
+ 'host_components/metrics/dfs/FSNamesystem/CapacityTotal',
+ 'host_components/metrics/dfs/FSNamesystem/CapacityRemaining',
+ 'host_components/metrics/dfs/FSNamesystem/CapacityNonDFSUsed',
+ 'host_components/metrics/rpc/client/RpcQueueTime_avg_time', 'host_components/metrics/runtime/StartTime'
+ );
+ }
+ realUrl += (realUrlFields.join(',') + '&minimal_response=true');
return App.ajax.send({
name: 'hosts.metrics.lazy_load',
sender: this,
@@ -402,6 +419,29 @@ App.UpdateController = Em.Controller.extend({
*/
loadHostsMetricSuccessCallback: function (data) {
App.hostsMapper.setMetrics(data);
+ if (App.router.get('currentState.parentState.name') === 'hostDetails' && data) {
+ const hostComponentsData = Em.get(data, 'items.0.host_components');
+ if (hostComponentsData) {
+ const nameNodeData = hostComponentsData.findProperty('HostRoles.component_name', 'NAMENODE');
+ if (nameNodeData) {
+ const hostName = Em.get(data, 'items.0.Hosts.host_name'),
+ nameNodeModelMap = App.serviceMetricsMapper.activeNameNodeConfig,
+ processedModelProperties = this.nameNodeMetricsModelProperties,
+ hdfsModel = App.HDFSService.find('HDFS'),
+ componentModel = App.HostComponent.find(`NAMENODE_${hostName}`);
+ Object.keys(nameNodeModelMap).forEach(key => {
+ if (processedModelProperties.contains(key)) {
+ const modelKey = stringUtils.underScoreToCamelCase(key);
+ hdfsModel.get(modelKey)[hostName] = Em.get(nameNodeData, nameNodeModelMap[key]);
+ hdfsModel.propertyDidChange(modelKey);
+ }
+ });
+ componentModel.setProperties({
+ clusterIdValue: Em.get(nameNodeData, 'metrics.dfs.namenode.ClusterId')
+ });
+ }
+ }
+ }
},
/**
diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js
index 29b5fef..6324f3a 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -92,16 +92,6 @@ App.hostsMapper = App.QuickDataMapper.create({
item: 'name'
}
},
- nameNodeMetricsConfig: {
- name_node_start_time: 'metrics.runtime.StartTime',
- jvm_memory_heap_used: 'metrics.jvm.HeapMemoryUsed',
- capacity_used: 'metrics.dfs.FSNamesystem.CapacityUsed',
- capacity_total: 'metrics.dfs.FSNamesystem.CapacityTotal',
- capacity_remaining: 'metrics.dfs.FSNamesystem.CapacityRemaining',
- capacity_non_dfs_used: 'metrics.dfs.FSNamesystem.CapacityNonDFSUsed',
- jvm_memory_heap_max: 'metrics.jvm.HeapMemoryMax',
- name_node_rpc: 'metrics.rpc.client.RpcQueueTime_avg_time'
- },
map: function (json, returnMapped) {
returnMapped = !!returnMapped;
console.time('App.hostsMapper execution time');
@@ -118,7 +108,6 @@ App.hostsMapper = App.QuickDataMapper.create({
var clusterName = App.get('clusterName');
var advancedHostComponents = [];
var hostComponentLogs = [];
- var nameNodeMetrics;
// Create a map for quick access on existing hosts
var hosts = App.Host.find().toArray();
@@ -137,8 +126,7 @@ App.hostsMapper = App.QuickDataMapper.create({
item.host_components = item.host_components || [];
for (var i = 0; i < item.host_components.length; i++){
var host_component = item.host_components[i];
- var componentName = host_component.HostRoles.component_name;
- var id = componentName + "_" + item.Hosts.host_name;
+ var id = host_component.HostRoles.component_name + "_" + item.Hosts.host_name;
var component = this.parseIt(host_component, this.hostComponentConfig);
var serviceName = host_component.HostRoles.service_name;
@@ -177,9 +165,6 @@ App.hostsMapper = App.QuickDataMapper.create({
component.component_logs_id = logParsed.id;
hostComponentLogs.push(logParsed);
}
- if (componentName === 'NAMENODE' && host_component.metrics) {
- nameNodeMetrics = this.parseIt(host_component, this.nameNodeMetricsConfig);
- }
}
var currentVersion = item.stack_versions.findProperty('HostStackVersions.state', 'CURRENT');
@@ -214,7 +199,6 @@ App.hostsMapper = App.QuickDataMapper.create({
}
});
var parsedItem = this.parseIt(item, this.config);
- $.extend(parsedItem, nameNodeMetrics);
parsedItem.selected = selectedHosts.contains(parsedItem.host_name);
parsedItem.not_started_components = notStartedComponents;
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js
index 5e7cf52..8d14ede 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -437,6 +437,15 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
}
}, this)
},
+
+ setNameNodeMetricsProperties: function (item, hostComponent) {
+ const activeNameNodeConfig = this.activeNameNodeConfig,
+ activeNameNodeConfigKeys = Object.keys(activeNameNodeConfig);
+ activeNameNodeConfigKeys.forEach(key => {
+ item[key][Em.get(hostComponent, 'HostRoles.host_name')] = Em.get(hostComponent, activeNameNodeConfig[key]);
+ });
+ },
+
/**
* Map quick links to services:OOZIE,GANGLIA
* @param finalJson
@@ -492,9 +501,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
let finalConfig = jQuery.extend({}, this.config);
// Change the JSON so that it is easy to map
const hdfsConfig = this.hdfsConfig,
- activeNameNodeConfig = this.activeNameNodeConfig,
- activeNameNodeConfigKeys = Object.keys(activeNameNodeConfig),
- activeNameNodeConfigInitial = activeNameNodeConfigKeys.reduce((obj, key) => Object.assign({}, obj, {
+ activeNameNodeConfigInitial = Object.keys(this.activeNameNodeConfig).reduce((obj, key) => Object.assign({}, obj, {
[key]: {}
}), {});
Object.assign(item, activeNameNodeConfigInitial);
@@ -528,11 +535,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
});
break;
}
- activeNameNodeConfigKeys.forEach(key => {
- if (clusterIdValue && (!item[key][clusterIdValue] || haState === 'active')) {
- item[key][clusterIdValue] = Em.get(hc, activeNameNodeConfig[key]);
- }
- });
+ this.setNameNodeMetricsProperties(item, hc);
});
unknownNameNodes.forEach(nameNode => {
if (nameSpacesWithActiveNameNodes.contains(nameNode.clusterIdValue)) {
@@ -540,9 +543,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
}
});
} else {
- activeNameNodeConfigKeys.forEach(key => {
- item[key].default = Em.get(firstHostComponent, activeNameNodeConfig[key]);
- });
+ this.setNameNodeMetricsProperties(item, firstHostComponent);
}
item.nameNodeComponent = component;
@@ -550,9 +551,9 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
// Get the live, dead & decommission nodes from string json
if (firstHostComponent.metrics && firstHostComponent.metrics.dfs && firstHostComponent.metrics.dfs.namenode) {
item.metrics_not_available = false;
- var decommissionNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DecomNodes);
- var deadNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.DeadNodes);
- var liveNodesJson = App.parseJSON(component.host_components[0].metrics.dfs.namenode.LiveNodes);
+ var decommissionNodesJson = App.parseJSON(firstHostComponent.metrics.dfs.namenode.DecomNodes);
+ var deadNodesJson = App.parseJSON(firstHostComponent.metrics.dfs.namenode.DeadNodes);
+ var liveNodesJson = App.parseJSON(firstHostComponent.metrics.dfs.namenode.LiveNodes);
} else {
item.metrics_not_available = true;
}
diff --git a/ambari-web/app/mixins/main/dashboard/widgets/namenode_widget.js b/ambari-web/app/mixins/main/dashboard/widgets/namenode_widget.js
index 1e82d32..7b81542 100644
--- a/ambari-web/app/mixins/main/dashboard/widgets/namenode_widget.js
+++ b/ambari-web/app/mixins/main/dashboard/widgets/namenode_widget.js
@@ -24,6 +24,15 @@ App.NameNodeWidgetMixin = Em.Mixin.create({
componentGroup: Em.computed.findByKey('model.masterComponentGroups', 'name', 'subGroupId'),
- clusterId: Em.computed.alias('componentGroup.clusterId')
+ clusterId: Em.computed.alias('componentGroup.clusterId'),
+
+ hostName: function () {
+ const allHostNames = this.get('componentGroup.hosts'),
+ hostComponents = App.HostComponent.find().filter(component => {
+ return component.get('componentName') === 'NAMENODE' && allHostNames.contains(component.get('hostName'));
+ }),
+ resultingComponent = hostComponents.findProperty('haStatus', 'active') || hostComponents.get('firstObject');
+ return resultingComponent && resultingComponent.get('hostName');
+ }.property('clusterId')
});
\ No newline at end of file
diff --git a/ambari-web/app/models/host.js b/ambari-web/app/models/host.js
index cacca87..ec7c71c 100644
--- a/ambari-web/app/models/host.js
+++ b/ambari-web/app/models/host.js
@@ -54,16 +54,6 @@ App.Host = DS.Model.extend({
index: DS.attr('number'),
stackVersions: DS.hasMany('App.HostStackVersion'),
- // NameNode metrics
- nameNodeStartTime: DS.attr('number'),
- jvmMemoryHeapUsed: DS.attr('number'),
- jvmMemoryHeapMax: DS.attr('number'),
- capacityUsed: DS.attr('number'),
- capacityTotal: DS.attr('number'),
- capacityRemaining: DS.attr('number'),
- capacityNonDfsUsed: DS.attr('number'),
- nameNodeRpc: DS.attr('number'),
-
isFiltered: DS.attr('boolean'),
/**
diff --git a/ambari-web/app/templates/main/dashboard/widgets/uptime.hbs b/ambari-web/app/templates/main/dashboard/widgets/uptime.hbs
index befc9da..4cd2a8a 100644
--- a/ambari-web/app/templates/main/dashboard/widgets/uptime.hbs
+++ b/ambari-web/app/templates/main/dashboard/widgets/uptime.hbs
@@ -20,15 +20,17 @@
<ul class="list-unstyled">
<li class="img-thumbnail row">
<div class="caption col-md-10"> {{view.title}} </div>
- <div class="corner-icon col-md-1">
- <button class="dropdown-toggle ellipsis-menu button-border" data-toggle="dropdown" href="#"></button>
- <ul class="dropdown-menu">
- <li><button type="button" href="#" class="button-border"
- {{action deleteWidget target="view"}}>
- <i class="icon-trash"></i> {{t common.delete}}</button>
- </li>
- </ul>
- </div>
+ {{#if view.showActions}}
+ <div class="corner-icon col-md-1">
+ <button class="dropdown-toggle ellipsis-menu button-border" data-toggle="dropdown" href="#"></button>
+ <ul class="dropdown-menu">
+ <li><button type="button" href="#" class="button-border"
+ {{action deleteWidget target="view"}}>
+ <i class="icon-trash"></i> {{t common.delete}}</button>
+ </li>
+ </ul>
+ </div>
+ {{/if}}
{{#if view.isDataLoaded}}
<div {{bindAttr class=":hidden-info-general view.hiddenInfoClass"}}>
<table align="center">
diff --git a/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js b/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
index 903a1ed..21e3b0d 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
@@ -21,13 +21,13 @@ var numberUtils = require('utils/number_utils');
App.NameNodeCapacityPieChartView = App.PieChartDashboardWidgetView.extend(App.NameNodeWidgetMixin, {
- modelValueMax: Em.computed.getByKey('model.capacityTotalValues', 'clusterId'),
+ modelValueMax: Em.computed.getByKey('model.capacityTotalValues', 'hostName'),
/**
* HDFS model has 'remaining' value, but not 'used'
*/
- modelValueUsed: Em.computed.getByKey('model.capacityRemainingValues', 'clusterId'),
- modelValueCapacityUsed: Em.computed.getByKey('model.capacityUsedValues', 'clusterId'),
- modelValueNonDfsUsed: Em.computed.getByKey('model.capacityNonDfsUsedValues', 'clusterId'),
+ modelValueUsed: Em.computed.getByKey('model.capacityRemainingValues', 'hostName'),
+ modelValueCapacityUsed: Em.computed.getByKey('model.capacityUsedValues', 'hostName'),
+ modelValueNonDfsUsed: Em.computed.getByKey('model.capacityNonDfsUsedValues', 'hostName'),
widgetHtmlId: Em.computed.format('widget-nn-capacity-{0}', 'subGroupId'),
hiddenInfoClass: "hidden-info-six-line",
diff --git a/ambari-web/app/views/main/dashboard/widgets/hdfs_links.js b/ambari-web/app/views/main/dashboard/widgets/hdfs_links.js
index 4949c23..4da5ed8 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hdfs_links.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hdfs_links.js
@@ -50,7 +50,7 @@ App.HDFSLinksView = App.LinkDashboardWidgetView.extend(App.NameNodeWidgetMixin,
}.property(),
masterGroupsArray: function () {
- const activeMasterGroup = this.get('model.masterComponentGroups').find(group => group.name === this.get('subGroupId'));
+ const activeMasterGroup = this.get('model.masterComponentGroups').findProperty('name', this.get('subGroupId'));
return [activeMasterGroup];
}.property('model.masterComponentGroups', 'subGroupId')
});
\ No newline at end of file
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js b/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
index 9f4eaa2..4d2e124 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
@@ -20,8 +20,8 @@ var App = require('app');
App.NameNodeHeapPieChartView = App.PieChartDashboardWidgetView.extend(App.NameNodeWidgetMixin, {
- modelValueMax: Em.computed.getByKey('model.jvmMemoryHeapMaxValues', 'clusterId'),
- modelValueUsed: Em.computed.getByKey('model.jvmMemoryHeapUsedValues', 'clusterId'),
+ modelValueMax: Em.computed.getByKey('model.jvmMemoryHeapMaxValues', 'hostName'),
+ modelValueUsed: Em.computed.getByKey('model.jvmMemoryHeapUsedValues', 'hostName'),
widgetHtmlId: Em.computed.format('widget-nn-heap-{0}', 'subGroupId'),
getUsed: function() {
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js b/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
index 4449168..b360d7e 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
@@ -33,7 +33,7 @@ App.NameNodeRpcView = App.TextDashboardWidgetView.extend(App.EditableWidgetMixin
isRed: Em.computed.gtProperties('data', 'thresholdMax'),
- modelValue: Em.computed.getByKey('model.nameNodeRpcValues', 'clusterId'),
+ modelValue: Em.computed.getByKey('model.nameNodeRpcValues', 'hostName'),
data: function () {
const rpc = this.get('modelValue');
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_uptime.js b/ambari-web/app/views/main/dashboard/widgets/namenode_uptime.js
index 71f285c..30ccbfe6 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_uptime.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_uptime.js
@@ -21,6 +21,6 @@ var App = require('app');
App.NameNodeUptimeView = App.UptimeTextDashboardWidgetView.extend(App.NameNodeWidgetMixin, {
component: 'NameNode',
- modelValue: Em.computed.getByKey('model.nameNodeStartTimeValues', 'clusterId')
+ modelValue: Em.computed.getByKey('model.nameNodeStartTimeValues', 'hostName')
});
\ No newline at end of file
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index 9a9bbe8..a66e5df 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -63,43 +63,61 @@ App.MainHostSummaryView = Em.View.extend(App.TimeRangeMixin, {
showHostMetricsBlock: Em.computed.or('hasHostMetricsService', 'hasNameNode'),
nameNodeWidgets: function () {
- const hasNameNode = this.get('hasNameNode'),
- model = this.get('content');
+ const hasNameNode = this.get('hasNameNode');
let widgets = [];
if (hasNameNode) {
+ const model = App.HDFSService.find('HDFS'),
+ hostName = this.get('content.hostName'),
+ widgetsDefinitions = require('data/dashboard_widgets').toMapByProperty('viewName');
widgets.pushObjects([
App.NameNodeHeapPieChartView.extend({
model,
+ hostName,
widgetHtmlId: 'nn-heap',
title: Em.I18n.t('dashboard.widgets.NameNodeHeap'),
showActions: false,
- modelValueMax: Em.computed.alias('model.jvmMemoryHeapMax'),
- modelValueUsed: Em.computed.alias('model.jvmMemoryHeapUsed')
+ widget: {
+ threshold: widgetsDefinitions.NameNodeHeapPieChartView.threshold,
+ }
}),
App.NameNodeCapacityPieChartView.extend({
model,
+ hostName,
widgetHtmlId: 'nn-capacity',
title: Em.I18n.t('dashboard.widgets.HDFSDiskUsage'),
showActions: false,
- modelValueMax: Em.computed.alias('model.capacityTotal'),
- modelValueUsed: Em.computed.alias('model.capacityRemaining'),
- modelValueCapacityUsed: Em.computed.alias('model.capacityUsed'),
- modelValueNonDfsUsed: Em.computed.alias('model.capacityNonDfsUsed')
+ widget: {
+ threshold: widgetsDefinitions.NameNodeCapacityPieChartView.threshold
+ }
}),
App.NameNodeCpuPieChartView.extend({
widgetHtmlId: 'nn-cpu',
title: Em.I18n.t('dashboard.widgets.NameNodeCpu'),
showActions: false,
+ widget: {
+ threshold: widgetsDefinitions.NameNodeCpuPieChartView.threshold
+ },
subGroupId: this.get('nameNodeComponent.haNameSpace'),
activeNameNodes: [this.get('nameNodeComponent')],
nameNode: this.get('nameNodeComponent')
}),
App.NameNodeRpcView.extend({
model,
+ hostName,
widgetHtmlId: 'nn-rpc',
title: Em.I18n.t('dashboard.widgets.NameNodeRpc'),
showActions: false,
- modelValue: Em.computed.alias('model.nameNodeRpc')
+ widget: {
+ threshold: widgetsDefinitions.NameNodeRpcView.threshold
+ }
+ }),
+ App.NameNodeUptimeView.extend({
+ model,
+ hostName,
+ widgetHtmlId: 'nn-uptime',
+ title: Em.I18n.t('dashboard.widgets.NameNodeUptime'),
+ showActions: false,
+ subGroupId: this.get('nameNodeComponent.haNameSpace')
})
]);
}
diff --git a/ambari-web/app/views/main/service/info/summary/hdfs/widgets.js b/ambari-web/app/views/main/service/info/summary/hdfs/widgets.js
index 914db59..1dd172a 100644
--- a/ambari-web/app/views/main/service/info/summary/hdfs/widgets.js
+++ b/ambari-web/app/views/main/service/info/summary/hdfs/widgets.js
@@ -41,22 +41,20 @@ function diskPartPercent(i18nKey, totalKey, usedKey) {
});
}
-App.HDFSSummaryWidgetsView = Em.View.extend({
+App.HDFSSummaryWidgetsView = Em.View.extend(App.NameNodeWidgetMixin, {
templateName: require('templates/main/service/info/summary/hdfs/widgets'),
nameSpace: 'default',
- service: function () {
+ model: function () {
return App.HDFSService.find().objectAt(0);
}.property('controller.content.serviceName'),
- componentGroup: Em.computed.findByKey('service.masterComponentGroups', 'name', 'nameSpace'),
-
- clusterId: Em.computed.alias('componentGroup.clusterId'),
+ subGroupId: Em.computed.alias('nameSpace'),
nodeUptime: function () {
- const uptime = this.get(`service.nameNodeStartTimeValues.${this.get('clusterId')}`);
+ const uptime = this.get('model.nameNodeStartTimeValues')[this.get('hostName')];
if (uptime && uptime > 0) {
let diff = App.dateTime() - uptime;
if (diff < 0) {
@@ -66,11 +64,11 @@ App.HDFSSummaryWidgetsView = Em.View.extend({
return this.t('dashboard.services.uptime').format(formatted);
}
return this.t('services.service.summary.notRunning');
- }.property('service.nameNodeStartTimeValues'),
+ }.property('model.nameNodeStartTimeValues'),
- jvmMemoryHeapUsed: Em.computed.getByKey('service.jvmMemoryHeapUsedValues', 'clusterId'),
+ jvmMemoryHeapUsed: Em.computed.getByKey('model.jvmMemoryHeapUsedValues', 'hostName'),
- jvmMemoryHeapMax: Em.computed.getByKey('service.jvmMemoryHeapMaxValues', 'clusterId'),
+ jvmMemoryHeapMax: Em.computed.getByKey('model.jvmMemoryHeapMaxValues', 'hostName'),
nodeHeapPercent: App.MainDashboardServiceView.formattedHeapPercent(
'dashboard.services.hdfs.nodes.heapUsedPercent', 'jvmMemoryHeapUsed', 'jvmMemoryHeapMax'
@@ -80,11 +78,11 @@ App.HDFSSummaryWidgetsView = Em.View.extend({
'dashboard.services.hdfs.nodes.heapUsed', 'jvmMemoryHeapUsed', 'jvmMemoryHeapMax'
),
- capacityTotal: Em.computed.getByKey('service.capacityTotalValues', 'clusterId'),
+ capacityTotal: Em.computed.getByKey('model.capacityTotalValues', 'hostName'),
- capacityUsed: Em.computed.getByKey('service.capacityUsedValues', 'clusterId'),
+ capacityUsed: Em.computed.getByKey('model.capacityUsedValues', 'hostName'),
- capacityRemaining: Em.computed.getByKey('service.capacityRemainingValues', 'clusterId'),
+ capacityRemaining: Em.computed.getByKey('model.capacityRemainingValues', 'hostName'),
dfsUsedDiskPercent: diskPartPercent('dashboard.services.hdfs.capacityUsedPercent', 'capacityTotal', 'capacityUsed'),
@@ -107,29 +105,29 @@ App.HDFSSummaryWidgetsView = Em.View.extend({
remainingDisk: diskPart('dashboard.services.hdfs.capacityUsed', 'capacityTotal', 'capacityRemaining'),
- dfsTotalBlocksValue: Em.computed.getByKey('service.dfsTotalBlocksValues', 'clusterId'),
+ dfsTotalBlocksValue: Em.computed.getByKey('model.dfsTotalBlocksValues', 'hostName'),
dfsTotalBlocks: Em.computed.formatUnavailable('dfsTotalBlocksValue'),
- dfsCorruptBlocksValue: Em.computed.getByKey('service.dfsTotalBlocksValues', 'clusterId'),
+ dfsCorruptBlocksValue: Em.computed.getByKey('model.dfsTotalBlocksValues', 'hostName'),
dfsCorruptBlocks: Em.computed.formatUnavailable('dfsCorruptBlocksValue'),
- dfsMissingBlocksValue: Em.computed.getByKey('service.dfsMissingBlocksValues', 'clusterId'),
+ dfsMissingBlocksValue: Em.computed.getByKey('model.dfsMissingBlocksValues', 'hostName'),
dfsMissingBlocks: Em.computed.formatUnavailable('dfsMissingBlocksValue'),
- dfsUnderReplicatedBlocksValue: Em.computed.getByKey('service.dfsUnderReplicatedBlocksValues', 'clusterId'),
+ dfsUnderReplicatedBlocksValue: Em.computed.getByKey('model.dfsUnderReplicatedBlocksValues', 'hostName'),
dfsUnderReplicatedBlocks: Em.computed.formatUnavailable('dfsUnderReplicatedBlocksValue'),
- dfsTotalFilesValue: Em.computed.getByKey('service.dfsTotalFilesValues', 'clusterId'),
+ dfsTotalFilesValue: Em.computed.getByKey('model.dfsTotalFilesValues', 'hostName'),
- dfsTotalFiles: Em.computed.formatUnavailable('service.dfsTotalFilesValue'),
+ dfsTotalFiles: Em.computed.formatUnavailable('model.dfsTotalFilesValue'),
- healthStatus: Em.computed.getByKey('service.healthStatusValues', 'clusterId'),
+ healthStatus: Em.computed.getByKey('model.healthStatusValues', 'hostName'),
- upgradeStatusValue: Em.computed.getByKey('service.upgradeStatusValues', 'clusterId'),
+ upgradeStatusValue: Em.computed.getByKey('model.upgradeStatusValues', 'hostName'),
upgradeStatus: function () {
const upgradeStatus = this.get('upgradeStatusValue'),
@@ -148,7 +146,7 @@ App.HDFSSummaryWidgetsView = Em.View.extend({
return this.get('upgradeStatusValue') === false && this.get('healthStatus') === 'green';
}.property('upgradeStatusValue', 'healthStatus'),
- safeModeStatusValue: Em.computed.getByKey('service.safeModeStatusValues', 'clusterId'),
+ safeModeStatusValue: Em.computed.getByKey('model.safeModeStatusValues', 'hostName'),
safeModeStatus: function () {
const safeMode = this.get('safeModeStatusValue');
diff --git a/ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js b/ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js
index 73fcd53..e493d10 100644
--- a/ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js
@@ -81,19 +81,20 @@ describe('App.NameNodeRpcView', function() {
];
tests.forEach(function(test) {
- describe('nameNodeRpc - ' + test.model.nameNodeRpc, function() {
- var jobTrackerRpcView = App.NameNodeRpcView.create({
- clusterId: 'c',
+ var hostName = 'c';
+ describe('nameNodeRpc - ' + test.model.nameNodeRpcValues[hostName], function() {
+ var nameNodeRpcView = App.NameNodeRpcView.create({
+ hostName: hostName,
model: test.model
});
it('content', function() {
- expect(jobTrackerRpcView.get('content')).to.equal(test.e.content);
+ expect(nameNodeRpcView.get('content')).to.equal(test.e.content);
});
it('data', function() {
- expect(jobTrackerRpcView.get('data')).to.equal(test.e.data);
+ expect(nameNodeRpcView.get('data')).to.equal(test.e.data);
});
it('isNA', function() {
- expect(jobTrackerRpcView.get('isNA')).to.equal(test.e.isNA);
+ expect(nameNodeRpcView.get('isNA')).to.equal(test.e.isNA);
});
});
});
--
To stop receiving notification emails like this one, please contact
ababiichuk@apache.org.