-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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: Create dataset blank state #21058
Merged
Merged
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1298c6a
beginning of routing
AAfghahi d1ac6b0
elizabeth review
AAfghahi 1ccdc90
changed folder layout
AAfghahi 92ebcee
Dataset layout setup
lyndsiWilliams a879d84
Fix DatasetLayout test
lyndsiWilliams d2f2337
Fixed height issue
lyndsiWilliams 78ce3d6
Fix link to sqllab
lyndsiWilliams 263601f
Fix DatasetPanel test
lyndsiWilliams f697bea
Remove arbitrary right panel
lyndsiWilliams c5c7f9e
Add empty state SVGs
lyndsiWilliams 68867b2
Restructure/rename some Dataset files
lyndsiWilliams c495811
Fixed styling issue
lyndsiWilliams 0e6d9c8
Fix background color
lyndsiWilliams c654c4f
Fix header border
lyndsiWilliams 4623fce
Fix empty DatasetPanel styles
lyndsiWilliams 0e3016d
Adjust description rendering in DatasetPanel to fix tests
lyndsiWilliams 30d733a
Add spaces back to blank dataset description to fix tests
lyndsiWilliams ecf3314
Fix blank dataset description styles
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
42 changes: 42 additions & 0 deletions
42
superset-frontend/src/views/CRUD/data/dataset/AddDataset/AddDataset.test.tsx
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,42 @@ | ||
/** | ||
* 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 React from 'react'; | ||
import { render, screen } from 'spec/helpers/testing-library'; | ||
import AddDataset from 'src/views/CRUD/data/dataset/AddDataset'; | ||
|
||
describe('AddDataset', () => { | ||
it('renders a blank state AddDataset', () => { | ||
render(<AddDataset />); | ||
|
||
const blankeStateImgs = screen.getAllByRole('img', { name: /empty/i }); | ||
|
||
// Header | ||
expect(screen.getByText(/header/i)).toBeVisible(); | ||
// Left panel | ||
expect(blankeStateImgs[0]).toBeVisible(); | ||
expect(screen.getByText(/no database tables found/i)).toBeVisible(); | ||
// Database panel | ||
expect(blankeStateImgs[1]).toBeVisible(); | ||
expect(screen.getByText(/select dataset source/i)).toBeVisible(); | ||
// Footer | ||
expect(screen.getByText(/footer/i)).toBeVisible(); | ||
|
||
expect(blankeStateImgs.length).toBe(2); | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/DatasetPanel.test.tsx
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,41 @@ | ||
/** | ||
* 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 React from 'react'; | ||
import { render, screen } from 'spec/helpers/testing-library'; | ||
import DatasetPanel from 'src/views/CRUD/data/dataset/AddDataset/DatasetPanel'; | ||
|
||
describe('DatasetPanel', () => { | ||
it('renders a blank state DatasetPanel', () => { | ||
render(<DatasetPanel />); | ||
|
||
const blankDatasetImg = screen.getByRole('img', { name: /empty/i }); | ||
const blankDatasetTitle = screen.getByText(/select dataset source/i); | ||
const blankDatasetDescription = screen.getByText( | ||
/datasets can be created from database tables or sql queries\. select a database table to the left or to open sql lab\. from there you can save the query as a dataset\./i, | ||
); | ||
const sqlLabLink = screen.getByRole('button', { | ||
name: /create dataset from sql query/i, | ||
}); | ||
|
||
expect(blankDatasetImg).toBeVisible(); | ||
expect(blankDatasetTitle).toBeVisible(); | ||
expect(blankDatasetDescription).toBeVisible(); | ||
expect(sqlLabLink).toBeVisible(); | ||
}); | ||
}); |
53 changes: 53 additions & 0 deletions
53
superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
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,53 @@ | ||
/** | ||
* 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 React from 'react'; | ||
import { t } from '@superset-ui/core'; | ||
import { EmptyStateBig } from 'src/components/EmptyState'; | ||
|
||
const renderDescription = () => ( | ||
<> | ||
{t('Datasets can be created from database tables or SQL queries. Select ')} | ||
<br /> | ||
{t('a database table to the left or ')} | ||
<span | ||
role="button" | ||
onClick={() => { | ||
window.location.href = `/superset/sqllab`; | ||
}} | ||
tabIndex={0} | ||
> | ||
{t('create dataset from SQL query')} | ||
</span> | ||
{t(' to open ')} | ||
<br /> | ||
{t('SQL Lab. From there you can save the query as a 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. Same here on these. 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. Fixed in |
||
</> | ||
); | ||
|
||
export default function DatasetPanel() { | ||
return ( | ||
<> | ||
<EmptyStateBig | ||
image="empty-dataset.svg" | ||
title={t('Select dataset source')} | ||
description={renderDescription()} | ||
/> | ||
</> | ||
); | ||
} |
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
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
superset-frontend/src/views/CRUD/data/dataset/AddDataset/Header/Header.test.tsx
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 @@ | ||
/** | ||
* 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 React from 'react'; | ||
import { render, screen } from 'spec/helpers/testing-library'; | ||
import Header from 'src/views/CRUD/data/dataset/AddDataset/Header'; | ||
|
||
describe('Header', () => { | ||
it('renders a blank state Header', () => { | ||
render(<Header />); | ||
|
||
expect(screen.getByText(/header/i)).toBeVisible(); | ||
}); | ||
}); |
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/LeftPanel.test.tsx
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,31 @@ | ||
/** | ||
* 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 React from 'react'; | ||
import { render, screen } from 'spec/helpers/testing-library'; | ||
import LeftPanel from 'src/views/CRUD/data/dataset/AddDataset/LeftPanel'; | ||
|
||
describe('LeftPanel', () => { | ||
it('renders a blank state LeftPanel', () => { | ||
render(<LeftPanel />); | ||
|
||
expect(screen.getByRole('img', { name: /empty/i })).toBeVisible(); | ||
expect(screen.getByText(/no database tables found/i)).toBeVisible(); | ||
expect(screen.getByText(/try selecting a different schema/i)).toBeVisible(); | ||
}); | ||
}); |
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/src/views/CRUD/data/dataset/AddDataset/RightPanel/RightPanel.test.tsx
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 @@ | ||
/** | ||
* 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 React from 'react'; | ||
import { render, screen } from 'spec/helpers/testing-library'; | ||
import RightPanel from 'src/views/CRUD/data/dataset/AddDataset/RightPanel'; | ||
|
||
describe('RightPanel', () => { | ||
it('renders a blank state RightPanel', () => { | ||
render(<RightPanel />); | ||
|
||
expect(screen.getByText(/right panel/i)).toBeVisible(); | ||
}); | ||
}); |
File renamed without changes.
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
File renamed without changes.
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.
any reason why this isn't in a p tag and wrapping on its own?
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.
It causes the tests to break with this error:
![Screen Shot 2022-08-18 at 9 13 37 PM](https://user-images.githubusercontent.com/55605634/185527715-6781f6c7-42b3-4a97-99fd-d451cfbfd358.png)
It did the same when I tried wrapping it in a div as well, so I broke it up since the EmptyStateBig component didn't like anything other than the fragments.
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.
Fixed in
this commit
.