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: deprecate JS object confirm before calling #32527
fix: deprecate JS object confirm before calling #32527
Conversation
WalkthroughWalkthroughThe changes across various files primarily focus on the removal and simplification of features related to the "Confirm Before Calling" functionality in JavaScript functions and associated test adjustments. This includes removing redundant user confirmation steps, streamlining test flows, and updating component visibility settings related to function execution settings. Changes
Assessment against linked issues
Possibly related issues
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (7)
Files skipped from review as they are similar to previous changes (3)
Additional comments not posted (6)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
export const CONFIRM_BEFORE_CALLING_HEADING = { | ||
text: "Confirm before calling ", | ||
hasInfo: true, | ||
info: `Ask for confirmation before executing function. | ||
(This setting is deprecated and will be removed in the future.)`, | ||
key: "run_before_calling", | ||
hidden: true, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new CONFIRM_BEFORE_CALLING_HEADING
object is well-defined with appropriate properties. However, ensure that the deprecation note is clear about when this feature will be removed to avoid confusion.
label: "No", | ||
value: "false", | ||
}, | ||
CONFIRM_BEFORE_CALLING_HEADING, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding CONFIRM_BEFORE_CALLING_HEADING
directly to SETTINGS_HEADINGS
without conditions might not be ideal since it's deprecated. Consider adding a condition to include it only if necessary.
- CONFIRM_BEFORE_CALLING_HEADING,
+ ...(shouldIncludeConfirmBeforeCalling ? [CONFIRM_BEFORE_CALLING_HEADING] : []),
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
CONFIRM_BEFORE_CALLING_HEADING, | |
...(shouldIncludeConfirmBeforeCalling ? [CONFIRM_BEFORE_CALLING_HEADING] : []), |
/build-deploy-preview env=release skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8642786354. |
Deploy-Preview-URL: https://appsmith-kpreziifs-get-appsmith.vercel.app 🚨 Note: The release environment runs EE code, so using a frontend-only DP on this repo, will |
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad1_Spec.ts
Show resolved
Hide resolved
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts
Show resolved
Hide resolved
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JsOnLoad3_Spec.ts
Show resolved
Hide resolved
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8643279346. |
Deploy-Preview-URL: https://ce-32527.dp.appsmith.com |
@rishabhrathod01 Tested the above test scenarios and have a couple of observations:
Screen.Recording.2024-04-11.at.1.39.35.PM.mov |
This is a vercel feature on deploy preview to add comments once we log in. For creating DP pointing to release we use vercel hence this popup is visible.
I would like to keep this UI consistent until we remove this feature. Cases where even a single confirm before calling option is enabled we will see the column and position would move for both of the cases. IMO, it is better to keep the position consistent as few JSObject settings shouldn’t look different from others for users. Thoughts?
Yeah, I agree. Ideally, we should show a confirmation before the toggle itself but as we don't have the UI for that.
Any idea, Where shall we show the warning message? |
Got it
Agree with you, let's do that once we remove this feature completely, but in meantime can we please confirm the UI with someone from design team? IMO this is a small UI issue but still a quality issue, so let's confirm with design team once
Got it for now, we can probably show a warning toast message to just let the user know why it disappeared |
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8657477247. |
Deploy-Preview-URL: https://ce-32527.dp.appsmith.com |
@@ -446,11 +445,7 @@ WHERE aircraft_type = 'Passenger Plane'`; | |||
propPane.EnterJSContext("onClick", `{{Query1.run()}}`); | |||
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE)); | |||
agHelper.ClickButton("Submit"); | |||
jsEditor.ConfirmationClick("No"); //Handling both No & Yes from confirmation dialog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rishabhrathod01 @sneha122 : Aren't these lines asserting if the confirm before calling feature of the API/Query is working? This wasn't about JS Object's feature. Can you please confirm if this was the correct change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trishaanand you are correct. This code was misleading as it uses jsEditor class method to assert ApiEditor confirmation. I will undo this and will use generic or specific class names here to avoid this confusion in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @trishaanand for catching these 🚀, Missed during the review because I mainly relied on the fact that since tests are passing in CI, we should be okay with the changes, I will be more diligent about test cases review too from now onwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the check back in this PR #32957
app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts
Show resolved
Hide resolved
app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts
Show resolved
Hide resolved
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts
Show resolved
Hide resolved
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts
Show resolved
Hide resolved
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad4_Spec.ts
Show resolved
Hide resolved
//agHelper.WaitUntilToastDisappear('The action "Quotes" has failed');No toast appears! | ||
|
||
agHelper.AssertElementAbsence(jsEditor._dialogBody("WhatTrumpThinks")); //Since JS call is NO, dependent API confirmation should not appear | ||
|
||
agHelper.RefreshPage("getConsolidatedData"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rishabhrathod01 @sneha122 : Any reason to refresh the page considering the last line is to deploy the app. We should already have the page open at this point right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trishaanand I will need to dig deeper here, i am not sure why was this present earlier. Let me check and get back on this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vsvamsi1 could you please check if we could skip the refresh page that was added here. https://github.com/appsmithorg/appsmith/pull/30506/files#diff-25b467f92a60af5a65ad19e00f03aca3e9aa2c9ee324b4744cf15d1e233473e7
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JsOnLoad3_Spec.ts
Show resolved
Hide resolved
app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JsOnLoad3_Spec.ts
Show resolved
Hide resolved
onLoad = true, | ||
bfrCalling = true, | ||
) { | ||
public VerifyAsyncFuncSettings(funName: string, onLoad = true) { | ||
// this.agHelper.AssertExistingToggleState(this._functionSetting(Cypress.env("MESSAGES").JS_SETTINGS_ONPAGELOAD()), onLoad) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rishabhrathod01 @sneha122 : Could we please get rid of these commented lines. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will remove the commented code in a new PR.
Description
We deprecate confirm before calling for JSObjects
Fixes #29248
Test scenarios
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8654538946
Commit: 6ac458b
Cypress dashboard url: Click here!