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

feat(explore): Dataset Panel Options when Source = Query II #20299

Merged
merged 4 commits into from
Jun 10, 2022

Conversation

lyndsiWilliams
Copy link
Member

SUMMARY

This adds a different dataset panel dropdown when a chart's datasource is a query.

SCREENSHOTS / ANIMATED GIF

queryDatasourcePanel

queryDatasourceSaveDatasetModal

queryDatasetPanel

TESTING INSTRUCTIONS

  • Open a chart with a query datasource type
  • Click the thee dots next to the chart name to reveal the dataset options dropdown
  • Observe that the options are now "Query preview", "View in SQL Lab", and "Save as dataset"
  • Click "View in SQL Lab" to be taken to SQL Lab
  • Click "Save as dataset" and observe the save dataset modal

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@superset-github-bot superset-github-bot bot added the Superset-Community-Partners Preset community partner program participants label Jun 7, 2022
@lyndsiWilliams lyndsiWilliams removed the Superset-Community-Partners Preset community partner program participants label Jun 7, 2022
</Menu>
);

const datasourceTypeCheck =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have this somewhere else? Also the current dataset is SlTable.. but I think I remember seeing us using Dataset?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh whoops, good catch! This already exists as isValidDatasourceType in DatasourcePanel/index.tsx here: https://github.com/apache/superset/blob/master/superset-frontend/src/explore/components/DatasourcePanel/index.tsx#L310-L314

So I'll move/export/use that one instead.

But it does include SlTable, as well as Dataset. I think it was set up that way to check for any of the DatasourceTypes (minus table and druid). Should I remove it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, since this still lives in two places, can we dry it up a bit with something like
Object.values(DatasourceType).includes(datasource.type)

Copy link
Member

@eschutho eschutho Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nm, I see that you removed it in the other component. Still possibly a good way to make it more succinct and potentially remove the import.

@lyndsiWilliams
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2022

@lyndsiWilliams Ephemeral environment spinning up at http://34.209.46.24:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@codecov
Copy link

codecov bot commented Jun 8, 2022

Codecov Report

Merging #20299 (c567756) into master (ba0c37d) will decrease coverage by 0.01%.
The diff coverage is 86.36%.

@@            Coverage Diff             @@
##           master   #20299      +/-   ##
==========================================
- Coverage   66.61%   66.60%   -0.02%     
==========================================
  Files        1733     1734       +1     
  Lines       64953    65007      +54     
  Branches     6858     6870      +12     
==========================================
+ Hits        43268    43296      +28     
- Misses      19929    19953      +24     
- Partials     1756     1758       +2     
Flag Coverage Δ
javascript 51.51% <86.36%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...re/components/controls/DatasourceControl/index.jsx 74.73% <85.71%> (+1.89%) ⬆️
...d/src/explore/components/DatasourcePanel/index.tsx 69.33% <100.00%> (-0.41%) ⬇️
...gin-chart-echarts/src/Timeseries/transformProps.ts 54.76% <0.00%> (-3.58%) ⬇️
...d/plugins/plugin-chart-echarts/src/utils/series.ts 84.40% <0.00%> (-3.10%) ⬇️
...lugin-chart-echarts/src/Timeseries/transformers.ts 50.00% <0.00%> (-0.40%) ⬇️
...ashboard/components/gridComponents/ChartHolder.jsx 57.77% <0.00%> (-0.18%) ⬇️
...perset-frontend/src/dashboard/containers/Chart.jsx 75.00% <0.00%> (ø)
...et-frontend/src/components/Chart/ChartRenderer.jsx 54.23% <0.00%> (ø)
...frontend/plugins/plugin-chart-echarts/src/types.ts 100.00% <0.00%> (ø)
...tend/plugins/plugin-chart-echarts/src/constants.ts 100.00% <0.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba0c37d...c567756. Read the comment docs.

overlay={datasourceMenu}
overlay={
isValidDatasourceType(datasource.type)
? queryDatasourceMenu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it just showing the query now for testing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only shows the query dropdown if the datasource is a query, it should not be showing at this point.

@@ -327,7 +321,7 @@ export default function DataSourcePanel({
placeholder={t('Search Metrics & Columns')}
/>
<div className="field-selections">
{isValidDatasourceType && showInfoboxCheck() && (
{isValidDatasourceType(datasource.type) && showInfoboxCheck() && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to show for only a certain type too?

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@eschutho eschutho merged commit c842c9e into apache:master Jun 10, 2022
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@lyndsiWilliams lyndsiWilliams deleted the lyndsi/query-dataset-panel-dropdown branch June 21, 2022 13:28
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/L 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants