Merge branch 'master' of mus.cacr.caltech.edu:htsworkflow
authorDiane Trout <diane@caltech.edu>
Sun, 7 Nov 2010 23:58:07 +0000 (15:58 -0800)
committerDiane Trout <diane@caltech.edu>
Sun, 7 Nov 2010 23:58:07 +0000 (15:58 -0800)
htsworkflow/frontend/inventory/views.py
htsworkflow/frontend/samples/views.py
htsworkflow/frontend/templates/inventory/inventory_index.html
htsworkflow/frontend/templates/inventory/inventory_summary.html
htsworkflow/frontend/templates/samples/library_index.html

index 7ff5b401f0e9dc6f19b0d6e2f1e968789700707e..dfb92a96ba8c41007b562f9cca750c6a8cd9a1b5 100644 (file)
@@ -1,3 +1,4 @@
+from htsworkflow.frontend.samples.changelist import ChangeList
 from htsworkflow.frontend.inventory.models import Item, LongTermStorage, ItemType
 from htsworkflow.frontend.inventory.bcmagic import item_search
 from htsworkflow.frontend.bcmagic.plugin import register_search_plugin
@@ -137,7 +138,16 @@ def index(request):
     """
     Inventory Index View
     """
+    # build changelist
+    item_changelist = ChangeList(request, Item,
+        list_filter=[],                 
+        search_fields=[],
+        list_per_page=200,
+        queryset=Item.objects.all()
+    )
+
     context_dict = {
+        'item_changelist': item_changelist,
         'page_name': 'Inventory Index'
     }
     context_dict.update(INVENTORY_CONTEXT_DEFAULTS)
index e63cf4d5748043668e3e195955758169e432ee38..afccc022586e1570b15117f0651351dbc63cfa8d 100644 (file)
@@ -62,7 +62,7 @@ def count_lanes(lane_set):
 
 def create_library_context(cl):
     """
-    Create a list of libraries that includes how many lanes were run
+     Create a list of libraries that includes how many lanes were run
     """
     records = []
     #for lib in library_items.object_list:
@@ -88,7 +88,7 @@ def create_library_context(cl):
     return {'library_list': records }
 
 def library(request):
-   # build changelist
+    # build changelist
     fcl = ChangeList(request, Library,
         list_filter=['affiliations', 'library_species'],
         search_fields=['id', 'library_name', 'amplified_from_sample__id'],
@@ -103,7 +103,6 @@ def library(request):
     
     app_context = {
         'page_name': 'Library Index',
-        'east_region_config_div': 'changelist-filter',
         'body': t.render(c)
     }
     app_context.update(SAMPLES_CONTEXT_DEFAULTS)
index 1a1e32b85594bd12da97b43bb62041a993fc0e1e..399dae1c6940ac4abf21bfad5fa7a2e749188f9e 100644 (file)
@@ -1,10 +1,69 @@
-{% extends "inventory/inventory_app.html" %}
-
-{% block additional_javascript %}
-<script type="text/javascript" src="/static/js/htsw-inventory.js"></script>
+{% extends "base_site.html" %}
+{% load adminmedia admin_list i18n %}
+{% block extrahead %}
+    <script type="text/javascript">
+      $(document).ready(function() {
+        $(window).resize(function() {
+           var window_height = $(window).height();
+           var position = $("#changelist table").position();
+           height = window_height - position.top;
+           $("#changelist table.filtered").height(height);
+           $("#changelist-filter").height(height);
+        });
+        $(window).resize();
+      });
+    </script>
 {% endblock %}
-
+{% block bodyclass %}change-list{% endblock %}
+{% block coltype %}flex{% endblock %}
 {% block content %}
-<div id="grid_target"></div>
+<div id="inventory-index-div" >
+  <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
+    {% block search %}{% search_form item_changelist %}{% endblock %}
+    {% block pagination %}{% pagination item_changelist %}{% endblock %}
+
+    {% block filters %}
+    {% if item_changelist.has_filters %}
+    <div id="changelist-filter">
+      <h2 >{% trans 'Filter' %}</h2>
+      {% for spec in item_changelist.filter_specs %}
+         {% admin_list_filter cl spec %}
+         {% endfor %}
+       </div>
+    {% endif %}
+    {% endblock %}
+  {% block summary_stats %}
+  <table class="{% if cl.has_filters %} filtered{% endif %}">
+    <thead >
+      <tr >
+        <td >UUID</td>
+        <td >Barcode ID</td>
+        <td >Location</td>
+        <td >Model</td>
+        <td >Vendor</td>
+        <td >Created</td>
+        <td >Contains</td>
+      </tr>
+    </thead>
+    <tbody >
+      {% for item in item_changelist.get_query_set %}
+      <tr >
+        <td >{{ item.uuid }}</td>
+        <td >{{ item.barcode_id}}</td>
+        <td >{{ item.location }}</td>
+        <td >{{ item.item_type }}</td>
+        <td ></td>      
+        <td >{{ item.creation_date }}</td>      
+        <td >
+          {% for content in item.longtermstorage_set.all %}
+          {{ content.flowcell }}
+          {% endfor %}
+        </td>
+      </tr>
+      {% endfor %}
+    </tbody>
+  </table>
+  {% endblock %}
+</div>
 {% endblock %}
-    
\ No newline at end of file
index d057ec9f1703fbd29fd3b52afc4dba01bd313086..3d462ddd4d58cc51ffce4f2e8769b84211e7923c 100644 (file)
         </p>
         <br />
         <center><div id="lts-grid"></div></center>
-        <script>
-                var lts_data = [
-                {% for lts in item.longtermstorage_set.all %}
-                        {% for lib in lts.libraries.iterator %}[ "{{ lts.flowcell.flowcell_id }}","{{ lib.id }}","{% for sd in lts.storage_devices.iterator %}{{ sd }}{% if forloop.last %}"{% else %}|{% endif %}{% endfor %}{% if forloop.parentloop.last %}{% if forloop.last %}]{% else %}],{% endif %}{% else %}],{% endif %}
-                        {% endfor %}
-                {% endfor %}
-                ];
-                
-                var lts_reader = new Ext.data.ArrayReader({}, [
-                        {name: 'flowcell'},
-                        {name: 'library'},
-                        {name: 'storage_devices'}
-                ]);
-                
-                var lts_grid = new Ext.grid.GridPanel({
-                        store: new Ext.data.GroupingStore({
-                                reader: lts_reader,
-                                data: lts_data,
-                                sortInfo: {'field': 'flowcell', 'direction': 'DESC'},
-                                groupField: 'flowcell'
-                        }),
-                        
-                        columns: [
-                                {id: 'flowcell', header: 'Flowcell', width: 30, sortable: true, dataIndex: 'flowcell', hidden: true},
-                                {header: 'Library', width: 30, sortable: true, dataIndex: 'library'},
-                                {header: 'Storage Devices', width: 60, sortable: true, dataIndex: 'storage_devices'}
-                        ],
-                        
-                        view: new Ext.grid.GroupingView({
-                                forceFit: true,
-                                groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
-                        }),
-                        
-                        frame: true,
-                        width: 700,
-                        autoHeight: true,
-                        collapisble: true,
-                        animCollapisble: true,
-                        stateful: true,
-                        stateId: 'inventory-item-lts-storage-grid',
-                        title: 'Long Term Storage Info',
-                        iconCls: 'icon-grid',
-                        renderTo: 'lts-grid'
-                })
-        </script>
         
 {% else %}
         <h3>Item with UUID of {{ uuid }} not found.</h3>
index af2f9edac8e515dd32132356fc9d62b940720213..1a53ac2a6f3aad48f77024ee1d18e6d0cceed69d 100644 (file)
@@ -16,7 +16,6 @@
 {% endblock %}
 {% block bodyclass %}change-list{% endblock %}
 {% block coltype %}flex{% endblock %}
-
 {% block content %}
 <div id="library-index-div" >
   <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
        </div>
     {% endif %}
     {% endblock %}
-{% block summary_stats %}
-<table class="{% if cl.has_filters %} filtered{% endif %}">
-  <thead >
-    <tr >
-      <td >Parent</td>
-      <td >Library ID</td>
-      <td >Species</td>
-      <td >Library Name</td>
-      <td colspan="3" >Single</td>
-      <td colspan="3" >Paired</td>
-      <td >HD</td>
-    </tr>
-    <tr >
-      <td colspan="4"></td>
-      <td>&lt;40</td>
-      <td>&lt;100</td>
-      <td>100+</td>
-      <td>&lt;40</td>
-      <td>&lt;100</td>
-      <td>100+</td>
-      <td></td>
-    </tr>
-  </thead>
-  <tbody >
-    {% for lib in library_list %}
-    <tr >
-      <td ><a href="/library/{{ lib.library_id }}">{{ lib.amplified_from }}</a></td>
-      <td ><a href="/library/{{ lib.library_id }}">{{ lib.library_id }}</a></td>
-      <td ><a href="/library/{{ lib.library_id }}">{{ lib.species_name }}</a></td>
-      <td ><a href="/library/{{ lib.library_id }}">{{ lib.library_name }}</a></td>
-      <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.0 }}</td>      
-      <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.1 }}</td>      
-      <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.2 }}</td>      
-      <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.0 }}</td>
-      <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.1 }}</td>      
-      <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.2 }}</td>      
-      {% if lib.is_archived %}
-        <td ><img src="/static/img/hdd_unmount.png" alt="Archived" /></td>
-      {% else %}
-        <td ></td>
-      {% endif %}
-    </tr>
-    {% endfor %}
-  </tbody>
-</table>
+  {% block summary_stats %}
+  <table class="{% if cl.has_filters %} filtered{% endif %}">
+    <thead >
+      <tr >
+        <td >Parent</td>
+        <td >Library ID</td>
+        <td >Species</td>
+        <td >Library Name</td>
+        <td colspan="3" >Single</td>
+        <td colspan="3" >Paired</td>
+        <td >HD</td>
+      </tr>
+      <tr >
+        <td colspan="4"></td>
+        <td>&lt;40</td>
+        <td>&lt;100</td>
+        <td>100+</td>
+        <td>&lt;40</td>
+        <td>&lt;100</td>
+        <td>100+</td>
+        <td></td>
+      </tr>
+    </thead>
+    <tbody >
+      {% for lib in library_list %}
+      <tr >
+        <td ><a href="/library/{{ lib.library_id }}">{{ lib.amplified_from }}</a></td>
+        <td ><a href="/library/{{ lib.library_id }}">{{ lib.library_id }}</a></td>
+        <td ><a href="/library/{{ lib.library_id }}">{{ lib.species_name }}</a></td>
+        <td ><a href="/library/{{ lib.library_id }}">{{ lib.library_name }}</a></td>
+        <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.0 }}</td>      
+        <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.1 }}</td>      
+        <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.2 }}</td>      
+        <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.0 }}</td>
+        <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.1 }}</td>      
+        <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.2 }}</td>      
+        {% if lib.is_archived %}
+          <td ><img src="/static/img/hdd_unmount.png" alt="Archived" /></td>
+        {% else %}
+          <td ></td>
+        {% endif %}
+      </tr>
+      {% endfor %}
+    </tbody>
+  </table>
+  {% endblock %}
 </div>
-
-{% endblock %}
 {% endblock %}