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

fix: Dataset creation header is now uneditable and holds proper default values #21557

Merged
merged 8 commits into from
Oct 13, 2022

Conversation

lyndsiWilliams
Copy link
Member

SUMMARY

Dataset header name is now uneditable. It displays "New dataset' until a table is selected, then it displays the selected table's name.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE:

dsHeaderBefore

AFTER:

dsHeaderAfter

TESTING INSTRUCTIONS

  • Go to http://localhost:9000/dataset/add/?testing
  • Try to click the header and see that it is no longer editable (at any point)
  • Select a database, schema, and table name
  • Observe that the header now displays the table name

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 Sep 22, 2022

Codecov Report

Merging #21557 (e9f6eb2) into master (ab53d77) will increase coverage by 0.35%.
The diff coverage is 75.00%.

@@            Coverage Diff             @@
##           master   #21557      +/-   ##
==========================================
+ Coverage   66.65%   67.00%   +0.35%     
==========================================
  Files        1797     1799       +2     
  Lines       68752    70080    +1328     
  Branches     7325     7807     +482     
==========================================
+ Hits        45829    46960    +1131     
- Misses      21049    21178     +129     
- Partials     1874     1942      +68     
Flag Coverage Δ
hive 52.90% <ø> (?)
javascript 53.58% <75.00%> (+0.42%) ⬆️
mysql 78.21% <ø> (ø)
postgres 78.27% <ø> (ø)
presto 52.80% <ø> (?)
python 81.40% <ø> (+0.34%) ⬆️
sqlite 76.77% <ø> (ø)
unit 50.91% <ø> (ø)

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

Impacted Files Coverage Δ
...s/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx 47.61% <ø> (ø)
...iews/CRUD/data/dataset/AddDataset/Header/index.tsx 81.81% <66.66%> (-5.69%) ⬇️
...d/src/views/CRUD/data/dataset/AddDataset/index.tsx 52.94% <100.00%> (ø)
...rontend/src/views/CRUD/dashboard/DashboardCard.tsx 51.21% <0.00%> (-7.12%) ⬇️
...c/components/ErrorMessage/DatabaseErrorMessage.tsx 66.66% <0.00%> (-6.07%) ⬇️
...rset-frontend/src/components/Chart/chartReducer.ts 22.66% <0.00%> (-2.34%) ⬇️
...s/plugin-chart-echarts/src/BoxPlot/controlPanel.ts 4.00% <0.00%> (-1.56%) ⬇️
...nd/src/dashboard/components/gridComponents/Tab.jsx 82.41% <0.00%> (-1.26%) ⬇️
...ontend/src/dashboard/components/dnd/handleHover.js 9.09% <0.00%> (-0.91%) ⬇️
...ponents/nativeFilters/FilterCard/useFilterScope.ts 78.94% <0.00%> (-0.69%) ⬇️
... and 72 more

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

@lyndsiWilliams
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

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

@lyndsiWilliams lyndsiWilliams added the need:qa-review Requires QA review label Sep 23, 2022
Copy link
Member

@Antonio-RiveroMartnez Antonio-RiveroMartnez left a comment

Choose a reason for hiding this comment

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

Big fan of the way you improved/simplified the tests! 🎉

);

const LeftPanelComponent = () => (
<LeftPanel
setDataset={setDataset}
schema={dataset?.schema}
schema={dataset?.schema ?? ''}

Choose a reason for hiding this comment

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

Since schema is optional as per the definition in LeftPanelProps wouldn't be sufficient to just send dataset?.schema ? without the empty string.

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, that does make more sense! Fixed in this commit.

waitFor(() =>
render(<Header setDataset={mockSetDataset} datasetName="" />),
);
waitFor(() => render(<Header setDataset={mockSetDataset} title="" />));

Choose a reason for hiding this comment

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

Isn't this the same as having no title thus the title: string; should be optional? Or what implication would that have? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

The title can't have nullish values because of the component that uses it: PageHeaderWithActions

Screen Shot 2022-09-23 at 4 45 18 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the other comments I left might address this and allow the title="" to be removed

Base automatically changed from arash.afghahi/sc-52806/create-dataset-footer to master September 23, 2022 23:40
@pull-request-size pull-request-size bot added size/L and removed size/M labels Sep 23, 2022
@lyndsiWilliams
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

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

@hughhhh hughhhh self-requested a review September 29, 2022 16:38
title: datasetName,
placeholder: t('Add the name of the dataset'),
title: schema ? title : t('New dataset'),
placeholder: t('New dataset'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you are using t'(New dataset') twice here, it may be worth defining a const with that value and using it in both places. If you export that const you could also use it in the test file so that if someone changes the value later you don't have to keep three separate string literals in sync manually.

export const DEFAULT_TITLE = t(New dataset);

Then use that on line 70, 71, and in line 51 of Header.test.tsx

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in this commit

}) {
const editableTitleProps = {
title: datasetName,
placeholder: t('Add the name of the dataset'),
title: schema ? title : t('New dataset'),
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why the usage of title here is tied to if schema is defined? If you make title optional, then set a default value for title as t('New dataset') could the conditional logic here could be removed?

export const DEFAULT_TITLE = t(New dataset); export default function Header({ setDataset, title = DEFAULT_TITLE, }: { setDataset: React.Dispatch<DSReducerActionType>; title?: string; }) { const editableTitleProps = { title, placeholder: DEFAULT_TITLE

It looks like the only use of schema prop is this case so changing this logic might also make the prop unnecessary and simplify the component's interface

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in this commit

<Header setDataset={setDataset} datasetName={dataset?.dataset_name ?? ''} />
<Header
setDataset={setDataset}
title={dataset?.table_name ?? 'New dataset'}
Copy link
Contributor

Choose a reason for hiding this comment

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

May want to wrap in a t('New dataset')
Also, may be worth using exported const from previous comment if you want to keep this in sync with what the default title is for header.tsx.

If making the title prop optional like mentioned in comment on Header/index.tsx then this could be simplified to title={dataset?.table_name} and the default value 'New dataset' would get applied by Header and schema prop could be removed

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in this commit

waitFor(() =>
render(<Header setDataset={mockSetDataset} datasetName="" />),
);
waitFor(() => render(<Header setDataset={mockSetDataset} title="" />));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the other comments I left might address this and allow the title="" to be removed

Copy link
Contributor

@eric-briscoe eric-briscoe left a comment

Choose a reason for hiding this comment

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

Looks great :)

@michael-s-molina
Copy link
Member

It's looking so beautiful 😍

@jinghua-qa
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

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

Copy link
Member

@jinghua-qa jinghua-qa left a comment

Choose a reason for hiding this comment

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

LGTM!

@lyndsiWilliams lyndsiWilliams merged commit df3b5a8 into master Oct 13, 2022
@lyndsiWilliams lyndsiWilliams deleted the lyndsi/uneditable-header branch October 13, 2022 22:17
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@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/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants