-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create dataset blank state (#21058)
* beginning of routing * elizabeth review * changed folder layout * Dataset layout setup * Fix DatasetLayout test * Fixed height issue * Fix link to sqllab * Fix DatasetPanel test * Remove arbitrary right panel * Add empty state SVGs * Restructure/rename some Dataset files * Fixed styling issue * Fix background color * Fix header border * Fix empty DatasetPanel styles * Adjust description rendering in DatasetPanel to fix tests * Add spaces back to blank dataset description to fix tests * Fix blank dataset description styles Co-authored-by: AAfghahi <arash.afghahi@gmail.com>
- Loading branch information
1 parent
52648ec
commit 6094274
Showing
21 changed files
with
560 additions
and
24 deletions.
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
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(); | ||
}); | ||
}); |
55 changes: 55 additions & 0 deletions
55
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,55 @@ | ||
/** | ||
* 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, styled } from '@superset-ui/core'; | ||
import { EmptyStateBig } from 'src/components/EmptyState'; | ||
|
||
const StyledEmptyStateBig = styled(EmptyStateBig)` | ||
p { | ||
width: ${({ theme }) => theme.gridUnit * 115}px; | ||
} | ||
`; | ||
|
||
const renderDescription = () => ( | ||
<> | ||
{t( | ||
'Datasets can be created from database tables or SQL queries. Select 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 SQL Lab. From there you can save the query as a dataset.')} | ||
</> | ||
); | ||
|
||
export default function DatasetPanel() { | ||
return ( | ||
<StyledEmptyStateBig | ||
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.
Oops, something went wrong.