-
Notifications
You must be signed in to change notification settings - Fork 33
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
[REFACTOR] Store part of the BpmnModel into memory for searches #1115
Conversation
This is a first step to avoid depending on the mxGraph model for elements search. It introduces a new dedicated registry to manage the BpmnModel and related objects. They are now used to search element by ids. This first implementation holds a structure to make search faster: this is probably not optimal and will be rework later. The previously called 'DisplayModel' has been extracted out of mxgraph code as it is not tight to it. It has been renamed into 'RenderedModel' for consistency with the wording we use everywhere else.
3867169
to
7b3d41d
Compare
♻️ PR Preview 6724ec7 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
export class BpmnModelRegistry { | ||
private searchableModel: SearchableModel; | ||
|
||
computeRenderedModel(bpmnModel: BpmnModel): RenderedModel { |
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.
👍🏼
@@ -2,7 +2,7 @@ | |||
<html lang="en"> | |||
<head> | |||
<meta charset="UTF-8"> | |||
<title>BPMN Visualization Non Regression</title> | |||
<title>BPMN Visualization - Elements Identification</title> |
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.
👍🏼
Putting back to draft to integrate review feedbacks. |
} | ||
} | ||
|
||
function toRenderedModel(bpmnModel: BpmnModel): RenderedModel { |
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.
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 managed by the removal of the 'safe navigation operator' ?.
in 7dd96bf
It must never be null or undefined (if so this is a bug elsewhere), so drop it for simplicity.
It must never be null or undefined (if so this is a bug elsewhere), so drop it for simplicity.
Kudos, SonarCloud Quality Gate passed! |
@@ -32,19 +33,22 @@ export default class BpmnVisualization { | |||
* @experimental subject to change, feedback welcome | |||
*/ | |||
readonly bpmnElementsRegistry: BpmnElementsRegistry; | |||
private readonly _bpmnModelRegistry: BpmnModelRegistry; |
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.
Not a big fan of underscore for private fields. IMHO it is enough to have linting and modifiers.
If we decide to go with that convention, we need to perhaps do the refactoring to convert other private fields to follow this approach.
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.
Agree, as decided with @csouchet, I will prepare a PR to make everything consistent.
This is a first step to avoid depending on the mxGraph model for elements
search.
It introduces a new dedicated registry to manage the BpmnModel and related
objects. They are now used to search element by ids. This first implementation
holds a structure to make search faster: this is probably not optimal and will
be rework later.
The previously called 'DisplayModel' has been extracted out of mxgraph code as
it is not tight to it. It has been renamed into 'RenderedModel' for consistency
with the wording we use everywhere else.
covers #953