From: Brandon King Date: Tue, 30 Jun 2009 20:03:16 +0000 (+0000) Subject: Behold the power of ExtJS grids! Muhahaha! =o) X-Git-Tag: 0.2.6~25 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=a4edf9e7cd803cb4f5864074d76c24deb30a6ead Behold the power of ExtJS grids! Muhahaha! =o) --- diff --git a/htsworkflow/frontend/inventory/views.py b/htsworkflow/frontend/inventory/views.py index 8273717..3c72d20 100644 --- a/htsworkflow/frontend/inventory/views.py +++ b/htsworkflow/frontend/inventory/views.py @@ -29,8 +29,26 @@ def data_items(request): item_d = {} item_d['uuid'] = item.uuid item_d['barcode_id'] = item.barcode_id + item_d['model_id'] = item.item_info.model_id + item_d['part_number'] = item.item_info.part_number + item_d['lot_number'] = item.item_info.lot_number + item_d['vendor'] = item.item_info.vendor.name item_d['creation_date'] = item.creation_date.strftime('%Y-%m-%d %H:%M:%S') item_d['modified_date'] = item.modified_date.strftime('%Y-%m-%d %H:%M:%S') + item_d['location'] = item.location.name + + # Item status if exists + if item.status is None: + item_d['status'] = '' + else: + item_d['status'] = item.status.name + + # Stored flowcells on device + if item.longtermstorage_set.count() > 0: + item_d['flowcells'] = ','.join([ lts.flowcell.flowcell_id for lts in item.longtermstorage_set.all() ]) + else: + item_d['flowcells'] = '' + item_d['type'] = item.item_type.name rows.append(item_d) @@ -38,6 +56,7 @@ def data_items(request): return HttpResponse(encode_json(d), content_type="application/javascript") + def index(request): """ Inventory Index View diff --git a/htsworkflow/frontend/static/js/htsw-inventory.js b/htsworkflow/frontend/static/js/htsw-inventory.js index b275cf1..419a80f 100644 --- a/htsworkflow/frontend/static/js/htsw-inventory.js +++ b/htsworkflow/frontend/static/js/htsw-inventory.js @@ -4,8 +4,15 @@ var getInventoryDataGrid = function(){ var Item = Ext.data.Record.create([ { name: 'uuid' }, { name: 'barcode_id'}, + { name: 'model_id'}, + { name: 'part_number'}, + { name: 'lot_number'}, + { name: 'vendor'}, { name: 'creation_date'/*, type: 'date', dateFormat: 'n/j h:ia'*/}, { name: 'modified_date'/*, type: 'date', dateFormat: 'n/j h:ia'*/}, + { name: 'location'}, + { name: 'status'}, + { name: 'flowcells'}, { name: 'type'} ]); @@ -33,16 +40,23 @@ var getInventoryDataGrid = function(){ url: '/inventory/data/items/', storeId: 'item_group_store', groupField: 'type', - sortInfo: { field: 'modified_date', direction: "ASC"}, + sortInfo: { field: 'creation_date', direction: "DESC"}, autoLoad: true }), columns: [ {id: 'uuid', header:"UUID", width: 32, sortable: true, dataIndex: 'uuid'}, {header: 'Barcode ID', width: 20, sortable: true, dataIndex: 'barcode_id'}, + {header: 'Location', width: 20, sortable: true, dataIndex: 'location'}, + {header: 'Model', width: 20, sortable: true, dataIndex: 'model_id'}, + {header: 'Part #', width: 20, sortable: true, dataIndex: 'part_number', hidden: true}, + {header: 'Lot #', width: 20, sortable: true, dataIndex: 'lot_number', hidden: true}, + {header: 'Vendor', width: 20, sortable: true, dataIndex: 'vendor'}, {header: 'Creation Date', width: 20, sortable: true, dataIndex: 'creation_date'/*, renderer: Ext.util.Format.dateRenderer('Y/m/d')*/}, - {header: 'Modified Date', width: 20, sortable: true, dataIndex: 'modified_date'/*, renderer: Ext.util.Format.dateRenderer('Y/m/d')*/}, - {header: 'Type', width: 20, sortable: true, dataIndex: 'type'} + {header: 'Modified Date', width: 20, sortable: true, dataIndex: 'modified_date', hidden: true/*, renderer: Ext.util.Format.dateRenderer('Y/m/d')*/}, + {header: 'Status', width: 20, sortable: true, dataIndex: 'status', hidden: true}, + {header: 'Stored Flowcells', width: 20, sortable: true, dataIndex: 'flowcells'}, + {header: 'Type', width: 20, sortable: true, dataIndex: 'type', hidden: true} ], view: new Ext.grid.GroupingView({ @@ -56,7 +70,10 @@ var getInventoryDataGrid = function(){ autoHeight: true, collapsible: false, title: "Inventory Index", - iconCls: 'icon-grid' + iconCls: 'icon-grid', + id: 'inventory_item_panel', + stateId: 'inventory_item_panel_state', + stateful: true, //renderTo: 'grid_target' });