You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2012/10/25 10:17:54 UTC

[20/22] git commit: Quickview: don't run tabFilter

Quickview: don't run tabFilter

For compact detail view (quickview), don't execute tabFilter, as only
the first tab is rendered in all cases. This prevents excessive API
calls from being made, slowing performance.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/17a16165
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/17a16165
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/17a16165

Branch: refs/heads/marvin-parallel
Commit: 17a16165841f7fb4a6b5881cf168e862d8b07b09
Parents: e53ab0d
Author: Brian Federle <br...@citrix.com>
Authored: Wed Oct 24 12:35:33 2012 -0700
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Oct 25 13:47:31 2012 +0530

----------------------------------------------------------------------
 ui/scripts/ui/widgets/detailView.js |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/17a16165/ui/scripts/ui/widgets/detailView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js
index 2d2957d..3282968 100644
--- a/ui/scripts/ui/widgets/detailView.js
+++ b/ui/scripts/ui/widgets/detailView.js
@@ -1019,7 +1019,6 @@
     var context = options.context ? options.context : {};
     var updateContext = $detailView.data('view-args').updateContext;
     var compact = options.compact;
-    var tabTotal = 0;
 
     if (updateContext) {
       $.extend($detailView.data('view-args').context, updateContext({
@@ -1035,16 +1034,22 @@
       );
     }
 
-    if (tabFilter) {
+    if (tabFilter && !compact) {
       removedTabs = tabFilter({
         context: context
       });
+    } else if (compact) {
+      removedTabs = $.grep(
+        $.map(
+          tabs,
+          function(value, key) { return key; }
+        ), function(tab, index) { return index > 0; }
+      );
     }
 
     $.each(tabs, function(key, value) {
       // Don't render tab, if filtered out
       if ($.inArray(key, removedTabs) > -1) return true;
-      if (compact && tabTotal) return true;
 
       var propGroup = key;
       var prop = value;
@@ -1062,8 +1067,6 @@
       $tabContent.data('detail-view-tab-id', key);
       $tabContent.data('detail-view-tab-data', value);
 
-      tabTotal++;
-
       return true;
     });