diff --git a/dejacode_toolkit/scancodeio.py b/dejacode_toolkit/scancodeio.py index 3fec6b5d..5ce28dac 100644 --- a/dejacode_toolkit/scancodeio.py +++ b/dejacode_toolkit/scancodeio.py @@ -224,40 +224,30 @@ def update_from_scan(self, package, user): return updated_fields - def fetch_project_packages(self, project_uuid): - """Return the list of packages for the provided `project_uuid`.""" - project_packages_url = self.get_scan_action_url(project_uuid, "packages") - packages = [] + def fetch_results(self, api_url): + results = [] - next_url = project_packages_url + next_url = api_url while next_url: - logger.debug(f"{self.label}: fetch packages from project_packages_url={next_url}") + logger.debug(f"{self.label}: fetch results from api_url={next_url}") response = self.request_get(url=next_url) if not response: - raise Exception("Error fetching project packages") + raise Exception("Error fetching results") - packages.extend(response["results"]) + results.extend(response["results"]) next_url = response["next"] - return packages + return results + + def fetch_project_packages(self, project_uuid): + """Return the list of packages for the provided `project_uuid`.""" + api_url = self.get_scan_action_url(project_uuid, "packages") + return self.fetch_results(api_url) - # TODO: Remove duplication with fetch_project_packages def fetch_project_dependencies(self, project_uuid): """Return the list of dependencies for the provided `project_uuid`.""" api_url = self.get_scan_action_url(project_uuid, "dependencies") - dependencies = [] - - next_url = api_url - while next_url: - logger.debug(f"{self.label}: fetch dependencies from project_packages_url={next_url}") - response = self.request_get(url=next_url) - if not response: - raise Exception("Error fetching project dependencies") - - dependencies.extend(response["results"]) - next_url = response["next"] - - return dependencies + return self.fetch_results(api_url) # (label, scan_field, model_field, input_type) SCAN_SUMMARY_FIELDS = [ diff --git a/product_portfolio/filters.py b/product_portfolio/filters.py index f6ec7db5..53ca9341 100644 --- a/product_portfolio/filters.py +++ b/product_portfolio/filters.py @@ -333,9 +333,6 @@ class DependencyFilterSet(DataspacedFilterSet): "resolved_to_package__version", ], ) - is_deployment_path = BooleanChoiceFilter( - widget=DropDownWidget(anchor="#codebase"), - ) class Meta: model = ProductDependency diff --git a/product_portfolio/templates/product_portfolio/tabs/tab_dependencies.html b/product_portfolio/templates/product_portfolio/tabs/tab_dependencies.html index 610629e2..ab6452a0 100644 --- a/product_portfolio/templates/product_portfolio/tabs/tab_dependencies.html +++ b/product_portfolio/templates/product_portfolio/tabs/tab_dependencies.html @@ -51,9 +51,11 @@ {% for dependency in filter_dependency.qs %}