This is an automated email from the ASF dual-hosted git repository. atkach 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 fc2a1b4 AMBARI-23422 Dashboard: add Yarn Containers widget fc2a1b4 is described below commit fc2a1b4acec27c9a6bc6c8334a69562600f015e2 Author: Andrii Tkach <atk...@apache.org> AuthorDate: Mon Apr 2 17:10:51 2018 +0300 AMBARI-23422 Dashboard: add Yarn Containers widget --- ambari-web/app/data/dashboard_widgets.js | 12 ++- ambari-web/app/messages.js | 1 + .../main/dashboard/widgets/simple_text.hbs | 12 ++- ambari-web/app/views.js | 1 + .../views/main/dashboard/widgets/text_widget.js | 2 + .../main/dashboard/widgets/yarn_containers.js | 85 ++++++++++++++++++++++ 6 files changed, 107 insertions(+), 6 deletions(-) diff --git a/ambari-web/app/data/dashboard_widgets.js b/ambari-web/app/data/dashboard_widgets.js index 5348678..85d497a 100644 --- a/ambari-web/app/data/dashboard_widgets.js +++ b/ambari-web/app/data/dashboard_widgets.js @@ -164,7 +164,8 @@ module.exports = [ viewName: 'YARNMemoryPieChartView', sourceName: 'YARN', title: Em.I18n.t('dashboard.widgets.YARNMemory'), - threshold: [50, 75] + threshold: [50, 75], + isHiddenByDefault: true }, { id: 21, @@ -201,5 +202,12 @@ module.exports = [ sourceName: 'PXF', title: Em.I18n.t('dashboard.widgets.PxfUp'), threshold: [] - } + }, + { + id: 26, + viewName: 'YarnContainersView', + sourceName: 'YARN', + title: Em.I18n.t('dashboard.widgets.YarnContainers'), + threshold: [] + }, ]; \ No newline at end of file diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index fe4d6aa..0c243bb 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -3005,6 +3005,7 @@ Em.I18n.translations = { 'dashboard.widgets.NodeManagersLive': 'NodeManagers Live', 'dashboard.widgets.YARNMemory': 'YARN Memory', 'dashboard.widgets.YARNLinks': 'YARN Links', + 'dashboard.widgets.YarnContainers': 'YARN Containers', 'dashboard.widgets.error.invalid': 'Invalid! Enter a number between {0} - {1}', 'dashboard.widgets.error.smaller': 'Threshold 1 should be smaller than threshold 2!', 'dashboard.widgets.HawqSegmentUp': 'HAWQ Segments Live', diff --git a/ambari-web/app/templates/main/dashboard/widgets/simple_text.hbs b/ambari-web/app/templates/main/dashboard/widgets/simple_text.hbs index fcd1221..5e89d72 100644 --- a/ambari-web/app/templates/main/dashboard/widgets/simple_text.hbs +++ b/ambari-web/app/templates/main/dashboard/widgets/simple_text.hbs @@ -25,10 +25,14 @@ <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 editWidget target="view"}}> - <i class="icon-pencil"></i> {{t common.edit}}</button> - </li> + {{#if view.isEditable}} + <li> + <button type="button" href="#" class="button-border" + {{action editWidget target="view"}}> + <i class="icon-pencil"></i> {{t common.edit}} + </button> + </li> + {{/if}} <li><button type="button" href="#" class="button-border" {{action deleteWidget target="view"}}> <i class="icon-trash"></i> {{t common.delete}}</button> diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js index 9eced52..8af9edd 100644 --- a/ambari-web/app/views.js +++ b/ambari-web/app/views.js @@ -287,6 +287,7 @@ require('views/main/dashboard/widgets/resource_manager_heap'); require('views/main/dashboard/widgets/resource_manager_uptime'); require('views/main/dashboard/widgets/node_managers_live'); require('views/main/dashboard/widgets/yarn_memory'); +require('views/main/dashboard/widgets/yarn_containers'); require('views/main/dashboard/widgets/supervisor_live'); require('views/main/dashboard/widgets/flume_agent_live'); require('views/main/dashboard/config_history_view'); diff --git a/ambari-web/app/views/main/dashboard/widgets/text_widget.js b/ambari-web/app/views/main/dashboard/widgets/text_widget.js index 79f0573..271edf6 100644 --- a/ambari-web/app/views/main/dashboard/widgets/text_widget.js +++ b/ambari-web/app/views/main/dashboard/widgets/text_widget.js @@ -24,6 +24,8 @@ App.TextDashboardWidgetView = App.DashboardWidgetView.extend({ classNameBindings: ['isRed', 'isOrange', 'isGreen', 'isNA'], + isEditable: true, + isRed: Em.computed.lteProperties('data', 'thresholdMin'), isOrange: Em.computed.and('!isGreen', '!isRed'), isGreen: Em.computed.gtProperties('data', 'thresholdMax'), diff --git a/ambari-web/app/views/main/dashboard/widgets/yarn_containers.js b/ambari-web/app/views/main/dashboard/widgets/yarn_containers.js new file mode 100644 index 0000000..c4186c5 --- /dev/null +++ b/ambari-web/app/views/main/dashboard/widgets/yarn_containers.js @@ -0,0 +1,85 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var App = require('app'); + +function counterOrNA(key) { + var _key = 'model.{0}.length'.format(key); + return Em.computed(_key, function () { + if (Em.isNone(this.get('model.'+ key)) || this.get('model.metricsNotAvailable')) { + return Em.I18n.t('services.service.summary.notAvailable'); + } + return this.get(_key); + }); +} + +App.YarnContainersView = App.TextDashboardWidgetView.extend({ + + hiddenInfo: function () { + return [ + this.get('containersAllocated') + ' ' + Em.I18n.t('dashboard.services.yarn.containers.allocated'), + this.get('containersPending') + ' ' + Em.I18n.t('dashboard.services.yarn.containers.pending'), + this.get('containersReserved')+ ' ' + Em.I18n.t('dashboard.services.yarn.containers.reserved') + ]; + }.property('containersAllocated', 'containersPending', 'containersReserved'), + + hiddenInfoClass: "hidden-info-three-line", + + maxValue: 'infinity', + + isEditable: false, + + containersAllocated: counterOrNA('containersAllocated'), + + containersPending: counterOrNA('containersPending'), + + containersReserved: counterOrNA('containersReserved'), + + isRed: Em.computed.alias('someMetricsNA'), + + isOrange: false, + + isGreen: Em.computed.equal('someMetricsNA', false), + + /** + * @type {string} + */ + content: function () { + if (this.get('someMetricsNA')) { + return Em.I18n.t('services.service.summary.notAvailable'); + } + return this.get('containersAllocated') + "/" + this.get('containersPending') + "/" + this.get('containersReserved'); + }.property('containersAllocated', 'containersPending', 'containersReserved'), + + /** + * @type {boolean} + */ + someMetricsNA: function () { + return Em.isNone(this.get('containersAllocated')) || + Em.isNone(this.get('containersPending')) || + Em.isNone(this.get('containersReserved')); + }.property('containersAllocated', 'containersPending', 'containersReserved'), + + /** + * @type {string} + */ + hintInfo: function () { + var maxTmp = parseFloat(this.get('maxValue')); + return Em.I18n.t('dashboard.widgets.hintInfo.hint1').format(maxTmp); + }.property('maxValue') +}); -- To stop receiving notification emails like this one, please contact atk...@apache.org.