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 9d5abbb8bfb kie-issues#1808: New Test Scenario and DMN Editors in 
built project load DMN models twice (#2931)
9d5abbb8bfb is described below

commit 9d5abbb8bfbf96bca23bb398b69180805734e4c5
Author: Yeser Amer <[email protected]>
AuthorDate: Tue Feb 25 15:03:51 2025 +0100

    kie-issues#1808: New Test Scenario and DMN Editors in built project load 
DMN models twice (#2931)
---
 packages/dmn-editor-envelope/src/DmnEditorRoot.tsx            | 11 ++++++++---
 .../scesim-editor-envelope/src/TestScenarioEditorRoot.tsx     | 11 +++++++----
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx 
b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
index ae20e2c5359..f9dc8e02640 100644
--- a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
+++ b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
@@ -41,6 +41,7 @@ import { EmptyState, EmptyStateBody, EmptyStateIcon } from 
"@patternfly/react-co
 import { Title } from "@patternfly/react-core/dist/js/components/Title";
 
 export const EXTERNAL_MODELS_SEARCH_GLOB_PATTERN = "**/*.{dmn,pmml}";
+export const TARGET_DIRECTORY = "target/classes/";
 
 export const EMPTY_DMN = () => `<?xml version="1.0" encoding="UTF-8"?>
 <definitions
@@ -230,8 +231,8 @@ export class DmnEditorRoot extends 
React.Component<DmnEditorRootProps, DmnEditor
     });
 
     return list.normalizedPosixPathsRelativeToTheWorkspaceRoot.flatMap((p) =>
-      // Do not show this DMN on the list
-      p === this.state.openFileNormalizedPosixPathRelativeToTheWorkspaceRoot
+      // Do not show this DMN on the list and filter out assets into 
target/classes directory
+      p === this.state.openFileNormalizedPosixPathRelativeToTheWorkspaceRoot 
|| p.includes(TARGET_DIRECTORY)
         ? []
         : 
__path.relative(__path.dirname(this.state.openFileNormalizedPosixPathRelativeToTheWorkspaceRoot!),
 p)
     );
@@ -604,7 +605,11 @@ function ExternalModelsManager({
         for (let i = 0; i < 
list.normalizedPosixPathsRelativeToTheWorkspaceRoot.length; i++) {
           const normalizedPosixPathRelativeToTheWorkspaceRoot = 
list.normalizedPosixPathsRelativeToTheWorkspaceRoot[i];
 
-          if (normalizedPosixPathRelativeToTheWorkspaceRoot === 
thisDmnsNormalizedPosixPathRelativeToTheWorkspaceRoot) {
+          // Do not show this DMN on the list and filter out assets into 
target/classes directory
+          if (
+            normalizedPosixPathRelativeToTheWorkspaceRoot === 
thisDmnsNormalizedPosixPathRelativeToTheWorkspaceRoot ||
+            
normalizedPosixPathRelativeToTheWorkspaceRoot.includes(TARGET_DIRECTORY)
+          ) {
             continue;
           }
 
diff --git a/packages/scesim-editor-envelope/src/TestScenarioEditorRoot.tsx 
b/packages/scesim-editor-envelope/src/TestScenarioEditorRoot.tsx
index 38c1aa5b2d2..03486ccef8f 100644
--- a/packages/scesim-editor-envelope/src/TestScenarioEditorRoot.tsx
+++ b/packages/scesim-editor-envelope/src/TestScenarioEditorRoot.tsx
@@ -38,6 +38,7 @@ import { getMarshaller, SceSimMarshaller, SceSimModel } from 
"@kie-tools/scesim-
 import { EMPTY_ONE_EIGHT } from 
"@kie-tools/scesim-editor/dist/resources/EmptyScesimFile";
 
 export const DMN_MODELS_SEARCH_GLOB_PATTERN = "**/*.dmn";
+export const TARGET_DIRECTORY = "target/classes/";
 
 export type TestScenarioEditorRootProps = {
   exposing: (s: TestScenarioEditorRoot) => void;
@@ -215,7 +216,10 @@ export class TestScenarioEditorRoot extends 
React.Component<TestScenarioEditorRo
       });
 
       return list.normalizedPosixPathsRelativeToTheWorkspaceRoot.flatMap((p) =>
-        
__path.relative(__path.dirname(this.state.openFileNormalizedPosixPathRelativeToTheWorkspaceRoot!),
 p)
+        // Filter out assets into target/classes directory
+        p.includes(TARGET_DIRECTORY)
+          ? []
+          : 
__path.relative(__path.dirname(this.state.openFileNormalizedPosixPathRelativeToTheWorkspaceRoot!),
 p)
       );
     };
 
@@ -415,9 +419,8 @@ function ExternalModelsManager({
         for (let i = 0; i < 
list.normalizedPosixPathsRelativeToTheWorkspaceRoot.length; i++) {
           const normalizedPosixPathRelativeToTheWorkspaceRoot = 
list.normalizedPosixPathsRelativeToTheWorkspaceRoot[i];
 
-          if (
-            normalizedPosixPathRelativeToTheWorkspaceRoot === 
thisScesimNormalizedPosixPathRelativeToTheWorkspaceRoot
-          ) {
+          // Filter out assets into target/classes directory
+          if 
(normalizedPosixPathRelativeToTheWorkspaceRoot.includes(TARGET_DIRECTORY)) {
             continue;
           }
 


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

Reply via email to