This is an automated email from the ASF dual-hosted git repository.
thiagoelg 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 029b55c7d69 kie-issues#1912: DMN VS Code Extension: Evaluation
highlights feature should not be available (#3066)
029b55c7d69 is described below
commit 029b55c7d696d0a2cecda34f207b923c02af2e7a
Author: Jozef Marko <[email protected]>
AuthorDate: Wed Apr 23 16:45:39 2025 +0200
kie-issues#1912: DMN VS Code Extension: Evaluation highlights feature
should not be available (#3066)
---
.../dmn-editor-envelope/src/DmnEditorFactory.tsx | 3 ++
packages/dmn-editor-envelope/src/DmnEditorRoot.tsx | 2 +
.../src/NewDmnEditorFactory.tsx | 4 ++
packages/dmn-editor/src/DmnEditor.tsx | 4 ++
.../dmn-editor/src/overlaysPanel/OverlaysPanel.tsx | 50 ++++++++++++----------
.../src/settings/DmnEditorSettingsContext.tsx | 10 ++++-
.../dmn-editor/stories/dmnEditorStoriesWrapper.tsx | 3 ++
.../EvaluationHighlights.stories.tsx | 2 +
8 files changed, 54 insertions(+), 24 deletions(-)
diff --git a/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
b/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
index 61e00ddb636..5fc9372621c 100644
--- a/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
+++ b/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
@@ -111,6 +111,7 @@ export function DmnEditorRootWrapper({
envelopeContext,
exposing,
workspaceRootAbsolutePosixPath,
+ isEvaluationHighlightsSupported,
isReadOnly,
channelType,
onOpenedBoxedExpressionEditorNodeChange,
@@ -118,6 +119,7 @@ export function DmnEditorRootWrapper({
envelopeContext?: KogitoEditorEnvelopeContextType<KogitoEditorEnvelopeApi,
KogitoEditorChannelApi>;
exposing: (s: DmnEditorRoot) => void;
workspaceRootAbsolutePosixPath: string;
+ isEvaluationHighlightsSupported?: boolean;
isReadOnly: boolean;
channelType?: ChannelType;
onOpenedBoxedExpressionEditorNodeChange?: (newOpenedNodeId: string |
undefined) => void;
@@ -183,6 +185,7 @@ export function DmnEditorRootWrapper({
onOpenedBoxedExpressionEditorNodeChange={onOpenedBoxedExpressionEditorNodeChange}
workspaceRootAbsolutePosixPath={workspaceRootAbsolutePosixPath}
keyboardShortcutsService={envelopeContext?.services.keyboardShortcuts}
+ isEvaluationHighlightsSupported={isEvaluationHighlightsSupported ??
false}
isReadOnly={isReadOnly}
isImportDataTypesFromJavaClassesSupported={isImportDataTypesFromJavaClassesSupported}
javaCodeCompletionService={javaCodeCompletionService}
diff --git a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
index d73cb4abc80..ecd897c5871 100644
--- a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
+++ b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
@@ -71,6 +71,7 @@ export type DmnEditorRootProps = {
onOpenedBoxedExpressionEditorNodeChange?: (newOpenedNodeId: string |
undefined) => void;
workspaceRootAbsolutePosixPath: string;
keyboardShortcutsService: KeyboardShortcutsService | undefined;
+ isEvaluationHighlightsSupported?: boolean;
isReadOnly: boolean;
isImportDataTypesFromJavaClassesSupported?: boolean;
javaCodeCompletionService?: JavaCodeCompletionExposedInteropApi;
@@ -503,6 +504,7 @@ export class DmnEditorRoot extends
React.Component<DmnEditorRootProps, DmnEditor
externalContextName={""}
externalContextDescription={""}
issueTrackerHref={""}
+
isEvaluationHighlightsSupported={this.props?.isEvaluationHighlightsSupported}
isReadOnly={this.state.isReadOnly}
isImportDataTypesFromJavaClassesSupported={this.props?.isImportDataTypesFromJavaClassesSupported}
javaCodeCompletionService={this.props?.javaCodeCompletionService}
diff --git a/packages/dmn-editor-envelope/src/NewDmnEditorFactory.tsx
b/packages/dmn-editor-envelope/src/NewDmnEditorFactory.tsx
index 373cf831689..d42c9ce0466 100644
--- a/packages/dmn-editor-envelope/src/NewDmnEditorFactory.tsx
+++ b/packages/dmn-editor-envelope/src/NewDmnEditorFactory.tsx
@@ -19,6 +19,7 @@
import * as React from "react";
import {
+ ChannelType,
DEFAULT_WORKSPACE_ROOT_ABSOLUTE_POSIX_PATH,
EditorFactory,
EditorInitArgs,
@@ -61,6 +62,9 @@ export class NewDmnEditorInterface extends DmnEditorInterface
{
workspaceRootAbsolutePosixPath={
this.initArgs.workspaceRootAbsolutePosixPath ??
DEFAULT_WORKSPACE_ROOT_ABSOLUTE_POSIX_PATH
}
+ isEvaluationHighlightsSupported={
+ this.initArgs.channel === ChannelType.ONLINE ||
this.initArgs.channel === ChannelType.ONLINE_MULTI_FILE
+ }
isReadOnly={this.initArgs.isReadOnly}
onOpenedBoxedExpressionEditorNodeChange={(newOpenedNodeId) => {
(
diff --git a/packages/dmn-editor/src/DmnEditor.tsx
b/packages/dmn-editor/src/DmnEditor.tsx
index 0161f7e9d56..9482f520544 100644
--- a/packages/dmn-editor/src/DmnEditor.tsx
+++ b/packages/dmn-editor/src/DmnEditor.tsx
@@ -167,6 +167,10 @@ export type DmnEditorProps = {
* This is shown on the ErrorBoundary fallback component, when an uncaught
error happens.
*/
issueTrackerHref?: string;
+ /**
+ * A flag to enable 'Evaluation Highlights' on supported channels (only
ONLINE for now)
+ */
+ isEvaluationHighlightsSupported?: boolean;
/**
* A flag to enable read-only mode on the DMN Editor.
* When enabled navigation is still possible (e.g. entering the Boxed
Expression Editor, Data Types and Included Models),
diff --git a/packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx
b/packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx
index 3541b1847f2..15359acf648 100644
--- a/packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx
+++ b/packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx
@@ -27,6 +27,7 @@ import { useLayoutEffect, useRef } from "react";
import { Icon } from "@patternfly/react-core/dist/js/components/Icon";
import { Tooltip } from "@patternfly/react-core/dist/js/components/Tooltip";
import { HelpIcon } from "@patternfly/react-icons/dist/js/icons/help-icon";
+import { useSettings } from "../settings/DmnEditorSettingsContext";
const MIN_SNAP = 5;
const MAX_SNAP = 50;
@@ -41,6 +42,7 @@ export function OverlaysPanel({ availableHeight }:
OverlaysPanelProps) {
const diagram = useDmnEditorStore((s) => s.diagram);
const dmnEditorStoreApi = useDmnEditorStoreApi();
const overlayPanelContainer = useRef<HTMLDivElement>(null);
+ const { isEvaluationHighlightsSupported } = useSettings();
useLayoutEffect(() => {
if (overlayPanelContainer.current && availableHeight) {
if (overlayPanelContainer.current.scrollHeight <= availableHeight) {
@@ -152,30 +154,32 @@ export function OverlaysPanel({ availableHeight }:
OverlaysPanelProps) {
}
/>
</FormGroup>
- <FormGroup
- label={"Enable evaluation highlights"}
- labelIcon={
- <Tooltip
- content={
- "Enable highlighting Decision Table rules and Boxed
Conditional Expression branches based on evaluation results, also showing
success/error status badges on Decision nodes."
- }
- >
- <Icon size="sm" status="info">
- <HelpIcon />
- </Icon>
- </Tooltip>
- }
- >
- <Switch
-
data-testid={"kie-tools--dmn-editor--evaluation-highlights-control"}
- isChecked={diagram.overlays.enableEvaluationHighlights}
- onChange={(newValue) =>
- dmnEditorStoreApi.setState((state) => {
- state.diagram.overlays.enableEvaluationHighlights = newValue;
- })
+ {isEvaluationHighlightsSupported && (
+ <FormGroup
+ label={"Enable evaluation highlights"}
+ labelIcon={
+ <Tooltip
+ content={
+ "Enable highlighting Decision Table rules and Boxed
Conditional Expression branches based on evaluation results, also showing
success/error status badges on Decision nodes."
+ }
+ >
+ <Icon size="sm" status="info">
+ <HelpIcon />
+ </Icon>
+ </Tooltip>
}
- />
- </FormGroup>
+ >
+ <Switch
+
data-testid={"kie-tools--dmn-editor--evaluation-highlights-control"}
+ isChecked={diagram.overlays.enableEvaluationHighlights}
+ onChange={(newValue) =>
+ dmnEditorStoreApi.setState((state) => {
+ state.diagram.overlays.enableEvaluationHighlights = newValue;
+ })
+ }
+ />
+ </FormGroup>
+ )}
</Form>
</div>
);
diff --git a/packages/dmn-editor/src/settings/DmnEditorSettingsContext.tsx
b/packages/dmn-editor/src/settings/DmnEditorSettingsContext.tsx
index 2a44250be16..96cf3c4002a 100644
--- a/packages/dmn-editor/src/settings/DmnEditorSettingsContext.tsx
+++ b/packages/dmn-editor/src/settings/DmnEditorSettingsContext.tsx
@@ -23,6 +23,7 @@ import { JavaCodeCompletionService } from
"@kie-tools/import-java-classes-compon
export interface DmnEditorSettingsContextType {
isReadOnly: boolean;
+ isEvaluationHighlightsSupported?: boolean;
isImportDataTypesFromJavaClassesSupported?: boolean;
javaCodeCompletionService?: JavaCodeCompletionService;
}
@@ -36,6 +37,7 @@ export function useSettings() {
export function DmnEditorSettingsContextProvider(
_props: React.PropsWithChildren<{
isReadOnly?: boolean;
+ isEvaluationHighlightsSupported?: boolean;
isImportDataTypesFromJavaClassesSupported?: boolean;
javaCodeCompletionService?: JavaCodeCompletionService;
}>
@@ -45,10 +47,16 @@ export function DmnEditorSettingsContextProvider(
const value = useMemo<DmnEditorSettingsContextType>(
() => ({
isReadOnly: props.isReadOnly ?? false,
+ isEvaluationHighlightsSupported: props?.isEvaluationHighlightsSupported
?? false,
isImportDataTypesFromJavaClassesSupported:
props?.isImportDataTypesFromJavaClassesSupported ?? false,
javaCodeCompletionService: props?.javaCodeCompletionService,
}),
- [props.isReadOnly, props?.isImportDataTypesFromJavaClassesSupported,
props?.javaCodeCompletionService]
+ [
+ props.isReadOnly,
+ props?.isEvaluationHighlightsSupported,
+ props?.isImportDataTypesFromJavaClassesSupported,
+ props?.javaCodeCompletionService,
+ ]
);
return <DmnEditorSettingsContext.Provider
value={value}>{children}</DmnEditorSettingsContext.Provider>;
diff --git a/packages/dmn-editor/stories/dmnEditorStoriesWrapper.tsx
b/packages/dmn-editor/stories/dmnEditorStoriesWrapper.tsx
index f6528d3f640..890aac3bc57 100644
--- a/packages/dmn-editor/stories/dmnEditorStoriesWrapper.tsx
+++ b/packages/dmn-editor/stories/dmnEditorStoriesWrapper.tsx
@@ -106,6 +106,9 @@ export function DmnEditorWrapper(props?:
Partial<StorybookDmnEditorProps>) {
ref={ref}
model={model}
originalVersion={props?.originalVersion ?? args.originalVersion}
+ isEvaluationHighlightsSupported={
+ props?.isEvaluationHighlightsSupported ??
args.isEvaluationHighlightsSupported
+ }
isReadOnly={isReadOnly}
onModelChange={onModelChange}
onOpenedBoxedExpressionEditorNodeChange={onOpenedBoxedExpressionEditorNodeChangeNoOperation}
diff --git
a/packages/dmn-editor/stories/misc/evaluationHighlights/EvaluationHighlights.stories.tsx
b/packages/dmn-editor/stories/misc/evaluationHighlights/EvaluationHighlights.stories.tsx
index edc00b616ba..9f59d866187 100644
---
a/packages/dmn-editor/stories/misc/evaluationHighlights/EvaluationHighlights.stories.tsx
+++
b/packages/dmn-editor/stories/misc/evaluationHighlights/EvaluationHighlights.stories.tsx
@@ -817,6 +817,7 @@ function EvaluationHighlights(args: DmnEditorProps) {
validationMessages: args.validationMessages,
evaluationResultsByNodeId: args.evaluationResultsByNodeId,
issueTrackerHref: args.issueTrackerHref,
+ isEvaluationHighlightsSupported: args.isEvaluationHighlightsSupported,
})}
</>
);
@@ -858,5 +859,6 @@ export const EvaluationHighlightsStory: Story = {
externalModelsByNamespace: {},
issueTrackerHref: "",
validationMessages: {},
+ isEvaluationHighlightsSupported: true,
},
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]