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: Create dataset header component #21189

Merged
merged 6 commits into from
Sep 14, 2022

Conversation

lyndsiWilliams
Copy link
Member

SUMMARY

This is the blank state implementation of the header component for the create dataset page. This PR also adds an option tooltip to the button in the PageHeaderWithActions component.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE:

layoutWithHeaderBefore

AFTER:

layoutWithHeaderAfter

headerAfter

TESTING INSTRUCTIONS

  • Go to http://localhost:9000/dataset/add/?testing
  • Observe the header component
  • Click the dataset name textbox and change the text by either pressing enter or clicking out of the box
    • Observe the text change
  • Mousehover over the disabled save and menu buttons on the left
    • Observe the tooltip

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

@codecov
Copy link

codecov bot commented Aug 24, 2022

Codecov Report

Merging #21189 (c3e3544) into master (973d870) will decrease coverage by 0.01%.
The diff coverage is 95.65%.

@@            Coverage Diff             @@
##           master   #21189      +/-   ##
==========================================
- Coverage   66.61%   66.59%   -0.02%     
==========================================
  Files        1791     1791              
  Lines       68542    68554      +12     
  Branches     7318     7319       +1     
==========================================
- Hits        45656    45653       -3     
- Misses      20987    21008      +21     
+ Partials     1899     1893       -6     
Flag Coverage Δ
hive 53.06% <ø> (ø)
javascript 52.76% <95.65%> (-0.03%) ⬇️
mysql 78.17% <ø> (ø)
postgres 78.23% <ø> (ø)
presto 52.96% <ø> (ø)
python 81.38% <ø> (ø)
sqlite 76.73% <ø> (ø)
unit 51.07% <ø> (ø)

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

Impacted Files Coverage Δ
...end/src/components/PageHeaderWithActions/index.tsx 90.00% <ø> (ø)
superset-frontend/src/components/Tooltip/index.tsx 100.00% <ø> (ø)
...iews/CRUD/data/dataset/AddDataset/Header/index.tsx 87.50% <87.50%> (-12.50%) ⬇️
...d/src/views/CRUD/data/dataset/AddDataset/index.tsx 42.85% <100.00%> (+9.52%) ⬆️
...rc/views/CRUD/data/dataset/DatasetLayout/index.tsx 100.00% <100.00%> (ø)
...set-frontend/src/views/CRUD/data/dataset/styles.ts 100.00% <100.00%> (ø)
...rd/components/nativeFilters/FilterBar/keyValue.tsx 18.51% <0.00%> (-22.23%) ⬇️
...board/components/nativeFilters/FilterBar/index.tsx 60.14% <0.00%> (-5.80%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link
Contributor

Storybook has completed and can be viewed at

@lyndsiWilliams
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

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

Comment on lines 161 to 162
tooltip={tooltipProps?.text ?? undefined}
placement={tooltipProps?.placement ?? undefined}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tooltip={tooltipProps?.text ?? undefined}
placement={tooltipProps?.placement ?? undefined}
tooltip={tooltipProps?.text}
placement={tooltipProps?.placement}

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in this commit.

@@ -19,6 +19,7 @@
import React, { ReactNode, ReactElement } from 'react';
import { css, SupersetTheme, t, useTheme } from '@superset-ui/core';
import { AntdDropdown, AntdDropdownProps } from 'src/components';
import { TooltipPlacement } from 'antd/es/tooltip';
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind exporting this from the Tooltip component in our components library and then importing it here? I think we should centralize all the components related things and avoid accessing antd directly

Copy link
Member Author

Choose a reason for hiding this comment

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

Good thinking! Fixed in this commit.

import AddDataset from 'src/views/CRUD/data/dataset/AddDataset';

describe('AddDataset', () => {
it('renders a blank state AddDataset', () => {
render(<AddDataset />);
const renderAndWait = async () => {
Copy link
Member

@geido geido Aug 25, 2022

Choose a reason for hiding this comment

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

If the purpose here to wait until the component has finished loading, you can use something like this

const waitForRender = () => waitFor(() => render(<AddDataset />));

await waitForRender();

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 yeah that's a lot cleaner! Fixed in this commit.


const editableTitleProps = {
title: '',
placeholder: 'Add the name of the dataset',
Copy link
Member

Choose a reason for hiding this comment

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

I think all the text in this file needs to be localized

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, fixed in this commit.

placement: 'bottomRight',
};

const Styles = styled.div`
Copy link
Member

Choose a reason for hiding this comment

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

should this go into styles?

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 yeah good call, fixed in this commit.

}
`;

const disabledSaveBtnStyles = (theme: SupersetTheme) => css`
Copy link
Member

Choose a reason for hiding this comment

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

same with this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also fixed in this commit.


export default function Header() {
return <div>Header</div>;
return (
Copy link
Member

Choose a reason for hiding this comment

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

hey, quick question in regards to the save button. What happens, currently, when I press save? I believe that we have a state action that is supposed to put the name into state. Does it currently do that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, I have the data properly flowing now in this commit.

@geido
Copy link
Member

geido commented Aug 30, 2022

/testenv up

@github-actions
Copy link
Contributor

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

expect(saveButton).toBeVisible();
expect(saveButton).toBeDisabled();
expect(menuButton).toBeVisible();
expect(menuButton).toBeDisabled();
Copy link
Member

Choose a reason for hiding this comment

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

should there be a test for when someone passes in a name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can do! Added in this commit.

@lyndsiWilliams lyndsiWilliams added the need:qa-review Requires QA review label Aug 31, 2022
expect(screen.getByText(/header/i)).toBeVisible();
const waitForRender = () =>
waitFor(() =>
render(<Header setDataset={mockSetDataset} datasetName="" />),
Copy link
Member

@hughhhh hughhhh Sep 8, 2022

Choose a reason for hiding this comment

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

add a test to make sure if datasetName is set that value of the textbox renders

Copy link
Member Author

Choose a reason for hiding this comment

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

@jinghua-qa
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2022

@jinghua-qa Ephemeral environment spinning up at http://35.91.138.110:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@jinghua-qa
Copy link
Member

LGTM

@lyndsiWilliams lyndsiWilliams merged commit 6e8cad3 into master Sep 14, 2022
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@lyndsiWilliams lyndsiWilliams deleted the lyndsi/create-dataset-header branch September 14, 2022 01:47
@C-monC
Copy link

C-monC commented Sep 15, 2022

Any possibility this induces #21476?

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 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 need:qa-review Requires QA review size/L 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants