Skip to content
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

Convert DeckGlMap component to typescript #769

Closed
hkfb opened this issue Jan 21, 2022 · 5 comments · Fixed by #783
Closed

Convert DeckGlMap component to typescript #769

hkfb opened this issue Jan 21, 2022 · 5 comments · Fixed by #783
Assignees
Labels
AspenTech Task owned by AspenTech maintenance map-component Issues related to the map component.

Comments

@hkfb
Copy link
Collaborator

hkfb commented Jan 21, 2022

Related to #610

@hkfb hkfb added maintenance AspenTech Task owned by AspenTech map-component Issues related to the map component. labels Jan 21, 2022
@shadab-skhan shadab-skhan self-assigned this Jan 25, 2022
shadab-skhan pushed a commit to shadab-skhan/webviz-subsurface-components that referenced this issue Jan 28, 2022
@shadab-skhan
Copy link
Contributor

Seems to be blocked by this issue in dash
plotly/dash#719

@anders-kiaer
Copy link
Collaborator

anders-kiaer commented Feb 1, 2022

Do you have some more details on the error/issue you see @shadab-skhan? 🙂

I'm not fully into the details, but think we have done this already in webviz-core-components components folder (https://github.com/equinor/webviz-core-components/tree/master/react/src/lib/components) where all components are .tsx. To my understanding the npm transpile build command both in that repository and here in this one(?) converts .tsx to .jsx (such that only .tsx needs to go into git and the version control).

@shadab-skhan
Copy link
Contributor

The issue I am getting is after build, generated DeckGLMap.py doesn't contains python docstring and list of available_properties is empty, because of which the dash app isn't able to recognize the props.

I think the possible solution to fix this is to declare PropTypes in tsx file.

@anders-kiaer
Copy link
Collaborator

👍 Something you have seen previously as well @rubenthoms?

@rubenthoms
Copy link
Collaborator

There is no way around defining PropTypes yet since dash-generate-components is depending on them to identify the properties and their descriptions required in Python. It is possible to completely change to TypeScript though, but it requires an extra step where (only!) all main component files are transpiled to JS before dash-generate-components is run. In wcc we transpile first and then remove all subfolders in the components directories before we run dash-generate-components. This is in order to prevent the creation of Python wrappers for subcomponents. PropTypes are still necessary though (no identification of TypeScript types).

FYI: Dash utilizes react-docgen to extract meta information: https://github.com/reactjs/react-docgen.

See also:
https://github.com/plotly/dash/blob/3334c07f59cb1ee9bc4596ebbdce6edb41f94968/dash/development/component_generator.py#L39-L73
https://github.com/plotly/dash/blob/e8ac94919105a91c76a966c21aca2ec7b0297e22/dash/extract-meta.js#L81-L97

shadab-skhan pushed a commit to shadab-skhan/webviz-subsurface-components that referenced this issue Feb 8, 2022
shadab-skhan added a commit that referenced this issue Feb 9, 2022
* Convert DeckGlMap component to typescript
Closes #769

* correct proptypes

* Move setEditedData callback to userData prop

* Added COlorTables prop

* removed extra code

Co-authored-by: Shadab Khan <Shadab.Khan@Emerson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AspenTech Task owned by AspenTech maintenance map-component Issues related to the map component.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants