瀏覽代碼

[search] Update gridlayout field list in a new dashboard

Romain Rigaux 11 年之前
父節點
當前提交
4db6a26
共有 2 個文件被更改,包括 8 次插入8 次删除
  1. 4 1
      apps/search/src/search/templates/admin_collections.mako
  2. 4 7
      apps/search/static/js/search.ko.js

+ 4 - 1
apps/search/src/search/templates/admin_collections.mako

@@ -32,6 +32,9 @@ ${ commonheader(_('Search'), "search", user, "29px") | n,unicode }
     <button type="button" class="btn importBtn" data-bind="visible: collections().length > 0 && !isLoading()">
       <i class="fa fa-plus-circle"></i> ${ _('Import Index') }
       </button>
+    <button type="button" class="btn importBtn" data-bind="visible: collections().length > 0 && !isLoading()">
+      <i class="fa fa-plus-circle"></i> ${ _('Create Index') }
+      </button>
     </div>
   <h4>${_('Dashboards')}</h4>
 </div>
@@ -41,7 +44,7 @@ ${ commonheader(_('Search'), "search", user, "29px") | n,unicode }
   <div class="card">
   <%actionbar:render>
     <%def name="search()">
-      <input type="text" placeholder="${_('Filter dashboards by name...')}" class="input-xlarge search-query" id="filterInput" data-bind="visible: collections().length > 0 && !isLoading()">
+      <input type="text" placeholder="${_('Filter dashboards...')}" class="input-xlarge search-query" id="filterInput" data-bind="visible: collections().length > 0 && !isLoading()">
     </%def>
 
     <%def name="creation()">

+ 4 - 7
apps/search/static/js/search.ko.js

@@ -519,36 +519,33 @@ var Collection = function (vm, collection) {
     var _fields = [];
     var _availableFields = self.template.fieldsAttributes();
 
-    console.log(_availableFields);
-
     $.each(_availableFields, function (index, field) {
       if (self.template.fieldsAttributesFilter() == "" || field.name().toLowerCase().indexOf(self.template.fieldsAttributesFilter().toLowerCase()) > -1){
         _fields.push(field);
       }
     });
-    console.log("fileds")
-    console.log(_fields);
+    
     self.template.filteredAttributeFields(_fields);
   });
 
   self.template.fieldsAttributesFilter("");
 
-
   self.updateFields = function() {
     $.post("/search/get_collection/", {
         name: self.name()
 	  }, function (data) {
 	    if (data.status == 0) {
-	      self.idField(data.collection.collection.idField);
+	      self.idField(data.collection.collection.idField);	      
 	      self.template.template(data.collection.collection.template.template);
 	      self.template.fieldsAttributes.removeAll();
 	      $.each(data.collection.collection.template.fieldsAttributes, function(index, field) {
 		    self.template.fieldsAttributes.push(ko.mapping.fromJS(field));
-		  });
+		  });	      
 	      self.fields.removeAll();
 	      $.each(data.collection.collection.fields, function(index, field) {
 	    	self.fields.push(ko.mapping.fromJS(field));
 	      });
+	      self.template.fieldsAttributesFilter.valueHasMutated();
 	    }
 	}).fail(function (xhr, textStatus, errorThrown) {});
   };