Repository: ambari Updated Branches: refs/heads/branch-2.5 979633414 -> 2d16e77a6
AMBARI-18408 Configuration Groups popup: Tooltip over properties number has too much content (Vivek Ratnavel Subramanian via zhewang) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2d16e77a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2d16e77a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2d16e77a Branch: refs/heads/branch-2.5 Commit: 2d16e77a6de33b9c4b012e122e7ecee9519f8381 Parents: 9796334 Author: Zhe (Joe) Wang <zhew...@apache.org> Authored: Mon Sep 19 14:41:54 2016 -0700 Committer: Zhe (Joe) Wang <zhew...@apache.org> Committed: Mon Sep 19 14:43:19 2016 -0700 ---------------------------------------------------------------------- .../service/manage_config_groups_controller.js | 36 ++++++++++++++++++++ .../manage_configuration_groups_popup.hbs | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2d16e77a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js index e6e21bc..ad44b9c 100644 --- a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js +++ b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js @@ -138,6 +138,42 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, { hostsModifiedConfigGroups: {}, /** + * Trim the tooltip text to show first 500 characters of properties list + * @type {string} + */ + tooltipText: function() { + var selectedConfigGroup = this.get('selectedConfigGroup'), + propertiesList = selectedConfigGroup.get('propertiesList'), + trimLength = 500, + trimmedText = "", + noOfRemainingProperties = 0, + index = 0, + propertyText = "", + addDots = false; + if(propertiesList.length > trimLength) { + // Adjust trim length based on occurrence of <br/> around trim length + index = propertiesList.substring(trimLength-10, trimLength+10).indexOf("<br/>"); + if(index > -1) { + trimLength = trimLength - 10 + index; + } else { + addDots = true; + } + trimmedText = propertiesList.substring(0, trimLength); + if(addDots) { + trimmedText += " ..."; + } + noOfRemainingProperties = (propertiesList.substring(trimLength).match(new RegExp("<br/>", "g")) || []).length - 1; + if(noOfRemainingProperties > 0) { + propertyText = (noOfRemainingProperties > 1) ? "properties" : "property"; + trimmedText += "<br/> and " + noOfRemainingProperties + " more " + propertyText; + } + } else { + trimmedText = propertiesList; + } + return trimmedText; + }.property('selectedConfigGroup.propertiesList'), + + /** * Check when some config group was changed and updates <code>hostsModifiedConfigGroups</code> once * @method hostsModifiedConfigGroupsObs */ http://git-wip-us.apache.org/repos/asf/ambari/blob/2d16e77a/ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs b/ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs index d0fd103..2c9dfa6 100644 --- a/ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs +++ b/ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs @@ -69,7 +69,7 @@ <div class="span2">{{t common.overrides}}</div> <div class="span10"> <a href="" class="properties-link" {{action showProperties target="controller"}} - {{bindAttr data-original-title="selectedConfigGroup.propertiesList" }}>{{selectedConfigGroup.properties.length}} {{t common.properties}}</a> + {{bindAttr data-original-title="tooltipText" }}>{{selectedConfigGroup.properties.length}} {{t common.properties}}</a> </div> </div> <div class="clearfix"></div>