-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add method for updating flows in NAD viewer #137
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: massimo.ferraro <massimo.ferraro@soft.it>
Signed-off-by: massimo.ferraro <massimo.ferraro@soft.it>
@@ -16,6 +16,7 @@ import { debounce } from '@mui/material'; | |||
|
|||
type DIMENSIONS = { width: number; height: number; viewbox: VIEWBOX }; | |||
type VIEWBOX = { x: number; y: number; width: number; height: number }; | |||
export type FLOW = { branchId: string; side: number; p: number }; |
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.
- It's strange to have this class in upper case, I think it's only for constants. Besides we could put any kind of values on arrow one day, so you'd better name it
BranchSideLabel
. - You named the value
p
, but it could be any value. And about the side, it would be more compact to have it directly in two parameters, I meanvalue1
andvalue2
. - In typescript is it possible to define value1 and value2 to be either a number or 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.
Changed for handling generic branch labels: type renamed to BranchLabel, and now containing 2 generic values, numbers or strings
} | ||
|
||
private setFlow(branchId: string, side: number, p: number) { | ||
const edge: EdgeMetadata | undefined = this.diagramMetadata?.edges.find((edge) => edge.equipmentId == branchId); |
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.
For a big network, we should probably have a map to access directly the edge with its equipmentId.
Note that the same kind of direct access should be considered also for other edges.find() if we notice it's slow for a big network.
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.
Added a map for caching edges. The map could possibly be used also in other class methods
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
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.
you can revert those changes
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.
These changes to the SVG were done for showing the arrows, even without the update of the branch labels. Why revert these changes?
…d add caching map Signed-off-by: massimo.ferraro <massimo.ferraro@soft.it>
Signed-off-by: massimo.ferraro <massimo.ferraro@soft.it>
Quality Gate passedIssues Measures |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
no
What kind of change does this PR introduce?
feature
What is the current behavior?
The NAD viewer does not allow to change the flows shown in the SVG
What is the new behavior (if this is a feature change)?
The NAD viewer provide a method for changing the flows shown in the SVG
Does this PR introduce a breaking change or deprecate an API?
Other information:
In the demo, in the add-diagram.ts file, examples of code changing flows are provided