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: disable cancel button on a disabled select widget #13275

Merged

Conversation

Tooluloope
Copy link
Contributor

@Tooluloope Tooluloope commented Apr 25, 2022

Description

Disable the cancel button on a disabled select widget

Fixes #13254

Type of change

  • Bugfix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit Test

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Test coverage results 🧪

🟢 Total coverage has increased
// Code coverage diff between base branch:release and head branch: fix/disable-cancel-button-on-a-disabled-select-widget 
Status File % Stmts % Branch % Funcs % Lines
🟢 total 56.59 (0) 38.41 (0.01) 35.84 (0) 56.84 (0)
🟢 app/client/src/components/ads/Icon.tsx 99.44 (0.01) 85 (0.79) 100 (0) 99.43 (0)
🟢 app/client/src/selectors/commentsSelectors.ts 85.25 (1.64) 64.71 (2.95) 73.33 (0) 90.59 (2.35)
🟢 app/client/src/widgets/SelectWidget/component/SelectButton.tsx 100 (0) 83.33 (33.33) 100 (0) 100 (0)

@Tooluloope Tooluloope self-assigned this Apr 25, 2022
@vercel
Copy link

vercel bot commented Apr 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
appsmith ✅ Ready (Inspect) Visit Preview May 11, 2022 at 1:46AM (UTC)

@github-actions github-actions bot added Widgets & Blocks Pod This label assigns issues to the widgets & blocks pod Bug Something isn't working High This issue blocks a user from building or impacts a lot of users Select Widget Select or dropdown widget UI Building Pod labels Apr 25, 2022
app/client/src/components/ads/Icon.tsx Outdated Show resolved Hide resolved
fillColor={disabled ? Colors.GREY_7 : Colors.GREY_10}
name="cross"
onClick={handleCancelClick}
onClick={!disabled ? handleCancelClick : undefined}
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic should be present in the icon and not here. If I were to use disabled in Icon at other places then I would have to explicitly write this logic everytime and there is a good chance that someone might just miss out doing this expecting it might be happenning internally or just not being mindful.

fireEvent.click(getByTestId("selectbutton.btn.cancel"));
expect(defaultProps.handleCancelClick).not.toBeCalled();
expect(getByText("0")).toBeTruthy();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a new line after this.

@Tooluloope
Copy link
Contributor Author

/ok-to-test sha=2d57840

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2232770080.
Workflow: Appsmith External Integration Test Workflow.
Commit: 2d57840.
PR: 13275.

@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2232770080.
Commit: 2d57840.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_CATEGORY
scripting 655.39 591.71 610.82 634.47 566.2 610.82 611.72 5.72 5.12
painting 4 7.2 4.21 4.03 3.78 4.03 4.64 31.03 27.80
rendering 249.57 269.82 242.23 257.14 256.75 256.75 255.1 4.01 3.59
BIND_TABLE_DATA
scripting 2216.76 2215.47 2258.67 2289.12 2359.52 2258.67 2267.91 2.64 2.36
painting 7.14 16.54 16.9 13.93 23.76 16.54 15.65 38.27 34.25
rendering 486.36 531.71 520.91 524.27 549.8 524.27 522.61 4.43 3.96
CLICK_ON_TABLE_ROW
scripting 1471.62 1604.56 1564.8 1628.88 1835.65 1604.56 1621.1 8.27 7.40
painting 27.15 12.28 13.35 11.31 16.16 13.35 16.05 40.31 36.01
rendering 241.07 250.34 274.14 248.99 276.54 250.34 258.22 6.22 5.56
UPDATE_POST_TITLE
scripting 2252.72 2515.77 2979.07 2484.27 3342.88 2515.77 2714.94 16.17 14.46
painting 11.59 14.56 14.64 12.52 28.51 14.56 16.36 42.30 37.84
rendering 314.77 331.59 313.79 322 434.62 322 343.35 15.00 13.42
OPEN_MODAL
scripting 2380.54 1094.93 1044.25 925.51 1109.81 1094.93 1311.01 45.94 41.09
painting 9.94 9.91 13 15.59 21.06 13 13.9 33.45 29.93
rendering 352.02 364.85 354.6 364.19 395.42 364.19 366.22 4.72 4.22
CLOSE_MODAL
scripting 2310.24 569.82 589.78 696.45 660.05 660.05 965.27 78.07 69.83
painting 5.49 5.32 7.27 12.48 9.77 7.27 8.07 37.79 33.83
rendering 215.8 221.58 207.11 234.67 246.35 221.58 225.1 6.90 6.18

1 similar comment
@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2232770080.
Commit: 2d57840.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_CATEGORY
scripting 655.39 591.71 610.82 634.47 566.2 610.82 611.72 5.72 5.12
painting 4 7.2 4.21 4.03 3.78 4.03 4.64 31.03 27.80
rendering 249.57 269.82 242.23 257.14 256.75 256.75 255.1 4.01 3.59
BIND_TABLE_DATA
scripting 2216.76 2215.47 2258.67 2289.12 2359.52 2258.67 2267.91 2.64 2.36
painting 7.14 16.54 16.9 13.93 23.76 16.54 15.65 38.27 34.25
rendering 486.36 531.71 520.91 524.27 549.8 524.27 522.61 4.43 3.96
CLICK_ON_TABLE_ROW
scripting 1471.62 1604.56 1564.8 1628.88 1835.65 1604.56 1621.1 8.27 7.40
painting 27.15 12.28 13.35 11.31 16.16 13.35 16.05 40.31 36.01
rendering 241.07 250.34 274.14 248.99 276.54 250.34 258.22 6.22 5.56
UPDATE_POST_TITLE
scripting 2252.72 2515.77 2979.07 2484.27 3342.88 2515.77 2714.94 16.17 14.46
painting 11.59 14.56 14.64 12.52 28.51 14.56 16.36 42.30 37.84
rendering 314.77 331.59 313.79 322 434.62 322 343.35 15.00 13.42
OPEN_MODAL
scripting 2380.54 1094.93 1044.25 925.51 1109.81 1094.93 1311.01 45.94 41.09
painting 9.94 9.91 13 15.59 21.06 13 13.9 33.45 29.93
rendering 352.02 364.85 354.6 364.19 395.42 364.19 366.22 4.72 4.22
CLOSE_MODAL
scripting 2310.24 569.82 589.78 696.45 660.05 660.05 965.27 78.07 69.83
painting 5.49 5.32 7.27 12.48 9.77 7.27 8.07 37.79 33.83
rendering 215.8 221.58 207.11 234.67 246.35 221.58 225.1 6.90 6.18

@@ -197,7 +197,11 @@ export const IconWrapper = styled.span<IconProps>`

display: flex;
align-items: center;

cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
&:hover {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do &, &:hover? It would cover both.
Also, do we need to define hover styles? IIRC cursors values get inherited; so we probably can remove the hover styles, can you check this out?

<IconWrapper
className={Classes.ICON}
clickable={clickable}
onClick={undefined}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need undefined here? We took out onClick from props

@Tooluloope
Copy link
Contributor Author

/ok-to-test sha=47398e2

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2238975317.
Workflow: Appsmith External Integration Test Workflow.
Commit: 47398e2.
PR: 13275.

@Tooluloope
Copy link
Contributor Author

/ok-to-test sha=70c475f

@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2243495415.
Commit: fa48a02.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_CATEGORY
scripting 1124.73 2328.7 1117.58 1053.86 1085.79 1117.58 1342.13 41.15 36.80
painting 8.62 9.42 6.99 13.1 11.89 9.42 10 24.70 22.10
rendering 392.04 376.65 368.02 366.74 372.23 372.23 375.14 2.72 2.44
BIND_TABLE_DATA
scripting 2222.76 2598.94 2188.96 2145.9 2200.15 2200.15 2271.34 8.16 7.29
painting 22.9 46.36 24.94 34.76 24.96 24.96 30.78 32.03 28.65
rendering 938.67 904.91 869.98 902.94 792.73 902.94 881.85 6.29 5.62
CLICK_ON_TABLE_ROW
scripting 3583.82 5148.42 4151.27 4290.66 4908.26 4290.66 4416.49 14.13 12.64
painting 50.19 59.28 55.8 47.53 115.08 55.8 65.58 42.77 38.26
rendering 535.19 755.01 1061.28 965.91 984.49 965.91 860.38 24.91 22.28
UPDATE_POST_TITLE
scripting 5742.12 5144.58 4453.6 4888.21 5766.1 5144.58 5198.92 10.85 9.70
painting 32.49 32.35 33.72 49.19 33.86 33.72 36.32 19.91 17.79
rendering 506.68 568.6 502.89 542.25 523.63 523.63 528.81 5.14 4.60
OPEN_MODAL
scripting 1955.73 2137.63 1982.7 4707.56 1953.63 1982.7 2547.45 47.50 42.48
painting 37.44 31.87 46.2 31.13 44.57 37.44 38.24 18.28 16.34
rendering 560.15 613.28 538.67 600.48 549.18 560.15 572.35 5.72 5.12
CLOSE_MODAL
scripting 966.72 4385.66 2305.48 968.99 1046.37 1046.37 1934.64 76.68 68.59
painting 17.8 18.14 6.99 24.27 6.9 17.8 14.82 51.55 46.09
rendering 361.05 370.18 323.71 352.72 339.24 352.72 349.38 5.24 4.69

@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2243495415.
Commit: fa48a02.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_CATEGORY
scripting 1008.61 2006.2 1879.36 859.23 975.12 1008.61 1345.7 40.85 36.54
painting 5.41 8.44 5.71 5.22 6.97 5.71 6.35 21.26 19.06
rendering 319.79 303.13 310.44 311.61 328.15 311.61 314.62 3.05 2.73
BIND_TABLE_DATA
scripting 2218.87 2319.08 2393.49 2316.69 2398.76 2319.08 2329.38 3.14 2.81
painting 9.87 15.99 25.64 23.94 20.48 20.48 19.18 33.26 29.77
rendering 737.27 635.93 638.91 799.43 758.48 737.27 714 10.28 9.19
CLICK_ON_TABLE_ROW
scripting 2027.46 1906.17 1971.66 2200.94 1858.79 1971.66 1993 6.66 5.96
painting 20.38 17.11 17.27 19.01 15.2 17.27 17.79 11.13 9.95
rendering 288.93 296.76 289.28 304.93 300.64 296.76 296.11 2.37 2.12
UPDATE_POST_TITLE
scripting 3529.94 3039.84 4081.42 3317.94 3088.44 3317.94 3411.52 12.38 11.08
painting 23.82 27.07 13.81 30.46 18.28 23.82 22.69 29.48 26.40
rendering 423 404.77 388.48 415.63 429.13 415.63 412.2 3.90 3.49
OPEN_MODAL
scripting 1250.5 1486.92 1352.01 1237.11 1602.78 1352.01 1385.86 11.34 10.15
painting 11.7 15.11 20.32 12.15 11.88 12.15 14.23 25.86 23.12
rendering 418.11 470.94 415.09 429.64 512.43 429.64 449.24 9.30 8.32
CLOSE_MODAL
scripting 807.43 621.69 618.22 737.9 817.08 737.9 720.46 13.42 12.01
painting 5.86 4.49 4.77 5.62 5.72 5.62 5.29 11.72 10.40
rendering 302.52 240.76 235.83 255.54 270.33 255.54 261 10.29 9.20

@chandannkumar
Copy link

Tested this PR and working as expected

  • Disable the cancel button on a disabled select widget - Fixed

ashit-rath
ashit-rath previously approved these changes May 4, 2022
@github-actions
Copy link

github-actions bot commented May 9, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2243495415.
Workflow: Appsmith External Integration Test Workflow.
Commit: fa48a02.
PR: 13275.

@Tooluloope
Copy link
Contributor Author

/ok-to-test sha=de8aebf

@github-actions
Copy link

github-actions bot commented May 9, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2291611828.
Workflow: Appsmith External Integration Test Workflow.
Commit: de8aebf.
PR: 13275.

@github-actions
Copy link

github-actions bot commented May 9, 2022

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2243495415.
Commit: fa48a02.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_WIDGET_MENU_OPEN
scripting 1999.38 1912.04 1975.4 1959.08 1983.03 1975.4 1965.79 1.70 1.52
painting 7.35 16.1 11.58 18.05 14.87 14.87 13.59 30.98 27.67
rendering 688.71 666.22 682.7 688.45 680.92 682.7 681.4 1.34 1.20
SELECT_WIDGET_SELECT_OPTION
scripting 309.41 321.33 336.33 317.78 312.67 317.78 319.5 3.27 2.93
painting 12.75 4.6 5.05 7.04 5.22 5.22 6.93 48.77 43.72
rendering 18.31 19.55 19.8 20.52 18.5 19.55 19.34 4.76 4.29

@github-actions
Copy link

github-actions bot commented May 9, 2022

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2291611828.
Commit: de8aebf.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_WIDGET_MENU_OPEN
scripting 1760.48 1525.55 1454.27 1750.79 1595.97 1595.97 1617.41 8.40 7.51
painting 7.96 7.25 8.13 10.99 6.27 7.96 8.12 21.67 19.46
rendering 591.77 523.83 514.07 591.91 550.2 550.2 554.36 6.62 5.92
SELECT_WIDGET_SELECT_OPTION
scripting 287.94 213.89 297.72 477.29 257.29 287.94 306.83 32.83 29.36
painting 8.93 3.71 5.38 10.53 8.2 8.2 7.35 37.55 33.61
rendering 17.47 17.8 18.25 19.35 17.03 17.8 17.98 4.95 4.39

@github-actions
Copy link

github-actions bot commented May 9, 2022

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2243495415.
Commit: fa48a02.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_WIDGET_MENU_OPEN
scripting 1999.38 1912.04 1975.4 1959.08 1983.03 1975.4 1965.79 1.70 1.52
painting 7.35 16.1 11.58 18.05 14.87 14.87 13.59 30.98 27.67
rendering 688.71 666.22 682.7 688.45 680.92 682.7 681.4 1.34 1.20
SELECT_WIDGET_SELECT_OPTION
scripting 309.41 321.33 336.33 317.78 312.67 317.78 319.5 3.27 2.93
painting 12.75 4.6 5.05 7.04 5.22 5.22 6.93 48.77 43.72
rendering 18.31 19.55 19.8 20.52 18.5 19.55 19.34 4.76 4.29

@Aishwarya-U-R
Copy link
Contributor

/ok-to-test sha=fdc3143

@github-actions
Copy link

github-actions bot commented May 9, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2292960420.
Workflow: Appsmith External Integration Test Workflow.
Commit: fdc3143.
PR: 13275.

@github-actions
Copy link

github-actions bot commented May 9, 2022

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2292960420.
Commit: fdc3143.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_WIDGET_MENU_OPEN
scripting 1820.97 1964.03 1995.6 1623.3 1836.12 1836.12 1848 7.96 7.12
painting 12.42 16.45 11.93 8.84 10.99 11.93 12.13 22.92 20.53
rendering 634.18 889.38 799.42 616.2 715.54 715.54 730.94 15.68 14.03
SELECT_WIDGET_SELECT_OPTION
scripting 296.84 486.09 414.21 324.2 425.6 414.21 389.39 19.93 17.83
painting 3.95 6.38 9.82 8.89 7.08 7.08 7.22 31.72 28.39
rendering 21.2 30.79 25.59 24.02 29.46 25.59 26.21 14.99 13.43

@Tooluloope
Copy link
Contributor Author

/ok-to-test sha=2f8c178

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2304320947.
Workflow: Appsmith External Integration Test Workflow.
Commit: 2f8c178.
PR: 13275.

@@ -248,7 +248,6 @@ function ManualUpgrades() {
>
<Icon
className="t--upgrade"
disabled={applicationVersion < latestVersion}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arunvjn Could you help confirm this.
I had two failing test, Application_URL and Git_Spec. which were caused by disabled been true and still expecting the onClick Event to fire. So I basically removed the disabled property since it needs onClick to fire regardless

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good. @Tooluloope

@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2304320947.
Commit: 2f8c178.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_WIDGET_MENU_OPEN
scripting 2024.49 1941.74 1970.02 2189.7 1941.9 1970.02 2013.57 5.17 4.62
painting 12.51 10.47 14.28 20.03 14.27 14.27 14.31 24.88 22.22
rendering 866.78 846.12 847.16 840.95 908.99 847.16 862 3.25 2.91
SELECT_WIDGET_SELECT_OPTION
scripting 432.51 303.33 297.35 287.76 298.87 298.87 323.96 18.81 16.83
painting 5.01 6.18 6.94 6.75 3.77 6.18 5.73 23.21 20.77
rendering 24.31 19.82 19.41 21.28 20.91 20.91 21.15 9.13 8.13

1 similar comment
@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2304320947.
Commit: 2f8c178.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_WIDGET_MENU_OPEN
scripting 2024.49 1941.74 1970.02 2189.7 1941.9 1970.02 2013.57 5.17 4.62
painting 12.51 10.47 14.28 20.03 14.27 14.27 14.31 24.88 22.22
rendering 866.78 846.12 847.16 840.95 908.99 847.16 862 3.25 2.91
SELECT_WIDGET_SELECT_OPTION
scripting 432.51 303.33 297.35 287.76 298.87 298.87 323.96 18.81 16.83
painting 5.01 6.18 6.94 6.75 3.77 6.18 5.73 23.21 20.77
rendering 24.31 19.82 19.41 21.28 20.91 20.91 21.15 9.13 8.13

@Tooluloope Tooluloope merged commit 10aca02 into release May 11, 2022
@Tooluloope Tooluloope deleted the fix/disable-cancel-button-on-a-disabled-select-widget branch May 11, 2022 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working High This issue blocks a user from building or impacts a lot of users Select Widget Select or dropdown widget skip-docs Widgets & Blocks Pod This label assigns issues to the widgets & blocks pod
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]-[800]:Close button can be clicked on a disabled select widget
5 participants