From da6c7b1526cbbb63bddbffb2c279ff67a9c8370a Mon Sep 17 00:00:00 2001 From: Giuseppe Steduto Date: Wed, 25 Oct 2023 16:27:54 +0200 Subject: [PATCH] utils: return different message when deleting all the workflow runs Change the `delete_workflow` function so that when the deletion of a workflow includes all its runs, then this is mentioned in the `message` property returned. Closes #531. --- reana_workflow_controller/rest/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reana_workflow_controller/rest/utils.py b/reana_workflow_controller/rest/utils.py index 83820a23..82c50606 100644 --- a/reana_workflow_controller/rest/utils.py +++ b/reana_workflow_controller/rest/utils.py @@ -270,10 +270,16 @@ def delete_workflow(workflow, all_runs=False, workspace=False): _mark_workflow_as_deleted_in_db(workflow) remove_workflow_jobs_from_cache(workflow) + if all_runs: + message = "All workflows named {0} successfully deleted.".format( + workflow.name + ) + else: + message = "Workflow successfully deleted." return ( jsonify( { - "message": "Workflow successfully deleted", + "message": message, "workflow_id": workflow.id_, "workflow_name": get_workflow_name(workflow), "status": workflow.status.name,