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 2023/01/11 20:15:35 UTC

[GitHub] [superset] codyml opened a new pull request, #22693: fix(explore): Restore missing dataset states

codyml opened a new pull request, #22693:
URL: https://github.com/apache/superset/pull/22693

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   This PR fixes Explore's dataset control so it correctly displays the intended UI when the chart's dataset doesn't exist or Explore has been opened without a specified chart or dataset.
   
   Prior to moving Explore into the SPA, `DatasourceControl` (the dataset picker in the upper left) would check for a dataset ID of `null` to determine if the current chart's dataset existed.  As part of moving Explore into the SPA, the initial Explore state in Redux was set to [this object](https://github.com/apache/superset/blob/539936522fbbda46ebb39b65ed298f6e251a548f/superset-frontend/src/explore/fixtures.tsx#L146), which has the dataset ID set to `0`.  When a user opens Explore for a chart whose dataset does not exist, or when Explore is opened without a specified chart (this happens for new charts) and also without a dataset specified (this should only happen by accident), the initial Explore state's dataset object is not overwritten.  Because `DatasourceControl` is checking for an ID of `null`, it doesn't correctly identify these cases as empty dataset situations, and shows options that should only be present in situations when there is a dataset and don't work correctly when 
 no dataset is present.
   
   This PR:
   - Makes Explore check for a dataset ID of 0, so the empty dataset alerts that were already present in code appear again
   - Hides the "Edit Dataset" and "View in SQL Lab" menu items, which don't work without a dataset
   - Makes the "missing dataset" text translated and a little more human-readable
   - Adds tests
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   Chart with missing dataset, before:
   ![localhost_9000_explore__slice_id=152 (1)](https://user-images.githubusercontent.com/13007381/211907567-22027b54-112e-421a-b0a3-7dc161ee67a8.png)
   
   Chart with missing dataset, after:
   ![localhost_9000_explore__slice_id=152 (2)](https://user-images.githubusercontent.com/13007381/211907653-c9ac7e27-218c-4430-b670-01a2cd3a9329.png)
   
   No chart with no dataset specified (e.g. from visiting `/explore` with no query string), before:
   ![localhost_9000_explore_](https://user-images.githubusercontent.com/13007381/211907582-54084b82-c8c3-47a4-ae79-f93e7c6feb80.png)
   
   No chart with no dataset specified, after:
   ![localhost_9000_explore_ (1)](https://user-images.githubusercontent.com/13007381/211907630-0ae991bb-6992-4f7c-b3c0-4953c9b3159e.png)
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   - Create and save a chart based on a dataset, then delete that dataset.  Open that chart again and confirm that the correct message (dataset was deleted) appears under `DatasourceControl` and that the only menu option in the `DatasourceControl` three-dots menu is "Swap dataset".
   - Check that swapping the dataset via button or via menu item makes the message disappear and allows for chart editing/saving.
   - Visit `/explore` and confirm that the correct message (missing URL params) appears under `DatasourceControl` and that the only menu option in the `DatasourceControl` three-dots menu is "Swap dataset".
   - Check that swapping the dataset via menu item makes the message disappear and allows for chart editing/saving.
   - Check that creating charts from the Add Chart page works the same as before.
   - Check that editing existing charts with existing datasets works the same as before.
   - Check that creating charts from a SQL Lab query works the same, before and after saving the dataset.
   
   ### 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:
   - [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.

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] codyml commented on a diff in pull request #22693: fix(explore): Restore missing dataset states

Posted by GitBox <gi...@apache.org>.
codyml commented on code in PR #22693:
URL: https://github.com/apache/superset/pull/22693#discussion_r1068476725


##########
superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx:
##########
@@ -267,11 +267,12 @@ class DatasourceControl extends React.PureComponent {
       showSaveDatasetModal,
     } = this.state;
     const { datasource, onChange, theme } = this.props;
-    const isMissingDatasource = datasource?.id == null;
+    const isMissingDatasource = !datasource || datasource.id === 0;

Review Comment:
   That's cleaner, thanks!  This now also covers the original `null` case in case it's still used somewhere I couldn't find, which is probably good.



-- 
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] codyml commented on pull request #22693: fix(explore): Restore missing dataset states

Posted by GitBox <gi...@apache.org>.
codyml commented on PR #22693:
URL: https://github.com/apache/superset/pull/22693#issuecomment-1382081654

   @eschutho thanks, feel free to merge!


-- 
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 #22693: fix(explore): Restore missing dataset states

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #22693:
URL: https://github.com/apache/superset/pull/22693#issuecomment-1379500591

   # [Codecov](https://codecov.io/gh/apache/superset/pull/22693?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 [#22693](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c8e677c) into [master](https://codecov.io/gh/apache/superset/commit/c0aeb2a75a06694402be0f15d1eb64631d3b9ef9?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c0aeb2a) will **decrease** coverage by `0.01%`.
   > The diff coverage is `71.42%`.
   
   > :exclamation: Current head c8e677c differs from pull request most recent head f6e1992. Consider uploading reports for the commit f6e1992 to get more accurate results
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #22693      +/-   ##
   ==========================================
   - Coverage   67.10%   67.08%   -0.02%     
   ==========================================
     Files        1869     1869              
     Lines       71580    71591      +11     
     Branches     7806     7824      +18     
   ==========================================
   - Hits        48031    48027       -4     
   - Misses      21521    21536      +15     
     Partials     2028     2028              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `53.92% <74.60%> (-0.04%)` | :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/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...-chart-controls/src/sections/advancedAnalytics.tsx](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY2hhcnQtY29udHJvbHMvc3JjL3NlY3Rpb25zL2FkdmFuY2VkQW5hbHl0aWNzLnRzeA==) | `14.28% <ø> (ø)` | |
   | [...rt-controls/src/shared-controls/sharedControls.tsx](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY2hhcnQtY29udHJvbHMvc3JjL3NoYXJlZC1jb250cm9scy9zaGFyZWRDb250cm9scy50c3g=) | `55.17% <ø> (ø)` | |
   | [...ui-core/src/chart/components/FallbackComponent.tsx](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvY2hhcnQvY29tcG9uZW50cy9GYWxsYmFja0NvbXBvbmVudC50c3g=) | `100.00% <ø> (ø)` | |
   | [...et-ui-core/src/chart/components/SuperChartCore.tsx](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvY2hhcnQvY29tcG9uZW50cy9TdXBlckNoYXJ0Q29yZS50c3g=) | `100.00% <ø> (ø)` | |
   | [...ackages/superset-ui-core/src/utils/featureFlags.ts](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdXRpbHMvZmVhdHVyZUZsYWdzLnRz) | `100.00% <ø> (ø)` | |
   | [...s/legacy-plugin-chart-calendar/src/controlPanel.ts](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcGx1Z2luLWNoYXJ0LWNhbGVuZGFyL3NyYy9jb250cm9sUGFuZWwudHM=) | `50.00% <ø> (ø)` | |
   | [...s/legacy-plugin-chart-heatmap/src/controlPanel.tsx](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcGx1Z2luLWNoYXJ0LWhlYXRtYXAvc3JjL2NvbnRyb2xQYW5lbC50c3g=) | `57.14% <ø> (ø)` | |
   | [...ns/legacy-plugin-chart-horizon/src/controlPanel.ts](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcGx1Z2luLWNoYXJ0LWhvcml6b24vc3JjL2NvbnRyb2xQYW5lbC50cw==) | `100.00% <ø> (ø)` | |
   | [...ns/legacy-plugin-chart-map-box/src/controlPanel.ts](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcGx1Z2luLWNoYXJ0LW1hcC1ib3gvc3JjL2NvbnRyb2xQYW5lbC50cw==) | `30.00% <0.00%> (ø)` | |
   | [...legacy-plugin-chart-partition/src/controlPanel.tsx](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9sZWdhY3ktcGx1Z2luLWNoYXJ0LXBhcnRpdGlvbi9zcmMvY29udHJvbFBhbmVsLnRzeA==) | `25.00% <ø> (ø)` | |
   | ... and [116 more](https://codecov.io/gh/apache/superset/pull/22693?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :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=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.

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] rusackas merged pull request #22693: fix(explore): Restore missing dataset states

Posted by GitBox <gi...@apache.org>.
rusackas merged PR #22693:
URL: https://github.com/apache/superset/pull/22693


-- 
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] eschutho commented on a diff in pull request #22693: fix(explore): Restore missing dataset states

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #22693:
URL: https://github.com/apache/superset/pull/22693#discussion_r1068804885


##########
superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx:
##########
@@ -267,11 +267,12 @@ class DatasourceControl extends React.PureComponent {
       showSaveDatasetModal,
     } = this.state;
     const { datasource, onChange, theme } = this.props;
-    const isMissingDatasource = datasource?.id == null;
+    const isMissingDatasource = !datasource || datasource.id === 0;

Review Comment:
   yeah, that's it. 👍 
   



-- 
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] eschutho commented on a diff in pull request #22693: fix(explore): Restore missing dataset states

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #22693:
URL: https://github.com/apache/superset/pull/22693#discussion_r1067590207


##########
superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx:
##########
@@ -267,11 +267,12 @@ class DatasourceControl extends React.PureComponent {
       showSaveDatasetModal,
     } = this.state;
     const { datasource, onChange, theme } = this.props;
-    const isMissingDatasource = datasource?.id == null;
+    const isMissingDatasource = !datasource || datasource.id === 0;

Review Comment:
   Would this also work? 
   ```suggestion
       const isMissingDatasource = !!datasource?.id
   ```



-- 
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] codyml commented on a diff in pull request #22693: fix(explore): Restore missing dataset states

Posted by GitBox <gi...@apache.org>.
codyml commented on code in PR #22693:
URL: https://github.com/apache/superset/pull/22693#discussion_r1068484288


##########
superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx:
##########
@@ -267,11 +267,12 @@ class DatasourceControl extends React.PureComponent {
       showSaveDatasetModal,
     } = this.state;
     const { datasource, onChange, theme } = this.props;
-    const isMissingDatasource = datasource?.id == null;
+    const isMissingDatasource = !datasource || datasource.id === 0;

Review Comment:
   Actually sorry, `!!datasource?.id` doesn't work but `!datasource?.id` works.  Is that what you meant?



-- 
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