Fixed bug: select columns all checked in filters, autocomplete based on query_all...
authorLoic Baron <loic.baron@lip6.fr>
Tue, 15 Oct 2013 15:51:03 +0000 (17:51 +0200)
committerLoic Baron <loic.baron@lip6.fr>
Tue, 15 Oct 2013 15:51:03 +0000 (17:51 +0200)
plugins/hazelnut/static/js/hazelnut.js
plugins/query_editor/__init__.py
plugins/query_editor/static/js/query_editor.js
portal/sliceview.py

index 249d2b4..bdb2de7 100644 (file)
 
             /* Processing hidden_columns */
             $.each(this.options.hidden_columns, function(i, field) {
-                manifold.raise_event(self.options.query_all_uuid, FIELD_REMOVED, field);
-                //self.hide_column(field);
+                //manifold.raise_event(self.options.query_all_uuid, FIELD_REMOVED, field);
+                self.hide_column(field);
             });
         }, // initialize_table
 
index 0312ef1..2d73053 100644 (file)
@@ -5,6 +5,12 @@ from django.template.loader import render_to_string
 # XXX We need naming helpers in the python Plugin class also, used in template
 
 class QueryEditor(Plugin):
+    def __init__ (self, query, query_all = None, **settings):
+        Plugin.__init__ (self, **settings)
+        self.query=query
+        self.query_uuid = query.query_uuid
+        self.query_all = query_all
+        self.query_all_uuid = query_all.query_uuid if query_all else None
 
     def template_file(self):
         return "query_editor.html"
@@ -22,9 +28,6 @@ class QueryEditor(Plugin):
         }
         return reqs
 
-    def json_settings_list (self):
-        return ['plugin_uuid', 'domid', 'query_uuid']
-
     def export_json_settings (self):
         return True
 
@@ -82,4 +85,7 @@ class QueryEditor(Plugin):
                 'checked':       md_field['name'] in self.query.get_select()
             })
         #return { 'fields': fields, 'hidden_columns': hidden_columns }
+        #return { 'fields': fields , 'query_uuid': self.query_uuid, 'query_all_uuid': self.query_all_uuid }
         return { 'fields': fields }
+
+    def json_settings_list (self): return ['plugin_uuid', 'domid', 'query_uuid', 'query_all_uuid', ]
index 9858818..7338b69 100644 (file)
         init: function(options, element) {
             this._super(options, element);
             this.listen_query(options.query_uuid);
+            // this one is the complete list of resources
+            // and will be bound to callbacks like on_all_new_record
+            this.listen_query(options.query_all_uuid, 'all');
+
 
             this.elts('queryeditor-auto-filter').change(this.event_filter_added('='));
             this.elts('queryeditor-filter').change(this.event_filter_added('='));
             //console.log("Query_Editor: query_done!");
             //console.log(this.availableTags);
         },
-        on_new_record: function(record)
+        /* Autocomplete based on query_all to get all the fields, where query get only the fields selected  */
+        on_all_new_record: function(record)
         {
-            //console.log("Query_Editor: new_record!");
-            //console.log(record);
             availableTags = this.availableTags;           
             jQuery.each(record,function(key,value){
                 value = unfold.get_value(value);
index 9b96d4f..1ff92d3 100644 (file)
@@ -117,7 +117,8 @@ class SliceView (LoginRequiredAutoLogoutView):
        
         filter_query_editor = QueryEditor(
             page  = page,
-            query = query_resource_all,
+            query = sq_resource, 
+            query_all = query_resource_all,
             title = "Select Columns",
             domid = 'select-columns',
             )