danielzhe commented on code in PR #2508:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2508#discussion_r1704432802


##########
packages/dmn-editor/src/diagram/Palette.tsx:
##########
@@ -245,7 +245,11 @@ export function Palette({ pulse }: { pulse: boolean }) {
         <br />
         <aside className={"kie-dmn-editor--external-nodes-panel-toggle"}>
           {diagram.openLhsPanel === DiagramLhsPanel.EXTERNAL_NODES && (
-            <div className={"kie-dmn-editor--palette-nodes-popover"} style={{ 
maxHeight }}>
+            <div
+              className={"kie-dmn-editor--palette-nodes-popover"}
+              style={{ maxHeight }}
+              data-testid={"kie-tools--dmn-editor--external-nodes-container"}
+            >

Review Comment:
   Do we have tests for "DRG Nodes" panel? I only found for drag nodes from the 
palette not from the "DRG Nodes" panel. 🤔 



##########
packages/dmn-editor/src/mutations/addDecisionToDecisionService.ts:
##########
@@ -25,25 +25,42 @@ import { SnapGrid } from "../store/Store";
 import { MIN_NODE_SIZES } from "../diagram/nodes/DefaultSizes";
 import { NODE_TYPES } from "../diagram/nodes/NodeTypes";
 import { Normalized } from "../normalization/normalize";
+import {
+  DMN15__tBusinessKnowledgeModel,
+  DMN15__tDecision,
+  DMN15__tDecisionService,
+  DMN15__tInputData,
+  DMN15__tKnowledgeSource,
+} from "@kie-tools/dmn-marshaller/src/schemas/dmn-1_5/ts-gen/types";
+
+export type DrgElement =
+  | Normalized<{ __$$element: "decision" } & DMN15__tDecision>
+  | Normalized<{ __$$element: "businessKnowledgeModel" } & 
DMN15__tBusinessKnowledgeModel>
+  | Normalized<{ __$$element: "decisionService" } & DMN15__tDecisionService>
+  | Normalized<{ __$$element: "inputData" } & DMN15__tInputData>
+  | Normalized<{ __$$element: "knowledgeSource" } & DMN15__tKnowledgeSource>;
 
 export function addDecisionToDecisionService({
   definitions,
-  decisionId,
+  drgElement,
   decisionServiceId,
   drdIndex,
   snapGrid,
+  decisionShape,
+  elementId,
 }: {
   definitions: Normalized<DMN15__tDefinitions>;
-  decisionId: string;
+  drgElement: DrgElement;
   decisionServiceId: string;
   drdIndex: number;
   snapGrid: SnapGrid;
+  decisionShape: Normalized<DMNDI15__DMNShape>;
+  elementId: string;
 }) {

Review Comment:
   In the previous code we was getting the ID, in `Diagram.tsx` using the 
following code:
   
   ```
   decisionId: selectedNodes[i].data.dmnObject!["@_id"]!, // We can assume that 
all selected nodes are Decisions because the contaiment was validated above.
   ```
   
   So I think it is safe to assume that `selectedNodes[i].data.dmnObject` is 
always a `Decision` which is the `DrgElement` that we looking for. Maybe I 
should change the type of `DrgElement` I defined 
[here](https://github.com/apache/incubator-kie-tools/pull/2508/files#diff-b544ce6235db5e0b538561f2aac58e54da6162dac8a58fcb39cee682e8420f63R36)
 
   to:
   
   `export type DecisionDrgElement = Normalized<{ __$$element: "decision" } & 
DMN15__tDecision>`
   
   About the ID, I can't see any case where the ID of the selected node will be 
different than the DRG, except for the imported nodes the ID in the DRG is not 
full, it is only the local ID (the Guid), but from `selectedNodes[I].["@_id"]` 
is the real ID used in the current diagram (namespace + id).



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to