You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "Kusuma04-dev (via GitHub)" <gi...@apache.org> on 2025/02/27 10:24:23 UTC

[PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Kusuma04-dev opened a new pull request, #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943

   closes https://github.com/apache/incubator-kie-issues/issues/315 DMN Runner table view should display validation messages
   Before fix:
    we are displaying messages from decisionresults which is in response because of this few error messages are not getting displayed.
   example: using round up function
   <img width="1202" alt="Screenshot 2025-02-27 at 3 52 32 PM" src="https://github.com/user-attachments/assets/2c48e347-2e7d-4c02-88c1-15b189581f14" />
   
   After fix:
   Now we are displaying the messages directly from response.
   Example:
   <img width="1185" alt="Screenshot 2025-02-27 at 3 54 06 PM" src="https://github.com/user-attachments/assets/31f9552a-5b44-469c-b46b-cfd0f45321da" />
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "jomarko (via GitHub)" <gi...@apache.org>.
jomarko commented on PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#issuecomment-2700213676

   I will do my re-review after @ljmotta points are addressed, as he asked code changes that may change the final behavior.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#issuecomment-2690366706

   > Hi @Kusuma04-dev , thank you for the pull request. It will be very helpful for users to see these messages from backend 💪 .
   > 
   > However it seems we need to improve our code for transforming backend data into UI data. Once I created model with three decisions, the message was 'tripled' there. See the attached screenshot.
   > 
   > ![image](https://private-user-images.githubusercontent.com/8044780/417921033-a626a406-2597-4072-b67f-725808d45d61.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDA3NDEwNTMsIm5iZiI6MTc0MDc0MDc1MywicGF0aCI6Ii84MDQ0NzgwLzQxNzkyMTAzMy1hNjI2YTQwNi0yNTk3LTQwNzItYjY3Zi03MjU4MDhkNDVkNjEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMjhUMTEwNTUzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWM0Nzc0ZTkzZGY5MjljODQzODhlYjc0ZTUxNWZlZmE2ZTEyY2M5ODNiNzNmNGI3ZTAzOTU0MDhiM2YzZjlmYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.mKsoU7atcsi1F6-3hMIUTPkopBZMjS589ZPUW-59f-g)
   
   Thanks Jozef for the review, I have missed to check this type of scenario. I have handled now.Please validate.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#discussion_r1981101482


##########
packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx:
##########
@@ -262,6 +263,13 @@ export function DmnRunnerContextProvider(props: PropsWithChildren<Props>) {
             if (canceled.get()) {
               return;
             }
+            const currentResults = results[currentInputIndex];
+            if (currentResults && currentResults.messages?.length > 0) {
+              const messagesMap = new Map(currentResults.messages.map((message) => [message.sourceId, message]));
+              setCurrentResponseMessage(messagesMap);
+            } else {
+              setCurrentResponseMessage(new Map());
+            }

Review Comment:
   if we use currentInputIndex , then we won't get all the messages in case of dmn runner table having 2 rows Luiz. Considering we have to display all validation messages for all the rows , did the changes . Please review .Thanks @ljmotta .
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "yesamer (via GitHub)" <gi...@apache.org>.
yesamer commented on code in PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#discussion_r2086048652


##########
packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx:
##########
@@ -333,6 +335,19 @@ export function DmnRunnerContextProvider(props: PropsWithChildren<Props>) {
     [props.dmnLanguageService, props.workspaceFile.relativePath, props.workspaceFile.workspaceId, workspaces]
   );
 
+  const findDecisionIdIdBySourceId = useCallback(

Review Comment:
   @Kusuma04-dev As reported by copilot:
   
   ```suggestion
     const findDecisionIdBySourceId = useCallback(
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#issuecomment-2700533508

   > @Kusuma04-dev hi, I have a question, if `DmnRunnerContextProvider` could somehow reduce/aggregate messages information, to contain also row number. I mean, lest say we show validation messages for three rows, it would be nice to have some prefix in the message saying what row it is related to.
   > 
   > <img alt="417547437-31f9552a-5b44-469c-b46b-cfd0f45321da" width="1185" src="https://private-user-images.githubusercontent.com/8044780/419408214-1755fca5-77c3-4adb-b71f-bce357969efa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDExNzExNTAsIm5iZiI6MTc0MTE3MDg1MCwicGF0aCI6Ii84MDQ0NzgwLzQxOTQwODIxNC0xNzU1ZmNhNS03N2MzLTRhZGItYjcxZi1iY2UzNTc5NjllZmEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDMwNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAzMDVUMTAzNDEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGQ2OGMyYTViM2FjNTZhNDJhMmRiZDM3NzJkZTNhNjY2YjE5YWUxZjJjYjk0ZWUyYzg3NmM2Njk2YTcyNDhjZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.LfMBJX4-0z44jOcGJpAcxO5nnCBNQJsSEQ84Ld6jMAM">
   
   Hi @jomarko , In case of form , we are showing messages for that particular row only , so i feel it's understandable without row number also , WDYT?For example if we have 3 rows then if u select row 1 - only messages related to that row will display and if u go to row 2 then only messages related to row 2 will display.  but in case of table ,might be needed to show row numbers as we are displaying all messages at a time.Let me check if it is possible.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "ljmotta (via GitHub)" <gi...@apache.org>.
ljmotta commented on PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#issuecomment-2706424858

   @jomarko I agree with Jozef. We need to keep the errors under the node name, or having multiple errors can be very dificult to track.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "ljmotta (via GitHub)" <gi...@apache.org>.
ljmotta commented on code in PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#discussion_r1980149469


##########
packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx:
##########
@@ -162,6 +162,7 @@ export function DmnRunnerContextProvider(props: PropsWithChildren<Props>) {
   );
   const status = useMemo(() => (isExpanded ? DmnRunnerStatus.AVAILABLE : DmnRunnerStatus.UNAVAILABLE), [isExpanded]);
   const dmnRunnerAjv = useMemo(() => new DmnRunnerAjv().getAjv(), []);
+  const [currentResponseMessage, setCurrentResponseMessage] = useState<Map<string, DmnEvaluationMessages>>(new Map());

Review Comment:
   Please, specify what is expected in the Map. e.g. `currentResultMessagesBySourceId` (sourceId -> message).



##########
packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx:
##########
@@ -341,18 +351,11 @@ export function DmnRunnerContextProvider(props: PropsWithChildren<Props>) {
       new Map<string, string>()
     );
 
-    const messagesBySourceId =
-      results[currentInputIndex]?.reduce((acc, decisionResult) => {
-        decisionResult.messages?.forEach((message) => {
-          const messageEntry = acc.get(message.sourceId);
-          if (!messageEntry) {
-            acc.set(message.sourceId, [message]);
-          } else {
-            acc.set(message.sourceId, [...messageEntry, message]);
-          }
-        });
-        return acc;
-      }, new Map<string, DmnEvaluationMessages[]>()) ?? new Map<string, DmnEvaluationMessages[]>();
+    const messagesBySourceId = Array.from(currentResponseMessage.values()).reduce((acc, message) => {

Review Comment:
   I think I've missed something here. This `reduce` isn't recreating the `currentResponseMessage`? If this is correct, we don't need the `messagesBySourceId`.



##########
packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx:
##########
@@ -262,6 +263,13 @@ export function DmnRunnerContextProvider(props: PropsWithChildren<Props>) {
             if (canceled.get()) {
               return;
             }
+            const currentResults = results[currentInputIndex];
+            if (currentResults && currentResults.messages?.length > 0) {
+              const messagesMap = new Map(currentResults.messages.map((message) => [message.sourceId, message]));
+              setCurrentResponseMessage(messagesMap);
+            } else {
+              setCurrentResponseMessage(new Map());
+            }

Review Comment:
   If we use the `currentInputIndex`, what will happen with the DMN Runner table? The validation messages from all rows will appear? I mean, if we have two rows, both with invalid values, we will still have two different validation messages?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "ljmotta (via GitHub)" <gi...@apache.org>.
ljmotta commented on code in PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#discussion_r2081492405


##########
packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx:
##########
@@ -328,6 +330,19 @@ export function DmnRunnerContextProvider(props: PropsWithChildren<Props>) {
     [props.dmnLanguageService, props.workspaceFile.relativePath, props.workspaceFile.workspaceId, workspaces]
   );
 
+  const findDecisionIdIdBySourceId = useMemo(
+    () => (sourceid: any) => {
+      if (!Array.isArray(invalidElementPaths)) return "";
+      for (const path of invalidElementPaths) {
+        if (path.includes(sourceid)) {
+          return path[0];
+        }
+      }
+      return "";
+    },
+    [invalidElementPaths]
+  );

Review Comment:
   Why not a `useCallback`? Please fix the `sourceid` typo, and add the `sourceId` type.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#discussion_r1980877375


##########
packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx:
##########
@@ -341,18 +351,11 @@ export function DmnRunnerContextProvider(props: PropsWithChildren<Props>) {
       new Map<string, string>()
     );
 
-    const messagesBySourceId =
-      results[currentInputIndex]?.reduce((acc, decisionResult) => {
-        decisionResult.messages?.forEach((message) => {
-          const messageEntry = acc.get(message.sourceId);
-          if (!messageEntry) {
-            acc.set(message.sourceId, [message]);
-          } else {
-            acc.set(message.sourceId, [...messageEntry, message]);
-          }
-        });
-        return acc;
-      }, new Map<string, DmnEvaluationMessages[]>()) ?? new Map<string, DmnEvaluationMessages[]>();
+    const messagesBySourceId = Array.from(currentResponseMessage.values()).reduce((acc, message) => {

Review Comment:
   Thanks for pointing out @ljmotta , Now i have set only messages to currentresponsemessages and then handling them based on sourceid as before.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#discussion_r2086075120


##########
packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx:
##########
@@ -333,6 +335,19 @@ export function DmnRunnerContextProvider(props: PropsWithChildren<Props>) {
     [props.dmnLanguageService, props.workspaceFile.relativePath, props.workspaceFile.workspaceId, workspaces]
   );
 
+  const findDecisionIdIdBySourceId = useCallback(

Review Comment:
   Thanks for pointing this @yesamer.Made the changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#discussion_r2081681092


##########
packages/online-editor/src/dmnRunner/DmnRunnerContextProvider.tsx:
##########
@@ -328,6 +330,19 @@ export function DmnRunnerContextProvider(props: PropsWithChildren<Props>) {
     [props.dmnLanguageService, props.workspaceFile.relativePath, props.workspaceFile.workspaceId, workspaces]
   );
 
+  const findDecisionIdIdBySourceId = useMemo(
+    () => (sourceid: any) => {
+      if (!Array.isArray(invalidElementPaths)) return "";
+      for (const path of invalidElementPaths) {
+        if (path.includes(sourceid)) {
+          return path[0];
+        }
+      }
+      return "";
+    },
+    [invalidElementPaths]
+  );

Review Comment:
   Thanks for the review @ljmotta . Made the changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#315: DMN Runner table view should display validation messages [incubator-kie-tools]

Posted by "jomarko (via GitHub)" <gi...@apache.org>.
jomarko commented on PR #2943:
URL: https://github.com/apache/incubator-kie-tools/pull/2943#issuecomment-2700748229

   @Kusuma04-dev yes, I am sorry that I was not clear in my last comment. It is fine for me to keep `form`mode as it is. I spoke about `table` mode. In screenshot I used `form` mode but I wanted just highlight with the red text what information I speak about and what place in problems panel.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org