瀏覽代碼

[search] Protect against dashboard with no analytics dimension

Romain Rigaux 10 年之前
父節點
當前提交
c4ca4b781e
共有 1 個文件被更改,包括 10 次插入9 次删除
  1. 10 9
      apps/search/src/search/static/search/js/search.ko.js

+ 10 - 9
apps/search/src/search/static/search/js/search.ko.js

@@ -527,15 +527,6 @@ var Collection = function (vm, collection) {
 
   self.facets = ko.mapping.fromJS(collection.facets);
   $.each(self.facets(), function (index, facet) {
-
-    if (typeof facet.properties.facets != 'undefined') {
-      $.each(facet.properties.facets(), function (pivotIndex, pivotFacet) {
-        pivotFacet.aggregate.subscribe(function () {
-          vm.search();
-        });
-      });
-    }
-
     facet.properties.limit.subscribe(function () {
       vm.search();
     });
@@ -549,7 +540,17 @@ var Collection = function (vm, collection) {
         vm.search();
       });
     }
+    if (typeof facet.properties.facets != 'undefined') {
+      $.each(facet.properties.facets(), function (index, pivotFacet) {
+        if (pivotFacet.aggregate) {
+          pivotFacet.aggregate.subscribe(function () {
+            vm.search();
+          });
+        }
+      });
+    }
   });
+
   self.template.rows.subscribe(function() {
     vm.search();
   });