Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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#1298: Decision Services & multiple DRDs: make it possible o add external Decisions to a Decision Service #2508
kie-issues#1298: Decision Services & multiple DRDs: make it possible o add external Decisions to a Decision Service #2508
Changes from 11 commits
b690ebb
33de8ea
2db60f6
b55113d
24f1b15
f916099
99924ea
d64a04e
a078041
c9f88bf
411e61d
6cd536f
a44b7da
fad6167
3ee4271
a84bea2
90c03ff
c3c23dd
54b419c
40a0fdf
227ee5a
3d8abb5
9d7a04e
a5f3e71
8bbb1cf
81d260f
1bdc614
ffa1867
2921171
e22fcd1
3cb35a5
334cf35
bd5786c
0e90a76
a03e182
d9408e7
4759ae3
91a815f
702f44f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal preference, but I always think we should avoid intermediate variables to avoid giving it a name. It's one more thing to hold onto my head when reading code...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very good topic.
I like to split in variables because I find it easier to "think" step-by-step and have less complexity per line.
Also, in this case, I'm giving "meaning" to what
(externalModel.model as Normalized<DmnLatestModel>).definitions.drgElement
: it is the "external drgs". So I don't have to care where it comes from in line 59 or what it is. It is the "external drgs that come from somewhere". Ok, "somewhere" is just a line above, but in my mind, looking at line 59, it is a "problem solved" that I don't have to care about anymore.But the main point is that if someone new looks at the code it can easily get what
(externalModel.model as Normalized<DmnLatestModel>).definitions.drgElement
means.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message is targeting two different cases. Not having an element and the element not being a Decision are two distinguish scenarios. I think this should be break into two errors. If
decision === undefined
the element doesn't exist message. And thedecision.__$$element !== "decision"
the error telling isn't a Decision. WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm following the existing error message patterns used in this mutation and in
deleteDecisionFromDecisionService
. In my opinion, we will only be adding more code to do something that we can do in fewer lines.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
decisionHref
isn't the same as thehrefString
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The
decisionHref
can be something likeuri#id
,id
, or even#id
.The
buildXmlHref
makes sure that we haveuri#id
or#id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
href
will always have the the#
on its structure. If it's possible to have ahref
variable without it (anid
value), the variable is wrongly named. Now, looking at the source of this value, it comes from thecomputeDiagramData.ts
file which creates theselectedNodesById
map. The mapid
is a value made with thebuildXmlHref
, so all ids arehref
, meaning thedecisionHref
is correctly named.I think this is a problem in our codebase, where we mix the
id
and thehref
, and at some point we need to address this. FYI @tiagobentoThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielzhe @tiagobento how are we going to proceed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielzhe Please use
decisionHref
wherehrefString
is currently being used, since they are exactly the same string.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same with this error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same here.
xmlHref
will not have the same value as thedecisionHref
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same answer as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xmlHref
is exactly the same ashref
... you're even building it with the same values. No need to have thisxmlHref
variable...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those changes are made automatically by the Prettier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Prettier doesn't change the imports... Maybe it's your VS Code "Organize imports"?