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: Deprecate form button widget #11152

Closed
wants to merge 14 commits into from

Conversation

wmdev0808
Copy link
Contributor

@wmdev0808 wmdev0808 commented Feb 14, 2022

Description

Since we have resetWidget as a trigger function, we can deprecate the form button widget added with every form widget.

  • Rename all references of FORM_BUTTON_WIDGET to BUTTON_WIDGET
  • Remove FormButtonWidget from the widgets in Appsmith
  • Add migrations to change the type of FORM_BUTTON_WIDGET to BUTTON_WIDGET
  • Migrate the extra features existing in FormButtonWidget to ButtonWidget.

QA Note:

This needs to be a backwards compatible change, i.e, existing Form Widgets must work as they have been so far.
We need to also confirm if FormButtonWidget's features work in the ButtonWidget now. (Reset on click and Disabled on invalid)

Fixes #3613

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Migrations have jest tests
  • Existing Form Widget tests must pass.

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: feat/3613-deprecate-form-button 
Status File % Stmts % Branch % Funcs % Lines
🟢 total 55.71 (-0.01) 37.09 (0.04) 35.79 (0) 56.07 (-0.01)
🟢 app/client/src/icons/WidgetIcons.tsx 59.78 (0.64) 100 (0) 15.91 (0.35) 59.78 (0.64)
🟢 app/client/src/sagas/SnipingModeSagas.ts 20 (0) 3.23 (0.1) 40 (0) 20.79 (0)
🟢 app/client/src/utils/DSLMigrations.ts 73.63 (0.36) 70.05 (0.72) 71.72 (0.59) 73.46 (0.38)
🟢 app/client/src/utils/WorkerUtil.ts 89.76 (0.78) 72.55 (1.96) 100 (0) 93.33 (0.95)
🟢 app/client/src/utils/autocomplete/TernServer.ts 52.94 (0.23) 41.67 (0.84) 36.21 (0) 56.99 (0.25)
🔴 app/client/src/widgets/ButtonWidget/widget/index.tsx 61.22 (-9.51) 30 (-12.86) 58.33 (0) 60.42 (-9.58)
app/client/src/widgets/FormButtonWidget/index.ts 100 100 100 100
app/client/src/widgets/FormButtonWidget/widget/index.tsx 65.71 19.05 62.5 64.71
app/client/test/factories/Widgets/FormButtonFactory.ts 75 100 0 75

-- Add disabledWhenInvalid, resetFormOnClick properties to the existing ButtonWidget
-- Remove FormButtonWidget and its references
-- Adapt FormWidget to use ButtonWidget instead of FormButtonWidget
-- Add a migration for converting FORM_BUTTON_WIDGET to BUTTON_WIDGET
-- Add a Jest test case for form button migration
-- Update helpText for disabledWhenInvalid and resetFormOnClick props
@wmdev0808 wmdev0808 added Enhancement New feature or request Widgets Product This label groups issues related to widgets Button Widget Issues related to the button widget Form Widget labels Feb 14, 2022
@wmdev0808 wmdev0808 self-assigned this Feb 14, 2022
@vercel
Copy link

vercel bot commented Feb 14, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/get-appsmith/appsmith/4uJ7jwY8yfmPw4aEW6UpkMLsfxq8
✅ Preview: https://appsmith-git-feat-3613-deprecate-form-button-get-appsmith.vercel.app

@wmdev0808
Copy link
Contributor Author

/ok-to-test sha=e133c89

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/1843614680.
Workflow: Appsmith External Integration Test Workflow.
Commit: e133c89.
PR: 11152.

@@ -85,7 +85,7 @@
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}"
},
"FORM_BUTTON_WIDGET": {
"BUTTON_WIDGET": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we remove this entry instead of renaming it? We should already have an entry for BUTTON_WIDGET

Copy link
Contributor

Choose a reason for hiding this comment

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

Please check rest of this file for similar changes and remove if redundant entries are made for BUTTON_WIDGET

@ashit-rath
Copy link
Contributor

ashit-rath commented Feb 15, 2022

Note to QA: Please verify the Generate CRUD app. @appsmithorg/qa

ashit-rath
ashit-rath previously approved these changes Feb 15, 2022
@wmdev0808
Copy link
Contributor Author

/ok-to-test sha=210f8c5

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/1864616102.
Workflow: Appsmith External Integration Test Workflow.
Commit: 210f8c5.
PR: 11152.

@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/1864616102.
Commit: 210f8c5.
Results:

Click to view performance test results

Median Mean SD.Sample SD.Population

@wmdev0808
Copy link
Contributor Author

/ok-to-test sha=b6c1a03

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/1865005691.
Workflow: Appsmith External Integration Test Workflow.
Commit: b6c1a03.
PR: 11152.

@riodeuno
Copy link
Contributor

@appsmithorg/qa This needs extensive testing w.r.t making sure that existing form widgets work exactly as they have so far. Testing this is critical.

@wmdev0808
Copy link
Contributor Author

/ok-to-test sha=4b768bc

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/1893762268.
Workflow: Appsmith External Integration Test Workflow.
Commit: 4b768bc.
PR: 11152.

@github-actions
Copy link

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/1893762268.
Commit: 4b768bc.
Results:

Click to view performance test results

Median Mean SD.Sample SD.Population

@wmdev0808
Copy link
Contributor Author

/ok-to-test sha=d860aca

@github-actions
Copy link

github-actions bot commented Mar 1, 2022

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/1918351490.
Workflow: Appsmith External Integration Test Workflow.
Commit: d860aca.
PR: 11152.

@github-actions
Copy link

github-actions bot commented Mar 1, 2022

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

Click to view performance test results

Median Mean SD.Sample SD.Population

@somangshu
Copy link
Contributor

@vivekverma2312 @wmdev0808 A user that has found an issue - formButton.isDisabled is not working. Can we please add it in our test plan for newer alternative? - https://community.appsmith.com/t/how-can-i-validate-if-a-form-is-valid-in-a-widget-outside-the-form/700/2 - I hope its working here.

also @riodeuno should this be fixed in the form button since we are going to maintain it, Or we simply tell the user to migrate to the new form button?

@YogeshJayaseelan
Copy link
Contributor

YogeshJayaseelan commented Mar 4, 2022

@wmdev0808 @riodeuno @somangshu @vivekverma2312 Testing in progress for this feature and please find the status below,

Issue 1: Disabled Invalid form does not work on passing the JS queries like {{Button3.text==="Submit"}} or {{Input1.text.length>4}}

https://loom.com/share/57d4e3b1b3ae403fa13d99cc52ab4ca1

Questions:

Question 1 - Migration - Opening any older apps which has a form widget - The button name still reads as 'FormButton1' and 'FormButton2' are we okay with keeping the button name as 'FormButton1' or 'FormButton2' in older apps?

Question 2 -Properties of the button is not the same in the table button property

@riodeuno
Copy link
Contributor

riodeuno commented Mar 7, 2022

@YogeshJayaseelan We're not changing the names of the widgets. So, FormButton1, etc, are correct names. The table button properties will be different from the button properties. We can look at standardising this in the widget property pane organisation effort @dilippitchika

@somangshu I was wondering if we have decided to maintain the FormButton widget? The code updates here, deprecates and removes references to the FormButton widget.

If we're removing FormButton widget, @YogeshJayaseelan we need to absolutely make sure that all Form widgets work when migrating to this DP. So, we should work on creating complex forms, and using some of our complex application on release, then opening them in the deploy preview and making sure that they work fine.

If we're still going to maintain FormButton widget, @YogeshJayaseelan we need to make sure freshly added Form widgets in the deploy preview don't have any regression in features.

@somangshu
Copy link
Contributor

@riodeuno multiple people suggested that we do not write migration as that will have high chance of breaking an old app, So based on this my assumption would be that we will have to maintain the old formButton

@riodeuno
Copy link
Contributor

riodeuno commented Mar 8, 2022

@somangshu Got it. If we're not migrating then I will suggest we close this PR and create a new one with the limited set of changes. That will only involve updating the Form blueprint and upgrading the button widget's feature set to include the features in the FormButton Widget.

The QA approach for the same should be simply to make sure that any new Form widgets work exactly as they did and have the same features. We might also want to copy the feature's cypress tests from the Form Button widget to the Button Widget.

@YogeshJayaseelan
Copy link
Contributor

@riodeuno @somangshu We have paused testing this for now. Will resume testing once the migration-related discussion is closed

CC - @vivekverma2312

@somangshu
Copy link
Contributor

@wmdev0808 can you understand the change required here? Please let me know if a discussion is required. Do collect all possible questions before we start our discussion

@wmdev0808
Copy link
Contributor Author

wmdev0808 commented Mar 9, 2022

@wmdev0808 can you understand the change required here? Please let me know if a discussion is required. Do collect all possible questions before we start our discussion

@somangshu , I want your reply with the followings:

Here are my understanding for the new requirements:

  • We don't need any migration for backward compatibility
  • The newly created forms will be using ButtonWidget instead of FormButtonWidget, ensuring its original functionalities
  • ButtonWidget should include from related form fields

Here are my questions:

  • Am I missing any other requirements?
  • Does the current implementation has issues with old forms or even newly created forms?
  • If yes with the above, please add demonstrating videos for my reference.

@somangshu
Copy link
Contributor

somangshu commented Mar 9, 2022

@wmdev0808 please help me understand what is the migration doing in the PR. I am not sure right now

@wmdev0808
Copy link
Contributor Author

wmdev0808 commented Mar 9, 2022

@wmdev0808 please help me understand what is the migration doing in the PR. I am not sure right now

It just replaces the widget type with button widget's, that is, FORM_BUTTON_WIDGET to BUTTON_WIDGET

@somangshu
Copy link
Contributor

somangshu commented Mar 9, 2022

It just replaces the widget type with button widget's, that is, FORM_BUTTON_WIDGET to BUTTON_WIDGET

@wmdev0808 what is the reason to do that, @YogeshJayaseelan @vivekverma2312 did we test around this, We need to be sure that this cannot break anything

@wmdev0808
Copy link
Contributor Author

It just replaces the widget type with button widget's, that is, FORM_BUTTON_WIDGET to BUTTON_WIDGET
@wmdev0808 what is the reason to do that, @YogeshJayaseelan @vivekverma2312 did we test around this, We need to be sure that this cannot break anything

Because we will be using ButtonWidget instead of FormButtonWidget, resulting remove FormButtonWidget in our code base

@somangshu
Copy link
Contributor

@riodeuno would this break any old applications

@riodeuno
Copy link
Contributor

riodeuno commented Mar 15, 2022

@somangshu Whether this will break any existing applications is a tough question to answer. Looking at the code and how these widgets work, it seems like they shouldn't. With that said, we need rigorous testing for the migration nevertheless.

This concern is also the reason for contention over whether to

  1. keep maintaining the FORM_BUTTON_WIDGET and use BUTTON_WIDGET as a replacement in new forms or to
  2. replace all references of FORM_BUTTON_WIDGET to BUTTON_WIDGET while migrating existing DSLs as well (the current PR's changes).

Form Widget is one of our most used widgets and breaking changes can impact our users negatively. To avoid a breaking scenario, we are approaching this solution in approach 1.

@wmdev0808 we can consider migration as a separate effort. The idea is to phase this solution into two parts

  1. Stop using Form Button Widget for any new forms added henceforth. This will confirm if the Button widget upgrade is working correctly for our users. Once this is successful,
  2. Deprecate the Form Button Widget and cleanup the codebase with migrations to the widget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Button Widget Issues related to the button widget Enhancement New feature or request Form Widget Widgets Product This label groups issues related to widgets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]-[800]:Deprecate form button widget
5 participants