-
Notifications
You must be signed in to change notification settings - Fork 16
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
Retrieve spatialDataColumn in TableWidget for its future usage #900
Retrieve spatialDataColumn in TableWidget for its future usage #900
Conversation
|
||
``` | ||
yarn build && ./copy-packages.sh ~/workspace/repositories/cloud-native/workspace-www/node_modules/@carto | ||
``` |
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.
@zbigg I've added this, as we both sometimes copy&paste content for the seek of pragmatism when developing things on Carto4React and testing them on cloud-native 😄
queryParams.spatialDataType = spatialDataType; | ||
if (spatialFilters) queryParams.spatialFilters = JSON.stringify(spatialFilters); | ||
if (spatialDataType) queryParams.spatialDataType = spatialDataType; | ||
if (spatialDataColumn) queryParams.spatialDataColumn = spatialDataColumn; |
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 only specifies which is the spatialDataColumn
and shouldn't affect other Widgets, but it's used from the Backend perspective for determining which column they should "transform", for more info see: https://github.com/CartoDB/cloud-native/pull/17146
@@ -121,6 +122,7 @@ function TableWidget({ | |||
height={height} | |||
dense={dense} | |||
isLoading={isLoading} | |||
onRowClick={onRowClick} |
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've added support for the onRowClick
event Handler to the TableWidget, because it needs support for this initiative 👍
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.
ok but add a new comment in the parm section please
Pull Request Test Coverage Report for Build 10770948415Details
💛 - Coveralls |
Visit the preview URL for this PR (updated for commit 9d90a71): https://cartodb-fb-storybook-react-dev--pr900-feature-438209-s-tkhjm3e2.web.app (expires Mon, 16 Sep 2024 10:06:45 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 517cc4d31d7e09cf277774e034094b67c301cd4c |
packages/react-api/src/api/model.js
Outdated
if (props.model === 'table') { | ||
queryParams.params = JSON.stringify({ | ||
...params, | ||
column: [...params.column, spatialDataColumn] |
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.
Very minor.
I would prefer special parameter that either hides (hiddenColumns
) some column or fetches extra column (invisiableColumns
) than magic that just adds geo column to fetched set.
App will have power to use whatever "extra" column it needs - even if current use case is to add exactly same column as spatialDataColumn
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 like it 🤔
The only "problem" I see is that we'll have to expose or move somewhere the extraction of the spatialDataColumn
, because it's the one we need to pass down as "hiddenColumns` or whatever name we decide to use, WDYT?
I've tried to keep the number of changes as minimal as possible because of being Carto4React, but I'm happy to make more obvious the retrieval of such columns, rather than hiding magic in the "core utility"
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.
Will share more details in Slack, but we are also working on adding the ability for the server to return a unique ID for all layers, by hashing the geometry. When a unique ID is available, perhaps fetching the entire geometry into the table widget is not necessary?
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 with @donmccurdy but it's something that we need to check in the server-side click initiative. Also, I'm worried if PS uses this widget and suddenly they will start receiving geometries. @jmgaya It would be possible to request the geometries as an optional parameter of the table widget?
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 think this if
is going to be difficult to adapt when we integrate carto-api-client
. The TableWidget has a columns
parameter that you could use to add the spatialDataColumn
and you would need an extra property to hide this column. I know that it requires more changes but I think that would be cleaner.
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.
When a unique ID is available, perhaps fetching the entire geometry into the table widget is not necessary?
Yup, I think this makes total sense! However, it's not ready yet, but we should probably re-visit this once we merge this 👍
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 think this if is going to be difficult to adapt when we integrate carto-api-client
Absolutely agree! I've tried to keep this as minimal as possible, but in terms of reusability, we can handle this in a different way, let me propose something else 👍
@@ -121,6 +122,7 @@ function TableWidget({ | |||
height={height} | |||
dense={dense} | |||
isLoading={isLoading} | |||
onRowClick={onRowClick} |
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.
ok but add a new comment in the parm section please
packages/react-api/src/api/model.js
Outdated
if (props.model === 'table') { | ||
queryParams.params = JSON.stringify({ | ||
...params, | ||
column: [...params.column, spatialDataColumn] |
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 with @donmccurdy but it's something that we need to check in the server-side click initiative. Also, I'm worried if PS uses this widget and suddenly they will start receiving geometries. @jmgaya It would be possible to request the geometries as an optional parameter of the table widget?
packages/react-api/src/api/model.js
Outdated
if (props.model === 'table') { | ||
queryParams.params = JSON.stringify({ | ||
...params, | ||
column: [...params.column, spatialDataColumn] |
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 think this if
is going to be difficult to adapt when we integrate carto-api-client
. The TableWidget has a columns
parameter that you could use to add the spatialDataColumn
and you would need an extra property to hide this column. I know that it requires more changes but I think that would be cleaner.
Description
Shortcut: https://app.shortcut.com/cartoteam/story/438209/add-support-for-geocolumn-spatialdatacolumn-when-retrieving-table-widget-information?cf_workflow=500091853&ct_workflow=all&vc_group_by=day
Sending this to the API should give us back the information about the
spatialDataColumn
, which we'll use afterward for zooming into the coordinateType of change