From 0f3d0c5977ab2ddb4e4a8844fee9e9647ba2da64 Mon Sep 17 00:00:00 2001 From: Thomas Druez Date: Mon, 7 Nov 2022 10:21:25 +0400 Subject: [PATCH] Include current_step in API, add changelog entry #300 Signed-off-by: Thomas Druez --- CHANGELOG.rst | 4 ++++ scanpipe/api/serializers.py | 1 + scanpipe/tests/test_views.py | 2 ++ 3 files changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1fdcaa859..6e972205a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,10 @@ v31.1.0 (unreleased) - Generate CycloneDX SBOM (Software Bill of Materials) as a new downloadable output. https://github.com/nexB/scancode.io/issues/389 +- Display the current active step of a running pipeline in the "Pipeline" section of + the project details view, inside the run status tag. + https://github.com/nexB/scancode.io/issues/300 + - Refine the fields ordering in API Serializers based on the toolkit order. https://github.com/nexB/scancode.io/issues/546 diff --git a/scanpipe/api/serializers.py b/scanpipe/api/serializers.py index d4117348b..c448ccc65 100644 --- a/scanpipe/api/serializers.py +++ b/scanpipe/api/serializers.py @@ -75,6 +75,7 @@ class Meta: "url", "pipeline_name", "status", + "current_step", "description", "project", "uuid", diff --git a/scanpipe/tests/test_views.py b/scanpipe/tests/test_views.py index 922108e31..b717d7f0c 100644 --- a/scanpipe/tests/test_views.py +++ b/scanpipe/tests/test_views.py @@ -390,6 +390,7 @@ def test_scanpipe_views_run_status_view(self): self.assertContains(response, expected) self.assertContains(response, f'hx-get="{url}?current_status={run.status}"') + run.current_step = "1/2 Step A" run.set_task_started(run.pk) run.refresh_from_db() response = self.client.get(url) @@ -404,6 +405,7 @@ def test_scanpipe_views_run_status_view(self): f'hx-get="{url}?current_status={run.status}&display_current_step=True"' ) self.assertContains(response, expected) + self.assertContains(response, '1/2 Step A') run.set_task_ended(exitcode=1) response = self.client.get(url)