-
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
NAD viewer #1
NAD viewer #1
Conversation
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Tried to use it in pypowsybl-jupyter widget, worked fine |
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
README.md
Outdated
|
||
Typescript library to integrate a powsybl svg diagram in a javascript project. The library is built with the Parcel bundler. | ||
Symply use: 'npm run build' |
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.
remove "symply"
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
README.md
Outdated
#### For integrators | ||
|
||
If you want to deploy a new version of commons-ui in the [NPM package registry](https://www.npmjs.com/package/@powsybl/powsybl-diagram-viewer), |
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.
reference to commons-ui
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
demo/src/style.css
Outdated
@@ -0,0 +1,6 @@ | |||
#svg-container { | |||
position: relative; /* let it at the charge of the user? */ |
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.
remove ?
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
package.json
Outdated
"version": "0.0.1", | ||
"description": "Typescript library to integrate a powsybl svg diagram in a javascript project.", | ||
"author": "powsybl team", | ||
"homepage": "https://github.com/powsybl", |
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.
link
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 sure maybe https://www.powsybl.org/ ?
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.
Yes, and github repo is below in the file
package.json
Outdated
"scripts": { | ||
"watch": "parcel watch", | ||
"build": "parcel build", | ||
"test": "echo \"Error: no test specified\" && exit 1", |
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.
to implement ?
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.
Yes it's in progress
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 simple test has been implemented. getDimensionsFromSvg() isn't tested as Jest doesn't support svg manipulation in the DOM.
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
src/setupTests.ts
Outdated
@@ -0,0 +1,5 @@ | |||
//FIXME workaround svg.panzoom.js import crash even though it's not used |
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 had the same issue in pypowsybl-jupyter, the problem is that svg.panzoom.js is somewhat broken.
A solution is to import the ESM module svg.panzoom.esm.js instead. This can be configured in jest config file.
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.
See that issue for more background :
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.
Thanks. We already use that hack (global SVG with setupTests) in Gridstudy, we gonna do the same here. I use the jsdom environnement for tests, not the node.js one. I don't know if it would work.
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.
Indeed, it actually requires jsdom to work since svg.js works on the DOM.
It would allow svg.js to actually modify the DOM, in the unit test.
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
Signed-off-by: Etienne Homer <[email protected]>
const width: number = +svg.getAttribute('width'); | ||
const height: number = +svg.getAttribute('height'); | ||
const viewbox: VIEWBOX = svg.viewBox.baseVal; | ||
return { width: width, height: height, viewbox: viewbox }; |
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.
Add a test ?
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.
Svg manipulation isn't well supported with Jest. The test doesn't pass.
const width: number = +svg.getAttribute('width'); | ||
const height: number = +svg.getAttribute('height'); | ||
const viewbox: VIEWBOX = svg.viewBox.baseVal; | ||
return { width: width, height: height, viewbox: viewbox }; |
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.
Add a test ?
Signed-off-by: HOMER Etienne <[email protected]>
Signed-off-by: HOMER Etienne <[email protected]>
Signed-off-by: HOMER Etienne <[email protected]>
Signed-off-by: HOMER Etienne <[email protected]>
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
This PR gives a simple TS/JS component to integrate a network area diagram svg.