Skip to content

Commit

Permalink
kie-issues#1773: DMN Editor: Render badges with evaluation status on …
Browse files Browse the repository at this point in the history
…Decision nodes

Closes: apache/incubator-kie-issues#1773
  • Loading branch information
jomarko committed Jan 22, 2025
1 parent ea7bde6 commit c4043b1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 20 deletions.
33 changes: 33 additions & 0 deletions packages/dmn-editor/src/DmnEditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,39 @@
}
/* (end) nodes */

/* (begin) decision node evaluation status */
.kie-dmn-editor--decision-node--evaluation-status-failure::before {
content: " \2716";
font-size: 0.8em;
text-align: left;
color: white;
background-color: rgb(134, 106, 212);
position: absolute;
top: 0px;
left: 0px;
height: 40px;
width: 40px;
clip-path: polygon(0% 100%, 100% 0%, 0% 0%);
padding-left: 0.2em;
}

.kie-dmn-editor--decision-node--evaluation-status-success::before {
content: " \2714";
font-size: 0.8em;
text-align: left;
color: white;
background-color: rgb(134, 106, 212);
position: absolute;
top: 0px;
left: 0px;
height: 40px;
width: 40px;
clip-path: polygon(0% 100%, 100% 0%, 0% 0%);
padding-left: 0.2em;
}

/* (end) decision node evaluation status */

/* (begin) decisionService and group nodes */
/* DECISION SERVICES AND GROUPS HAVE A SPECIFIC SELECTION MECHANISM TO ALLOW EDITING EDGES INSIDE THEM */
.kie-dmn-editor--node-decisionService-visibleRect {
Expand Down
7 changes: 6 additions & 1 deletion packages/dmn-editor/src/diagram/nodes/Nodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,11 @@ export const DecisionNode = React.memo(
);
});

const isEvaluationHighlightsEnabled = useDmnEditorStore((s) => s.diagram.overlays.enableEvaluationHighlights);
const evaluationStatusClassName = isEvaluationHighlightsEnabled
? "kie-dmn-editor--decision-node--evaluation-status-success"
: "";

return (
<>
<svg className={`kie-dmn-editor--node-shape ${className}`}>
Expand All @@ -421,7 +426,7 @@ export const DecisionNode = React.memo(

<div
ref={ref}
className={`kie-dmn-editor--node kie-dmn-editor--decision-node ${className}`}
className={`kie-dmn-editor--node kie-dmn-editor--decision-node ${className} ${evaluationStatusClassName}`}
tabIndex={-1}
onDoubleClick={triggerEditing}
onKeyDown={triggerEditingIfEnter}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
/\*

- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
\*/
{/* Licensed to the Apache Software Foundation (ASF) under one */}
{/* or more contributor license agreements. See the NOTICE file */}
{/* distributed with this work for additional information */}
{/* regarding copyright ownership. The ASF licenses this file */}
{/* to you under the Apache License, Version 2.0 (the */}
{/* "License"); you may not use this file except in compliance */}
{/* with the License. You may obtain a copy of the License at */}
{/* */}
{/* http://www.apache.org/licenses/LICENSE-2.0 */}
{/* */}
{/* Unless required by applicable law or agreed to in writing, */}
{/* software distributed under the License is distributed on an */}
{/* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY */}
{/* KIND, either express or implied. See the License for the */}
{/* specific language governing permissions and limitations */}
{/* under the License. */}

import EmptyWithAvailableExternalModelsStories from "./EmptyWithAvailableExternalModels.stories";
import { Meta } from "@storybook/blocks";
Expand Down

0 comments on commit c4043b1

Please sign in to comment.