You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/05/04 18:05:08 UTC
[GitHub] [superset] m-ajay opened a new pull request #14467: [WIP] fix(dashboard): Prevent char overflow when displaying chart description
m-ajay opened a new pull request #14467:
URL: https://github.com/apache/superset/pull/14467
### SUMMARY
This fixes issue #12643
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
<img width="554" alt="screenshot-before" src="https://user-images.githubusercontent.com/12539911/117048661-3c0c7300-ace1-11eb-9bfc-f50aa9391f0a.png">
After
<img width="549" alt="Screen Shot 2021-05-04 at 2 02 42 PM" src="https://user-images.githubusercontent.com/12539911/117048827-69f1b780-ace1-11eb-8c81-7d72de1d4d74.png">
### TEST PLAN
CI and manual test
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [x] Has associated issue:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] 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.
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] graceguo-supercat commented on a change in pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
graceguo-supercat commented on a change in pull request #14467:
URL: https://github.com/apache/superset/pull/14467#discussion_r626173442
##########
File path: superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
##########
@@ -164,6 +164,14 @@ export default class Chart extends React.Component {
clearTimeout(this.resizeTimeout);
}
+ componentDidUpdate(prevProps) {
+ // refresh chart when user toggles the description.
+ // fix for https://github.com/apache/superset/issues/12643
+ if (prevProps.isExpanded !== this.props.isExpanded) {
+ this.forceUpdate();
+ }
Review comment:
forceUpdate() is a solution but we should try to avoid all uses of forceUpdate() and only read from this.props and this.state in render().
So i suggest we do this:
- add `descriptionHeight` in component state, initial value = 0
- in `componentDidUpdate`, set descriptionHeight state like
```
const descriptionHeight =
this.props.isExpanded && this.descriptionRef
? this.descriptionRef.offsetHeight
: 0;
```
- in `shouldComponentUpdate`, if descriptionHeight state is changed, just like height state is change, should return true:
```
if (
nextState.width !== this.state.width ||
nextState.height !== this.state.height ||
nextState.descriptionHeight !== this.state.descriptionHeight
) {
return true;
}
```
- for `getChartHeight()` function , get chart content height by height and descriptionHeight:
```
getChartHeight() {
const headerHeight = this.getHeaderHeight();
return this.state.height - headerHeight - this.state.descriptionHeight;
}
```
--
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.
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] edited a comment on pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #14467:
URL: https://github.com/apache/superset/pull/14467#issuecomment-832171364
# [Codecov](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#14467](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (34a4fa1) into [master](https://codecov.io/gh/apache/superset/commit/21cf12a480acbfb94821ad7ec9b6cd78dbf7f2cf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (21cf12a) will **decrease** coverage by `0.00%`.
> The diff coverage is `88.88%`.
[](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #14467 +/- ##
==========================================
- Coverage 77.12% 77.12% -0.01%
==========================================
Files 954 953 -1
Lines 48175 48176 +1
Branches 6063 6053 -10
==========================================
Hits 37155 37155
- Misses 10819 10820 +1
Partials 201 201
```
| Flag | Coverage Δ | |
|---|---|---|
| javascript | `71.95% <88.88%> (-0.01%)` | :arrow_down: |
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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../src/dashboard/components/gridComponents/Chart.jsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0NoYXJ0LmpzeA==) | `81.18% <88.88%> (+1.80%)` | :arrow_up: |
| [...rc/views/CRUD/alert/components/AlertStatusIcon.tsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvYWxlcnQvY29tcG9uZW50cy9BbGVydFN0YXR1c0ljb24udHN4) | `46.96% <0.00%> (-0.80%)` | :arrow_down: |
| [...ols/MetricControl/AdhocMetricEditPopover/index.jsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9NZXRyaWNDb250cm9sL0FkaG9jTWV0cmljRWRpdFBvcG92ZXIvaW5kZXguanN4) | `78.29% <0.00%> (-0.50%)` | :arrow_down: |
| [superset-frontend/src/chart/chartAction.js](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L2NoYXJ0QWN0aW9uLmpz) | `52.70% <0.00%> (-0.27%)` | :arrow_down: |
| [superset-frontend/src/components/Select/styles.tsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L3N0eWxlcy50c3g=) | `84.72% <0.00%> (-0.21%)` | :arrow_down: |
| [...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlcnNDb25maWdGb3JtL0ZpbHRlcnNDb25maWdGb3JtLnRzeA==) | `70.23% <0.00%> (-0.18%)` | :arrow_down: |
| [superset-frontend/src/components/Icons/Icon.tsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvSWNvbnMvSWNvbi50c3g=) | `96.00% <0.00%> (ø)` | |
| [superset-frontend/src/components/Label/index.tsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTGFiZWwvaW5kZXgudHN4) | `100.00% <0.00%> (ø)` | |
| [...uperset-frontend/src/explore/exploreUtils/index.js](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvZXhwbG9yZVV0aWxzL2luZGV4Lmpz) | `66.25% <0.00%> (ø)` | |
| [...set-frontend/src/components/ListViewCard/index.tsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTGlzdFZpZXdDYXJkL2luZGV4LnRzeA==) | `100.00% <0.00%> (ø)` | |
| ... and [21 more](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [21cf12a...34a4fa1](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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.
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] junlincc commented on pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
junlincc commented on pull request #14467:
URL: https://github.com/apache/superset/pull/14467#issuecomment-832322778
/testenv up
--
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.
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] github-actions[bot] commented on pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14467:
URL: https://github.com/apache/superset/pull/14467#issuecomment-832986663
Ephemeral environment shutdown and build artifacts deleted.
--
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.
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 #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #14467:
URL: https://github.com/apache/superset/pull/14467#issuecomment-832171364
# [Codecov](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#14467](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d807142) into [master](https://codecov.io/gh/apache/superset/commit/21cf12a480acbfb94821ad7ec9b6cd78dbf7f2cf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (21cf12a) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #14467 +/- ##
=======================================
Coverage 77.12% 77.12%
=======================================
Files 954 954
Lines 48175 48178 +3
Branches 6063 6064 +1
=======================================
+ Hits 37155 37158 +3
Misses 10819 10819
Partials 201 201
```
| Flag | Coverage Δ | |
|---|---|---|
| javascript | `71.95% <100.00%> (+<0.01%)` | :arrow_up: |
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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../src/dashboard/components/gridComponents/Chart.jsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0NoYXJ0LmpzeA==) | `80.00% <100.00%> (+0.61%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [21cf12a...d807142](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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.
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] edited a comment on pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #14467:
URL: https://github.com/apache/superset/pull/14467#issuecomment-832171364
# [Codecov](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#14467](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d807142) into [master](https://codecov.io/gh/apache/superset/commit/21cf12a480acbfb94821ad7ec9b6cd78dbf7f2cf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (21cf12a) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.
> :exclamation: Current head d807142 differs from pull request most recent head 34a4fa1. Consider uploading reports for the commit 34a4fa1 to get more accurate results
[](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #14467 +/- ##
=======================================
Coverage 77.12% 77.12%
=======================================
Files 954 954
Lines 48175 48178 +3
Branches 6063 6064 +1
=======================================
+ Hits 37155 37158 +3
Misses 10819 10819
Partials 201 201
```
| Flag | Coverage Δ | |
|---|---|---|
| javascript | `71.95% <100.00%> (+<0.01%)` | :arrow_up: |
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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../src/dashboard/components/gridComponents/Chart.jsx](https://codecov.io/gh/apache/superset/pull/14467/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0NoYXJ0LmpzeA==) | `80.00% <100.00%> (+0.61%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [21cf12a...34a4fa1](https://codecov.io/gh/apache/superset/pull/14467?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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.
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] michael-s-molina commented on pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
michael-s-molina commented on pull request #14467:
URL: https://github.com/apache/superset/pull/14467#issuecomment-832826083
@m-ajay Can you change the PR description from "This fixes issue #12643" to "Fixes #12643" so that the issue is automatically closed when we merge this PR?
--
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.
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] graceguo-supercat commented on pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
graceguo-supercat commented on pull request #14467:
URL: https://github.com/apache/superset/pull/14467#issuecomment-832986378

--
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.
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] graceguo-supercat commented on a change in pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
graceguo-supercat commented on a change in pull request #14467:
URL: https://github.com/apache/superset/pull/14467#discussion_r626173442
##########
File path: superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
##########
@@ -164,6 +164,14 @@ export default class Chart extends React.Component {
clearTimeout(this.resizeTimeout);
}
+ componentDidUpdate(prevProps) {
+ // refresh chart when user toggles the description.
+ // fix for https://github.com/apache/superset/issues/12643
+ if (prevProps.isExpanded !== this.props.isExpanded) {
+ this.forceUpdate();
+ }
Review comment:
forceUpdate() is a solution but we should try to avoid all uses of forceUpdate() and only read from this.props and this.state in render().
So i suggest we do this:
- add `descriptionHeight` in component state, initial value = 0
- add `componentDidUpdate` so that we can set descriptionHeight state whenever `isExpanded` prop is changed:
```
componentDidUpdate(prevProps, prevState, snapshot) {
if (this.props.isExpanded !== prevProps.isExpanded) {
const descriptionHeight =
this.props.isExpanded && this.descriptionRef
? this.descriptionRef.offsetHeight
: 0;
this.setState({
descriptionHeight,
})
}
}
```
- in `shouldComponentUpdate`, if descriptionHeight state is changed, just like height state is change, should return true:
```
if (
nextState.width !== this.state.width ||
nextState.height !== this.state.height ||
nextState.descriptionHeight !== this.state.descriptionHeight
) {
return true;
}
```
- for `getChartHeight()` function , get chart content height by height and descriptionHeight:
```
getChartHeight() {
const headerHeight = this.getHeaderHeight();
return this.state.height - headerHeight - this.state.descriptionHeight;
}
```
--
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.
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] graceguo-supercat merged pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
graceguo-supercat merged pull request #14467:
URL: https://github.com/apache/superset/pull/14467
--
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.
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] graceguo-supercat commented on a change in pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
graceguo-supercat commented on a change in pull request #14467:
URL: https://github.com/apache/superset/pull/14467#discussion_r626173442
##########
File path: superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
##########
@@ -164,6 +164,14 @@ export default class Chart extends React.Component {
clearTimeout(this.resizeTimeout);
}
+ componentDidUpdate(prevProps) {
+ // refresh chart when user toggles the description.
+ // fix for https://github.com/apache/superset/issues/12643
+ if (prevProps.isExpanded !== this.props.isExpanded) {
+ this.forceUpdate();
+ }
Review comment:
forceUpdate() is a solution but we should try to avoid all uses of forceUpdate() and only read from this.props and this.state in render().
So i suggest we do this:
- add `descriptionHeight` in component state, initial value = 0
- add `componentDidUpdate` so that we can set descriptionHeight state whenever `isExpanded` prop is changed:
```
componentDidUpdate(prevProps, prevState, snapshot) {
if (this.props.isExpanded !== prevProps.isExpanded) {
const descriptionHeight =
this.props.isExpanded && this.descriptionRef
? this.descriptionRef.offsetHeight
: 0;
this.setState({
descriptionHeight,
})
}
}
```
- in `shouldComponentUpdate`, if descriptionHeight state is changed, just like height state is change, should return true:
```
if (
nextState.width !== this.state.width ||
nextState.height !== this.state.height ||
nextState.descriptionHeight !== this.state.descriptionHeight
) {
return true;
}
```
- in the end, `getChartHeight()` function should return chart content height by height and descriptionHeight:
```
getChartHeight() {
const headerHeight = this.getHeaderHeight();
return this.state.height - headerHeight - this.state.descriptionHeight;
}
```
--
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.
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] github-actions[bot] commented on pull request #14467: fix(dashboard): Prevent char overflow when displaying chart description
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14467:
URL: https://github.com/apache/superset/pull/14467#issuecomment-832323532
@junlincc Ephemeral environment spinning up at http://34.222.14.1:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.
--
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.
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