This is an automated email from the ASF dual-hosted git repository.

tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new ab3030b602d KIE Sandbox: Allow choosing between `lenient` and `strict` 
error modes on DMN Runner (#3250)
ab3030b602d is described below

commit ab3030b602d74d2f30227cba5c2c88aaccf2d2a8
Author: Aswathi <[email protected]>
AuthorDate: Wed Aug 20 23:39:12 2025 +0530

    KIE Sandbox: Allow choosing between `lenient` and `strict` error modes on 
DMN Runner (#3250)
---
 packages/extended-services-api/src/payload.ts      |  1 +
 .../src/dmnRunner/DmnRunnerContext.tsx             |  2 ++
 .../src/dmnRunner/DmnRunnerContextProvider.tsx     | 14 ++++++++++++-
 .../ExtendedServices/ExtendedServicesButtons.tsx   | 23 ++++++++++++++++++++--
 4 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/packages/extended-services-api/src/payload.ts 
b/packages/extended-services-api/src/payload.ts
index b93550e1279..dbe72f06aca 100644
--- a/packages/extended-services-api/src/payload.ts
+++ b/packages/extended-services-api/src/payload.ts
@@ -26,4 +26,5 @@ export interface ExtendedServicesModelPayload {
   mainURI: string;
   resources: ExtendedServicesModelResource[];
   context?: any;
+  isStrictMode?: boolean;
 }
diff --git a/packages/online-editor/src/dmnRunner/DmnRunnerContext.tsx 
b/packages/online-editor/src/dmnRunner/DmnRunnerContext.tsx
index 7812fb0ae62..ccd687783cd 100644
--- a/packages/online-editor/src/dmnRunner/DmnRunnerContext.tsx
+++ b/packages/online-editor/src/dmnRunner/DmnRunnerContext.tsx
@@ -41,6 +41,7 @@ export interface DmnRunnerContextType {
   results: Array<DecisionResult[] | undefined>;
   resultsDifference: Array<Array<object>>;
   status: DmnRunnerStatus;
+  isStrictMode: boolean;
 }
 
 export interface DmnRunnerCallbacksContextType {
@@ -51,6 +52,7 @@ export interface DmnRunnerCallbacksContextType {
   onRowDeleted: (args: { rowIndex: number }) => void;
   setDmnRunnerInputs: (newInputsRow: (previousInputs: Array<InputRow>) => 
Array<InputRow> | Array<InputRow>) => void;
   setDmnRunnerMode: (newMode: DmnRunnerMode) => void;
+  setIsStrictMode: (newMode: boolean) => void;
   setDmnRunnerConfigInputs: (
     newConfigInputs: (previousConfigInputs: UnitablesInputsConfigs) => 
UnitablesInputsConfigs | UnitablesInputsConfigs
   ) => void;
diff --git a/packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx 
b/packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx
index 4671b6c73fd..8a2776b6f0b 100644
--- a/packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx
+++ b/packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx
@@ -263,6 +263,7 @@ export function DmnRunnerContextProvider(props: 
PropsWithChildren<Props>) {
   const dmnRunnerAjv = useMemo(() => new DmnRunnerAjv().getAjv(), []);
   const [currentResponseMessages, setCurrentResponseMessages] = 
useState<DmnEvaluationMessages[]>([]);
   const [invalidElementPaths, setInvalidElementPaths] = 
useState<string[][]>([]);
+  const [isStrictMode, setIsStrictMode] = useState(false);
 
   const { envelopeServer } = useEditorDockContext();
 
@@ -330,9 +331,16 @@ export function DmnRunnerContextProvider(props: 
PropsWithChildren<Props>) {
             URI: normalizedPosixPathRelativeToTheWorkspaceRoot,
           })
         ),
+        isStrictMode: isStrictMode,
       };
     },
-    [props.dmnLanguageService, props.workspaceFile.relativePath, 
props.workspaceFile.workspaceId, workspaces]
+    [
+      isStrictMode,
+      props.dmnLanguageService,
+      props.workspaceFile.relativePath,
+      props.workspaceFile.workspaceId,
+      workspaces,
+    ]
   );
 
   const findDecisionIdBySourceId = useCallback(
@@ -842,6 +850,7 @@ export function DmnRunnerContextProvider(props: 
PropsWithChildren<Props>) {
       setDmnRunnerInputs,
       setDmnRunnerMode,
       setDmnRunnerPersistenceJson,
+      setIsStrictMode,
     }),
     [
       onRowAdded,
@@ -852,6 +861,7 @@ export function DmnRunnerContextProvider(props: 
PropsWithChildren<Props>) {
       setDmnRunnerInputs,
       setDmnRunnerMode,
       setDmnRunnerPersistenceJson,
+      setIsStrictMode,
     ]
   );
 
@@ -870,6 +880,7 @@ export function DmnRunnerContextProvider(props: 
PropsWithChildren<Props>) {
       results,
       resultsDifference,
       status,
+      isStrictMode,
     }),
     [
       canBeVisualized,
@@ -885,6 +896,7 @@ export function DmnRunnerContextProvider(props: 
PropsWithChildren<Props>) {
       results,
       resultsDifference,
       status,
+      isStrictMode,
     ]
   );
 
diff --git 
a/packages/online-editor/src/editor/ExtendedServices/ExtendedServicesButtons.tsx
 
b/packages/online-editor/src/editor/ExtendedServices/ExtendedServicesButtons.tsx
index 2903a90fa63..a5592fc9547 100644
--- 
a/packages/online-editor/src/editor/ExtendedServices/ExtendedServicesButtons.tsx
+++ 
b/packages/online-editor/src/editor/ExtendedServices/ExtendedServicesButtons.tsx
@@ -45,6 +45,7 @@ import { DeleteDropdownWithConfirmation } from 
"../DeleteDropdownWithConfirmatio
 import { useDmnRunnerPersistenceDispatch } from 
"../../dmnRunnerPersistence/DmnRunnerPersistenceDispatchContext";
 import { DmnRunnerProviderActionType } from "../../dmnRunner/DmnRunnerTypes";
 import { PanelId, useEditorDockContext } from 
"../EditorPageDockContextProvider";
+import { Switch } from "@patternfly/react-core/dist/js/components/Switch";
 
 interface Props {
   workspace: ActiveWorkspace | undefined;
@@ -56,8 +57,8 @@ export function ExtendedServicesButtons(props: Props) {
   const extendedServices = useExtendedServices();
   const devDeployments = useDevDeployments();
   const { onTogglePanel, onOpenPanel } = useEditorDockContext();
-  const { isExpanded, mode } = useDmnRunnerState();
-  const { setDmnRunnerMode, setDmnRunnerContextProviderState } = 
useDmnRunnerDispatch();
+  const { isExpanded, mode, isStrictMode } = useDmnRunnerState();
+  const { setDmnRunnerMode, setDmnRunnerContextProviderState, setIsStrictMode 
} = useDmnRunnerDispatch();
   const devDeploymentsDropdownItems = 
useDevDeploymentsDeployDropdownItems(props.workspace);
   const { onDeleteDmnRunnerPersistenceJson, 
onDownloadDmnRunnerPersistenceJson, onUploadDmnRunnerPersistenceJson } =
     useDmnRunnerPersistenceDispatch();
@@ -185,6 +186,24 @@ export function ExtendedServicesButtons(props: Props) {
                 >
                   As Table
                 </DropdownItem>,
+                <React.Fragment key={"dmn-runner-mode"}>
+                  <Divider />
+                  <DropdownItem key={"strict-mode"} component={"button"} 
className={"strict-mode-check"}>
+                    <div onClick={(e) => e.stopPropagation()}>
+                      <Switch
+                        id="validation-mode"
+                        label={"Strict"}
+                        isChecked={isStrictMode}
+                        isDisabled={false}
+                        onChange={(e, val) => {
+                          if (extendedServices.status === 
ExtendedServicesStatus.RUNNING) {
+                            setIsStrictMode(val);
+                          }
+                        }}
+                      />
+                    </div>
+                  </DropdownItem>
+                </React.Fragment>,
                 <React.Fragment key={"dmn-runner-inputs"}>
                   <Divider />
                   <DropdownItem


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to