-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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): Frontend implementation of dataset creation from infobox #19855
Merged
lyndsiWilliams
merged 58 commits into
apache:master
from
preset-io:lyndsi/create-dataset-from-infobox
Jun 7, 2022
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
6487ee4
Frontend implementation of create dataset from infobox
lyndsiWilliams 2675ccb
Fixed sl_dataset type
lyndsiWilliams 0bbb69f
Fix test
lyndsiWilliams a5688f5
Fixed sl_dataset type (forgot to save)
lyndsiWilliams 8a3e4aa
RTL testing
lyndsiWilliams 3e1f913
Adjusted styling/text on infobox and save dataset modal
lyndsiWilliams d4afdfe
Appease lint
lyndsiWilliams c32412b
Make infobox invisible and fix tests
lyndsiWilliams 83d2173
Remove unnecessary placeholder
lyndsiWilliams 3430551
Move types to sql lab
lyndsiWilliams 2bdd51a
Moved logic into save dataset modal
lyndsiWilliams fe7085a
Change DatasourceMeta type to Dataset
lyndsiWilliams 29f74e2
Add ExploreDatasource union type to save dataset modal
lyndsiWilliams 7aeba6b
Get user info from redux inside save dataset modal
lyndsiWilliams 1d49ef5
Addressed comments
lyndsiWilliams 4c35710
Adjusting to new query type
lyndsiWilliams ff63e6a
Fixed save dataset in explore and union type
lyndsiWilliams d28edf4
Added testing
lyndsiWilliams 5ec5eed
Defined d for queries
lyndsiWilliams 65da6ac
Remove dataset from SaveDatasetModal
lyndsiWilliams 2ef4ad4
Clarify useSelector parameter
lyndsiWilliams 1729fe7
Fix dndControls union type
lyndsiWilliams 8a45aef
Fix shared-controls union type
lyndsiWilliams e4fc404
Fix controlPanel union type
lyndsiWilliams 106609a
Move ExploreRootState to explore type file
lyndsiWilliams 4028043
Remove unnecessary testing playground
lyndsiWilliams a9212ff
Move datasource type check in DatasourcePanel to a function
lyndsiWilliams eab9fc0
Make all sqllab Query imports reference @superset-ui/core Query type
lyndsiWilliams 9b14992
Deconstruct query props in ResultSet
lyndsiWilliams 8558460
Fix union type in /legacy-plugin-chart-heatmap/src/controlPanel
lyndsiWilliams c1fb8a6
Change SaveDatasetModal tests to RTL
lyndsiWilliams 9d225c4
Cleaned datasourceTypeCheck
lyndsiWilliams 383ec2e
Fix infobox styling
lyndsiWilliams a0c771b
Fix SaveDatasetModal test
lyndsiWilliams bc38438
Fix query fixture in sqllab and Query type in SaveDatasetModal test
lyndsiWilliams 91f06ea
Fix Query type and make test query fixture
lyndsiWilliams 55bb379
Added columns to Query type, separated results property, created Quer…
lyndsiWilliams dab90b4
Fixed a couple missed broken types
lyndsiWilliams c560456
Added ExploreDatasource to SqlLab type file
lyndsiWilliams 30f4508
Removed unneeded Query import from DatasourcePanel
lyndsiWilliams 6ee52ea
Address PR comments
lyndsiWilliams 1773954
Fix columnChoices
lyndsiWilliams 20ede6d
Fix all incorrect column property checks
lyndsiWilliams ccd3e3e
Fix logic on dndGroupByControl
lyndsiWilliams a585546
Dry up savedMetrics type check
lyndsiWilliams 5c93394
Fixed TIME_COLUMN_OPTION
lyndsiWilliams b9db9d2
Dried savedMetrics type check even further
lyndsiWilliams cea65ce
Change savedMetricsTypeCheck to defineSavedMetrics
lyndsiWilliams 90c20b2
Change datasourceTypeCheck to isValidDatasourceType
lyndsiWilliams faac391
Fix Query path in groupByControl
lyndsiWilliams ac671a4
dnd_granularity_sqla now sorts Query types with is_dttm at the top
lyndsiWilliams cf12f1d
Fixed/cleaned query sort
lyndsiWilliams 55c3a79
Merge branch 'master' into lyndsi/create-dataset-from-infobox
lyndsiWilliams 379d9a9
Add sortedQueryColumns and proper optional chaining to granularity_sqla
lyndsiWilliams 23923f4
Move testQuery to core-ui, add test coverage for Queries in columnCho…
lyndsiWilliams 430e43b
Moved DEFAULT_METRICS to core-ui and wrote a test for defineSavedMetrics
lyndsiWilliams 054ee97
Add license and clean dataset test object
lyndsiWilliams 5514305
Change DatasourceType.Dataset to dataset
lyndsiWilliams File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ import type { | |
JsonValue, | ||
Metric, | ||
QueryFormData, | ||
QueryResponse, | ||
QueryFormMetric, | ||
QueryFormColumn, | ||
} from '@superset-ui/core'; | ||
|
@@ -53,7 +54,7 @@ export type ColumnMeta = Omit<Column, 'id'> & { | |
id?: number; | ||
} & AnyDict; | ||
|
||
export interface DatasourceMeta { | ||
export interface Dataset { | ||
id: number; | ||
type: DatasourceType; | ||
columns: ColumnMeta[]; | ||
|
@@ -71,7 +72,7 @@ export interface DatasourceMeta { | |
|
||
export interface ControlPanelState { | ||
form_data: QueryFormData; | ||
datasource: DatasourceMeta | null; | ||
datasource: Dataset | QueryResponse | null; | ||
controls: ControlStateMapping; | ||
} | ||
|
||
|
@@ -90,7 +91,7 @@ export interface ActionDispatcher< | |
* Mapping of action dispatchers | ||
*/ | ||
export interface ControlPanelActionDispatchers { | ||
setDatasource: ActionDispatcher<[DatasourceMeta]>; | ||
setDatasource: ActionDispatcher<[Dataset]>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will need to be Query too in the future |
||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
superset-frontend/packages/superset-ui-chart-controls/src/utils/defineSavedMetrics.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-disable camelcase */ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
import { QueryResponse, DEFAULT_METRICS } from '@superset-ui/core'; | ||
import { Dataset } from '../types'; | ||
|
||
export const defineSavedMetrics = ( | ||
datasource: Dataset | QueryResponse | null, | ||
) => | ||
datasource?.hasOwnProperty('metrics') | ||
? (datasource as Dataset)?.metrics || [] | ||
: DEFAULT_METRICS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@lyndsiWilliams do you think you can dry up lines 45-60 more?
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.
actually, looks like we'll have to wait for the column name property to be the same first. 👍