diff --git a/seqauto/grids/sequencing_data_grids.py b/seqauto/grids/sequencing_data_grids.py index 5e216b502..02ecf063d 100644 --- a/seqauto/grids/sequencing_data_grids.py +++ b/seqauto/grids/sequencing_data_grids.py @@ -7,7 +7,7 @@ from library.jqgrid.jqgrid_user_row_config import JqGridUserRowConfig from seqauto.models import SequencingRun, BamFile, UnalignedReads, VCFFile, QC, Experiment, EnrichmentKit from snpdb.models import UserGridConfig, DataState -from snpdb.views.datatable_view import DatatableConfig, RichColumn +from snpdb.views.datatable_view import DatatableConfig, RichColumn, SortOrder class ExperimentColumns(DatatableConfig[Experiment]): @@ -184,18 +184,24 @@ def __init__(self, user, **kwargs): 'sortorder': 'desc'}) -class EnrichmentKitListGrid(JqGridUserRowConfig): - model = EnrichmentKit - caption = 'EnrichmentKit' - fields = ["id", "name", "version", "enrichment_kit_type", "obsolete"] - colmodel_overrides = {'id': {'width': 20, 'formatter': 'viewEnrichmentKit'}} +# class EnrichmentKitListGrid(JqGridUserRowConfig): +class EnrichmentKitColumns(DatatableConfig[EnrichmentKit]): + def __init__(self, request, **kwargs): + super().__init__(request) + self.user = request.user - # manufacturer__name causes join cast error? - # ProgrammingError: operator does not exist: text = integer - # LINE 1: ...urer" ON ("snpdb_enrichmentkit"."manufacturer_id" = "snpdb_m... - def __init__(self, user, **kwargs): - super().__init__(user) - queryset = self.model.objects.all() - self.queryset = queryset.values(*self.get_field_names()) - self.extra_config.update({'sortname': 'id', - 'sortorder': 'desc'}) + self.rich_columns = [ + RichColumn(key="id", orderable=True, default_sort=SortOrder.DESC), + RichColumn(key="name", label="Name", orderable=True, + renderer=self.view_primary_key, + client_renderer='TableFormat.linkUrl'), + RichColumn(key="version", label="Version", orderable=True), + RichColumn(key="enrichment_kit_type", + label="Enrichment Kit Type", orderable=True), + RichColumn(key="obsolete", + label="Obsolete", orderable=True) + ] + + def get_initial_queryset(self) -> QuerySet[EnrichmentKit]: + queryset = EnrichmentKit.objects.all() + return queryset # not sure if this is the most appropriate translation diff --git a/seqauto/templates/seqauto/enrichment_kits_list.html b/seqauto/templates/seqauto/enrichment_kits_list.html index e6f000b2f..0e1b6a041 100644 --- a/seqauto/templates/seqauto/enrichment_kits_list.html +++ b/seqauto/templates/seqauto/enrichment_kits_list.html @@ -8,10 +8,7 @@

Enrichment Kits

- {% load jqgrid_tags %} + -
- {% jqgrid 'enrichment_kit_list_grid' 'EnrichmentKits' False None 'seqauto/grids/enrichment_kits_list_grid.html' delete=False %} -
{% endblock %} diff --git a/seqauto/urls.py b/seqauto/urls.py index 1c08a07eb..b4739081f 100644 --- a/seqauto/urls.py +++ b/seqauto/urls.py @@ -8,7 +8,7 @@ GoldCoverageSummaryGrid, SequencingSamplesGrid, SequencingSamplesHistoricalGrid from seqauto.grids.sequencing_data_grids import SequencingRunListGrid, \ UnalignedReadsListGrid, BamFileListGrid, VCFFileListGrid, QCFileListGrid, \ - EnrichmentKitListGrid, ExperimentColumns + EnrichmentKitColumns, ExperimentColumns from seqauto.grids.sequencing_software_versions_grids import LibraryGrid, SequencerGrid, \ AssayGrid, AlignerGrid, VariantCallerGrid, VariantCallingPipelineGrid from seqauto.views import SequencerUpdate, LibraryUpdate, AssayUpdate, VariantCallerUpdate, \ @@ -72,7 +72,7 @@ perm_path('bam_file/grid//', JQGridView.as_view(grid=BamFileListGrid), name='bam_file_grid'), perm_path('vcf_file/grid//', JQGridView.as_view(grid=VCFFileListGrid), name='vcf_file_grid'), perm_path('qc/grid//', JQGridView.as_view(grid=QCFileListGrid), name='qc_grid'), - perm_path('enrichment_kit/grid//', JQGridView.as_view(grid=EnrichmentKitListGrid), name='enrichment_kit_list_grid'), + perm_path('enrichment_kit/grid/', DatabaseTableView.as_view(column_class=EnrichmentKitColumns), name='enrichment_kit_datatable'), perm_path('enrichment_kit/gene/grid/////', JQGridView.as_view(grid=EnrichmentKitGeneCoverageGrid), name='enrichment_kit_gene_coverage_grid'), perm_path('gold_coverage_summary/grid///', JQGridView.as_view(grid=GoldCoverageSummaryGrid), name='gold_coverage_summary_grid'), perm_path('sequencing_stats/sequencing_samples/grid//', JQGridView.as_view(grid=SequencingSamplesGrid, csv_download=True), name='sequencing_samples_grid'),