slice browsing now displaying users, users can be added to slice (missing handling...
authorJordan Augé <jordan.auge@lip6.fr>
Fri, 23 Aug 2013 14:20:11 +0000 (16:20 +0200)
committerJordan Augé <jordan.auge@lip6.fr>
Fri, 23 Aug 2013 14:20:11 +0000 (16:20 +0200)
plugin.hazelnut: removed resource specific code

plugins/hazelnut/static/js/hazelnut.js
trash/sliceview.py

index af2dcfa..ca63e1e 100644 (file)
@@ -7,7 +7,6 @@
 (function($){
 
     // TEMP
-    var ELEMENT_KEY = 'resource_hrn';
     var debug=false;
     debug=true
 
  // UNUSED ? //         
  // UNUSED ? //         }, // update_plugin
 
-        checkbox: function (plugin_uuid, header, field) //, selected_str, disabled_str)
+        checkbox: function (key, value)
         {
             var result="";
-            if (header === null)
-                header = '';
             // Prefix id with plugin_uuid
             result += "<input";
             result += " class='hazelnut-checkbox'";
-            result += " id='" + this.id('checkbox', this.id_from_key(this.key, unfold.get_value(header))) + "'";
-             //hazelnut-checkbox-" + plugin_uuid + "-" + unfold.get_value(header).replace(/\\/g, '')  + "'";
-            result += " name='" + unfold.get_value(field) + "'";
+            result += " id='" + this.id('checkbox', this.id_from_key(key, value)) + "'";
+            result += " name='" + key + "'";
             result += " type='checkbox'";
-            //result += selected_str;
-            //result += disabled_str;
             result += " autocomplete='off'";
-            result += " value='" + unfold.get_value(header) + "'";
+            result += " value='" + value + "'";
             result += "></input>";
             return result;
         }, // checkbox
             if (this.options.checkboxes)
                 // Use a key instead of hostname (hard coded...)
                 // XXX remove the empty checked attribute
-                line.push(this.checkbox(this.options.plugin_uuid, record[ELEMENT_KEY], record['type']));
+                line.push(this.checkbox(this.key, record[this.key]));
     
             // XXX Is adding an array of lines more efficient ?
             this.table.fnAddData(line);
index a966100..9f1663e 100644 (file)
@@ -58,6 +58,9 @@ def _slice_view (request, slicename):
     resource_md = metadata.details_by_object('resource')
     resource_fields = [column['name'] for column in resource_md['column']]
 
+    user_md = metadata.details_by_object('user')
+    user_fields = ['user_hrn'] # [column['name'] for column in user_md['column']]
+
     # TODO The query to run is embedded in the URL
     main_query = Query.get('slice').filter_by('slice_hrn', '=', slicename)
     main_query.select(
@@ -69,10 +72,12 @@ def _slice_view (request, slicename):
     )
 
     query_resource_all = Query.get('resource').select(resource_fields)
+    query_user_all = Query.get('user').select(user_fields)
 
     aq = AnalyzedQuery(main_query, metadata=metadata)
     page.enqueue_query(main_query, analyzed_query=aq)
     page.enqueue_query(query_resource_all)
+    page.enqueue_query(query_user_all)
 
     # Prepare the display according to all metadata
     # (some parts will be pending, others can be triggered by users).
@@ -203,6 +208,7 @@ def _slice_view (request, slicename):
         togglable   = False,
         # this is the query at the core of the slice list
         query       = sq_user,
+        query_all  = query_user_all,
         checkboxes  = True,
         datatables_options = { 
             # for now we turn off sorting on the checkboxes columns this way