From 2aa057aca01afb003305b2326352fc35e773e8cb Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Wed, 23 Apr 2025 20:49:48 +0530 Subject: [PATCH 1/4] replacing remaining instances of executeOnLoad with runBehavior on frontend --- .../constants/PluginActionConstants.ts | 6 ++--- .../RestActionTransformers.test.ts | 1 - app/client/src/actions/pluginActionActions.ts | 5 ++-- app/client/src/api/ActionAPI.tsx | 10 ++++++++ app/client/src/api/PageApi.tsx | 3 ++- .../src/ce/constants/ReduxActionConstants.tsx | 3 +++ .../DataTree/dataTreeJSAction.test.ts | 9 ++++---- .../entityReducers/actionsReducer.tsx | 7 +++--- .../entityReducers/jsActionsReducer.tsx | 9 ++++---- .../autocomplete/EntityDefinitions.test.ts | 5 ++-- .../PartialExportModal/unitTestUtils.ts | 16 ++++--------- .../components/editorComponents/utils.test.ts | 3 ++- .../entities/Action/actionProperties.test.ts | 3 ++- app/client/src/entities/Action/index.ts | 3 +-- .../EntityNavigation/JSObjectsPane/index.ts | 2 +- .../components/JSFunctionSettings.test.tsx | 5 ++-- .../components/JSFunctionSettings.tsx | 2 +- .../src/pages/Editor/JSEditor/utils.test.ts | 3 ++- .../SaaSEditor/__data__/FinalState.json | 15 ++++++------ .../SaaSEditor/__data__/InitialState.json | 15 ++++++------ .../sagas/ActionExecution/PluginActionSaga.ts | 10 +++++--- app/client/src/sagas/ActionSagas.ts | 23 ++++++++++--------- .../BuildingBlockSagas/tests/fixtures.ts | 3 ++- app/client/src/sagas/JSPaneSagas.ts | 4 ++-- .../src/utils/DynamicBindingUtils.test.ts | 3 ++- .../FilterInternalProperties/JsAction.ts | 6 ++++- app/client/src/utils/JSPaneUtils.test.ts | 23 ++++++++++--------- app/client/src/utils/JSPaneUtils.tsx | 9 ++++---- app/client/test/factories/MockPluginsState.ts | 8 +++---- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- .../src/main/resources/setting.json | 2 +- 41 files changed, 132 insertions(+), 106 deletions(-) diff --git a/app/client/src/PluginActionEditor/constants/PluginActionConstants.ts b/app/client/src/PluginActionEditor/constants/PluginActionConstants.ts index dd7714fb7ea1..871758fdc5f6 100644 --- a/app/client/src/PluginActionEditor/constants/PluginActionConstants.ts +++ b/app/client/src/PluginActionEditor/constants/PluginActionConstants.ts @@ -3,15 +3,15 @@ import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig export const THEME = EditorTheme.LIGHT; export enum ActionRunBehaviour { - PAGE_LOAD = "PAGE_LOAD", + ON_PAGE_LOAD = "ON_PAGE_LOAD", MANUAL = "MANUAL", } export const RUN_BEHAVIOR = { - PAGE_LOAD: { + ON_PAGE_LOAD: { label: "On page load", subText: "Query runs when the page loads or when manually triggered", - value: ActionRunBehaviour.PAGE_LOAD, + value: ActionRunBehaviour.ON_PAGE_LOAD, }, MANUAL: { label: "Manual", diff --git a/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts b/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts index 4298185f29ea..d12203dc6557 100644 --- a/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts +++ b/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts @@ -16,7 +16,6 @@ import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionCon const BASE_ACTION: ApiAction = { dynamicBindingPathList: [], cacheResponse: "", - executeOnLoad: false, runBehavior: ActionRunBehaviour.MANUAL, invalids: [], isValid: false, diff --git a/app/client/src/actions/pluginActionActions.ts b/app/client/src/actions/pluginActionActions.ts index ef0bcd204e07..42c2f90a0717 100644 --- a/app/client/src/actions/pluginActionActions.ts +++ b/app/client/src/actions/pluginActionActions.ts @@ -20,6 +20,7 @@ import type { EventLocation } from "ee/utils/analyticsUtilTypes"; import type { GenerateDestinationIdInfoReturnType } from "ee/sagas/helpers"; import type { Span } from "instrumentation/types"; import type { EvaluationReduxAction } from "./EvaluationReduxActionTypes"; +import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export const createActionRequest = ( payload: Partial, @@ -353,7 +354,7 @@ export const executePageLoadActions = ( export const setActionsToExecuteOnPageLoad = ( actions: Array<{ - executeOnLoad: boolean; + runBehavior: ActionRunBehaviour; id: string; name: string; }>, @@ -366,7 +367,7 @@ export const setActionsToExecuteOnPageLoad = ( export const setJSActionsToExecuteOnPageLoad = ( actions: Array<{ - executeOnLoad: boolean; + runBehavior: ActionRunBehaviour; id: string; name: string; collectionId?: string; diff --git a/app/client/src/api/ActionAPI.tsx b/app/client/src/api/ActionAPI.tsx index ada85c39b255..bb139eb3b0c7 100644 --- a/app/client/src/api/ActionAPI.tsx +++ b/app/client/src/api/ActionAPI.tsx @@ -10,6 +10,7 @@ import type { APIRequest } from "constants/AppsmithActionConstants/ActionConstan import type { WidgetType } from "constants/WidgetConstants"; import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers"; import type { PostActionRunConfig } from "./types"; +import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export interface Property { key: string; @@ -309,6 +310,15 @@ class ActionAPI extends API { flag: shouldExecute.toString(), }); } + + static async updateActionRunBehavior( + actionId: string, + runBehavior: ActionRunBehaviour, + ) { + return API.put(ActionAPI.url + `/runBehavior/${actionId}`, { + runBehavior, + }); + } } export default ActionAPI; diff --git a/app/client/src/api/PageApi.tsx b/app/client/src/api/PageApi.tsx index db81058b901d..ae05cd00af62 100644 --- a/app/client/src/api/PageApi.tsx +++ b/app/client/src/api/PageApi.tsx @@ -9,6 +9,7 @@ import type { import type { DSLWidget } from "WidgetProvider/constants"; import type { FetchApplicationResponse } from "ee/api/ApplicationApi"; import type { APP_MODE } from "entities/App"; +import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export interface FetchPageRequest { pageId: string; @@ -69,7 +70,7 @@ export interface SavePageResponseData { dsl: Partial; messages: string[]; actionUpdates: Array<{ - executeOnLoad: boolean; + runBehavior: ActionRunBehaviour; id: string; name: string; collectionId?: string; diff --git a/app/client/src/ce/constants/ReduxActionConstants.tsx b/app/client/src/ce/constants/ReduxActionConstants.tsx index 57ad73c96b46..4d07c102b57d 100644 --- a/app/client/src/ce/constants/ReduxActionConstants.tsx +++ b/app/client/src/ce/constants/ReduxActionConstants.tsx @@ -809,6 +809,8 @@ const ActionActionTypes = { TOGGLE_ACTION_EXECUTE_ON_LOAD_SUCCESS: "TOGGLE_ACTION_EXECUTE_ON_LOAD_SUCCESS", TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT: "TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT", + UPDATE_ACTION_RUN_BEHAVIOR_INIT: "UPDATE_ACTION_RUN_BEHAVIOR_INIT", + UPDATE_ACTION_RUN_BEHAVIOR_SUCCESS: "UPDATE_ACTION_RUN_BEHAVIOR_SUCCESS", }; const ActionActionErrorTypes = { @@ -823,6 +825,7 @@ const ActionActionErrorTypes = { SAVE_ACTION_NAME_ERROR: "SAVE_ACTION_NAME_ERROR", SAVE_API_NAME_ERROR: "SAVE_API_NAME_ERROR", TOGGLE_ACTION_EXECUTE_ON_LOAD_ERROR: "TOGGLE_ACTION_EXECUTE_ON_LOAD_ERROR", + UPDATE_ACTION_RUN_BEHAVIOR_ERROR: "UPDATE_ACTION_RUN_BEHAVIOR_ERROR", }; const PropertyPanelActionTypes = { diff --git a/app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts b/app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts index f9765a1ad245..de8b52f486a8 100644 --- a/app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts +++ b/app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts @@ -1,6 +1,7 @@ import { PluginType } from "entities/Plugin"; import { generateDataTreeJSAction } from "./dataTreeJSAction"; import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReducer"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; describe("generateDataTreeJSAction", () => { it("generate js collection in data tree", () => { @@ -44,7 +45,7 @@ describe("generateDataTreeJSAction", () => { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, dynamicBindingPathList: [ { key: "body", @@ -91,7 +92,7 @@ describe("generateDataTreeJSAction", () => { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -239,7 +240,7 @@ describe("generateDataTreeJSAction", () => { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, dynamicBindingPathList: [ { key: "body", @@ -286,7 +287,7 @@ describe("generateDataTreeJSAction", () => { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { diff --git a/app/client/src/ce/reducers/entityReducers/actionsReducer.tsx b/app/client/src/ce/reducers/entityReducers/actionsReducer.tsx index b02f54ac5263..0915cd7194c0 100644 --- a/app/client/src/ce/reducers/entityReducers/actionsReducer.tsx +++ b/app/client/src/ce/reducers/entityReducers/actionsReducer.tsx @@ -13,6 +13,7 @@ import type { UpdateActionPropertyActionPayload, } from "actions/pluginActionActions"; import { klona } from "klona"; +import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export interface ActionData { isLoading: boolean; @@ -314,7 +315,7 @@ export const handlers = { draftMetaState: ActionDataState, action: ReduxAction< Array<{ - executeOnLoad: boolean; + runBehavior: ActionRunBehaviour; id: string; name: string; }> @@ -324,8 +325,8 @@ export const handlers = { draftMetaState.forEach((action) => { if (action.config.id in actionUpdateSearch) { - action.config.executeOnLoad = - actionUpdateSearch[action.config.id].executeOnLoad; + action.config.runBehavior = + actionUpdateSearch[action.config.id].runBehavior; } }); }, diff --git a/app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx b/app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx index 4d267d75d041..96d2eef48127 100644 --- a/app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx +++ b/app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx @@ -8,6 +8,7 @@ import { import { set, keyBy, findIndex, unset } from "lodash"; import { create } from "mutative"; import { klona } from "klona"; +import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export const initialState: JSCollectionDataState = []; @@ -365,14 +366,14 @@ export const handlers = { action: ReduxAction<{ actionId: string; collectionId: string; - executeOnLoad: boolean; + runBehavior: ActionRunBehaviour; }>, ): JSCollectionDataState => state.map((a) => { if (a.config.id === action.payload.collectionId) { const updatedActions = a.config.actions.map((jsAction) => { if (jsAction.id === action.payload.actionId) { - set(jsAction, `executeOnLoad`, action.payload.executeOnLoad); + set(jsAction, `runBehavior`, action.payload.runBehavior); } return jsAction; @@ -393,7 +394,7 @@ export const handlers = { state: JSCollectionDataState, action: ReduxAction< Array<{ - executeOnLoad: boolean; + runBehavior: ActionRunBehaviour; id: string; name: string; collectionId: string; @@ -410,7 +411,7 @@ export const handlers = { allActions.forEach((js) => { if (js.id in actionUpdateSearch) { - js.executeOnLoad = actionUpdateSearch[js.id].executeOnLoad; + js.runBehavior = actionUpdateSearch[js.id].runBehavior; } }); } diff --git a/app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts b/app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts index 0b5e260e35ea..0d2b54e6a9d1 100644 --- a/app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts +++ b/app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts @@ -2,6 +2,7 @@ import { PluginType } from "entities/Plugin"; import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReducer"; import { getPropsForJSActionEntity } from "ee/pages/Editor/Explorer/Entity/getEntityProperties"; import type { JSActionEntity } from "ee/entities/DataTree/types"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; const jsObject: JSCollectionData = { isLoading: false, @@ -44,7 +45,7 @@ const jsObject: JSCollectionData = { jsArguments: [], isAsync: false, }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -86,7 +87,7 @@ const jsObject: JSCollectionData = { jsArguments: [], isAsync: true, }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { diff --git a/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts b/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts index f778afdcc940..3fc4e2ae851d 100644 --- a/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts +++ b/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts @@ -2307,8 +2307,7 @@ export const defaultAppState = { }, ], }, - executeOnLoad: true, - runBehavior: "PAGE_LOAD", + runBehavior: "ON_PAGE_LOAD", dynamicBindingPathList: [], isValid: true, invalids: [], @@ -2392,7 +2391,6 @@ export const defaultAppState = { }, }, }, - executeOnLoad: false, runBehavior: "MANUAL", isValid: true, invalids: [], @@ -10049,7 +10047,7 @@ export const defaultAppState = { label: "On page load", subText: "Query runs when the page loads or when manually triggered", - value: "PAGE_LOAD", + value: "ON_PAGE_LOAD", }, { label: "Manual", @@ -10100,7 +10098,7 @@ export const defaultAppState = { label: "On page load", subText: "Query runs when the page loads or when manually triggered", - value: "PAGE_LOAD", + value: "ON_PAGE_LOAD", }, { label: "Manual", @@ -10151,7 +10149,7 @@ export const defaultAppState = { label: "On page load", subText: "Query runs when the page loads or when manually triggered", - value: "PAGE_LOAD", + value: "ON_PAGE_LOAD", }, { label: "Manual", @@ -10231,7 +10229,7 @@ export const defaultAppState = { label: "On page load", subText: "Query runs when the page loads or when manually triggered", - value: "PAGE_LOAD", + value: "ON_PAGE_LOAD", }, { label: "Manual", @@ -10414,7 +10412,6 @@ export const defaultAppState = { selfReferencingDataPaths: [], jsArguments: [], }, - executeOnLoad: false, runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ @@ -10465,7 +10462,6 @@ export const defaultAppState = { selfReferencingDataPaths: [], jsArguments: [], }, - executeOnLoad: false, runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ @@ -10550,7 +10546,6 @@ export const defaultAppState = { selfReferencingDataPaths: [], jsArguments: [], }, - executeOnLoad: false, runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ @@ -10601,7 +10596,6 @@ export const defaultAppState = { selfReferencingDataPaths: [], jsArguments: [], }, - executeOnLoad: false, runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ diff --git a/app/client/src/components/editorComponents/utils.test.ts b/app/client/src/components/editorComponents/utils.test.ts index d0cb4f124788..111df2e7b5f1 100644 --- a/app/client/src/components/editorComponents/utils.test.ts +++ b/app/client/src/components/editorComponents/utils.test.ts @@ -1,3 +1,4 @@ +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; import { getJSResponseViewState, JSResponseState } from "./utils"; const TEST_JS_FUNCTION_ID = "627ccff468e1fa5185b7f901"; @@ -30,7 +31,7 @@ const TEST_JS_FUNCTION = { jsArguments: [], isAsync: true, }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { diff --git a/app/client/src/entities/Action/actionProperties.test.ts b/app/client/src/entities/Action/actionProperties.test.ts index 54b695bc9e47..e849f1214f72 100644 --- a/app/client/src/entities/Action/actionProperties.test.ts +++ b/app/client/src/entities/Action/actionProperties.test.ts @@ -2,6 +2,7 @@ import type { Action } from "entities/Action"; import { PluginType } from "entities/Plugin"; import { getBindingAndReactivePathsOfAction } from "entities/Action/actionProperties"; import { EvaluationSubstitutionType } from "ee/entities/DataTree/types"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; const DEFAULT_ACTION: Action = { actionConfiguration: {}, @@ -10,7 +11,7 @@ const DEFAULT_ACTION: Action = { id: "randomDatasource", }, dynamicBindingPathList: [], - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, id: "", baseId: "", invalids: [], diff --git a/app/client/src/entities/Action/index.ts b/app/client/src/entities/Action/index.ts index 31bb2564d0d8..619ca0a42088 100644 --- a/app/client/src/entities/Action/index.ts +++ b/app/client/src/entities/Action/index.ts @@ -140,8 +140,7 @@ export interface BaseAction { pageId: string; collectionId?: string; pluginId: string; - executeOnLoad: boolean; - runBehavior?: ActionRunBehaviour; + runBehavior: ActionRunBehaviour; dynamicBindingPathList: DynamicPath[]; isValid: boolean; invalids: string[]; diff --git a/app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts b/app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts index 20aafe584921..9bf7b7dca3f5 100644 --- a/app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts +++ b/app/client/src/pages/Editor/EntityNavigation/JSObjectsPane/index.ts @@ -81,7 +81,7 @@ export default class JSObjectsPaneNavigation extends PaneNavigation { *getTab(propertyPath: string) { if ( - propertyPath.includes("executeOnLoad") || + propertyPath.includes("runBehavior") || propertyPath.includes("confirmBeforeExecute") ) { return JSEditorTab.SETTINGS; diff --git a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx index 3662a47e06c4..5dff0fde7728 100644 --- a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx +++ b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx @@ -4,6 +4,7 @@ import { render, screen } from "test/testUtils"; import { JSFunctionSettings } from "./JSFunctionSettings"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; import { JSObjectFactory } from "test/factories/Actions/JSObject"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; // Mock the useFeatureFlag hook jest.mock("utils/hooks/useFeatureFlag"); @@ -54,11 +55,11 @@ describe("JSFunctionSettings", () => { const updatedJSActions = [ { ...actions[0], - executeOnLoad: true, + runBehavior: ActionRunBehaviour.ON_PAGE_LOAD, }, { ...actions[1], - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, }, ]; diff --git a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx index 76e69311a428..30f0e7ca064a 100644 --- a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx +++ b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx @@ -76,7 +76,7 @@ const FunctionSettingRow = (props: FunctionSettingsRowProps) => { key={props.action.id} w="100%" > - {props.action.name} + {props.action.name} { pageId: "page-id", collectionId: "collection-id", pluginId: "plugin-id", - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, dynamicBindingPathList: [], isValid: false, invalids: [], diff --git a/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json b/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json index 87b2ea3c6c88..096753362703 100644 --- a/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json +++ b/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json @@ -83,7 +83,6 @@ } ] }, - "executeOnLoad": false, "runBehavior": "MANUAL", "dynamicBindingPathList": [], "isValid": true, @@ -2552,7 +2551,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2598,7 +2597,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2644,7 +2643,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2696,7 +2695,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2735,7 +2734,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2781,7 +2780,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2827,7 +2826,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json b/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json index 418611d59ff4..94d3027906b8 100644 --- a/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json +++ b/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json @@ -82,7 +82,6 @@ } ] }, - "executeOnLoad": false, "runBehavior": "MANUAL", "dynamicBindingPathList": [], "isValid": true, @@ -2551,7 +2550,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2597,7 +2596,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2643,7 +2642,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2695,7 +2694,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2734,7 +2733,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2780,7 +2779,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", @@ -2826,7 +2825,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts index df5e52e894af..876043dfcd9d 100644 --- a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts +++ b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts @@ -170,6 +170,7 @@ import { } from "selectors/gitModSelectors"; import { createActionExecutionResponse } from "./PluginActionSagaUtils"; import captureException from "instrumentation/sendFaroErrors"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; interface FilePickerInstumentationObject { numberOfFiles: number; @@ -1553,13 +1554,16 @@ function triggerFileUploadInstrumentation( }); } -// Function to clear the action responses for the actions which are not executeOnLoad. +// Function to clear the action responses for the actions which are not runBehavior: ON_PAGE_LOAD. function* clearTriggerActionResponse() { const currentPageActions: ActionData[] = yield select(getCurrentActions); for (const action of currentPageActions) { - // Clear the action response if the action has data and is not executeOnLoad. - if (action.data && !action.config.executeOnLoad) { + // Clear the action response if the action has data and is not runBehavior: ON_PAGE_LOAD. + if ( + action.data && + action.config.runBehavior !== ActionRunBehaviour.ON_PAGE_LOAD + ) { yield put(clearActionResponse(action.config.id)); yield put( updateActionData([ diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index 71e7e1d40ce7..88e0ebd62e48 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -147,6 +147,7 @@ import { import { handleQueryEntityRedirect } from "./IDESaga"; import type { EvaluationReduxAction } from "actions/EvaluationReduxActionTypes"; import { IDE_TYPE } from "ee/IDE/Interfaces/IDETypes"; +import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export const DEFAULT_PREFIX = { QUERY: "Query", @@ -1038,12 +1039,12 @@ export function* setActionPropertySaga( ), ); - if (propertyName === "executeOnLoad") { + if (propertyName === "runBehavior") { yield put({ - type: ReduxActionTypes.TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT, + type: ReduxActionTypes.UPDATE_ACTION_RUN_BEHAVIOR_INIT, payload: { actionId, - shouldExecute: value, + runBehavior: value as ActionRunBehaviour, }, }); @@ -1060,25 +1061,25 @@ export function* setActionPropertySaga( if (!skipSave) yield put(updateAction({ id: actionId })); } -function* toggleActionExecuteOnLoadSaga( - action: ReduxAction<{ actionId: string; shouldExecute: boolean }>, +function* updateActionRunBehaviorSaga( + action: ReduxAction<{ actionId: string; runBehavior: ActionRunBehaviour }>, ) { try { const response: ApiResponse = yield call( - ActionAPI.toggleActionExecuteOnLoad, + ActionAPI.updateActionRunBehavior, action.payload.actionId, - action.payload.shouldExecute, + action.payload.runBehavior, ); const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { yield put({ - type: ReduxActionTypes.TOGGLE_ACTION_EXECUTE_ON_LOAD_SUCCESS, + type: ReduxActionTypes.UPDATE_ACTION_RUN_BEHAVIOR_SUCCESS, }); } } catch (error) { yield put({ - type: ReduxActionErrorTypes.TOGGLE_ACTION_EXECUTE_ON_LOAD_ERROR, + type: ReduxActionErrorTypes.UPDATE_ACTION_RUN_BEHAVIOR_ERROR, payload: error, }); } @@ -1262,8 +1263,8 @@ export function* watchActionSagas() { takeEvery(ReduxActionErrorTypes.MOVE_ACTION_ERROR, handleMoveOrCopySaga), takeEvery(ReduxActionErrorTypes.COPY_ACTION_ERROR, handleMoveOrCopySaga), takeLatest( - ReduxActionTypes.TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT, - toggleActionExecuteOnLoadSaga, + ReduxActionTypes.UPDATE_ACTION_RUN_BEHAVIOR_INIT, + updateActionRunBehaviorSaga, ), takeLatest(ReduxActionTypes.EXECUTE_COMMAND, executeCommandSaga), takeLatest( diff --git a/app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts b/app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts index f756e3b5b96d..531588b4b68e 100644 --- a/app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts +++ b/app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts @@ -4,6 +4,7 @@ import type { WidgetDraggingUpdateParams } from "layoutSystems/common/canvasAren import type { FlattenedWidgetProps } from "ee/reducers/entityReducers/canvasWidgetsReducer"; import { PaginationType, type Action } from "entities/Action"; import { PluginType } from "entities/Plugin"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export const skeletonWidget: FlattenedWidgetProps = { needsErrorInfo: false, @@ -129,7 +130,7 @@ export const newlyCreatedActions: Action[] = [ }, ], }, - executeOnLoad: true, + runBehavior: ActionRunBehaviour.ON_PAGE_LOAD, dynamicBindingPathList: [ { key: "body", diff --git a/app/client/src/sagas/JSPaneSagas.ts b/app/client/src/sagas/JSPaneSagas.ts index d8f4b3e8cb8f..8e5c0240ffe4 100644 --- a/app/client/src/sagas/JSPaneSagas.ts +++ b/app/client/src/sagas/JSPaneSagas.ts @@ -782,7 +782,7 @@ function* setFunctionPropertySaga( const actionId = action.id; - if (propertyName === "executeOnLoad") { + if (propertyName === "runBehavior") { yield put({ type: ReduxActionTypes.TOGGLE_FUNCTION_EXECUTE_ON_LOAD_INIT, payload: { @@ -868,7 +868,7 @@ function* toggleFunctionExecuteOnLoadSaga( payload: { actionId: actionId, collectionId: collectionId, - executeOnLoad: shouldExecute, + runBehavior: shouldExecute, }, }); } diff --git a/app/client/src/utils/DynamicBindingUtils.test.ts b/app/client/src/utils/DynamicBindingUtils.test.ts index 178732e90c24..c89d07238f85 100644 --- a/app/client/src/utils/DynamicBindingUtils.test.ts +++ b/app/client/src/utils/DynamicBindingUtils.test.ts @@ -13,6 +13,7 @@ import { getEvalValuePath, isChildPropertyPath, } from "./DynamicBindingUtils"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; describe.each([ ["{{A}}", ["{{A}}"]], @@ -120,7 +121,7 @@ describe("DynamicBindingPathlist", () => { }, ], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, dynamicBindingPathList: [ { key: "body", diff --git a/app/client/src/utils/FilterInternalProperties/JsAction.ts b/app/client/src/utils/FilterInternalProperties/JsAction.ts index 6382946a2a93..02c1a1b6c0ac 100644 --- a/app/client/src/utils/FilterInternalProperties/JsAction.ts +++ b/app/client/src/utils/FilterInternalProperties/JsAction.ts @@ -1,6 +1,7 @@ import type { JSActionEntity } from "ee/entities/DataTree/types"; import type { DataTree } from "entities/DataTree/dataTreeTypes"; import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReducer"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export const getJsActionPeekData = ( jsAction: JSCollectionData, @@ -15,7 +16,10 @@ export const getJsActionPeekData = ( // eslint-disable-next-line @typescript-eslint/no-empty-function peekData[jsChild.name] = function () {}; - if (jsAction.data?.[jsChild.id] && jsChild.executeOnLoad) { + if ( + jsAction.data?.[jsChild.id] && + jsChild.runBehavior === ActionRunBehaviour.ON_PAGE_LOAD + ) { // TODO: Fix this the next time the file is edited // eslint-disable-next-line @typescript-eslint/no-explicit-any (peekData[jsChild.name] as any).data = jsAction.data[jsChild.id]; diff --git a/app/client/src/utils/JSPaneUtils.test.ts b/app/client/src/utils/JSPaneUtils.test.ts index 41b0af1fd8d6..f9924c30a9da 100644 --- a/app/client/src/utils/JSPaneUtils.test.ts +++ b/app/client/src/utils/JSPaneUtils.test.ts @@ -2,6 +2,7 @@ import { PluginType } from "entities/Plugin"; import type { JSCollection } from "entities/JSCollection"; import type { ParsedBody } from "./JSPaneUtils"; import { getDifferenceInJSCollection } from "./JSPaneUtils"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; const JSObject1: JSCollection = { id: "1234", @@ -41,7 +42,7 @@ const JSObject1: JSCollection = { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -83,7 +84,7 @@ const JSObject1: JSCollection = { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -151,7 +152,7 @@ const JSObject2: JSCollection = { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -193,7 +194,7 @@ const JSObject2: JSCollection = { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -277,7 +278,7 @@ const resultRenamedActions = { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -358,7 +359,7 @@ const resultDeletedActions = { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -469,7 +470,7 @@ const resultChangedBody = { body: "async () => {\n\t\t//use async-await or promises\n\tconsole.log('content changed')}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -549,7 +550,7 @@ const resultChangedParameters = { { name: "b", value: undefined }, ], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -624,7 +625,7 @@ const resultRemovedAsync = { body: "() => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -699,7 +700,7 @@ const resultAddedAsync = { body: "async () => {\n\t\t//write code here\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, clientSideExecution: true, dynamicBindingPathList: [ { @@ -754,7 +755,7 @@ const resultAddedAction = { newActions: [ { name: "myFun3", - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, pageId: "page123", collectionId: "1234", workspaceId: "workspace123", diff --git a/app/client/src/utils/JSPaneUtils.tsx b/app/client/src/utils/JSPaneUtils.tsx index cc510332831f..dcd901aff1c1 100644 --- a/app/client/src/utils/JSPaneUtils.tsx +++ b/app/client/src/utils/JSPaneUtils.tsx @@ -3,6 +3,7 @@ import type { JSCollection, JSAction, Variable } from "entities/JSCollection"; import { ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils"; import LOG_TYPE from "entities/AppsmithConsole/logtype"; import AppsmithConsole from "utils/AppsmithConsole"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export interface ParsedJSSubAction { name: string; @@ -130,7 +131,7 @@ export const getDifferenceInJSCollection = ( const obj = { name: action.name, collectionId: jsAction.id, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, pageId: jsAction.pageId, workspaceId: jsAction.workspaceId, actionConfiguration: { @@ -229,7 +230,7 @@ export const createDummyJSCollectionActions = ( { name: "myFun1", workspaceId, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, actionConfiguration: { body: "function () {}", timeoutInMillisecond: 0, @@ -241,7 +242,7 @@ export const createDummyJSCollectionActions = ( { name: "myFun2", workspaceId, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, actionConfiguration: { body: "async function () {}", timeoutInMillisecond: 0, @@ -281,7 +282,7 @@ export const createSingleFunctionJsCollection = ( { name: functionName, workspaceId, - executeOnLoad: false, + runBehavior: ActionRunBehaviour.MANUAL, actionConfiguration: { body: "function () {}", timeoutInMillisecond: 0, diff --git a/app/client/test/factories/MockPluginsState.ts b/app/client/test/factories/MockPluginsState.ts index 20f1b479044f..5083e1245e1f 100644 --- a/app/client/test/factories/MockPluginsState.ts +++ b/app/client/test/factories/MockPluginsState.ts @@ -6961,7 +6961,7 @@ export default { label: "On page load", subText: "Query runs when the page loads or when manually triggered", - value: "PAGE_LOAD", + value: "ON_PAGE_LOAD", }, { label: "Manual", @@ -7041,7 +7041,7 @@ export default { label: "On page load", subText: "Query runs when the page loads or when manually triggered", - value: "PAGE_LOAD", + value: "ON_PAGE_LOAD", }, { label: "Manual", @@ -7121,7 +7121,7 @@ export default { label: "On page load", subText: "Query runs when the page loads or when manually triggered", - value: "PAGE_LOAD", + value: "ON_PAGE_LOAD", }, { label: "Manual", @@ -7165,7 +7165,7 @@ export default { label: "On page load", subText: "Query runs when the page loads or when manually triggered", - value: "PAGE_LOAD", + value: "ON_PAGE_LOAD", }, { label: "Manual", diff --git a/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json b/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json index 886ab7cc9c61..8a6023f66a82 100644 --- a/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json index b704da21e3c3..626323a7925b 100644 --- a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json index b704da21e3c3..626323a7925b 100644 --- a/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json index 4808881b2d26..eb645fbe35e4 100644 --- a/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json index b704da21e3c3..626323a7925b 100644 --- a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json index b2dbee8e8798..cfb1a0b66c57 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json index b25921dd9512..108bf972ad8e 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json index 236ccff73245..e5522e5309e9 100644 --- a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json index 236ccff73245..e5522e5309e9 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json index b704da21e3c3..626323a7925b 100644 --- a/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json index 2b5d596362f8..664b53a8285a 100755 --- a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json index 236ccff73245..e5522e5309e9 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json @@ -13,7 +13,7 @@ { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", - "value": "PAGE_LOAD" + "value": "ON_PAGE_LOAD" }, { "label": "Manual", From 8903d0d5c4d65bea8c21bcb9ae6059a408087b20 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Wed, 23 Apr 2025 23:00:07 +0530 Subject: [PATCH 2/4] fixing client build --- .../constants/PluginActionConstants.ts | 2 ++ .../RestActionTransformers.test.ts | 3 +-- .../DataTree/dataTreeJSAction.test.ts | 9 ++++---- .../autocomplete/EntityDefinitions.test.ts | 5 ++-- .../components/editorComponents/utils.test.ts | 2 +- .../entities/Action/actionProperties.test.ts | 3 +-- app/client/src/entities/Action/index.ts | 4 ++-- .../BuildingBlockSagas/tests/fixtures.ts | 3 +-- .../src/utils/DynamicBindingUtils.test.ts | 3 +-- app/client/src/utils/JSPaneUtils.test.ts | 23 +++++++++---------- app/client/test/factories/Actions/API.ts | 2 +- .../factories/Actions/GoogleSheetFactory.ts | 2 +- app/client/test/factories/Actions/JSObject.ts | 4 ++-- app/client/test/factories/Actions/Postgres.ts | 2 +- 14 files changed, 31 insertions(+), 36 deletions(-) diff --git a/app/client/src/PluginActionEditor/constants/PluginActionConstants.ts b/app/client/src/PluginActionEditor/constants/PluginActionConstants.ts index 871758fdc5f6..ce50c573b874 100644 --- a/app/client/src/PluginActionEditor/constants/PluginActionConstants.ts +++ b/app/client/src/PluginActionEditor/constants/PluginActionConstants.ts @@ -21,3 +21,5 @@ export const RUN_BEHAVIOR = { }; export const RUN_BEHAVIOR_VALUES = Object.values(RUN_BEHAVIOR); + +export type ActionRunBehaviourType = `${ActionRunBehaviour}`; diff --git a/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts b/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts index d12203dc6557..1f070b230076 100644 --- a/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts +++ b/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts @@ -9,14 +9,13 @@ import { MultiPartOptionTypes, POST_BODY_FORMAT_OPTIONS, } from "../constants/CommonApiConstants"; -import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; // jest.mock("POST_"); const BASE_ACTION: ApiAction = { dynamicBindingPathList: [], cacheResponse: "", - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", invalids: [], isValid: false, workspaceId: "", diff --git a/app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts b/app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts index de8b52f486a8..158b9839e6f5 100644 --- a/app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts +++ b/app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts @@ -1,7 +1,6 @@ import { PluginType } from "entities/Plugin"; import { generateDataTreeJSAction } from "./dataTreeJSAction"; import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReducer"; -import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; describe("generateDataTreeJSAction", () => { it("generate js collection in data tree", () => { @@ -45,7 +44,7 @@ describe("generateDataTreeJSAction", () => { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", dynamicBindingPathList: [ { key: "body", @@ -92,7 +91,7 @@ describe("generateDataTreeJSAction", () => { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -240,7 +239,7 @@ describe("generateDataTreeJSAction", () => { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", dynamicBindingPathList: [ { key: "body", @@ -287,7 +286,7 @@ describe("generateDataTreeJSAction", () => { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { diff --git a/app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts b/app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts index 0d2b54e6a9d1..7425f70d0eef 100644 --- a/app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts +++ b/app/client/src/ce/utils/autocomplete/EntityDefinitions.test.ts @@ -2,7 +2,6 @@ import { PluginType } from "entities/Plugin"; import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReducer"; import { getPropsForJSActionEntity } from "ee/pages/Editor/Explorer/Entity/getEntityProperties"; import type { JSActionEntity } from "ee/entities/DataTree/types"; -import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; const jsObject: JSCollectionData = { isLoading: false, @@ -45,7 +44,7 @@ const jsObject: JSCollectionData = { jsArguments: [], isAsync: false, }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -87,7 +86,7 @@ const jsObject: JSCollectionData = { jsArguments: [], isAsync: true, }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { diff --git a/app/client/src/components/editorComponents/utils.test.ts b/app/client/src/components/editorComponents/utils.test.ts index 111df2e7b5f1..3315e1945410 100644 --- a/app/client/src/components/editorComponents/utils.test.ts +++ b/app/client/src/components/editorComponents/utils.test.ts @@ -1,5 +1,5 @@ -import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; import { getJSResponseViewState, JSResponseState } from "./utils"; +import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; const TEST_JS_FUNCTION_ID = "627ccff468e1fa5185b7f901"; const TEST_JS_FUNCTION_BASE_ID = "627ccff468e1fa5185b7f912"; diff --git a/app/client/src/entities/Action/actionProperties.test.ts b/app/client/src/entities/Action/actionProperties.test.ts index e849f1214f72..23e827e6d5d4 100644 --- a/app/client/src/entities/Action/actionProperties.test.ts +++ b/app/client/src/entities/Action/actionProperties.test.ts @@ -2,7 +2,6 @@ import type { Action } from "entities/Action"; import { PluginType } from "entities/Plugin"; import { getBindingAndReactivePathsOfAction } from "entities/Action/actionProperties"; import { EvaluationSubstitutionType } from "ee/entities/DataTree/types"; -import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; const DEFAULT_ACTION: Action = { actionConfiguration: {}, @@ -11,7 +10,7 @@ const DEFAULT_ACTION: Action = { id: "randomDatasource", }, dynamicBindingPathList: [], - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", id: "", baseId: "", invalids: [], diff --git a/app/client/src/entities/Action/index.ts b/app/client/src/entities/Action/index.ts index 619ca0a42088..61a7687cdb99 100644 --- a/app/client/src/entities/Action/index.ts +++ b/app/client/src/entities/Action/index.ts @@ -10,7 +10,7 @@ import { type Plugin, type PluginName, } from "../Plugin"; -import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; +import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants"; export enum PaginationType { NONE = "NONE", @@ -140,7 +140,7 @@ export interface BaseAction { pageId: string; collectionId?: string; pluginId: string; - runBehavior: ActionRunBehaviour; + runBehavior: ActionRunBehaviourType; dynamicBindingPathList: DynamicPath[]; isValid: boolean; invalids: string[]; diff --git a/app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts b/app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts index 531588b4b68e..f45895b285a8 100644 --- a/app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts +++ b/app/client/src/sagas/BuildingBlockSagas/tests/fixtures.ts @@ -4,7 +4,6 @@ import type { WidgetDraggingUpdateParams } from "layoutSystems/common/canvasAren import type { FlattenedWidgetProps } from "ee/reducers/entityReducers/canvasWidgetsReducer"; import { PaginationType, type Action } from "entities/Action"; import { PluginType } from "entities/Plugin"; -import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; export const skeletonWidget: FlattenedWidgetProps = { needsErrorInfo: false, @@ -130,7 +129,7 @@ export const newlyCreatedActions: Action[] = [ }, ], }, - runBehavior: ActionRunBehaviour.ON_PAGE_LOAD, + runBehavior: "ON_PAGE_LOAD", dynamicBindingPathList: [ { key: "body", diff --git a/app/client/src/utils/DynamicBindingUtils.test.ts b/app/client/src/utils/DynamicBindingUtils.test.ts index c89d07238f85..85b3c9b704bb 100644 --- a/app/client/src/utils/DynamicBindingUtils.test.ts +++ b/app/client/src/utils/DynamicBindingUtils.test.ts @@ -13,7 +13,6 @@ import { getEvalValuePath, isChildPropertyPath, } from "./DynamicBindingUtils"; -import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; describe.each([ ["{{A}}", ["{{A}}"]], @@ -121,7 +120,7 @@ describe("DynamicBindingPathlist", () => { }, ], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", dynamicBindingPathList: [ { key: "body", diff --git a/app/client/src/utils/JSPaneUtils.test.ts b/app/client/src/utils/JSPaneUtils.test.ts index f9924c30a9da..18335ce5b9a7 100644 --- a/app/client/src/utils/JSPaneUtils.test.ts +++ b/app/client/src/utils/JSPaneUtils.test.ts @@ -2,7 +2,6 @@ import { PluginType } from "entities/Plugin"; import type { JSCollection } from "entities/JSCollection"; import type { ParsedBody } from "./JSPaneUtils"; import { getDifferenceInJSCollection } from "./JSPaneUtils"; -import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; const JSObject1: JSCollection = { id: "1234", @@ -42,7 +41,7 @@ const JSObject1: JSCollection = { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -84,7 +83,7 @@ const JSObject1: JSCollection = { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -152,7 +151,7 @@ const JSObject2: JSCollection = { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -194,7 +193,7 @@ const JSObject2: JSCollection = { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -278,7 +277,7 @@ const resultRenamedActions = { body: "() => {\n\t\t//write code here\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -359,7 +358,7 @@ const resultDeletedActions = { body: "async () => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -470,7 +469,7 @@ const resultChangedBody = { body: "async () => {\n\t\t//use async-await or promises\n\tconsole.log('content changed')}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -550,7 +549,7 @@ const resultChangedParameters = { { name: "b", value: undefined }, ], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -625,7 +624,7 @@ const resultRemovedAsync = { body: "() => {\n\t\t//use async-await or promises\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -700,7 +699,7 @@ const resultAddedAsync = { body: "async () => {\n\t\t//write code here\n\t}", jsArguments: [], }, - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -755,7 +754,7 @@ const resultAddedAction = { newActions: [ { name: "myFun3", - runBehavior: ActionRunBehaviour.MANUAL, + runBehavior: "MANUAL", pageId: "page123", collectionId: "1234", workspaceId: "workspace123", diff --git a/app/client/test/factories/Actions/API.ts b/app/client/test/factories/Actions/API.ts index f62d2f423fe2..17d15e2fe443 100644 --- a/app/client/test/factories/Actions/API.ts +++ b/app/client/test/factories/Actions/API.ts @@ -63,7 +63,7 @@ export const APIFactory = Factory.Sync.makeFactory({ datasourceConfiguration: { url: "www.mock-api.appsmith.com" }, }, dynamicBindingPathList: [], - executeOnLoad: false, + runBehavior: "MANUAL", invalids: [], isValid: true, jsonPathKeys: [], diff --git a/app/client/test/factories/Actions/GoogleSheetFactory.ts b/app/client/test/factories/Actions/GoogleSheetFactory.ts index c9eab37041be..830dafe7be08 100644 --- a/app/client/test/factories/Actions/GoogleSheetFactory.ts +++ b/app/client/test/factories/Actions/GoogleSheetFactory.ts @@ -63,7 +63,7 @@ export const GoogleSheetFactory = Factory.Sync.makeFactory({ }, }, }, - executeOnLoad: false, + runBehavior: "MANUAL", isValid: true, invalids: [], messages: [], diff --git a/app/client/test/factories/Actions/JSObject.ts b/app/client/test/factories/Actions/JSObject.ts index c9d546c3dd3d..a78b14252be1 100644 --- a/app/client/test/factories/Actions/JSObject.ts +++ b/app/client/test/factories/Actions/JSObject.ts @@ -30,7 +30,7 @@ export const JSObjectFactory = Factory.Sync.makeFactory({ body: "function (){\n\t\t//\twrite code here\n\t\t//\tthis.myVar1 = [1,2,3]\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { @@ -70,7 +70,7 @@ export const JSObjectFactory = Factory.Sync.makeFactory({ body: "async function () {\n\t\t//\tuse async-await or promises\n\t\t//\tawait storeValue('varName', 'hello world')\n\t}", jsArguments: [], }, - executeOnLoad: false, + runBehavior: "MANUAL", clientSideExecution: true, dynamicBindingPathList: [ { diff --git a/app/client/test/factories/Actions/Postgres.ts b/app/client/test/factories/Actions/Postgres.ts index ecf1068b6359..dabcf188cbf9 100644 --- a/app/client/test/factories/Actions/Postgres.ts +++ b/app/client/test/factories/Actions/Postgres.ts @@ -31,7 +31,7 @@ export const PostgresFactory = Factory.Sync.makeFactory({ }, ], }, - executeOnLoad: true, + runBehavior: "MANUAL", dynamicBindingPathList: [], isValid: true, invalids: [], From fdb711708a01fefa1f924f3d7ab0f54ee76bb8fb Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Wed, 23 Apr 2025 23:28:21 +0530 Subject: [PATCH 3/4] updating query params for change of run behavior --- app/client/src/api/ActionAPI.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/client/src/api/ActionAPI.tsx b/app/client/src/api/ActionAPI.tsx index bb139eb3b0c7..01d5ac5966fa 100644 --- a/app/client/src/api/ActionAPI.tsx +++ b/app/client/src/api/ActionAPI.tsx @@ -315,8 +315,8 @@ class ActionAPI extends API { actionId: string, runBehavior: ActionRunBehaviour, ) { - return API.put(ActionAPI.url + `/runBehavior/${actionId}`, { - runBehavior, + return API.put(ActionAPI.url + `/runBehavior/${actionId}`, undefined, { + behavior: runBehavior, }); } } From 2feb56c97ed45fcd0d477eaa3e0d7585313060a0 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Thu, 24 Apr 2025 00:11:16 +0530 Subject: [PATCH 4/4] updating redux actions --- app/client/src/actions/pluginActionActions.ts | 8 +++--- app/client/src/api/ActionAPI.tsx | 13 ++-------- .../src/ce/constants/ReduxActionConstants.tsx | 14 ++++------- .../entityReducers/actionsReducer.tsx | 2 +- .../entityReducers/jsActionsReducer.tsx | 4 +-- app/client/src/ce/sagas/PageSagas.tsx | 8 +++--- .../components/JSFunctionSettings.tsx | 13 +++------- app/client/src/sagas/ActionSagas.ts | 9 ++++--- app/client/src/sagas/JSPaneSagas.ts | 25 ++++++++++--------- 9 files changed, 41 insertions(+), 55 deletions(-) diff --git a/app/client/src/actions/pluginActionActions.ts b/app/client/src/actions/pluginActionActions.ts index 42c2f90a0717..98fd6425378c 100644 --- a/app/client/src/actions/pluginActionActions.ts +++ b/app/client/src/actions/pluginActionActions.ts @@ -352,7 +352,7 @@ export const executePageLoadActions = ( }; }; -export const setActionsToExecuteOnPageLoad = ( +export const setActionsRunBehavior = ( actions: Array<{ runBehavior: ActionRunBehaviour; id: string; @@ -360,12 +360,12 @@ export const setActionsToExecuteOnPageLoad = ( }>, ) => { return { - type: ReduxActionTypes.SET_ACTION_TO_EXECUTE_ON_PAGELOAD, + type: ReduxActionTypes.SET_ACTION_RUN_BEHAVIOR, payload: actions, }; }; -export const setJSActionsToExecuteOnPageLoad = ( +export const setJSActionsRunBehavior = ( actions: Array<{ runBehavior: ActionRunBehaviour; id: string; @@ -374,7 +374,7 @@ export const setJSActionsToExecuteOnPageLoad = ( }>, ) => { return { - type: ReduxActionTypes.SET_JS_ACTION_TO_EXECUTE_ON_PAGELOAD, + type: ReduxActionTypes.SET_JS_ACTION_RUN_BEHAVIOR, payload: actions, }; }; diff --git a/app/client/src/api/ActionAPI.tsx b/app/client/src/api/ActionAPI.tsx index 01d5ac5966fa..3855f9d4c172 100644 --- a/app/client/src/api/ActionAPI.tsx +++ b/app/client/src/api/ActionAPI.tsx @@ -10,7 +10,7 @@ import type { APIRequest } from "constants/AppsmithActionConstants/ActionConstan import type { WidgetType } from "constants/WidgetConstants"; import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers"; import type { PostActionRunConfig } from "./types"; -import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; +import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants"; export interface Property { key: string; @@ -302,18 +302,9 @@ class ActionAPI extends API { }); } - static async toggleActionExecuteOnLoad( - actionId: string, - shouldExecute: boolean, - ) { - return API.put(ActionAPI.url + `/executeOnLoad/${actionId}`, undefined, { - flag: shouldExecute.toString(), - }); - } - static async updateActionRunBehavior( actionId: string, - runBehavior: ActionRunBehaviour, + runBehavior: ActionRunBehaviourType, ) { return API.put(ActionAPI.url + `/runBehavior/${actionId}`, undefined, { behavior: runBehavior, diff --git a/app/client/src/ce/constants/ReduxActionConstants.tsx b/app/client/src/ce/constants/ReduxActionConstants.tsx index 4d07c102b57d..0a5c7a7ab369 100644 --- a/app/client/src/ce/constants/ReduxActionConstants.tsx +++ b/app/client/src/ce/constants/ReduxActionConstants.tsx @@ -66,11 +66,10 @@ const JSEditorActionTypes = { SET_FUNCTION_PROPERTY: "SET_FUNCTION_PROPERTY", UPDATE_JS_FUNCTION_PROPERTY_INIT: "UPDATE_JS_FUNCTION_PROPERTY_INIT", UPDATE_JS_FUNCTION_PROPERTY_SUCCESS: "UPDATE_JS_FUNCTION_PROPERTY_SUCCESS", - TOGGLE_FUNCTION_EXECUTE_ON_LOAD_INIT: "TOGGLE_FUNCTION_EXECUTE_ON_LOAD_INIT", - TOGGLE_FUNCTION_EXECUTE_ON_LOAD_SUCCESS: - "TOGGLE_FUNCTION_EXECUTE_ON_LOAD_SUCCESS", - SET_JS_ACTION_TO_EXECUTE_ON_PAGELOAD: "SET_JS_ACTION_TO_EXECUTE_ON_PAGELOAD", + SET_JS_ACTION_RUN_BEHAVIOR: "SET_JS_ACTION_RUN_BEHAVIOR", SET_ACTIVE_JS_ACTION: "SET_ACTIVE_JS_ACTION", + UPDATE_FUNCTION_RUN_BEHAVIOR_INIT: "UPDATE_FUNCTION_RUN_BEHAVIOR_INIT", + UPDATE_FUNCTION_RUN_BEHAVIOR_SUCCESS: "UPDATE_FUNCTION_RUN_BEHAVIOR_SUCCESS", }; const JSEditorActionErrorTypes = { @@ -85,6 +84,7 @@ const JSEditorActionErrorTypes = { REFACTOR_JS_ACTION_NAME_ERROR: "REFACTOR_JS_ACTION_NAME_ERROR", UPDATE_JS_ACTION_BODY_ERROR: "UPDATE_JS_ACTION_BODY_ERROR", UPDATE_JS_FUNCTION_PROPERTY_ERROR: "UPDATE_JS_FUNCTION_PROPERTY_ERROR", + UPDATE_FUNCTION_RUN_BEHAVIOR_ERROR: "UPDATE_FUNCTION_RUN_BEHAVIOR_ERROR", }; const GitActionTypes = { @@ -805,10 +805,7 @@ const ActionActionTypes = { SET_ACTION_PROPERTY: "SET_ACTION_PROPERTY", UPDATE_ACTION_PROPERTY: "UPDATE_ACTION_PROPERTY", SWITCH_DATASOURCE: "SWITCH_DATASOURCE", - SET_ACTION_TO_EXECUTE_ON_PAGELOAD: "SET_ACTION_TO_EXECUTE_ON_PAGELOAD", - TOGGLE_ACTION_EXECUTE_ON_LOAD_SUCCESS: - "TOGGLE_ACTION_EXECUTE_ON_LOAD_SUCCESS", - TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT: "TOGGLE_ACTION_EXECUTE_ON_LOAD_INIT", + SET_ACTION_RUN_BEHAVIOR: "SET_ACTION_RUN_BEHAVIOR", UPDATE_ACTION_RUN_BEHAVIOR_INIT: "UPDATE_ACTION_RUN_BEHAVIOR_INIT", UPDATE_ACTION_RUN_BEHAVIOR_SUCCESS: "UPDATE_ACTION_RUN_BEHAVIOR_SUCCESS", }; @@ -824,7 +821,6 @@ const ActionActionErrorTypes = { FETCH_ACTIONS_FOR_PAGE_ERROR: "FETCH_ACTIONS_FOR_PAGE_ERROR", SAVE_ACTION_NAME_ERROR: "SAVE_ACTION_NAME_ERROR", SAVE_API_NAME_ERROR: "SAVE_API_NAME_ERROR", - TOGGLE_ACTION_EXECUTE_ON_LOAD_ERROR: "TOGGLE_ACTION_EXECUTE_ON_LOAD_ERROR", UPDATE_ACTION_RUN_BEHAVIOR_ERROR: "UPDATE_ACTION_RUN_BEHAVIOR_ERROR", }; diff --git a/app/client/src/ce/reducers/entityReducers/actionsReducer.tsx b/app/client/src/ce/reducers/entityReducers/actionsReducer.tsx index 0915cd7194c0..87b686bdc0b1 100644 --- a/app/client/src/ce/reducers/entityReducers/actionsReducer.tsx +++ b/app/client/src/ce/reducers/entityReducers/actionsReducer.tsx @@ -311,7 +311,7 @@ export const handlers = { }, ]); }, - [ReduxActionTypes.SET_ACTION_TO_EXECUTE_ON_PAGELOAD]: ( + [ReduxActionTypes.SET_ACTION_RUN_BEHAVIOR]: ( draftMetaState: ActionDataState, action: ReduxAction< Array<{ diff --git a/app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx b/app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx index 96d2eef48127..326532256a79 100644 --- a/app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx +++ b/app/client/src/ce/reducers/entityReducers/jsActionsReducer.tsx @@ -361,7 +361,7 @@ export const handlers = { return a; }), - [ReduxActionTypes.TOGGLE_FUNCTION_EXECUTE_ON_LOAD_SUCCESS]: ( + [ReduxActionTypes.UPDATE_FUNCTION_RUN_BEHAVIOR_SUCCESS]: ( state: JSCollectionDataState, action: ReduxAction<{ actionId: string; @@ -390,7 +390,7 @@ export const handlers = { return a; }), - [ReduxActionTypes.SET_JS_ACTION_TO_EXECUTE_ON_PAGELOAD]: ( + [ReduxActionTypes.SET_JS_ACTION_RUN_BEHAVIOR]: ( state: JSCollectionDataState, action: ReduxAction< Array<{ diff --git a/app/client/src/ce/sagas/PageSagas.tsx b/app/client/src/ce/sagas/PageSagas.tsx index bbadd0ab499d..0ce2ece57247 100644 --- a/app/client/src/ce/sagas/PageSagas.tsx +++ b/app/client/src/ce/sagas/PageSagas.tsx @@ -88,8 +88,8 @@ import { fetchActionsForPageError, fetchActionsForPageSuccess, fetchActionsForView, - setActionsToExecuteOnPageLoad, - setJSActionsToExecuteOnPageLoad, + setActionsRunBehavior, + setJSActionsRunBehavior, } from "actions/pluginActionActions"; import type { UrlDataState } from "reducers/entityReducers/appReducer"; import { APP_MODE } from "entities/App"; @@ -536,7 +536,7 @@ export function* savePageSaga(action: ReduxAction<{ isRetry?: boolean }>) { ); if (actions && actions.length) { - yield put(setActionsToExecuteOnPageLoad(actions)); + yield put(setActionsRunBehavior(actions)); } const jsActions = actionUpdates.filter((d) => @@ -544,7 +544,7 @@ export function* savePageSaga(action: ReduxAction<{ isRetry?: boolean }>) { ); if (jsActions && jsActions.length) { - yield put(setJSActionsToExecuteOnPageLoad(jsActions)); + yield put(setJSActionsRunBehavior(jsActions)); } } diff --git a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx index 30f0e7ca064a..169ff0d3ed73 100644 --- a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx +++ b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx @@ -15,10 +15,7 @@ import { import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import type { OnUpdateSettingsProps } from "../types"; import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants"; -import { - RUN_BEHAVIOR, - RUN_BEHAVIOR_VALUES, -} from "PluginActionEditor/constants/PluginActionConstants"; +import { RUN_BEHAVIOR_VALUES } from "PluginActionEditor/constants/PluginActionConstants"; import styled from "styled-components"; const OptionLabel = styled(Text)` @@ -71,6 +68,7 @@ const FunctionSettingRow = (props: FunctionSettingsRowProps) => { { {props.action.name} {options.map((option) => (