-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix: Updating JSFunctionSettings unit test to fix failure #40480
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: Updating JSFunctionSettings unit test to fix failure #40480
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis change migrates the action execution behavior configuration from a boolean Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI (Dropdown)
participant Redux/Saga
participant Backend API
participant DB
User->>UI (Dropdown): Selects run behavior (Manual/On Page Load)
UI (Dropdown)->>Redux/Saga: Dispatches SET_RUN_BEHAVIOR action
Redux/Saga->>Backend API: PUT /runBehavior/{actionId} with behavior
Backend API->>DB: Update action.runBehavior and sync executeOnLoad
DB-->>Backend API: Persisted action
Backend API-->>Redux/Saga: Return updated action
Redux/Saga-->>UI (Dropdown): Update state/UI with new run behavior
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
🪧 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
…com/appsmithorg/appsmith into fix/client-unit-tests
🔴🔴🔴 Cyclic Dependency Check: This PR has increased the number of cyclic dependencies by 1, when compared with the release branch. Refer this document to identify the cyclic dependencies introduced by this PR. You can view the dependency diff in the run log. Look for the check-cyclic-dependencies job in the run. |
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: 3
🔭 Outside diff range comments (1)
app/client/cypress/support/Pages/JSEditor.ts (1)
299-315
:⚠️ Potential issueMethods need updating to handle dropdown selection instead of toggle.
The
VerifyAsyncFuncSettings
andEnableDisableAsyncFuncSettings
methods still use boolean parameters and check/uncheck operations, but the UI now uses a dropdown with enum values.These methods need to be updated to:
- Accept enum values instead of boolean parameters
- Select dropdown options instead of checking/unchecking
- public VerifyAsyncFuncSettings(funName: string, onLoad = true) { + public VerifyAsyncFuncSettings(funName: string, runBehavior = "ON_PAGE_LOAD") { this.toolbar.toggleSettings(); this.agHelper.AssertExistingCheckedState( this._onPageLoadSwitchStatus(funName), - onLoad.toString(), + runBehavior, ); this.toolbar.toggleSettings(); } - public EnableDisableAsyncFuncSettings(funName: string, onLoad = true) { + public EnableDisableAsyncFuncSettings(funName: string, runBehavior = "ON_PAGE_LOAD") { // Navigate to Settings tab this.toolbar.toggleSettings(); // Set onPageLoad - this.agHelper.CheckUncheck(this._onPageLoadSwitch(funName), onLoad); + this.agHelper.SelectDropdownOption(this._onPageLoadSwitch(funName), runBehavior); // Return to code tab this.toolbar.toggleSettings(); }Note: The method
agHelper.SelectDropdownOption
is a suggestion - you'll need to use the appropriate helper method for selecting dropdown options in your framework.
🧹 Nitpick comments (9)
app/client/src/ce/sagas/PageSagas.tsx (2)
542-543
: Improve filter condition clarityConsider making the filter condition more explicit about what you're checking for, to improve code readability.
- const actions = actionUpdates.filter( - (d) => !d.hasOwnProperty("collectionId"), - ); + const actions = actionUpdates.filter( + (d) => d.collectionId === undefined, + );🧰 Tools
🪛 Biome (1.9.4)
[error] 543-543: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
533-549
: Consider error handling for actionUpdatesThe code assumes
actionUpdates
is an array. Consider adding a null/undefined check before filtering.- if (actionUpdates && actionUpdates.length > 0) { + if (Array.isArray(actionUpdates) && actionUpdates.length > 0) {🧰 Tools
🪛 Biome (1.9.4)
[error] 535-535: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
[error] 538-538: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 543-543: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
[error] 546-546: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx (1)
63-72
: Test assertions updated to verify dropdown content.The assertions now correctly check for the presence of "On page load" and "Manual" text in the dropdown components, using appropriate selectors to verify the UI renders correctly.
Note: The selectors used (
.myFun1-run-behavior-setting
and.myFun2-run-behavior-setting
) are quite specific. Consider adding data-testid attributes for more maintainable test selectors if this isn't already a standard practice in your codebase.app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java (1)
132-132
: Ensure proper annotation for deprecated endpoint.The
@Deprecated
annotation is correctly applied, but consider adding@Deprecated(since = "version", forRemoval = true)
with appropriate version information for better maintenance tracking.-@Deprecated +@Deprecated(since = "your-version", forRemoval = true)app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx (1)
61-63
: Analytics event property naming could be improved.The analytics event still uses "toggleSetting" with value "ON_PAGE_LOAD" even though it's not a toggle anymore and the new value is the enum value.
AnalyticsUtil.logEvent("JS_OBJECT_SETTINGS_CHANGED", { - toggleSetting: "ON_PAGE_LOAD", + settingType: "RUN_BEHAVIOR", toggleValue: newRunBehavior, });app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json (1)
8-23
: Consistent migration torunBehavior
dropdown
This correctly replaces the oldexecuteOnLoad
switch with arunBehavior
dropdown, bringing Oracle plugin settings in line with the new platform standard.Nit: for clearer wording, consider this diff:
- "subText": "Query runs when the page loads or when manually triggered", + "subText": "Query runs automatically on page load or when manually triggered",And likewise for the manual option:
- "subText": "Query only runs when called in an event or JS with .run()", + "subText": "Query only runs when explicitly invoked via event handlers or with JS `.run()`",app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json (1)
8-23
: Run behavior dropdown aligned with platform convention
The MSSQL plugin now usesrunBehavior
withON_PAGE_LOAD
/MANUAL
options—great consistency.Minor wording tweak for the first option:
- "subText": "Query runs when the page loads or when manually triggered", + "subText": "Query runs automatically on page load or when manually triggered",app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json (1)
8-23
: Firestore plugin updated torunBehavior
enum
The Firestore settings now match the new dropdown-based execution behavior, ensuring uniform UX across plugins.Suggestion: refine the descriptive text:
- "subText": "Query runs when the page loads or when manually triggered", + "subText": "Query runs automatically on page load or when manually triggered",app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json (1)
8-23
: Mongo plugin adoptsrunBehavior
dropdown
Good update—executeOnLoad
is replaced with an explicitrunBehavior
setting, consistent with other database plugins.Optional refinement for clarity:
- "subText": "Query runs when the page loads or when manually triggered", + "subText": "Query runs automatically on page load or when manually triggered",
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (59)
app/client/cypress/support/Pages/JSEditor.ts
(1 hunks)app/client/src/PluginActionEditor/constants/PluginActionConstants.ts
(1 hunks)app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts
(1 hunks)app/client/src/actions/pluginActionActions.ts
(2 hunks)app/client/src/api/ActionAPI.tsx
(2 hunks)app/client/src/api/PageApi.tsx
(2 hunks)app/client/src/ce/constants/ReduxActionConstants.tsx
(4 hunks)app/client/src/ce/constants/messages.ts
(1 hunks)app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts
(4 hunks)app/client/src/ce/reducers/entityReducers/actionsReducer.tsx
(3 hunks)app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx
(4 hunks)app/client/src/ce/sagas/PageSagas.tsx
(2 hunks)app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts
(2 hunks)app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts
(10 hunks)app/client/src/components/editorComponents/utils.test.ts
(2 hunks)app/client/src/components/formControls/DropDownControl.tsx
(4 hunks)app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts
(1 hunks)app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts
(1 hunks)app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts
(1 hunks)app/client/src/entities/Action/actionProperties.test.ts
(1 hunks)app/client/src/entities/Action/index.ts
(2 hunks)app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts
(1 hunks)app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx
(5 hunks)app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx
(3 hunks)app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts
(1 hunks)app/client/src/pages/Editor/JSEditor/utils.test.ts
(2 hunks)app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json
(8 hunks)app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json
(8 hunks)app/client/src/sagas/ActionExecution/PluginActionSaga.ts
(2 hunks)app/client/src/sagas/ActionSagas.ts
(4 hunks)app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts
(1 hunks)app/client/src/sagas/JSPaneSagas.ts
(4 hunks)app/client/src/utils/DynamicBindingUtils.test.ts
(1 hunks)app/client/src/utils/FilterInternalProperties/JsAction.ts
(2 hunks)app/client/src/utils/JSPaneUtils.test.ts
(11 hunks)app/client/src/utils/JSPaneUtils.tsx
(5 hunks)app/client/test/factories/Actions/API.ts
(1 hunks)app/client/test/factories/Actions/GoogleSheetFactory.ts
(1 hunks)app/client/test/factories/Actions/JSObject.ts
(2 hunks)app/client/test/factories/Actions/Postgres.ts
(1 hunks)app/client/test/factories/MockPluginsState.ts
(4 hunks)app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/RunBehaviorEnum.java
(1 hunks)app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java
(2 hunks)app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json
(1 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java
(2 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java
(2 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java
(3 hunks)app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`app/client/cypress/**/**.*`: Review the following e2e test code written using the Cypress test library. Ensure that: - Follow best practices for Cypress code and e2e automation. ...
app/client/cypress/**/**.*
: Review the following e2e test code written using the Cypress test library. Ensure that:
- Follow best practices for Cypress code and e2e automation.
- Avoid using cy.wait in code.
- Avoid using cy.pause in code.
- Avoid using agHelper.sleep().
- Use locator variables for locators and do not use plain strings.
- Use data-* attributes for selectors.
- Avoid Xpaths, Attributes and CSS path.
- Avoid selectors like .btn.submit or button[type=submit].
- Perform logins via API with LoginFromAPI.
- Perform logout via API with LogOutviaAPI.
- Perform signup via API with SignupFromAPI.
- Avoid using it.only.
- Avoid using after and aftereach in test cases.
- Use multiple assertions for expect statements.
- Avoid using strings for assertions.
- Do not use duplicate filenames even with different paths.
- Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/support/Pages/JSEditor.ts
🧬 Code Graph Analysis (12)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
ActionRunBehaviourType
(27-27)
app/client/src/api/ActionAPI.tsx (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
ActionRunBehaviourType
(27-27)
app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (2)
app/client/src/ce/constants/ReduxActionConstants.tsx (1)
ReduxActionTypes
(1281-1324)app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
ActionRunBehaviourType
(27-27)
app/client/src/ce/sagas/PageSagas.tsx (2)
app/client/src/actions/pluginActionActions.ts (2)
setActionsRunBehavior
(355-366)setJSActionsRunBehavior
(368-380)app/client/src/entities/DataTree/dataTreeFactory.ts (2)
actions
(129-156)jsActions
(110-127)
app/client/src/api/PageApi.tsx (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
ActionRunBehaviourType
(27-27)
app/client/src/entities/Action/index.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
ActionRunBehaviourType
(27-27)
app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (2)
RUN_BEHAVIOR
(10-23)RUN_BEHAVIOR_VALUES
(25-25)
app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (2)
RUN_BEHAVIOR
(10-23)RUN_BEHAVIOR_VALUES
(25-25)
app/client/src/actions/pluginActionActions.ts (2)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (1)
ActionRunBehaviourType
(27-27)app/client/src/ce/constants/ReduxActionConstants.tsx (1)
ReduxActionTypes
(1281-1324)
app/client/src/components/formControls/DropDownControl.tsx (1)
app/client/src/ce/pages/workspace/InviteUsersForm.tsx (1)
OptionLabel
(127-134)
app/client/src/sagas/ActionExecution/PluginActionSaga.ts (2)
app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (1)
ActionData
(18-22)app/client/src/ce/selectors/entitiesSelector.ts (1)
getCurrentActions
(694-702)
app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts (1)
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (2)
RUN_BEHAVIOR
(10-23)RUN_BEHAVIOR_VALUES
(25-25)
🪛 Biome (1.9.4)
app/client/src/ce/sagas/PageSagas.tsx
[error] 543-543: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
(lint/suspicious/noPrototypeBuiltins)
[error] 546-546: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: client-unit-tests / client-unit-tests
- GitHub Check: client-build / client-build
- GitHub Check: client-lint / client-lint
- GitHub Check: server-unit-tests / server-unit-tests
🔇 Additional comments (133)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java (3)
18-18
: Added import for RunBehaviorEnumAppropriate addition of the import for the new enum used in the class.
104-113
: Good use of deprecation for executeOnLoadThe code properly deprecates the boolean
executeOnLoad
field with an informative Javadoc comment and annotation. This maintains backward compatibility while signaling the transition to the newrunBehavior
property.
112-113
: New runBehavior field with sensible defaultThe addition of the
runBehavior
field with a default value ofRunBehaviorEnum.MANUAL
is a good practice. The field has the same JSON views as the deprecated field, ensuring consistent serialization behavior.app/client/src/PluginActionEditor/constants/PluginActionConstants.ts (2)
5-8
: Clean enum definition for ActionRunBehaviourThe enum provides clear, distinct values for the two run behavior types.
25-27
: Proper exports for constants and typeGood approach exporting both the values array and a type alias for use throughout the application.
app/client/src/utils/DynamicBindingUtils.test.ts (1)
123-123
: Test updated to use runBehavior instead of executeOnLoadThe test fixture has been appropriately updated to align with the new field name and type.
app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts (1)
132-132
: Test fixture updated to use runBehavior instead of executeOnLoadThe test fixture has been correctly updated to use the new
runBehavior
property with the "ON_PAGE_LOAD" value, which is the appropriate replacement for what was likelyexecuteOnLoad: true
.app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts (2)
47-47
: Change looks good - executeOnLoad replaced with runBehaviorThe replacement of the deprecated boolean flag with the new enum-based property matches the migration pattern described in the PR. This ensures test data stays consistent with the JSObject schema changes.
89-89
: Consistent application of runBehavior propertyGood implementation of the same pattern for the second action in the test mock. Both actions now use "MANUAL" as their run behavior, which properly replaces the previous false executeOnLoad values.
app/client/test/factories/Actions/Postgres.ts (1)
34-34
: PostgresFactory updated to use runBehaviorCorrectly updated the factory to use the new runBehavior property. This ensures test data created with this factory will conform to the new schema expected by the application.
app/client/test/factories/Actions/API.ts (1)
66-66
: APIFactory updated to use runBehaviorThe API action factory has been properly updated with the new runBehavior property. This ensures consistency across all test factories that generate action objects.
app/client/src/ce/constants/messages.ts (1)
2592-2592
: UI message updated to reflect the new behavior modelThe ON_LOAD_TITLE message has been updated to reflect the change from a binary selection to a run behavior selection. This properly communicates the more expressive options now available to users.
app/client/test/factories/Actions/GoogleSheetFactory.ts (1)
66-66
: Property update to align with new execution behavior modelThe property has been updated from the boolean
executeOnLoad
to the string-basedrunBehavior
with value "MANUAL", which is part of the codebase-wide migration to a more expressive run behavior model.app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts (4)
47-47
: Test data updated to use new runBehavior propertyUpdated the test data to use
runBehavior: "MANUAL"
instead of the previousexecuteOnLoad
boolean property for the first JS action in the test fixture.
94-94
: Test data updated to use new runBehavior propertyUpdated the test data to use
runBehavior: "MANUAL"
instead of the previousexecuteOnLoad
boolean property for the second JS action in the test fixture.
242-242
: Test data updated to use new runBehavior propertyUpdated the test data to use
runBehavior: "MANUAL"
instead of the previousexecuteOnLoad
boolean property for the myFun2 action in the second test case.
289-289
: Test data updated to use new runBehavior propertyUpdated the test data to use
runBehavior: "MANUAL"
instead of the previousexecuteOnLoad
boolean property for the myFun1 action in the second test case.app/client/src/entities/Action/actionProperties.test.ts (1)
13-13
: Default action test fixture updatedUpdated the DEFAULT_ACTION test fixture to use the new
runBehavior
property instead of the deprecatedexecuteOnLoad
boolean flag. This change maintains consistency with the updated action model.app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts (1)
84-84
: Updated tab selection condition to check for new propertyThe condition has been updated to check for "runBehavior" in the property path instead of "executeOnLoad", ensuring that the navigation logic correctly shows the settings tab when the run behavior property is accessed.
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/types.ts (1)
3-6
: Type refinement for form values looks goodThe change from a less specific type to
ActionRunBehaviourType
improves type safety and aligns with the broader refactoring from boolean flags to an enum-based approach for run behavior configuration.app/client/src/pages/Editor/JSEditor/utils.test.ts (2)
9-9
: Added import looks correctImport of the ActionRunBehaviour enum needed for the refactored test code.
48-48
: Proper conversion from boolean to enum valueReplaced the previous boolean
executeOnLoad: false
with the enum-basedrunBehavior: ActionRunBehaviour.MANUAL
which properly aligns with the refactoring efforts.app/client/test/factories/Actions/JSObject.ts (1)
33-33
: Replaced executeOnLoad with runBehaviorBoth JS actions in the factory have been updated to use
runBehavior: "MANUAL"
instead of the previous boolean flag. This matches the expected behavior in the refactored codebase.Also applies to: 73-73
app/client/src/components/editorComponents/utils.test.ts (2)
2-2
: Added required importImport of ActionRunBehaviour enum for use in the test fixture.
34-34
: Updated test fixture to use runBehaviorTest fixture now uses the enum-based
runBehavior
property withActionRunBehaviour.MANUAL
value, correctly matching the migration from boolean flags to enum values.app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts (1)
18-18
: Update is consistent with the codebase migrationThe change from
executeOnLoad: false
torunBehavior: "MANUAL"
properly aligns with the system-wide migration from boolean flags to the more expressive enum values.app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/RunBehaviorEnum.java (1)
1-9
: Well-structured enum with clear documentationThe new enum provides a type-safe way to represent action execution behaviors, which is more maintainable and extensible than the previous boolean approach.
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCE.java (2)
4-4
: Import added correctly for the new enumThe import for RunBehaviorEnum is properly added to support the new method.
21-21
: Interface updated with new method to support run behavior enumThe new method
setRunBehavior
properly complements the existingsetExecuteOnLoad
method, supporting the migration from boolean flags to enum values.app/client/src/api/PageApi.tsx (2)
12-12
: Import added correctly for the new typeThe ActionRunBehaviourType import is properly added to support the updated interface.
73-73
: Updated interface to use the new run behavior typeThe change from boolean
executeOnLoad
to typedrunBehavior
in SavePageResponseData interface properly aligns with the broader refactoring effort.app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts (2)
1-4
: Import statements correctly updated for the new run behavior constantsThe imports now include
RUN_BEHAVIOR
andRUN_BEHAVIOR_VALUES
from the PluginActionEditor constants, which are necessary for the dropdown implementation.
12-16
: Properly migrated from boolean toggle to dropdown selectionThe configuration has been updated from a boolean
executeOnLoad
to a more expressiverunBehavior
dropdown, with proper initial value set toMANUAL
. This aligns with the broader migration across the codebase.app/client/src/entities/Action/index.ts (2)
13-13
: Import added for ActionRunBehaviourTypeCorrectly imported the type definition needed for the
runBehavior
property.
143-143
: BaseAction interface updated with runBehavior propertyThe
executeOnLoad
boolean flag has been replaced with the more expressiverunBehavior
property of typeActionRunBehaviourType
. This allows for more granular control of action execution behavior beyond just on/off.app/client/src/utils/FilterInternalProperties/JsAction.ts (2)
4-4
: Import added for ActionRunBehaviour enumProper import added for the ActionRunBehaviour enum used in the condition check.
19-22
: Updated condition to use runBehavior instead of executeOnLoadThe conditional check has been properly updated to use the new
runBehavior
property with the specific enum valueActionRunBehaviour.ON_PAGE_LOAD
instead of checking for the presence ofexecuteOnLoad
.app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts (2)
9-12
: Import statements correctly updated for run behavior constantsThe imports for
RUN_BEHAVIOR
andRUN_BEHAVIOR_VALUES
from PluginActionConstants have been added as required for the dropdown implementation.
20-24
: API settings properly migrated to use runBehavior dropdownThe API settings configuration has been correctly updated to use a dropdown for run behavior instead of a boolean toggle. The configuration now uses the
runBehavior
property with proper initial value set toMANUAL
and options fromRUN_BEHAVIOR_VALUES
.app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json (1)
8-23
: RunBehavior dropdown is well-defined
The new"runBehavior"
block replaces the old boolean flag cleanly. Labels, subtexts, and values align with theActionRunBehaviour
enum on the client. Just ensure the client‐side enum constants match"ON_PAGE_LOAD"
and"MANUAL"
.app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json (1)
8-23
: Consistent dropdown mapping for run behavior
This drop‐down configuration mirrors the other plugins and correctly defaults to"MANUAL"
. Confirm that any analytics or telemetry hooks reference the updatedrunBehavior
field.app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json (1)
8-23
: Dropdown controlType and options are accurate
TheDROP_DOWN
control and its two options cover the expected behaviors. Verify that localization pipelines pick up these new labels if you’re using i18n.app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json (1)
8-23
: Run behavior switch-to-dropdown is correct
Great replacement of the boolean flag. Ensure downstream code (sagas, reducers, API) refers torunBehavior
consistently.app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json (1)
8-23
: MySQL plugin runBehavior block looks good
Consistent with other plugins. Check that the plugin’s backend schema and DTOs support the newrunBehavior
property.app/client/src/utils/JSPaneUtils.tsx (5)
6-6
: Necessary import for the ActionRunBehaviour enumThe import is added to support the migration from
executeOnLoad
boolean to the more descriptiverunBehavior
enum-based approach.
134-134
: Replaced executeOnLoad with runBehavior enumProperly updated from boolean flag
executeOnLoad: false
to more expressiverunBehavior: ActionRunBehaviour.MANUAL
in the action creation object.
233-233
: Replaced executeOnLoad with runBehavior enumUpdated the dummy JS action configuration to use
runBehavior: ActionRunBehaviour.MANUAL
instead of the boolean flag.
245-245
: Replaced executeOnLoad with runBehavior enumConsistent update to the second action in
createDummyJSCollectionActions
function.
285-285
: Replaced executeOnLoad with runBehavior enumProperly updated the
createSingleFunctionJsCollection
function to use the new enum-based approach.app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts (2)
1-4
: Added imports for run behavior constantsImports the necessary constants to support the dropdown control for run behavior selection.
12-16
: Updated form control for run behaviorMigrated from a boolean switch to a more expressive dropdown:
- Changed label from "Run the API on page load" to "Run behavior"
- Changed property from
executeOnLoad
torunBehavior
- Changed control type from
SWITCH
toDROP_DOWN
- Set appropriate initial value and options from imported constants
This change provides users with more clarity on execution behavior options.
app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json (1)
8-23
: Updated S3 plugin settings to use run behavior dropdownSimilar to the client-side changes, the S3 plugin settings now use a dropdown for run behavior with "On page load" and "Manual" options instead of a boolean switch.
The implementation includes descriptive subtext for each option, making the behavior clearer to users.
app/client/src/sagas/ActionExecution/PluginActionSaga.ts (2)
172-172
: Added ActionRunBehaviour importRequired import for the enum used in the updated conditional check below.
1557-1566
: Updated condition for clearing action responsesModified the condition to use the new
runBehavior
property instead ofexecuteOnLoad
. The checkaction.config.runBehavior !== ActionRunBehaviour.ON_PAGE_LOAD
is logically equivalent to the previous!action.config.executeOnLoad
, maintaining the same functionality while using the new property.The comment on line 1557 is also updated to reflect the change.
app/client/src/api/ActionAPI.tsx (2)
13-13
: Import added to support typed run behavior.Good addition of the ActionRunBehaviourType import to provide proper typing for the new parameter.
305-312
: Method signature change aligns with backend API updates.The method has been properly updated to support the more expressive run behavior model, replacing the boolean toggle with an enum-based approach. The API endpoint and payload structure have been updated accordingly.
app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json (1)
8-23
: UI control upgraded from switch to dropdown for better clarity.Good enhancement to the run behavior configuration:
- The dropdown provides clearer options with descriptive labels and subtext
- Default is sensibly set to "MANUAL"
- The change aligns with the platform-wide migration from boolean flags to enum-based behavior selection
app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json (1)
8-23
: UI control upgraded from switch to dropdown for better clarity.Good enhancement to the run behavior configuration:
- The dropdown provides clearer options with descriptive labels and subtext
- Default is sensibly set to "MANUAL"
- The change aligns with the platform-wide migration from boolean flags to enum-based behavior selection
app/client/cypress/support/Pages/JSEditor.ts (2)
54-55
: Updated selector to target the new combobox control.The selector has been correctly updated to match the new UI component type (dropdown instead of switch).
57-57
: Updated class name in selector to match new component naming.The selector has been correctly updated to use the new "-run-behavior-setting" class.
app/client/src/utils/JSPaneUtils.test.ts (11)
44-44
: ✅ Correctly replacedexecuteOnLoad
withrunBehavior
The first action inJSObject1
now usesrunBehavior: "MANUAL"
, aligning with the new enum.
86-86
: ✅ ConsistentrunBehavior
update in second action ofJSObject1
The test fixture correctly setsrunBehavior: "MANUAL"
.
154-154
: ✅runBehavior
applied to first action inJSObject2
Matches the updated property name and default value.
196-196
: ✅runBehavior
applied to second action inJSObject2
Consistent with the schema change.
280-280
: ✅ UpdatedrunBehavior
inresultRenamedActions
fixture
Ensures name-change diff includes the new property.
361-361
: ✅ UpdatedrunBehavior
inresultDeletedActions
fixture
Deletion diff now reflects the new enum field.
472-472
: ✅ UpdatedrunBehavior
inresultChangedBody
fixture
Body-change diff correctly includesrunBehavior: "MANUAL"
.
552-552
: ✅ UpdatedrunBehavior
inresultChangedParameters
fixture
Parameter-change diff now carries the new property.
627-627
: ✅ UpdatedrunBehavior
inresultRemovedAsync
fixture
Removal of async tag diff includes the new enum field.
702-702
: ✅ UpdatedrunBehavior
inresultAddedAsync
fixture
Addition of async tag diff now aligns with the new run behavior.
757-757
: ✅ UpdatedrunBehavior
inresultAddedAction
fixture
New-action diff correctly setsrunBehavior: "MANUAL"
.app/client/src/ce/sagas/PageSagas.tsx (3)
91-92
: Imports updated to match the new action creator names.The imports have been correctly updated from
setActionsToExecuteOnPageLoad
andsetJSActionsToExecuteOnPageLoad
tosetActionsRunBehavior
andsetJSActionsRunBehavior
respectively, which aligns with the migration from booleanexecuteOnLoad
to the more expressiverunBehavior
enum approach.
539-540
: Updated action dispatch to use the new action creator.Correctly updated to use the new
setActionsRunBehavior
action creator instead of the previoussetActionsToExecuteOnPageLoad
.
547-548
: Updated action dispatch to use the new action creator for JS actions.Correctly updated to use the new
setJSActionsRunBehavior
action creator instead of the previoussetJSActionsToExecuteOnPageLoad
.app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts (10)
2310-2310
: The migration fromexecuteOnLoad
torunBehavior
looks correct.The addition of
runBehavior: "ON_PAGE_LOAD"
is consistent with the overall codebase refactoring to replace the booleanexecuteOnLoad
flag with a more descriptive enum.
2394-2394
: Proper implementation of therunBehavior
property.Setting
runBehavior: "MANUAL"
here is the correct equivalent to the previousexecuteOnLoad: false
setting.
10041-10058
: UI control properly updated to support the new run behavior options.The dropdown implementation with descriptive labels and subtext is appropriate for this change. The control type change from a switch to a dropdown improves the user experience by making the options more explicit and providing additional context through subtext.
10092-10109
: Dropdown implementation consistent with other instances.This implementation of the dropdown control matches the pattern established in the previous hunk, maintaining consistency throughout the codebase.
10143-10160
: Dropdown settings properly configured for API components.The run behavior options are appropriately defined for API components, with clear labels and helpful descriptions.
10223-10240
: Dropdown configuration consistent with previous implementations.The configuration for this dropdown maintains consistency with the other instances in the file.
10415-10415
: JS function default run behavior correctly set.Setting the default behavior to
"MANUAL"
for JS functions aligns with the expected behavior migration.
10465-10465
: Consistent application of therunBehavior
property.The
runBehavior: "MANUAL"
setting is consistently applied to all JS functions.
10549-10549
: Consistent implementation of run behavior property.The property is correctly set to
"MANUAL"
for this JS action configuration.
10599-10599
: Default behavior correctly specified.The
"MANUAL"
setting for the final JS action is consistent with the previous configurations.app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx (4)
6-6
: Good addition of the ActionRunBehaviour import.This import supports the transition from boolean
executeOnLoad
to the enum-basedrunBehavior
property, aligning with the broader migration effort.
19-19
: Test description appropriately updated.The test description now correctly reflects that it's testing the disabled state of the run behavior dropdown, which aligns with the UI changes.
31-31
: Updated test now correctly verifies dropdown components.The test has been properly updated to verify the presence of comboboxes instead of the previous switch components, matching the UI changes from boolean toggles to dropdown selectors.
Also applies to: 40-40
43-53
: Test data correctly uses the new enum values.The test data now properly uses
ActionRunBehaviour.ON_PAGE_LOAD
andActionRunBehaviour.MANUAL
instead of boolean values, reflecting the data model change.app/client/test/factories/MockPluginsState.ts (1)
6955-6973
: The new dropdown control for run behavior looks good.The change replaces a previous boolean switch for "executeOnLoad" with a more expressive dropdown that offers clear options:
- "On page load" - Runs when page loads or manually triggered
- "Manual" - Runs only when explicitly called
The implementation is consistent across all plugin configurations and includes helpful subtexts that explain each option's behavior.
Also applies to: 7035-7053, 7115-7133, 7159-7177
app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java (3)
5-5
: Import added correctly for RunBehaviorEnum.The new import is properly added to support the new endpoint.
119-127
: Well-implemented new endpoint for setting run behavior.The new endpoint follows REST principles and controller patterns established in the codebase. The implementation includes proper logging and response formatting.
129-132
: Good deprecation documentation for the legacy endpoint.The Javadoc comment clearly indicates that the endpoint is deprecated and directs users to the new replacement endpoint.
app/client/src/ce/reducers/entityReducers/actionsReducer.tsx (2)
16-16
: Correctly imported ActionRunBehaviourType type.The import for the new type is properly added to support the updated action handler.
314-332
: Updated action handler to use runBehavior instead of executeOnLoad.The Redux action handler has been appropriately updated to use the new
runBehavior
property, maintaining consistent state update patterns with the rest of the reducer.app/client/src/components/formControls/DropDownControl.tsx (5)
23-23
: Added Flex and Text components import.The import statement has been correctly updated to include the necessary components for the new styled components.
32-32
: Added styled-components import.The import for styled-components is correctly added to support the new styled components.
34-43
: Created styled components for dropdown option formatting.Two new styled components (
OptionLabel
andOptionSubText
) have been added to properly format dropdown options with labels and subtexts, improving the user experience.
477-477
: Fixed dropdown list height.A consistent height of 240px is now applied to dropdown lists for better user experience and UI consistency.
511-540
: Enhanced renderOptionWithIcon to support option subtexts.The function now conditionally renders options with a more sophisticated layout when subtexts are provided, improving readability and information hierarchy in dropdowns.
app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json (2)
86-86
: Updated action configuration to use runBehavior instead of executeOnLoad.The action configuration now correctly uses the
runBehavior
property with the value "MANUAL" instead of the deprecated booleanexecuteOnLoad
flag.
2546-2561
: Replaced boolean toggle with descriptive dropdown for all plugin configurations.The UI control for execution behavior has been consistently updated across all plugin configurations to use a dropdown with descriptive options instead of a simple toggle. The added subtexts provide clear explanations of each option's behavior.
app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json (2)
85-85
: Correctly added runBehavior property with MANUAL default value.The new runBehavior property has been properly added with the default value of "MANUAL" to replace the previous executeOnLoad boolean flag, aligning with the backend changes.
2545-2607
: Config changes properly implement the run behavior dropdown UI.The setting configuration has been properly updated to replace the previous boolean executeOnLoad switch with a more expressive dropdown for run behavior, including appropriate labels and descriptive subtext for both options.
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx (5)
2-20
: Correctly updated imports for new Select component.The imports have been properly updated to include the necessary components for the dropdown implementation, including Select, Option, and styled component utilities.
21-34
: Well-structured styled components for dropdown options.The styled components are appropriately defined with proper naming and styling that matches the design system with correct color variables.
47-50
: Successfully migrated from boolean to enum state.The component state has been properly updated to use the runBehavior enum instead of the executeOnLoad boolean, with correct options handling.
51-66
: Update handler correctly manages the new run behavior state.The callback function correctly handles the new runBehavior enum, updates local state, calls the parent callback, and logs analytics with the appropriate properties.
69-106
: UI successfully migrated from switch to dropdown.The UI has been properly updated to use a Select component instead of a switch, with good layout, correct data-testid attributes, and appropriate rendering of options with labels and subtext.
app/client/src/actions/pluginActionActions.ts (3)
23-23
: Correctly imported ActionRunBehaviourType.The new type import for ActionRunBehaviourType has been correctly added to properly type the action payloads.
355-366
: Successfully renamed action creator and updated payload type.The action creator has been properly renamed from setActionsToExecuteOnLoad to setActionsRunBehavior, with the payload properly updated to use runBehavior instead of executeOnLoad.
368-380
: Successfully renamed JS action creator and updated payload type.The JS action creator has been properly renamed from setJSActionsToExecuteOnPageLoad to setJSActionsRunBehavior, with the payload correctly updated to use runBehavior instead of executeOnLoad.
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/LayoutActionServiceCEImpl.java (4)
9-9
: Correctly imported RunBehaviorEnum.The RunBehaviorEnum has been properly imported for use in the service implementation.
304-310
: Added bidirectional synchronization for backward compatibility.The setExecuteOnLoad method has been correctly updated to also set the corresponding runBehavior value, ensuring backward compatibility for existing code.
322-349
: Well-implemented new setRunBehavior method.The new setRunBehavior method properly handles setting the new enum value while also maintaining backward compatibility by updating the executeOnLoad boolean flag.
426-435
: Properly handled initialization of runBehavior in createAction.The createAction method now correctly initializes the runBehavior property based on the execution context and existing executeOnLoad value, ensuring consistency between the two properties.
app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutActionServiceTest.java (3)
11-11
: Import added for RunBehaviorEnumGood addition of the import for RunBehaviorEnum, which is needed for the new test cases below.
1357-1402
: Test coverage for RunBehavior functionality looks goodThe test method effectively verifies that when runBehavior is changed:
- Changing to ON_PAGE_LOAD updates both executeOnLoad and userSetOnLoad to true
- Changing back to MANUAL updates executeOnLoad to false while preserving userSetOnLoad
- Changes are properly persisted in the repository
The test structure is clean with appropriate assertions verifying the state transitions.
1404-1441
: Good bidirectional sync testThis test properly verifies the backward compatibility of the system - ensuring that setting executeOnLoad (the legacy property) still correctly updates runBehavior (the new property).
The test covers both directions:
- executeOnLoad=true → runBehavior=ON_PAGE_LOAD
- executeOnLoad=false → runBehavior=MANUAL
This is critical for ensuring the consistency of the new model with existing code.
app/client/src/sagas/JSPaneSagas.ts (4)
104-104
: Import added for ActionRunBehaviourTypeThe import for ActionRunBehaviourType is correctly added to support the changes in this file.
786-797
: Updated setFunctionPropertySaga to handle runBehaviorThe property check has been properly updated from "executeOnLoad" to "runBehavior" and now dispatches the appropriate action type. The payload structure has also been updated to include runBehavior instead of shouldExecute.
850-882
: Renamed and updated saga for handling run behaviorThe function has been appropriately renamed from toggleFunctionExecuteOnLoadSaga to updateFunctionRunBehaviorSaga. The implementation has been updated to:
- Accept runBehavior as a parameter instead of shouldExecute
- Call ActionAPI.updateActionRunBehavior instead of toggleActionExecuteOnLoad
- Update the redux action types for success and error states
The changes maintain the same error handling pattern.
947-948
: Updated watcher saga to listen for new action typeThe watcher saga has been updated to listen for UPDATE_FUNCTION_RUN_BEHAVIOR_INIT instead of TOGGLE_FUNCTION_EXECUTE_ON_LOAD_INIT, correctly connecting to the renamed saga handler.
app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx (3)
11-11
: Import added for ActionRunBehaviourTypeThe import for ActionRunBehaviourType is correctly added to provide type safety for the runBehavior property.
364-392
: Updated reducer handler for run behavior updatesThe reducer handler has been properly updated to:
- Handle UPDATE_FUNCTION_RUN_BEHAVIOR_SUCCESS instead of TOGGLE_FUNCTION_EXECUTE_ON_LOAD_SUCCESS
- Accept runBehavior in the payload instead of executeOnLoad
- Set the runBehavior property on the action instead of executeOnLoad
This keeps the state updates aligned with the new model.
393-420
: Updated reducer handler for setting run behaviorThis handler has been appropriately updated to:
- Handle SET_JS_ACTION_RUN_BEHAVIOR instead of SET_JS_ACTION_TO_EXECUTE_ON_PAGELOAD
- Update runBehavior instead of executeOnLoad in the action objects
- Maintain the same efficient implementation using create() from mutative
The type in the payload has been properly updated to use ActionRunBehaviourType.
app/client/src/sagas/ActionSagas.ts (4)
150-150
: Import added for ActionRunBehaviourTypeThe import for ActionRunBehaviourType is correctly added to provide type safety for the runBehavior property.
1042-1052
: Updated setActionPropertySaga to handle runBehaviorThe property check has been properly updated from "executeOnLoad" to "runBehavior" and now dispatches UPDATE_ACTION_RUN_BEHAVIOR_INIT with the appropriate payload structure.
The type casting to ActionRunBehaviourType provides good type safety.
1064-1089
: Renamed and updated saga for handling run behaviorThe function has been appropriately renamed from toggleActionExecuteOnLoadSaga to updateActionRunBehaviorSaga. The implementation has been updated to:
- Accept runBehavior as a parameter instead of shouldExecute
- Call ActionAPI.updateActionRunBehavior instead of toggleActionExecuteOnLoad
- Update the redux action types for success and error states
The changes maintain the same error handling pattern and keep the behavior consistent.
1269-1270
: Updated watcher saga to listen for new action typeThe watcher saga has been updated to listen for UPDATE_ACTION_RUN_BEHAVIOR_INIT instead of TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT, correctly connecting to the renamed saga handler.
app/client/src/ce/constants/ReduxActionConstants.tsx (4)
69-69
: Appropriate addition of JS action run behavior constants.The new constants properly support the migration from boolean
executeOnLoad
to the more expressiverunBehavior
enum pattern.Also applies to: 71-72
87-87
: Added corresponding error type for function run behavior.Good practice to include the error constant to maintain consistency with the rest of the codebase's error handling patterns.
808-810
: Appropriate addition of action run behavior constants.These constants properly implement the transition from
executeOnLoad
boolean flag to the more flexiblerunBehavior
pattern for regular actions.
824-824
: Added corresponding error type for action run behavior.Maintains error handling consistency throughout the codebase.
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts
Outdated
Show resolved
Hide resolved
3867bcf
into
feat/reactive-actions-run-behaviour
Description
Updating JSFunctionSettings unit test to fix failure
Fixes #39833
Automation
/ok-to-test tags=""
🔍 Cypress test results
Warning
Tests have not run on the HEAD d74c7de yet
Tue, 29 Apr 2025 16:47:47 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit