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

refactor: clean up codes #22002

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

zhaoyongjie
Copy link
Member

SUMMARY

This PR clears codes up. It's no logical change. I will add comments on the codes for the reviewer.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

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

import { getUrlParam } from 'src/utils/urlUtils';
import { URL_PARAMS } from 'src/constants';
import { isNullish } from 'src/utils/common';
Copy link
Member Author

Choose a reason for hiding this comment

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

replace isNullish with isDefined

@@ -121,7 +117,7 @@ const changeFilterValue = async () => {
userEvent.click(screen.getAllByText('No filter')[0]);
userEvent.click(screen.getByDisplayValue('Last day'));
expect(await screen.findByText(/2021-04-13/)).toBeInTheDocument();
userEvent.click(screen.getByTestId(getDateControlTestId('apply-button')));
userEvent.click(screen.getByTestId(DATE_FILTER_TEST_KEY.applyButton));
Copy link
Member Author

Choose a reason for hiding this comment

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

Keep simple logic for a simple use case.

Comment on lines -177 to -181
setTooltipTitle(
type === ('error' as Type)
? t('Default value is required')
: actualRange || '',
);
Copy link
Member Author

Choose a reason for hiding this comment

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

Since the default value always gets from Store or constants, the value of the DateFilterControl will not be undefined.

So the type in the DateFilterControl is useless.

@@ -302,7 +295,7 @@ export default function DateFilterLabel(props: DateFilterControlProps) {
disabled={!validTimeRange}
key="apply"
onClick={onSave}
{...getDateFilterControlTestId('apply-button')}
data-test={DATE_FILTER_TEST_KEY.applyButton}
Copy link
Member Author

Choose a reason for hiding this comment

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

Keep simple too.

@codecov
Copy link

codecov bot commented Nov 2, 2022

Codecov Report

Merging #22002 (442de25) into master (4a330a3) will increase coverage by 0.00%.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           master   #22002   +/-   ##
=======================================
  Coverage   67.03%   67.03%           
=======================================
  Files        1813     1813           
  Lines       69437    69425   -12     
  Branches     7449     7447    -2     
=======================================
- Hits        46545    46542    -3     
+ Misses      20972    20963    -9     
  Partials     1920     1920           
Flag Coverage Δ
javascript 53.50% <0.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...perset-frontend/src/addSlice/AddSliceContainer.tsx 59.61% <0.00%> (ø)
...ts/nativeFilters/FilterBar/ActionButtons/index.tsx 87.50% <0.00%> (ø)
...nts/controls/DateFilterControl/DateFilterLabel.tsx 58.13% <ø> (+1.95%) ⬆️
...ore/components/controls/DateFilterControl/types.ts 100.00% <ø> (ø)
...ents/controls/DateFilterControl/utils/constants.ts 100.00% <ø> (ø)
...d/src/filters/components/Time/TimeFilterPlugin.tsx 0.00% <ø> (ø)
superset-frontend/src/utils/common.js 100.00% <ø> (+10.00%) ⬆️
...-frontend/src/visualizations/presets/MainPreset.js 100.00% <ø> (ø)

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

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@stephenLYZ stephenLYZ left a comment

Choose a reason for hiding this comment

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

Nice work. LGTM

@zhaoyongjie zhaoyongjie merged commit 429f246 into apache:master Nov 2, 2022
@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 size/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants