From 8d1d859fd5a4d80f58fee20b7c61beca1a5677b1 Mon Sep 17 00:00:00 2001 From: Stig Killendahl Date: Fri, 27 Dec 2024 16:17:52 +0100 Subject: [PATCH] Add cancel action --- .../src/TestSuite/AITTestSuite.Page.al | 13 ++++++++----- .../src/TestSuite/AITTestSuiteMgt.Codeunit.al | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Page.al b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Page.al index a8fc966f54..5096fadbbe 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Page.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuite.Page.al @@ -213,14 +213,14 @@ page 149031 "AIT Test Suite" } action(ResetStatus) { - Enabled = Rec.Status = Rec.Status::Running; - Caption = 'Reset Status'; - ToolTip = 'Reset the status.'; - Image = ResetStatus; + Visible = Rec.Status = Rec.Status::Running; + Caption = 'Cancel'; + ToolTip = 'Cancels the run and marks the run as Cancelled.'; + Image = Cancel; trigger OnAction() begin - AITTestSuiteMgt.ResetStatus(Rec); + AITTestSuiteMgt.CancelRun(Rec); end; } @@ -280,6 +280,9 @@ page 149031 "AIT Test Suite" { group(Category_Process) { + actionref(ResetStatus_Promoted; ResetStatus) + { + } actionref(Start_Promoted; Start) { } diff --git a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al index 5e080cd368..d25d95fdb9 100644 --- a/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al +++ b/src/Tools/AI Test Toolkit/src/TestSuite/AITTestSuiteMgt.Codeunit.al @@ -28,6 +28,7 @@ codeunit 149034 "AIT Test Suite Mgt." CannotRunMultipleSuitesInParallelErr: Label 'There is already a test run in progress. You need to wait for it to finish or cancel it before starting a new test run.'; FeatureNameLbl: Label 'AI Test Toolkit', Locked = true; LineNoFilterLbl: Label 'Codeunit %1 "%2" (Input: %3)', Locked = true; + ConfirmCancelQst: Label 'This action will mark the run as Cancelled. Are you sure you want to continue?'; procedure StartAITSuite(Iterations: Integer; var AITTestSuite: Record "AIT Test Suite") var @@ -208,16 +209,15 @@ codeunit 149034 "AIT Test Suite Mgt." Commit(); end; - internal procedure ResetStatus(var AITTestSuite: Record "AIT Test Suite") + internal procedure CancelRun(var AITTestSuite: Record "AIT Test Suite") var AITTestMethodLine: Record "AIT Test Method Line"; - ConfirmResetStatusQst: Label 'This action will mark the run as Completed. Are you sure you want to continue?'; begin - if not Confirm(ConfirmResetStatusQst) then + if not Confirm(ConfirmCancelQst) then exit; AITTestMethodLine.SetRange("Test Suite Code", AITTestSuite."Code"); - AITTestMethodLine.ModifyAll(Status, AITTestMethodLine.Status::Completed, true); + AITTestMethodLine.ModifyAll(Status, AITTestMethodLine.Status::Cancelled, true); AITTestSuite.Status := AITTestSuite.Status::Completed; AITTestSuite."No. of Tests Running" := 0; AITTestSuite."Ended at" := CurrentDateTime();