Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kie-issues#1808: New Test Scenario and DMN Editors in built project load DMN models twice #2931

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
);
Expand Down Expand Up @@ -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;
}

Expand Down
11 changes: 7 additions & 4 deletions packages/scesim-editor-envelope/src/TestScenarioEditorRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
);
};

Expand Down Expand Up @@ -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;
}

Expand Down
Loading