AMBARI-19002 Ambari widgets and service checks to honor LLAP clusters with 100% allocation to LLAP daemons. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/616e97ea Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/616e97ea Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/616e97ea Branch: refs/heads/branch-feature-AMBARI-18901 Commit: 616e97ea3655f54db3d1a19c2af43672ea971de2 Parents: 182479d Author: Andrii Tkach <atk...@apache.org> Authored: Tue Nov 29 13:40:37 2016 +0200 Committer: Andrii Tkach <atk...@apache.org> Committed: Tue Nov 29 13:40:37 2016 +0200 ---------------------------------------------------------------------- .../stacks/HDP/2.0.6/configuration/cluster-env.xml | 6 ++++++ ambari-web/app/views/main/dashboard/widgets.js | 17 +++++++++++++++-- .../test/views/main/dashboard/widgets_test.js | 11 ++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/616e97ea/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml index 0d313cc..cc6c8a3 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml @@ -274,4 +274,10 @@ gpgcheck=0</value> <description>For properties handled by handle_mounted_dirs this will make Ambari </description> <on-ambari-upgrade add="true"/> </property> + <property> + <name>hide_yarn_memory_widget</name> + <value>false</value> + <description>YARN Memory widget should be hidden by default on the dashboard.</description> + <on-ambari-upgrade add="true"/> + </property> </configuration> http://git-wip-us.apache.org/repos/asf/ambari/blob/616e97ea/ambari-web/app/views/main/dashboard/widgets.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/dashboard/widgets.js b/ambari-web/app/views/main/dashboard/widgets.js index 48293d3..c5eaafc 100644 --- a/ambari-web/app/views/main/dashboard/widgets.js +++ b/ambari-web/app/views/main/dashboard/widgets.js @@ -116,6 +116,16 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap }, this); }, + resolveConfigDependencies: function(visibleFull, hiddenFull) { + var clusterEnv = App.router.get('clusterController.clusterEnv').properties; + + if (clusterEnv['hide_yarn_memory_widget'] === 'true') { + hiddenFull.push(['20', 'YARN Memory']); + } else { + visibleFull.splice(visibleFull.indexOf('19'), 0, '20'); + } + }, + /** * Load widget statuses to <code>initPrefObject</code> */ @@ -126,7 +136,7 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap '6', '7', '8', '9', //host metrics '1', '5', '3', '10', //hdfs '13', '12', '14', '16', //hbase - '17', '18', '19', '20', '23', // all yarn + '17', '18', '19', '23', // all yarn '21', // storm '22', // flume '24', // hawq @@ -135,6 +145,7 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap var hiddenFull = [ ['15', 'Region In Transition'] ]; + this.resolveConfigDependencies(visibleFull, hiddenFull); // Display widgets for host metrics if the stack definition has a host metrics service to display it. if (this.get('host_metrics_model') == null) { @@ -155,7 +166,9 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap hbase.forEach(function (item) { visibleFull = visibleFull.without(item); }, this); - hiddenFull = []; + hiddenFull = hiddenFull.filter(function(item) { + return item[0] !== '15'; + }); } if (this.get('yarn_model') == null) { var yarn = ['17', '18', '19', '20', '23']; http://git-wip-us.apache.org/repos/asf/ambari/blob/616e97ea/ambari-web/test/views/main/dashboard/widgets_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js index 49a06a4..0781c79 100644 --- a/ambari-web/test/views/main/dashboard/widgets_test.js +++ b/ambari-web/test/views/main/dashboard/widgets_test.js @@ -107,12 +107,21 @@ describe('App.MainDashboardWidgetsView', function () { yarn_model: {} }, e: { - visibleL: totalWidgetsCount, + visibleL: totalWidgetsCount - 1, hiddenL: 1 }, m: 'All models are not null' } ]); + + beforeEach(function() { + sinon.stub(view, 'resolveConfigDependencies'); + }); + + afterEach(function() { + view.resolveConfigDependencies.restore(); + }); + tests.forEach(function (test) { describe(test.m, function () {