You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/09/21 13:29:28 UTC

[06/21] ambari git commit: AMBARI-18408 Configuration Groups popup: Tooltip over properties number has too much content (Vivek Ratnavel Subramanian via zhewang)

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/e54c31e8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e54c31e8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e54c31e8

Branch: refs/heads/branch-dev-patch-upgrade
Commit: e54c31e8900773dc46a80b2f18e111798709d536
Parents: 5d31b70
Author: Zhe (Joe) Wang <zh...@apache.org>
Authored: Mon Sep 19 14:41:54 2016 -0700
Committer: Zhe (Joe) Wang <zh...@apache.org>
Committed: Mon Sep 19 14:41:54 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/e54c31e8/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/e54c31e8/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>