diff --git a/CHANGELOG.rst b/CHANGELOG.rst index dd2595d0..4f70f87b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -66,6 +66,9 @@ Release notes Existing Keywords are suggested for consistency but any values is now allowed. https://github.com/nexB/dejacode/issues/48 +- Display Product inventory count on the Product list view. + https://github.com/nexB/dejacode/issues/81 + ### Version 5.0.1 - Improve the stability of the "Check for new Package versions" feature. diff --git a/component_catalog/filters.py b/component_catalog/filters.py index f8eb067c..353df10b 100644 --- a/component_catalog/filters.py +++ b/component_catalog/filters.py @@ -71,7 +71,7 @@ class ComponentFilterSet(DataspacedFilterSet): label=_("License"), field_name="licenses__key", to_field_name="key", - queryset=License.objects.all().only("key", "short_name", "dataspace"), + queryset=License.objects.only("key", "short_name", "dataspace__id"), widget=BootstrapSelectMultipleWidget( search_placeholder="Search licenses", ), @@ -80,7 +80,7 @@ class ComponentFilterSet(DataspacedFilterSet): label=_("Keyword"), to_field_name="label", lookup_expr="contains", - queryset=ComponentKeyword.objects.all().only("label", "dataspace"), + queryset=ComponentKeyword.objects.only("label", "dataspace__id"), widget=BootstrapSelectMultipleWidget( search_placeholder="Search keywords", ), @@ -183,7 +183,7 @@ class PackageFilterSet(DataspacedFilterSet): label=_("License"), field_name="licenses__key", to_field_name="key", - queryset=License.objects.all().only("key", "short_name", "dataspace"), + queryset=License.objects.only("key", "short_name", "dataspace__id"), widget=BootstrapSelectMultipleWidget( search_placeholder="Search licenses", ), diff --git a/dejacode/static/css/dejacode_bootstrap.css b/dejacode/static/css/dejacode_bootstrap.css index bb9096ae..41a9197b 100644 --- a/dejacode/static/css/dejacode_bootstrap.css +++ b/dejacode/static/css/dejacode_bootstrap.css @@ -248,6 +248,10 @@ dd.reduced pre { z-index: 1; font-size: 0.875rem; } +th.column-grouping { + width: 36px; + max-width: 36px; +} th.column-selection { width: 27px; max-width: 27px; @@ -336,6 +340,9 @@ table.products-table .column-license_expression { table.products-table .column-owner { min-width: 75px; } +table.products-table .column-productinventoryitem_count { + max-width:80px; +} /* -- Package List -- */ table.packages-table .column-usage_policy { diff --git a/license_library/filters.py b/license_library/filters.py index 0fe8ebd7..144a61f5 100644 --- a/license_library/filters.py +++ b/license_library/filters.py @@ -71,7 +71,7 @@ class LicenseFilterSet(DataspacedFilterSet): label=_("Category"), field_name="category__label", to_field_name="label", - queryset=LicenseCategory.objects.all(), + queryset=LicenseCategory.objects.only("label", "dataspace__id"), widget=BootstrapSelectMultipleWidget( search_placeholder="Search categories", ), @@ -80,7 +80,7 @@ class LicenseFilterSet(DataspacedFilterSet): label=_("License profile"), field_name="license_profile__name", to_field_name="name", - queryset=LicenseProfile.objects.all(), + queryset=LicenseProfile.objects.only("name", "dataspace__id"), widget=BootstrapSelectMultipleWidget( search_placeholder="Search license profiles", ), diff --git a/product_portfolio/filters.py b/product_portfolio/filters.py index 0aa88c1e..3afd43d8 100644 --- a/product_portfolio/filters.py +++ b/product_portfolio/filters.py @@ -56,6 +56,7 @@ class ProductFilterSet(DataspacedFilterSet): "primary_language", "owner", "configuration_status", + "productinventoryitem_count", ], field_labels={ "primary_language": "Language", @@ -67,7 +68,7 @@ class ProductFilterSet(DataspacedFilterSet): label=_("Configuration status"), field_name="configuration_status__label", to_field_name="label", - queryset=ProductStatus.objects.all(), + queryset=ProductStatus.objects.only("label", "dataspace__id"), widget=BootstrapSelectMultipleWidget( search=False, search_placeholder="Search configuration status", @@ -84,7 +85,7 @@ class ProductFilterSet(DataspacedFilterSet): label=_("License"), field_name="licenses__key", to_field_name="key", - queryset=License.objects.all(), + queryset=License.objects.only("key", "short_name", "dataspace__id"), widget=BootstrapSelectMultipleWidget( search_placeholder="Search licenses", ), @@ -93,7 +94,7 @@ class ProductFilterSet(DataspacedFilterSet): label=_("Keyword"), to_field_name="label", lookup_expr="contains", - queryset=ComponentKeyword.objects.all().only("label", "dataspace"), + queryset=ComponentKeyword.objects.only("label", "dataspace__id"), widget=BootstrapSelectMultipleWidget( search_placeholder="Search keywords", ), diff --git a/product_portfolio/templates/product_portfolio/includes/product_list_table.html b/product_portfolio/templates/product_portfolio/includes/product_list_table.html index 0c3c7db4..cf1778b7 100644 --- a/product_portfolio/templates/product_portfolio/includes/product_list_table.html +++ b/product_portfolio/templates/product_portfolio/includes/product_list_table.html @@ -46,6 +46,13 @@ {% endif %}