-
Notifications
You must be signed in to change notification settings - Fork 203
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#970: Test Scenario Editor: Integrate the @kie-tools/scesim-editor
component with the DMN Marshaller
#2887
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # packages/scesim-editor/src/creation/TestScenarioCreationPanel.tsx # packages/scesim-editor/stories/dev/DevWebApp.stories.tsx # packages/scesim-editor/stories/scesimEditorStoriesWrapper.tsx # repo/graph.json
🥳 🍾 🚀 |
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.
Please consider my comment inline. Thank you!
const settingsModel = useTestScenarioEditorStore((state) => state.scesim.model.ScenarioSimulationModel.settings); | ||
const [selectedDMNPathRelativeToThisScesim, setSelectedDMNPathRelativeToThisScesim] = useState<string | undefined>( |
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.
const [selectedDMNPathRelativeToThisScesim, setSelectedDMNPathRelativeToThisScesim] = useState<string | undefined>( | |
const [selectedDmnPathRelativeToThisSceSim, setSelectedDmnPathRelativeToThisSceSim] = useState<string | undefined>( |
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.
Done
console.trace(externalDMNModel); | ||
|
||
if (canceled.get() || !externalDMNModel) { | ||
setSelectedDmnModel(undefined); |
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.
Residual "callBackError" 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.
Ehm, what do you mean? Should I update the callBackError?
const [allDmnModelNormalizedPosixRelativePaths, setAllDmnModelNormalizedPosixRelativePaths] = useState< | ||
string[] | undefined | ||
>(undefined); | ||
const [callBackError, setCallBackError] = useState<any>(undefined); |
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.
"callBackError" is not really a very descriptive name. WDYT about "dmnNotFoundError"?
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.
Fine with me, done
return; | ||
} | ||
onRequestExternalModelByPath(selectedDMNPathRelativeToThisScesim) | ||
.then((externalDMNModel) => { |
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.
.then((externalDMNModel) => { | |
.then((externalDmnModel) => { |
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.
Done
callBackError !== undefined || | ||
selectedDmnModel?.normalizedPosixPathRelativeToTheOpenFile !== settingsModel.dmnFilePath?.__$$text, | ||
[callBackError, selectedDmnModel?.normalizedPosixPathRelativeToTheOpenFile, settingsModel.dmnFilePath?.__$$text] | ||
); |
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.
Maybe invert the negated variable? It's easier to understand when soemthing is "valid" than when it's "invalid". 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.
De Morgan likes this element
) | ||
); | ||
|
||
/** This callback return the unmarshalled representation of a DMN model given its path */ |
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.
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.
Done
if (callBackError) { | ||
throw callBackError; | ||
} | ||
}, [callBackError]); |
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.
If we're letting error propagete, why do we need the callBackError
state? Why not let them explode when they happen? Mapping errors as state is usually for a try/catch-like mechanism, when we want the screen to show a different UI for when errors occur.
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.
Good observation, so it's enough to rethrow the error inside the catch block, right?
id="dmn-select" | ||
name="dmn-select" | ||
onChange={(dmnModelPathRelativeToThisScesim) => { | ||
if (typeof dmnModelPathRelativeToThisScesim !== "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.
We usually trust the type system for such cases. What's the case where this would not be a 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.
I agree is not necessary at all. Removed.
@@ -77,7 +77,7 @@ export function updateColumn({ | |||
const factMappingValueToUpdate = factMappingValues[factMappingValueToUpdateIndex]; | |||
factMappingValueToUpdate.factIdentifier.className = { __$$text: factClassName }; | |||
factMappingValueToUpdate.factIdentifier.name = { __$$text: factName }; | |||
//factMappingValueToUpdate.rawValue = { __$$text: update.value }, //TODO 2 related see kie-issues#1514 | |||
//factMappingValueToUpdate.rawValue = { __$$text: update.value, "@_class": "string" }, //TODO 2 related see kie-issues#1514 |
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.
Can you please update the description of apache/incubator-kie-issues#1514? Thanks!
- The DMN model with the target reference is missing at all | ||
- The DMN model with the target reference is found, but in a different location */ | ||
const isMissingDataObjectsNotificationEnabled = useMemo(() => { | ||
const isReferencedDMNFileMissing = |
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.
const isReferencedDMNFileMissing = | |
const isReferencedDmnFileMissing = |
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.
Done
Postponing my review after code changes required by @tiagobento are in. |
Closes apache/incubator-kie-issues#970
This PR integrates the new Scesim Editor with the DMN Marshaller, making it possible to retrieve required information from an External DMN Model.
To whoever will review and test this PR, please consider some KI have already reported here
In addition, some use cases are still not fully implemented (eg. collections, expressions, nested data objects)
Those will be managed with apache/incubator-kie-issues#1514
Some examples:
Opening an existing Scesim file:
Screen.Recording.2025-02-05.at.15.24.17.mov
Creating a new DMN-based Scesim file with auto-population
Screen.Recording.2025-02-05.at.15.17.19.mov
Creating a new DMN-based Scesim file without auto-population
Screen.Recording.2025-02-05.at.15.19.16.mov
Opening an existing DMN-based Scesim file with the referenced DMN file removed
Screen.Recording.2025-02-05.at.15.27.45.mov
Opening an existing DMN-based Scesim file with the referenced DMN file moved to another location
Screen.Recording.2025-02-05.at.16.43.28.mov
Blocked by #2866. Required to update the tests.