Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
authorLoic Baron <loic.baron@lip6.fr>
Wed, 26 Feb 2014 18:34:15 +0000 (19:34 +0100)
committerLoic Baron <loic.baron@lip6.fr>
Wed, 26 Feb 2014 18:34:15 +0000 (19:34 +0100)
Conflicts:
rest/__init__.py

portal/templates/institution.html
portal/templates/onelab/onelab_home-view.html
rest/__init__.py

index 32a0e91..6026b71 100644 (file)
         </div>
     </div>
     <div class="home-panel" id="users" style="display:none;">
-        <br>
-        <h1>Users: onelab.upmc</h1>
-        <table>
-            <tr>
-                <th>+/-</th>
-                <th>email</th>
-                <th>user_hrn</th>
-                <th>number of slices</th>
-                <th>role</th>
-                <th>status</th>
-            </tr>
-            <tr>
-                <td><input type="checkbox"></td>
-                <td><a href="/portal/user/loic.baron@lip6.fr">loic.baron@lip6.fr</a></td>
-                <td>onelab.upmc.loic_baron</td>
-                <td>3</td>
-                <td>user</td>
-                <td>enabled</td>
-            </tr>
-            <tr>
-                <td><input type="checkbox"></td>
-                <td><a href="/portal/user/loic.baron@lip6.fr">loic.baron@lip6.fr</a></td>
-                <td>onelab.upmc.loic_baron</td>
-                <td>3</td>
-                <td>pi</td>
-                <td>enabled</td>
-            </tr>
-        </table>
+               <br>
+        <h1>Users: onelab.upmc</button></h1>
+        <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
+        <div id="user-tab-loaded" style="display:none;">
+            <table id="user-tab">
+                <tr>
+                    <th>+/-</th>
+                    <th>Email</th>
+                    <th>user_hrn</th>
+                    <th>First name</th>
+                    <th>Last name</th>
+                    <th>Enabled</th>
+                </tr>
+            </table>
+        </div>
         <div>
             <button id="deleteusers" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Users</button>
         </div>
-    </div>
+       </div>
     <div class="home-panel" id="slices" style="display:none;">
         <br>
         <h1>Slices: onelab.upmc <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create a Slice</button></h1>
             $("div#slice-tab-loaded").css("display","block");
             $("div#slice-tab-loading").css("display","none");
          });
+         {% endif %}
+               {% if person %}
+        $.getJSON("/rest/user/", function( data ) {
+            var list_users = [];
+            var table_users = [];
+                       /*
+                       "enabled", "keys", "parent_authority", "user_first_name", "user_last_name", "user_phone", "user_hrn", "slice", "user_email"
+                       */
+            $.each( data, function( key, val ) {
+                list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
+                /*if(val.nodes=="undefined" || val.nodes==null){
+                    nodes_length=0;
+                }else{
+                    nodes_length=val.nodes.length;
+                }
+
+                if(val.user=="undefined" || val.user==null){
+                    user_length=0;
+                }else{
+                    user_length=val.user.length;
+                }
+
+                if(val.slice_url=="undefined" || val.slice_url==null){
+                    slice_url="";
+                }else{
+                    slice_url="<a href='"+val.slice_url+"' target='_blank'>"+val.slice_url+"</a>";
+                }*/
+                
+                user_row = "<tr>";
+                user_row += "<td><input type='checkbox'></td>";
+                user_row += "<td>"+val.user_email+"</td>";
+                user_row += "<td>"+val.user_hrn+"</td>";
+                user_row += "<td>"+val.user_first_name+"</td>";
+                user_row += "<td>"+val.user_last_name+"</td>";
+                               user_row += "<td>"+val.enabled+"</td>";
+                table_users.push(user_row);
+                
+            });
+           
+            /* $("div#slice-list").html($( "<ul/>", { html: list_slices.join( "" ) })); */
+            $("table#user-tab tr:last").after(table_users.join( "" ));
+            $("div#user-tab-loaded").css("display","block");
+            $("div#user-tab-loading").css("display","none");
+         });
          {% endif %}
     });
 </script>
index b81d960..2855aee 100644 (file)
                });
                
                {% if person %}
-               $.getJSON("/rest/user/", function( data ) {
+        $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
                  var items = [];
                  $.each( data[0].slice, function( key, val ) {
                        items.push( "<li><a href=\"portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
index 0110d34..3f25d77 100644 (file)
@@ -13,7 +13,6 @@ from string import join
 import decimal
 import datetime
 import json
-import urlparse
 
 # handles serialization of datetime in json
 DateEncoder = lambda obj: obj.strftime("%B %d, %Y %H:%M:%S") if isinstance(obj, datetime.datetime) else None
@@ -37,15 +36,20 @@ def dispatch(request, object_type, object_name):
          'platform' : platform,
          'slice' : slice,
          'resource' : resource,
-         'user' : user
+         'user' : user,
     }
     
     if request.method == 'POST':
-        for el in request.POST.items():
-            if el[0].startswith('filters'):
-                object_filters[el[0][8:-1]] = el[1]
-            elif el[0].startswith('columns'):
-                object_properties = request.POST.getlist('columns[]')
+        req_items = request.POST.items()
+    elif request.method == 'GET':
+        req_items = request.GET.items()
+        
+    for el in req_items:
+        if el[0].startswith('filters'):
+            object_filters[el[0][8:-1]] = el[1]
+        elif el[0].startswith('columns'):
+            object_properties = request.POST.getlist('columns[]')
+        
     
     # platform is local
     if ((object_type == 'platform') or (object_type == 'testbed')) :
@@ -108,7 +112,6 @@ def send(request, response, object_properties):
         response_data = {}
         response_data['columns'] = object_properties
         response_data['labels'] = object_properties
-        #response_data['labels'] = [ 'Platform', 'Name', 'Url', 'Description','Gateway Type' ]
         response_data['data'] = []
         response_data['total'] = len(response)
         for r in response :