From 1a4b4a6970a53bc017d8245736b6c9cd05997337 Mon Sep 17 00:00:00 2001 From: bhavin Date: Fri, 16 Jul 2021 12:12:17 +0530 Subject: [PATCH 1/5] replaced form btn to btn --- .../mockResponses/WidgetConfigResponse.tsx | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/app/client/src/mockResponses/WidgetConfigResponse.tsx b/app/client/src/mockResponses/WidgetConfigResponse.tsx index e1e5fff9523..a3180ef23f9 100644 --- a/app/client/src/mockResponses/WidgetConfigResponse.tsx +++ b/app/client/src/mockResponses/WidgetConfigResponse.tsx @@ -675,7 +675,7 @@ const WidgetConfigResponse: WidgetConfigReducerState = { }, }, { - type: "FORM_BUTTON_WIDGET", + type: "BUTTON_WIDGET", size: { rows: 1 * GRID_DENSITY_MIGRATION_V1, cols: 4 * GRID_DENSITY_MIGRATION_V1, @@ -687,14 +687,12 @@ const WidgetConfigResponse: WidgetConfigReducerState = { props: { text: "Submit", buttonStyle: "PRIMARY_BUTTON", - disabledWhenInvalid: true, - resetFormOnClick: true, recaptchaV2: false, version: 1, }, }, { - type: "FORM_BUTTON_WIDGET", + type: "BUTTON_WIDGET", size: { rows: 1 * GRID_DENSITY_MIGRATION_V1, cols: 4 * GRID_DENSITY_MIGRATION_V1, @@ -706,13 +704,36 @@ const WidgetConfigResponse: WidgetConfigReducerState = { props: { text: "Reset", buttonStyle: "SECONDARY_BUTTON", - disabledWhenInvalid: false, - resetFormOnClick: true, recaptchaV2: false, version: 1, }, }, ], + operations: [ + { + type: BlueprintOperationTypes.MODIFY_PROPS, + fn: ( + widget: WidgetProps & { children?: WidgetProps[] }, + widgets: { [widgetId: string]: FlattenedWidgetProps }, + parent?: WidgetProps & { children?: WidgetProps[] }, + ) => { + const updatedWidgetsProperty: any = []; + widget.children?.map((child) => { + if ( + child.type === "BUTTON_WIDGET" && + child.text == "Reset" + ) { + updatedWidgetsProperty.push({ + widgetId: child.widgetId, + propertyName: "onClick", + propertyValue: `{{resetWidget("${parent?.widgetName}", true)}}`, + }); + } + }); + return updatedWidgetsProperty; + }, + }, + ], }, }, }, From 0f21138d8ca1dc285674e7cb23afdbe849846a58 Mon Sep 17 00:00:00 2001 From: bhavin Date: Fri, 16 Jul 2021 15:01:33 +0530 Subject: [PATCH 2/5] added migration with jest tests --- app/client/cypress/fixtures/formdsl.json | 34 ++- app/client/src/constants/WidgetConstants.tsx | 2 +- .../mockResponses/WidgetConfigResponse.tsx | 5 +- app/client/src/utils/WidgetPropsUtils.tsx | 5 + .../src/utils/migrations/FormWidget.test.ts | 255 ++++++++++++++++++ app/client/src/utils/migrations/FormWidget.ts | 36 +++ 6 files changed, 318 insertions(+), 19 deletions(-) create mode 100644 app/client/src/utils/migrations/FormWidget.test.ts create mode 100644 app/client/src/utils/migrations/FormWidget.ts diff --git a/app/client/cypress/fixtures/formdsl.json b/app/client/cypress/fixtures/formdsl.json index f8859c48a55..39913960235 100644 --- a/app/client/cypress/fixtures/formdsl.json +++ b/app/client/cypress/fixtures/formdsl.json @@ -240,12 +240,13 @@ "top": 11, "left": 12 }, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "props": { "resetFormOnClick": false, "disabledWhenInvalid": true, "buttonStyle": "PRIMARY_BUTTON", - "text": "Submit" + "text": "Submit", + "onClick": "{{resetWidget(\"Form1\", true)}}" } }, { @@ -257,12 +258,13 @@ "top": 11, "left": 8 }, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "props": { "resetFormOnClick": true, "disabledWhenInvalid": false, "buttonStyle": "SECONDARY_BUTTON", - "text": "Reset" + "text": "Reset", + "onClick": "{{resetWidget(\"Form1\", true)}}" } } ] @@ -318,12 +320,13 @@ "top": 11, "left": 12 }, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "props": { "resetFormOnClick": false, "disabledWhenInvalid": true, "buttonStyle": "PRIMARY_BUTTON", - "text": "Submit" + "text": "Submit", + "onClick": "{{resetWidget(\"Form1\", true)}}" } }, { @@ -335,12 +338,13 @@ "top": 11, "left": 8 }, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "props": { "resetFormOnClick": true, "disabledWhenInvalid": false, "buttonStyle": "SECONDARY_BUTTON", - "text": "Reset" + "text": "Reset", + "onClick": "{{resetWidget(\"Form1\", true)}}" } } ] @@ -366,7 +370,7 @@ }, { "resetFormOnClick": false, - "widgetName": "FormButton1", + "widgetName": "Button1", "rightColumn": 16, "isDefaultClickDisabled": true, "widgetId": "tf20n9k4z2", @@ -374,16 +378,17 @@ "topRow": 11, "bottomRow": 12, "isVisible": true, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "dynamicBindingPathList": [], "isLoading": false, "disabledWhenInvalid": true, "leftColumn": 12, - "text": "Submit" + "text": "Submit", + "onClick": "{{resetWidget(\"Form1\", true)}}" }, { "resetFormOnClick": true, - "widgetName": "FormButton2", + "widgetName": "Button2", "rightColumn": 12, "isDefaultClickDisabled": true, "widgetId": "6xnpe13jie", @@ -391,12 +396,13 @@ "topRow": 11, "bottomRow": 12, "isVisible": true, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "dynamicBindingPathList": [], "isLoading": false, "disabledWhenInvalid": false, "leftColumn": 8, - "text": "Reset" + "text": "Reset", + "onClick": "{{resetWidget(\"Form1\", true)}}" } ] } diff --git a/app/client/src/constants/WidgetConstants.tsx b/app/client/src/constants/WidgetConstants.tsx index d0f80adce1b..83d0043686f 100644 --- a/app/client/src/constants/WidgetConstants.tsx +++ b/app/client/src/constants/WidgetConstants.tsx @@ -100,7 +100,7 @@ export const layoutConfigurations: LayoutConfigurations = { FLUID: { minWidth: -1, maxWidth: -1 }, }; -export const LATEST_PAGE_VERSION = 27; +export const LATEST_PAGE_VERSION = 28; export const GridDefaults = { DEFAULT_CELL_SIZE: 1, diff --git a/app/client/src/mockResponses/WidgetConfigResponse.tsx b/app/client/src/mockResponses/WidgetConfigResponse.tsx index a3180ef23f9..3328fa19b8d 100644 --- a/app/client/src/mockResponses/WidgetConfigResponse.tsx +++ b/app/client/src/mockResponses/WidgetConfigResponse.tsx @@ -719,10 +719,7 @@ const WidgetConfigResponse: WidgetConfigReducerState = { ) => { const updatedWidgetsProperty: any = []; widget.children?.map((child) => { - if ( - child.type === "BUTTON_WIDGET" && - child.text == "Reset" - ) { + if (child.type === "BUTTON_WIDGET") { updatedWidgetsProperty.push({ widgetId: child.widgetId, propertyName: "onClick", diff --git a/app/client/src/utils/WidgetPropsUtils.tsx b/app/client/src/utils/WidgetPropsUtils.tsx index b5a683a2159..ebc1fc60237 100644 --- a/app/client/src/utils/WidgetPropsUtils.tsx +++ b/app/client/src/utils/WidgetPropsUtils.tsx @@ -30,6 +30,7 @@ import { migrateTableWidgetParentRowSpaceProperty, migrateTableWidgetHeaderVisibilityProperties, } from "utils/migrations/TableWidget"; +import { formWidgetButtonWidgetMigrations } from "utils/migrations/FormWidget"; import { migrateIncorrectDynamicBindingPathLists } from "utils/migrations/IncorrectDynamicBindingPathLists"; import * as Sentry from "@sentry/react"; import { migrateTextStyleFromTextWidget } from "./migrations/TextWidgetReplaceTextStyle"; @@ -789,6 +790,10 @@ const transformDSL = (currentDSL: ContainerWidgetProps) => { } if (currentDSL.version === 26) { currentDSL = migrateFilterValueForDropDownWidget(currentDSL); + currentDSL.version = 27; + } + if (currentDSL.version === 27) { + currentDSL = formWidgetButtonWidgetMigrations(currentDSL); currentDSL.version = LATEST_PAGE_VERSION; } diff --git a/app/client/src/utils/migrations/FormWidget.test.ts b/app/client/src/utils/migrations/FormWidget.test.ts new file mode 100644 index 00000000000..cd8a9577df8 --- /dev/null +++ b/app/client/src/utils/migrations/FormWidget.test.ts @@ -0,0 +1,255 @@ +import { WidgetProps } from "widgets/BaseWidget"; +import { ContainerWidgetProps } from "widgets/ContainerWidget"; +import { formWidgetButtonWidgetMigrations } from "./FormWidget"; + +const input: ContainerWidgetProps = { + widgetName: "MainContainer", + backgroundColor: "none", + rightColumn: 1280, + snapColumns: 64, + detachFromLayout: true, + widgetId: "0", + topRow: 0, + bottomRow: 1290, + containerStyle: "none", + snapRows: 125, + parentRowSpace: 1, + type: "CANVAS_WIDGET", + canExtend: true, + version: 26, + minHeight: 1292, + parentColumnSpace: 1, + dynamicTriggerPathList: [], + dynamicBindingPathList: [], + leftColumn: 0, + renderMode: "CANVAS", + isLoading: false, + children: [ + { + widgetName: "Form1", + backgroundColor: "white", + rightColumn: 41, + widgetId: "qeznqzmae8", + topRow: 15, + bottomRow: 67, + parentRowSpace: 10, + isVisible: true, + type: "FORM_WIDGET", + parentId: "0", + isLoading: false, + parentColumnSpace: 19.8125, + leftColumn: 13, + renderMode: "CANVAS", + version: 1, + children: [ + { + widgetName: "Canvas1", + rightColumn: 554.75, + detachFromLayout: true, + widgetId: "h53ef94ppg", + containerStyle: "none", + topRow: 0, + bottomRow: 520, + parentRowSpace: 1, + isVisible: true, + canExtend: false, + type: "CANVAS_WIDGET", + version: 1, + parentId: "qeznqzmae8", + minHeight: 520, + isLoading: false, + parentColumnSpace: 1, + leftColumn: 0, + renderMode: "CANVAS", + children: [ + { + widgetName: "Text1", + rightColumn: 25.5, + textAlign: "LEFT", + widgetId: "da7c6abwc4", + topRow: 1, + bottomRow: 5, + isVisible: true, + fontStyle: "BOLD", + type: "TEXT_WIDGET", + textColor: "#231F20", + version: 1, + parentId: "h53ef94ppg", + isLoading: false, + leftColumn: 1.5, + fontSize: "HEADING1", + text: "Form", + }, + { + resetFormOnClick: true, + widgetName: "FormButton1", + rightColumn: 62.4, + isDefaultClickDisabled: true, + widgetId: "0k0kdcgus2", + buttonStyle: "PRIMARY_BUTTON", + topRow: 45, + bottomRow: 49, + recaptchaV2: false, + isVisible: true, + type: "FORM_BUTTON_WIDGET", + version: 1, + parentId: "h53ef94ppg", + isLoading: false, + disabledWhenInvalid: true, + leftColumn: 46.4, + text: "Submit", + }, + { + resetFormOnClick: true, + widgetName: "FormButton2", + rightColumn: 46, + isDefaultClickDisabled: true, + widgetId: "yoh0muyis1", + buttonStyle: "SECONDARY_BUTTON", + topRow: 45, + bottomRow: 49, + recaptchaV2: false, + isVisible: true, + type: "FORM_BUTTON_WIDGET", + version: 1, + parentId: "h53ef94ppg", + isLoading: false, + disabledWhenInvalid: false, + leftColumn: 30, + text: "Reset", + }, + ], + }, + ], + }, + ], +}; + +const output: ContainerWidgetProps = { + widgetName: "MainContainer", + backgroundColor: "none", + rightColumn: 1280, + snapColumns: 64, + detachFromLayout: true, + widgetId: "0", + topRow: 0, + bottomRow: 1230, + containerStyle: "none", + snapRows: 125, + parentRowSpace: 1, + type: "CANVAS_WIDGET", + canExtend: true, + version: 27, + minHeight: 1240, + parentColumnSpace: 1, + dynamicTriggerPathList: [], + dynamicBindingPathList: [], + leftColumn: 0, + renderMode: "CANVAS", + isLoading: false, + children: [ + { + widgetName: "Form1", + backgroundColor: "white", + rightColumn: 41, + widgetId: "qeznqzmae8", + topRow: 15, + bottomRow: 67, + parentRowSpace: 10, + isVisible: true, + type: "FORM_WIDGET", + parentId: "0", + isLoading: false, + parentColumnSpace: 19.8125, + leftColumn: 13, + renderMode: "CANVAS", + version: 1, + children: [ + { + widgetName: "Canvas1", + rightColumn: 554.75, + detachFromLayout: true, + widgetId: "h53ef94ppg", + containerStyle: "none", + topRow: 0, + bottomRow: 520, + parentRowSpace: 1, + isVisible: true, + canExtend: false, + type: "CANVAS_WIDGET", + version: 1, + parentId: "qeznqzmae8", + minHeight: 520, + isLoading: false, + parentColumnSpace: 1, + leftColumn: 0, + children: [ + { + widgetName: "Text1", + rightColumn: 25.5, + textAlign: "LEFT", + widgetId: "da7c6abwc4", + topRow: 1, + bottomRow: 5, + isVisible: true, + fontStyle: "BOLD", + type: "TEXT_WIDGET", + textColor: "#231F20", + version: 1, + parentId: "h53ef94ppg", + isLoading: false, + leftColumn: 1.5, + fontSize: "HEADING1", + text: "Form", + }, + { + widgetName: "Button1", + rightColumn: 62.4, + onClick: '{{resetWidget("Form1", true)}}', + isDefaultClickDisabled: true, + widgetId: "0k0kdcgus2", + buttonStyle: "PRIMARY_BUTTON", + topRow: 45, + bottomRow: 49, + recaptchaV2: false, + isVisible: true, + type: "BUTTON_WIDGET", + version: 1, + parentId: "h53ef94ppg", + isLoading: false, + leftColumn: 46.4, + text: "Submit", + isDisabled: false, + }, + { + widgetName: "Button2", + rightColumn: 46, + onClick: '{{resetWidget("Form1", true)}}', + isDefaultClickDisabled: true, + widgetId: "yoh0muyis1", + buttonStyle: "SECONDARY_BUTTON", + topRow: 45, + bottomRow: 49, + recaptchaV2: false, + isVisible: true, + type: "BUTTON_WIDGET", + version: 1, + parentId: "h53ef94ppg", + isLoading: false, + leftColumn: 30, + text: "Reset", + isDisabled: false, + }, + ], + }, + ], + }, + ], +}; + +describe("Form widget updated form button widget to button widget", () => { + it("To test dsl updated to remove form btn widget and added button widget with correct props", () => { + const newDsl = formWidgetButtonWidgetMigrations(input); + expect(JSON.stringify(newDsl) === JSON.stringify(output)); + }); +}); diff --git a/app/client/src/utils/migrations/FormWidget.ts b/app/client/src/utils/migrations/FormWidget.ts new file mode 100644 index 00000000000..1398632de70 --- /dev/null +++ b/app/client/src/utils/migrations/FormWidget.ts @@ -0,0 +1,36 @@ +import { WidgetProps } from "widgets/BaseWidget"; +import { ContainerWidgetProps } from "widgets/ContainerWidget"; +import { cloneDeep } from "lodash"; + +export const formWidgetButtonWidgetMigrations = ( + currentDSL: ContainerWidgetProps, +) => { + currentDSL.children = currentDSL.children?.map((_child: WidgetProps) => { + let child = cloneDeep(_child); + + if (child.type === "FORM_WIDGET") { + const formName = child.widgetName; + // first children is canvas which will have other widgets as children + child.children.map((canvas: WidgetProps) => { + canvas.children.map((formChildWidgets: WidgetProps) => { + if (formChildWidgets.type === "FORM_BUTTON_WIDGET") { + // change fields : type + formChildWidgets.type = "BUTTON_WIDGET"; + // add field : isDisabled, onClick + formChildWidgets.isDisabled = false; + if (formChildWidgets.resetFormOnClick) { + formChildWidgets.onClick = `{{resetWidget("${formName}", true)}}`; + } + // remove fields from FormBtn : resetFormOnClick, disabledWhenInvalid + delete formChildWidgets.resetFormOnClick; + delete formChildWidgets.disabledWhenInvalid; + } + }); + }); + } else if (child.children && child.children.length > 0) { + child = formWidgetButtonWidgetMigrations(child); + } + return child; + }); + return currentDSL; +}; From 313a4b818b54caee3dd66ea164102d789bc3be88 Mon Sep 17 00:00:00 2001 From: bhavin Date: Fri, 16 Jul 2021 15:14:37 +0530 Subject: [PATCH 3/5] updated cypress tests --- app/client/cypress/fixtures/formResetDsl.json | 36 +++++++++---------- .../FormWidgets/FormReset_spec.js | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/client/cypress/fixtures/formResetDsl.json b/app/client/cypress/fixtures/formResetDsl.json index 99048332fc2..53a68a96333 100644 --- a/app/client/cypress/fixtures/formResetDsl.json +++ b/app/client/cypress/fixtures/formResetDsl.json @@ -52,9 +52,9 @@ "text": "Submit", "isDefaultClickDisabled": true, "buttonStyle": "PRIMARY_BUTTON", - "disabledWhenInvalid": true, - "resetFormOnClick": true, - "type": "FORM_BUTTON_WIDGET", + "isDisabled": false, + "onClick": "{{resetWidget(\"Form1\", true)}}", + "type": "BUTTON_WIDGET", "isLoading": false, "leftColumn": 12, "rightColumn": 16, @@ -69,9 +69,9 @@ "text": "Reset", "isDefaultClickDisabled": true, "buttonStyle": "SECONDARY_BUTTON", - "disabledWhenInvalid": false, - "resetFormOnClick": true, - "type": "FORM_BUTTON_WIDGET", + "isDisabled": false, + "onClick": "{{resetWidget(\"Form1\", true)}}", + "type": "BUTTON_WIDGET", "isLoading": false, "leftColumn": 8, "rightColumn": 12, @@ -178,7 +178,7 @@ } }, { - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "size": { "rows": 1, "cols": 4 @@ -190,12 +190,12 @@ "props": { "text": "Submit", "buttonStyle": "PRIMARY_BUTTON", - "disabledWhenInvalid": true, - "resetFormOnClick": true + "isDisabled": false, + "onClick":"{{resetWidget(\"Form1\", true)}}" } }, { - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "size": { "rows": 1, "cols": 4 @@ -207,8 +207,8 @@ "props": { "text": "Reset", "buttonStyle": "SECONDARY_BUTTON", - "disabledWhenInvalid": false, - "resetFormOnClick": true + "isDisabled": false, + "onClick":"{{resetWidget(\"Form1\", true)}}" } } ] @@ -258,7 +258,7 @@ } }, { - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "size": { "rows": 1, "cols": 4 @@ -270,12 +270,12 @@ "props": { "text": "Submit", "buttonStyle": "PRIMARY_BUTTON", - "disabledWhenInvalid": true, - "resetFormOnClick": true + "isDisabled": false, + "onClick":"{{resetWidget(\"Form1\", true)}}" } }, { - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "size": { "rows": 1, "cols": 4 @@ -287,8 +287,8 @@ "props": { "text": "Reset", "buttonStyle": "SECONDARY_BUTTON", - "disabledWhenInvalid": false, - "resetFormOnClick": true + "isDisabled": false, + "onClick":"{{resetWidget(\"Form1\", true)}}" } } ] diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/FormReset_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/FormReset_spec.js index 837c8813e8c..dac2e27bbb0 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/FormReset_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/FormReset_spec.js @@ -22,7 +22,7 @@ describe("Form reset functionality", function() { .invoke("attr", "value") .should("contain", "lindsay.ferguson@reqres.in"); - cy.get(widgetsPage.formButtonWidget) + cy.get(widgetsPage.buttonWidget) .contains("Reset") .click(); // eslint-disable-next-line cypress/no-unnecessary-waiting From 912b9f6eeb2a6962c5ed385fe2bea76896f2b6fd Mon Sep 17 00:00:00 2001 From: bhavin Date: Mon, 19 Jul 2021 16:35:22 +0530 Subject: [PATCH 4/5] updated cypress dsl --- .../cypress/fixtures/formInputTableDsl.json | 30 ++++++++----------- .../cypress/fixtures/formSwitchDsl.json | 10 +++---- .../cypress/fixtures/formWidgetdsl.json | 10 +++---- 3 files changed, 20 insertions(+), 30 deletions(-) diff --git a/app/client/cypress/fixtures/formInputTableDsl.json b/app/client/cypress/fixtures/formInputTableDsl.json index 71eba218770..a0381934421 100644 --- a/app/client/cypress/fixtures/formInputTableDsl.json +++ b/app/client/cypress/fixtures/formInputTableDsl.json @@ -52,9 +52,8 @@ "text": "Submit", "isDefaultClickDisabled": true, "buttonStyle": "PRIMARY_BUTTON", - "disabledWhenInvalid": true, - "resetFormOnClick": true, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", + "onClick": "{{resetWidget(\"Form1\", true)}}", "isLoading": false, "leftColumn": 12, "rightColumn": 16, @@ -69,9 +68,8 @@ "text": "Reset", "isDefaultClickDisabled": true, "buttonStyle": "SECONDARY_BUTTON", - "disabledWhenInvalid": false, - "resetFormOnClick": true, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", + "onClick": "{{resetWidget(\"Form1\", true)}}", "isLoading": false, "leftColumn": 8, "rightColumn": 12, @@ -133,7 +131,7 @@ } }, { - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "size": { "rows": 1, "cols": 4 @@ -145,12 +143,11 @@ "props": { "text": "Submit", "buttonStyle": "PRIMARY_BUTTON", - "disabledWhenInvalid": true, - "resetFormOnClick": true + "onClick": "{{resetWidget(\"Form1\", true)}}" } }, { - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "size": { "rows": 1, "cols": 4 @@ -162,8 +159,7 @@ "props": { "text": "Reset", "buttonStyle": "SECONDARY_BUTTON", - "disabledWhenInvalid": false, - "resetFormOnClick": true + "onClick": "{{resetWidget(\"Form1\", true)}}" } } ] @@ -212,7 +208,7 @@ } }, { - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "size": { "rows": 1, "cols": 4 @@ -224,12 +220,11 @@ "props": { "text": "Submit", "buttonStyle": "PRIMARY_BUTTON", - "disabledWhenInvalid": true, - "resetFormOnClick": true + "onClick": "{{resetWidget(\"Form1\", true)}}" } }, { - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", "size": { "rows": 1, "cols": 4 @@ -241,8 +236,7 @@ "props": { "text": "Reset", "buttonStyle": "SECONDARY_BUTTON", - "disabledWhenInvalid": false, - "resetFormOnClick": true + "onClick": "{{resetWidget(\"Form1\", true)}}" } } ] diff --git a/app/client/cypress/fixtures/formSwitchDsl.json b/app/client/cypress/fixtures/formSwitchDsl.json index 874e74af23d..c59f1fb28b0 100644 --- a/app/client/cypress/fixtures/formSwitchDsl.json +++ b/app/client/cypress/fixtures/formSwitchDsl.json @@ -55,9 +55,8 @@ "isDefaultClickDisabled": true, "version": 1, "buttonStyle": "PRIMARY_BUTTON", - "disabledWhenInvalid": true, - "resetFormOnClick": true, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", + "onClick": "{{resetWidget(\"Form1\", true)}}", "isLoading": false, "leftColumn": 12, "rightColumn": 16, @@ -73,9 +72,8 @@ "isDefaultClickDisabled": true, "version": 1, "buttonStyle": "SECONDARY_BUTTON", - "disabledWhenInvalid": false, - "resetFormOnClick": true, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", + "onClick": "{{resetWidget(\"Form1\", true)}}", "isLoading": false, "leftColumn": 8, "rightColumn": 12, diff --git a/app/client/cypress/fixtures/formWidgetdsl.json b/app/client/cypress/fixtures/formWidgetdsl.json index c27468b0a4b..6fd5c97b57c 100644 --- a/app/client/cypress/fixtures/formWidgetdsl.json +++ b/app/client/cypress/fixtures/formWidgetdsl.json @@ -84,9 +84,8 @@ "text": "Submit", "isDefaultClickDisabled": true, "buttonStyle": "PRIMARY_BUTTON", - "disabledWhenInvalid": true, - "resetFormOnClick": true, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", + "onClick": "{{resetWidget(\"Form1\", true)}}", "isLoading": false, "leftColumn": 12, "rightColumn": 16, @@ -101,9 +100,8 @@ "text": "Reset", "isDefaultClickDisabled": true, "buttonStyle": "SECONDARY_BUTTON", - "disabledWhenInvalid": false, - "resetFormOnClick": true, - "type": "FORM_BUTTON_WIDGET", + "type": "BUTTON_WIDGET", + "onClick": "{{resetWidget(\"Form1\", true)}}", "isLoading": false, "leftColumn": 8, "rightColumn": 12, From 89254252f7aa722eb6b3dc7b834f239293f2d319 Mon Sep 17 00:00:00 2001 From: bhavin Date: Wed, 28 Jul 2021 14:34:22 +0530 Subject: [PATCH 5/5] fixed migration issue --- app/client/src/utils/WidgetPropsUtils.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/client/src/utils/WidgetPropsUtils.tsx b/app/client/src/utils/WidgetPropsUtils.tsx index b2e282afa64..538832abada 100644 --- a/app/client/src/utils/WidgetPropsUtils.tsx +++ b/app/client/src/utils/WidgetPropsUtils.tsx @@ -792,6 +792,7 @@ const transformDSL = (currentDSL: ContainerWidgetProps) => { if (currentDSL.version === 26) { currentDSL = migrateDatePickerMinMaxDate(currentDSL); + currentDSL.version = 27; } if (currentDSL.version === 27) { currentDSL = migrateFilterValueForDropDownWidget(currentDSL);