+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
"""
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)
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:
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'],
app_context = {
'page_name': 'Library Index',
- 'east_region_config_div': 'changelist-filter',
'body': t.render(c)
}
app_context.update(SAMPLES_CONTEXT_DEFAULTS)
-{% 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
</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>
{% 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><40</td>
- <td><100</td>
- <td>100+</td>
- <td><40</td>
- <td><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><40</td>
+ <td><100</td>
+ <td>100+</td>
+ <td><40</td>
+ <td><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 %}