You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "kgabryje (via GitHub)" <gi...@apache.org> on 2023/07/20 13:26:04 UTC
[GitHub] [superset] kgabryje opened a new pull request, #24755: feat: Add line width unit control in deckgl Polygon and Path
kgabryje opened a new pull request, #24755:
URL: https://github.com/apache/superset/pull/24755
### SUMMARY
Currently the default unit of line width in deckgl Path and Polygon charts is meter. That leads to some confusion, especially in large scale maps, because users might think that the line is not drawn at all - while in reality it's simply too thin to be visible. This PR addresses that problem by changing the default unit from meters to pixels.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
https://github.com/apache/superset/assets/15073128/dc590943-062b-4071-9d97-2d3edf85211e
### TESTING INSTRUCTIONS
1. Create a deckgl Path chart
2. Verify that the default line width unit is pixels and default line width is 1 and that drawn line is visible
3. Verify a deckgl Polygons chart
4. Check "Stroked" and uncheck "Extruded"
5. Verify that line between polygons is visible
6. Verify that existing charts still use meters unit
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [x] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [x] Migration is atomic, supports rollback & is backwards-compatible
- [x] Confirm DB migration upgrade and downgrade tested
- [x] Runtime estimates and downtime expectations provided
Current: 0.12 s
10+: 0.12 s
100+: 0.21 s
1000+: 0.13 s
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] kgabryje commented on a diff in pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on code in PR #24755:
URL: https://github.com/apache/superset/pull/24755#discussion_r1276551077
##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts:
##########
@@ -97,21 +97,34 @@ const config: ControlPanelConfig = {
{
label: t('Map'),
expanded: true,
- controlSetRows: [
- [mapboxStyle, viewport],
- [autozoom, null],
- ],
+ controlSetRows: [[mapboxStyle], [viewport], [autozoom]],
},
{
label: t('Polygon Settings'),
expanded: true,
controlSetRows: [
[fillColorPicker, strokeColorPicker],
[filled, stroked],
- [extruded, multiplier],
- [lineWidth, null],
+ [extruded],
+ [multiplier],
+ [lineWidth],
Review Comment:
I'm going to do the same in the rest of deckgl plugins in upcoming PRs, no more controls squished in 1 row π
##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts:
##########
@@ -97,21 +97,34 @@ const config: ControlPanelConfig = {
{
label: t('Map'),
expanded: true,
- controlSetRows: [
- [mapboxStyle, viewport],
- [autozoom, null],
- ],
+ controlSetRows: [[mapboxStyle], [viewport], [autozoom]],
},
{
label: t('Polygon Settings'),
expanded: true,
controlSetRows: [
[fillColorPicker, strokeColorPicker],
[filled, stroked],
- [extruded, multiplier],
- [lineWidth, null],
+ [extruded],
+ [multiplier],
+ [lineWidth],
Review Comment:
I'm going to do the same in the rest of deckgl plugins in upcoming PRs, no more controls squished in 1 row π
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] john-bodley commented on a diff in pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on code in PR #24755:
URL: https://github.com/apache/superset/pull/24755#discussion_r1270951833
##########
superset/migrations/versions/2023-07-19_17-54_ee179a490af9_deckgl_path_width_units.py:
##########
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""deckgl-path-width-units
+
+Revision ID: ee179a490af9
+Revises: 863adcf72773
+Create Date: 2023-07-19 17:54:06.752360
+
+"""
+import json
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy import Column, Integer, or_, String, Text
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+# revision identifiers, used by Alembic.
+revision = "ee179a490af9"
+down_revision = "863adcf72773"
+
+
+Base = declarative_base()
+
+
+class Slice(Base):
+ __tablename__ = "slices"
+ id = Column(Integer, primary_key=True)
+ viz_type = Column(String(250))
+ params = Column(Text)
+
+
+def upgrade():
+ bind = op.get_bind()
+ session = db.Session(bind=bind)
+ for slc in session.query(Slice).filter(
+ or_(
+ Slice.viz_type == "deck_path",
+ Slice.viz_type == "deck_geojson",
+ Slice.viz_type == "deck_polygon",
+ )
+ ):
+ params = json.loads(slc.params)
Review Comment:
@kgabryje would you mind adding a try/except around the `json.loads(...)` block as there could be instances where the JSON payload is corrupted. See https://github.com/apache/superset/pull/24737 for details.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] kgabryje commented on a diff in pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on code in PR #24755:
URL: https://github.com/apache/superset/pull/24755#discussion_r1272238508
##########
superset/migrations/versions/2023-07-19_17-54_ee179a490af9_deckgl_path_width_units.py:
##########
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""deckgl-path-width-units
+
+Revision ID: ee179a490af9
+Revises: 863adcf72773
+Create Date: 2023-07-19 17:54:06.752360
+
+"""
+import json
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy import Column, Integer, or_, String, Text
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+# revision identifiers, used by Alembic.
+revision = "ee179a490af9"
+down_revision = "863adcf72773"
+
+
+Base = declarative_base()
+
+
+class Slice(Base):
+ __tablename__ = "slices"
+ id = Column(Integer, primary_key=True)
+ viz_type = Column(String(250))
+ params = Column(Text)
+
+
+def upgrade():
+ bind = op.get_bind()
+ session = db.Session(bind=bind)
+ for slc in session.query(Slice).filter(
+ or_(
+ Slice.viz_type == "deck_path",
+ Slice.viz_type == "deck_geojson",
+ Slice.viz_type == "deck_polygon",
+ )
+ ):
+ params = json.loads(slc.params)
+ if not params.get("line_width_unit"):
+ params["line_width_unit"] = "meters"
+ slc.params = json.dumps(params)
+ session.merge(slc)
Review Comment:
Thanks for explanation!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] commented on pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #24755:
URL: https://github.com/apache/superset/pull/24755#issuecomment-1644258427
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#24755](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (66e0129) into [master](https://app.codecov.io/gh/apache/superset/commit/cb9b865a5398c479d221308ac6be1bd0a442f778?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (cb9b865) will **increase** coverage by `8.66%`.
> The diff coverage is `n/a`.
> :exclamation: Current head 66e0129 differs from pull request most recent head a2bb699. Consider uploading reports for the commit a2bb699 to get more accurate results
```diff
@@ Coverage Diff @@
## master #24755 +/- ##
==========================================
+ Coverage 58.35% 67.02% +8.66%
==========================================
Files 1901 1901
Lines 73933 73933
Branches 8183 8183
==========================================
+ Hits 43146 49550 +6404
+ Misses 28666 22262 -6404
Partials 2121 2121
```
| Flag | Coverage Ξ | |
|---|---|---|
| hive | `?` | |
| postgres | `79.30% <ΓΈ> (?)` | |
| presto | `?` | |
| python | `79.39% <ΓΈ> (+18.13%)` | :arrow_up: |
| sqlite | `77.89% <ΓΈ> (?)` | |
| unit | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ | |
|---|---|---|
| [...et-chart-deckgl/src/layers/Geojson/controlPanel.ts](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcHJlc2V0LWNoYXJ0LWRlY2tnbC9zcmMvbGF5ZXJzL0dlb2pzb24vY29udHJvbFBhbmVsLnRz) | `50.00% <ΓΈ> (ΓΈ)` | |
| [...egacy-preset-chart-deckgl/src/layers/Path/Path.jsx](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcHJlc2V0LWNoYXJ0LWRlY2tnbC9zcmMvbGF5ZXJzL1BhdGgvUGF0aC5qc3g=) | `0.00% <ΓΈ> (ΓΈ)` | |
| [...reset-chart-deckgl/src/layers/Path/controlPanel.ts](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcHJlc2V0LWNoYXJ0LWRlY2tnbC9zcmMvbGF5ZXJzL1BhdGgvY29udHJvbFBhbmVsLnRz) | `50.00% <ΓΈ> (ΓΈ)` | |
| [...preset-chart-deckgl/src/layers/Polygon/Polygon.jsx](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcHJlc2V0LWNoYXJ0LWRlY2tnbC9zcmMvbGF5ZXJzL1BvbHlnb24vUG9seWdvbi5qc3g=) | `0.00% <ΓΈ> (ΓΈ)` | |
| [...et-chart-deckgl/src/layers/Polygon/controlPanel.ts](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcHJlc2V0LWNoYXJ0LWRlY2tnbC9zcmMvbGF5ZXJzL1BvbHlnb24vY29udHJvbFBhbmVsLnRz) | `33.33% <ΓΈ> (ΓΈ)` | |
| [...reset-chart-deckgl/src/utilities/Shared\_DeckGL.jsx](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcHJlc2V0LWNoYXJ0LWRlY2tnbC9zcmMvdXRpbGl0aWVzL1NoYXJlZF9EZWNrR0wuanN4) | `86.48% <ΓΈ> (ΓΈ)` | |
| [superset/examples/deck.py](https://app.codecov.io/gh/apache/superset/pull/24755?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZXhhbXBsZXMvZGVjay5weQ==) | `0.00% <ΓΈ> (ΓΈ)` | |
... and [348 files with indirect coverage changes](https://app.codecov.io/gh/apache/superset/pull/24755/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
:mega: Weβre building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] villebro commented on a diff in pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #24755:
URL: https://github.com/apache/superset/pull/24755#discussion_r1271864168
##########
superset/examples/deck.py:
##########
@@ -387,6 +387,7 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements
"stroked": False,
"extruded": True,
"multiplier": 0.1,
+ "line_width": 10,
Review Comment:
Shouldn't we also add `"line_width_unit": "meters"` here, as the default unit is now being changed?
##########
superset/migrations/versions/2023-07-19_17-54_ee179a490af9_deckgl_path_width_units.py:
##########
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""deckgl-path-width-units
+
+Revision ID: ee179a490af9
+Revises: 863adcf72773
+Create Date: 2023-07-19 17:54:06.752360
+
+"""
+import json
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy import Column, Integer, or_, String, Text
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+# revision identifiers, used by Alembic.
+revision = "ee179a490af9"
+down_revision = "863adcf72773"
+
+
+Base = declarative_base()
+
+
+class Slice(Base):
+ __tablename__ = "slices"
+ id = Column(Integer, primary_key=True)
+ viz_type = Column(String(250))
+ params = Column(Text)
+
+
+def upgrade():
+ bind = op.get_bind()
+ session = db.Session(bind=bind)
+ for slc in session.query(Slice).filter(
+ or_(
+ Slice.viz_type == "deck_path",
+ Slice.viz_type == "deck_geojson",
+ Slice.viz_type == "deck_polygon",
+ )
+ ):
+ params = json.loads(slc.params)
+ if not params.get("line_width_unit"):
+ params["line_width_unit"] = "meters"
+ slc.params = json.dumps(params)
Review Comment:
I assume that this will impact nearly all charts that are found by the filter clause. But I agree, adding the indentation here is more prudent and will avoid unnecessary db work.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] john-bodley commented on a diff in pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on code in PR #24755:
URL: https://github.com/apache/superset/pull/24755#discussion_r1270953864
##########
superset/migrations/versions/2023-07-19_17-54_ee179a490af9_deckgl_path_width_units.py:
##########
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""deckgl-path-width-units
+
+Revision ID: ee179a490af9
+Revises: 863adcf72773
+Create Date: 2023-07-19 17:54:06.752360
+
+"""
+import json
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy import Column, Integer, or_, String, Text
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+# revision identifiers, used by Alembic.
+revision = "ee179a490af9"
+down_revision = "863adcf72773"
+
+
+Base = declarative_base()
+
+
+class Slice(Base):
+ __tablename__ = "slices"
+ id = Column(Integer, primary_key=True)
+ viz_type = Column(String(250))
+ params = Column(Text)
+
+
+def upgrade():
+ bind = op.get_bind()
+ session = db.Session(bind=bind)
+ for slc in session.query(Slice).filter(
+ or_(
+ Slice.viz_type == "deck_path",
+ Slice.viz_type == "deck_geojson",
+ Slice.viz_type == "deck_polygon",
+ )
+ ):
+ params = json.loads(slc.params)
+ if not params.get("line_width_unit"):
+ params["line_width_unit"] = "meters"
+ slc.params = json.dumps(params)
Review Comment:
Also per https://github.com/apache/superset/pull/24737 it's probably best to only update `slc.params` if the parameters were updated. There's likely only a handful of charts which need upgrading and thus there's no need to update them allβwhich adds unnecessary effort on the database.
##########
superset/migrations/versions/2023-07-19_17-54_ee179a490af9_deckgl_path_width_units.py:
##########
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""deckgl-path-width-units
+
+Revision ID: ee179a490af9
+Revises: 863adcf72773
+Create Date: 2023-07-19 17:54:06.752360
+
+"""
+import json
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy import Column, Integer, or_, String, Text
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+# revision identifiers, used by Alembic.
+revision = "ee179a490af9"
+down_revision = "863adcf72773"
+
+
+Base = declarative_base()
+
+
+class Slice(Base):
+ __tablename__ = "slices"
+ id = Column(Integer, primary_key=True)
+ viz_type = Column(String(250))
+ params = Column(Text)
+
+
+def upgrade():
+ bind = op.get_bind()
+ session = db.Session(bind=bind)
+ for slc in session.query(Slice).filter(
+ or_(
+ Slice.viz_type == "deck_path",
+ Slice.viz_type == "deck_geojson",
+ Slice.viz_type == "deck_polygon",
+ )
+ ):
+ params = json.loads(slc.params)
+ if not params.get("line_width_unit"):
+ params["line_width_unit"] = "meters"
+ slc.params = json.dumps(params)
+ session.merge(slc)
Review Comment:
There's no need to do a `session.merge(...)` here. Typically `merge` is used when you may have more than one in-memory objects which map to the same database record with some key.
##########
superset/migrations/versions/2023-07-19_17-54_ee179a490af9_deckgl_path_width_units.py:
##########
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""deckgl-path-width-units
+
+Revision ID: ee179a490af9
+Revises: 863adcf72773
+Create Date: 2023-07-19 17:54:06.752360
+
+"""
+import json
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy import Column, Integer, or_, String, Text
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+# revision identifiers, used by Alembic.
+revision = "ee179a490af9"
+down_revision = "863adcf72773"
+
+
+Base = declarative_base()
+
+
+class Slice(Base):
+ __tablename__ = "slices"
+ id = Column(Integer, primary_key=True)
+ viz_type = Column(String(250))
+ params = Column(Text)
+
+
+def upgrade():
+ bind = op.get_bind()
+ session = db.Session(bind=bind)
+ for slc in session.query(Slice).filter(
+ or_(
+ Slice.viz_type == "deck_path",
+ Slice.viz_type == "deck_geojson",
+ Slice.viz_type == "deck_polygon",
+ )
+ ):
+ params = json.loads(slc.params)
+ if not params.get("line_width_unit"):
+ params["line_width_unit"] = "meters"
+ slc.params = json.dumps(params)
Review Comment:
Also per https://github.com/apache/superset/pull/24737 it's probably best to only update `slc.params` if the parameters were updated. There's likely only a handful of charts which need upgrading and thus there's no need to update them allβwhich adds unnecessary effort on the database.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] kgabryje commented on a diff in pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on code in PR #24755:
URL: https://github.com/apache/superset/pull/24755#discussion_r1272242321
##########
superset/examples/deck.py:
##########
@@ -387,6 +387,7 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements
"stroked": False,
"extruded": True,
"multiplier": 0.1,
+ "line_width": 10,
Review Comment:
Great catch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] villebro commented on a diff in pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #24755:
URL: https://github.com/apache/superset/pull/24755#discussion_r1273708351
##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts:
##########
@@ -97,21 +97,34 @@ const config: ControlPanelConfig = {
{
label: t('Map'),
expanded: true,
- controlSetRows: [
- [mapboxStyle, viewport],
- [autozoom, null],
- ],
+ controlSetRows: [[mapboxStyle], [viewport], [autozoom]],
},
{
label: t('Polygon Settings'),
expanded: true,
controlSetRows: [
[fillColorPicker, strokeColorPicker],
[filled, stroked],
- [extruded, multiplier],
- [lineWidth, null],
+ [extruded],
+ [multiplier],
+ [lineWidth],
Review Comment:
*Finally* these are split onto their own rows π
##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts:
##########
@@ -97,21 +97,34 @@ const config: ControlPanelConfig = {
{
label: t('Map'),
expanded: true,
- controlSetRows: [
- [mapboxStyle, viewport],
- [autozoom, null],
- ],
+ controlSetRows: [[mapboxStyle], [viewport], [autozoom]],
},
{
label: t('Polygon Settings'),
expanded: true,
controlSetRows: [
[fillColorPicker, strokeColorPicker],
[filled, stroked],
- [extruded, multiplier],
- [lineWidth, null],
+ [extruded],
+ [multiplier],
+ [lineWidth],
Review Comment:
*Finally* these are split onto their own rows π
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] kgabryje commented on a diff in pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on code in PR #24755:
URL: https://github.com/apache/superset/pull/24755#discussion_r1272243701
##########
superset/migrations/versions/2023-07-19_17-54_ee179a490af9_deckgl_path_width_units.py:
##########
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""deckgl-path-width-units
+
+Revision ID: ee179a490af9
+Revises: 863adcf72773
+Create Date: 2023-07-19 17:54:06.752360
+
+"""
+import json
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy import Column, Integer, or_, String, Text
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+# revision identifiers, used by Alembic.
+revision = "ee179a490af9"
+down_revision = "863adcf72773"
+
+
+Base = declarative_base()
+
+
+class Slice(Base):
+ __tablename__ = "slices"
+ id = Column(Integer, primary_key=True)
+ viz_type = Column(String(250))
+ params = Column(Text)
+
+
+def upgrade():
+ bind = op.get_bind()
+ session = db.Session(bind=bind)
+ for slc in session.query(Slice).filter(
+ or_(
+ Slice.viz_type == "deck_path",
+ Slice.viz_type == "deck_geojson",
+ Slice.viz_type == "deck_polygon",
+ )
+ ):
+ params = json.loads(slc.params)
+ if not params.get("line_width_unit"):
+ params["line_width_unit"] = "meters"
+ slc.params = json.dumps(params)
Review Comment:
Yes that's exactly the case, but you're right - for the sake of code quality I added the indent
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] kgabryje merged pull request #24755: feat: Add line width unit control in deckgl Polygon and Path
Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje merged PR #24755:
URL: https://github.com/apache/superset/pull/24755
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org