diff --git a/lib/galaxy/webapps/galaxy/api/jobs.py b/lib/galaxy/webapps/galaxy/api/jobs.py index 6c6f7757f9a7..6aebebe5ec3c 100644 --- a/lib/galaxy/webapps/galaxy/api/jobs.py +++ b/lib/galaxy/webapps/galaxy/api/jobs.py @@ -98,7 +98,7 @@ ) ViewQueryParam: JobIndexViewEnum = Query( - default="collection", + default=JobIndexViewEnum.collection, title="View", description="Determines columns to return. Defaults to 'collection'.", ) diff --git a/lib/galaxy/webapps/galaxy/services/jobs.py b/lib/galaxy/webapps/galaxy/services/jobs.py index 9ecfb718b963..5c39175567bf 100644 --- a/lib/galaxy/webapps/galaxy/services/jobs.py +++ b/lib/galaxy/webapps/galaxy/services/jobs.py @@ -86,7 +86,7 @@ def index( # TODO: optimize if this crucial if check_security_of_jobs and not security_check(trans, job.history, check_accessible=True): raise exceptions.ItemAccessibilityException("Cannot access the request job objects.") - job_dict = job.to_dict(view, system_details=is_admin) + job_dict = job.to_dict(view.value, system_details=is_admin) if view == JobIndexViewEnum.admin_job_list: job_dict["decoded_job_id"] = job.id if user_details: @@ -97,7 +97,7 @@ def index( def _check_nonadmin_access( self, - view: str, + view: JobIndexViewEnum, user_details: bool, decoded_user_id: Optional[DecodedDatabaseIdField], trans_user_id: Optional[int], diff --git a/lib/galaxy_test/api/test_jobs.py b/lib/galaxy_test/api/test_jobs.py index 7c226de419b7..82f9ecbab416 100644 --- a/lib/galaxy_test/api/test_jobs.py +++ b/lib/galaxy_test/api/test_jobs.py @@ -62,6 +62,24 @@ def test_admin_job_list(self, history_id): job = jobs[0] self._assert_has_keys(job, "command_line", "external_id", "handler") + @pytest.mark.require_new_history + def test_job_list_collection_view(self, history_id): + self.__history_with_new_dataset(history_id) + jobs_response = self._get("jobs?view=collection") + self._assert_status_code_is_ok(jobs_response) + jobs = jobs_response.json() + job = jobs[0] + self._assert_has_keys(job, "id", "tool_id", "state") + + @pytest.mark.require_new_history + def test_job_list_default_view(self, history_id): + self.__history_with_new_dataset(history_id) + jobs_response = self._get(f"jobs?history_id={history_id}") + self._assert_status_code_is_ok(jobs_response) + jobs = jobs_response.json() + job = jobs[0] + self._assert_has_keys(job, "id", "tool_id", "state") + @pytest.mark.require_new_history def test_index_state_filter(self, history_id): # Initial number of ok jobs