From 8d6718f43cba972394b887100c59038f5ab690f6 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Fri, 9 May 2025 19:27:12 +0530 Subject: [PATCH 01/10] removing unnecessary code --- .../PartialExportModal/unitTestUtils.ts | 24 +++++++++++++ .../formConfig/ApiSettingsConfig.ts | 3 +- .../formConfig/GoogleSheetsSettingsConfig.ts | 3 +- .../formConfig/PluginSettings.ts | 23 ++++++------ .../formConfig/QuerySettingsConfig.ts | 3 +- .../components/JSFunctionSettings.tsx | 14 ++------ .../SaaSEditor/__data__/FinalState.json | 35 +++++++++++++++++++ .../SaaSEditor/__data__/InitialState.json | 35 +++++++++++++++++++ app/client/src/utils/PluginUtils.ts | 11 ++---- app/client/test/factories/MockPluginsState.ts | 20 +++++++++++ .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- .../src/main/resources/setting.json | 30 +--------------- 22 files changed, 145 insertions(+), 386 deletions(-) diff --git a/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts b/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts index d00c56822f49..261b638644d4 100644 --- a/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts +++ b/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts @@ -10043,6 +10043,12 @@ export const defaultAppState = { controlType: "DROP_DOWN", initialValue: "MANUAL", options: [ + { + label: "Automatic", + subText: + "Query runs on page load or when a variable it depends on changes", + value: "AUTOMATIC", + }, { label: "On page load", subText: @@ -10094,6 +10100,12 @@ export const defaultAppState = { controlType: "DROP_DOWN", initialValue: "MANUAL", options: [ + { + label: "Automatic", + subText: + "Query runs on page load or when a variable it depends on changes", + value: "AUTOMATIC", + }, { label: "On page load", subText: @@ -10145,6 +10157,12 @@ export const defaultAppState = { controlType: "DROP_DOWN", initialValue: "MANUAL", options: [ + { + label: "Automatic", + subText: + "Query runs on page load or when a variable it depends on changes", + value: "AUTOMATIC", + }, { label: "On page load", subText: @@ -10225,6 +10243,12 @@ export const defaultAppState = { controlType: "DROP_DOWN", initialValue: "MANUAL", options: [ + { + label: "Automatic", + subText: + "Query runs on page load or when a variable it depends on changes", + value: "AUTOMATIC", + }, { label: "On page load", subText: diff --git a/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts b/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts index 1b87bbd97871..9a2f84a8b2ac 100644 --- a/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts +++ b/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts @@ -7,7 +7,6 @@ import { HTTP_PROTOCOL_VERSIONS, } from "PluginActionEditor/constants/CommonApiConstants"; import { - RUN_BEHAVIOR, RUN_BEHAVIOR_VALUES, RUN_BEHAVIOR_CONFIG_PROPERTY, } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; @@ -21,7 +20,7 @@ export default [ label: "Run behavior", configProperty: RUN_BEHAVIOR_CONFIG_PROPERTY, controlType: "DROP_DOWN", - initialValue: RUN_BEHAVIOR.MANUAL.label, + initialValue: "MANUAL", options: RUN_BEHAVIOR_VALUES, }, { diff --git a/app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts b/app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts index b413defeab3e..780f1f22d814 100644 --- a/app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts +++ b/app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts @@ -1,5 +1,4 @@ import { - RUN_BEHAVIOR, RUN_BEHAVIOR_VALUES, RUN_BEHAVIOR_CONFIG_PROPERTY, } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; @@ -13,7 +12,7 @@ export default [ label: "Run behavior", configProperty: RUN_BEHAVIOR_CONFIG_PROPERTY, controlType: "DROP_DOWN", - initialValue: RUN_BEHAVIOR.MANUAL.label, + initialValue: "MANUAL", options: RUN_BEHAVIOR_VALUES, }, { diff --git a/app/client/src/constants/AppsmithActionConstants/formConfig/PluginSettings.ts b/app/client/src/constants/AppsmithActionConstants/formConfig/PluginSettings.ts index 45c9f0708765..ff0dfc07892d 100644 --- a/app/client/src/constants/AppsmithActionConstants/formConfig/PluginSettings.ts +++ b/app/client/src/constants/AppsmithActionConstants/formConfig/PluginSettings.ts @@ -2,26 +2,23 @@ import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes"; export const RUN_BEHAVIOR_CONFIG_PROPERTY = "runBehaviour"; -export const RUN_BEHAVIOR = { - ON_PAGE_LOAD: { +export const RUN_BEHAVIOR_VALUES = [ + { + label: "Automatic", + subText: "Query runs on page load or when a variable it depends on changes", + value: ActionRunBehaviour.AUTOMATIC, + children: "Automatic", + }, + { label: "On page load", subText: "Query runs when the page loads or when manually triggered", value: ActionRunBehaviour.ON_PAGE_LOAD, children: "On page load", }, - MANUAL: { + { label: "Manual", subText: "Query only runs when called in an event or JS with .run()", value: ActionRunBehaviour.MANUAL, children: "Manual", }, -}; - -export const AUTOMATIC_RUN_BEHAVIOR = { - label: "Automatic", - subText: "Query runs on page load or when a variable it depends on changes", - value: ActionRunBehaviour.AUTOMATIC, - children: "Automatic", -}; - -export const RUN_BEHAVIOR_VALUES = Object.values(RUN_BEHAVIOR); +]; diff --git a/app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts b/app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts index 560a8ec64c8e..0b872e7c53d0 100644 --- a/app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts +++ b/app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts @@ -1,5 +1,4 @@ import { - RUN_BEHAVIOR, RUN_BEHAVIOR_VALUES, RUN_BEHAVIOR_CONFIG_PROPERTY, } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; @@ -13,7 +12,7 @@ export default [ label: "Run behavior", configProperty: RUN_BEHAVIOR_CONFIG_PROPERTY, controlType: "DROP_DOWN", - initialValue: RUN_BEHAVIOR.MANUAL.label, + initialValue: "MANUAL", options: RUN_BEHAVIOR_VALUES, }, { 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 a68f4387fe7c..27608b3d8052 100644 --- a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx +++ b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx @@ -16,10 +16,7 @@ import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import type { OnUpdateSettingsProps } from "../types"; import { type ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes"; import styled from "styled-components"; -import { - RUN_BEHAVIOR_VALUES, - AUTOMATIC_RUN_BEHAVIOR, -} from "constants/AppsmithActionConstants/formConfig/PluginSettings"; +import { RUN_BEHAVIOR_VALUES } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; const OptionLabel = styled(Text)` @@ -55,13 +52,8 @@ const FunctionSettingRow = (props: FunctionSettingsRowProps) => { "release_reactive_actions_enabled", ); - if (flagValueForReactiveActions) { - options = [ - AUTOMATIC_RUN_BEHAVIOR, - ...options.filter( - (option) => option.value !== AUTOMATIC_RUN_BEHAVIOR.value, - ), - ]; + if (!flagValueForReactiveActions) { + options = [...options.filter((option) => option.value !== "AUTOMATIC")]; } const onSelectOptions = useCallback( diff --git a/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json b/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json index 7b500b43447a..4a8c7eaf1496 100644 --- a/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json +++ b/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json @@ -2548,6 +2548,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2594,6 +2599,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2640,6 +2650,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2692,6 +2707,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2731,6 +2751,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2777,6 +2802,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2823,6 +2853,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", diff --git a/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json b/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json index b4d8f0b251a5..3a197ce6cef4 100644 --- a/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json +++ b/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json @@ -2547,6 +2547,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2593,6 +2598,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2639,6 +2649,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2691,6 +2706,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2730,6 +2750,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2776,6 +2801,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", @@ -2822,6 +2852,11 @@ "controlType": "DROP_DOWN", "initialValue": "MANUAL", "options": [ + { + "label": "Automatic", + "subText": "Query runs on page load or when a variable it depends on changes", + "value": "AUTOMATIC" + }, { "label": "On page load", "subText": "Query runs when the page loads or when manually triggered", diff --git a/app/client/src/utils/PluginUtils.ts b/app/client/src/utils/PluginUtils.ts index 3a1dcf781334..add433ca7d0a 100644 --- a/app/client/src/utils/PluginUtils.ts +++ b/app/client/src/utils/PluginUtils.ts @@ -1,16 +1,13 @@ import { objectKeys } from "@appsmith/utils"; import type { PluginType } from "entities/Plugin"; -import { - AUTOMATIC_RUN_BEHAVIOR, - RUN_BEHAVIOR_CONFIG_PROPERTY, -} from "constants/AppsmithActionConstants/formConfig/PluginSettings"; +import { RUN_BEHAVIOR_CONFIG_PROPERTY } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; import type { PluginActionSettingsConfig } from "PluginActionEditor/types/PluginActionTypes"; export const updatePluginRunBehaviourForPluginSettings = ( pluginSettings: Record, flagValueForReactiveActions: boolean, ) => { - if (flagValueForReactiveActions) { + if (!flagValueForReactiveActions) { return objectKeys(pluginSettings).reduce( (acc: Record, pluginType) => { acc[pluginType] = pluginSettings[pluginType].map( @@ -25,10 +22,8 @@ export const updatePluginRunBehaviourForPluginSettings = ( return { ...child, options: [ - AUTOMATIC_RUN_BEHAVIOR, ...child.options.filter( - (option) => - option.value !== AUTOMATIC_RUN_BEHAVIOR.value, + (option) => option.value !== "AUTOMATIC", ), ], }; diff --git a/app/client/test/factories/MockPluginsState.ts b/app/client/test/factories/MockPluginsState.ts index f2c78870fc35..6d1b3991b794 100644 --- a/app/client/test/factories/MockPluginsState.ts +++ b/app/client/test/factories/MockPluginsState.ts @@ -6957,6 +6957,11 @@ export default { controlType: "DROP_DOWN", initialValue: "MANUAL", options: [ + { + label: "Automatic", + subText: "Query runs on page load or when a variable it depends on changes", + value: "AUTOMATIC" + }, { label: "On page load", subText: @@ -7037,6 +7042,11 @@ export default { controlType: "DROP_DOWN", initialValue: "MANUAL", options: [ + { + label: "Automatic", + subText: "Query runs on page load or when a variable it depends on changes", + value: "AUTOMATIC" + }, { label: "On page load", subText: @@ -7117,6 +7127,11 @@ export default { controlType: "DROP_DOWN", initialValue: "MANUAL", options: [ + { + label: "Automatic", + subText: "Query runs on page load or when a variable it depends on changes", + value: "AUTOMATIC" + }, { label: "On page load", subText: @@ -7161,6 +7176,11 @@ export default { controlType: "DROP_DOWN", initialValue: "MANUAL", options: [ + { + label: "Automatic", + subText: "Query runs on page load or when a variable it depends on changes", + value: "AUTOMATIC" + }, { label: "On page load", subText: 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 b36da2b00704..9b5d6e185699 100644 --- a/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 2423dba973d5..664e50c657fe 100644 --- a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 2423dba973d5..664e50c657fe 100644 --- a/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/appsmithAiPlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 bc90ccb578ee..3bd55fa8e595 100644 --- a/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/firestorePlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 2423dba973d5..664e50c657fe 100644 --- a/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/googleAiPlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 efa3507d602c..ee870c8646e6 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 782fa172f0cb..458aab4e1d26 100644 --- a/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mongoPlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 463592e78b53..7b2d6ef719ec 100644 --- a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 463592e78b53..7b2d6ef719ec 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 2423dba973d5..664e50c657fe 100644 --- a/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/openAiPlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 1a0fe3a43d3b..906241476d0e 100755 --- a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", 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 463592e78b53..7b2d6ef719ec 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/setting.json @@ -4,29 +4,6 @@ "sectionName": "", "id": 1, "children": [ - { - "label": "Run behavior", - "configProperty": "runBehaviour", - "controlType": "DROP_DOWN", - "initialValue": "MANUAL", - "options": [ - { - "label": "On page load", - "subText": "Query runs when the page loads or when manually triggered", - "value": "ON_PAGE_LOAD" - }, - { - "label": "Manual", - "subText": "Query only runs when called in an event or JS with .run()", - "value": "MANUAL" - } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": false - } - }, { "label": "Run behavior", "configProperty": "runBehaviour", @@ -48,12 +25,7 @@ "subText": "Query only runs when called in an event or JS with .run()", "value": "MANUAL" } - ], - "hidden": { - "flagValue": "release_reactive_actions_enabled", - "comparison": "FEATURE_FLAG", - "value": true - } + ] }, { "label": "Request confirmation before running this query", From 43cc91c09dffe8716eefea964c991fd1084fcae9 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Fri, 9 May 2025 19:54:33 +0530 Subject: [PATCH 02/10] addressing coderrabbitai comments --- .../JSEditorToolbar/components/JSFunctionSettings.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 27608b3d8052..d8af31da2af1 100644 --- a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx +++ b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx @@ -47,7 +47,6 @@ interface FunctionSettingsRowProps extends Omit { const FunctionSettingRow = (props: FunctionSettingsRowProps) => { const [runBehaviour, setRunBehaviour] = useState(props.action.runBehaviour); let options = RUN_BEHAVIOR_VALUES as SelectOptionProps[]; - const selectedValue = options.find((opt) => opt.value === runBehaviour); const flagValueForReactiveActions = useFeatureFlag( "release_reactive_actions_enabled", ); @@ -56,6 +55,8 @@ const FunctionSettingRow = (props: FunctionSettingsRowProps) => { options = [...options.filter((option) => option.value !== "AUTOMATIC")]; } + const selectedValue = options.find((opt) => opt.value === runBehaviour); + const onSelectOptions = useCallback( (newRunBehaviour: ActionRunBehaviourType) => { setRunBehaviour(newRunBehaviour); @@ -88,7 +89,6 @@ const FunctionSettingRow = (props: FunctionSettingsRowProps) => { Date: Sat, 10 May 2025 00:12:23 +0530 Subject: [PATCH 03/10] adding the filtering logic for automatic dropdown option only on frontend --- .../PluginActionContext.tsx | 3 +- .../PluginActionSettings/SettingsPopover.tsx | 15 +++- .../types/PluginActionTypes.ts | 2 +- .../src/ce/selectors/featureFlagsSelectors.ts | 6 +- .../formConfig/ApiSettingsConfig.ts | 3 +- .../formConfig/GoogleSheetsSettingsConfig.ts | 3 +- .../formConfig/QuerySettingsConfig.ts | 3 +- .../components/JSFunctionSettings.tsx | 11 ++- app/client/src/sagas/PluginSagas.ts | 6 +- app/client/src/utils/PluginUtils.ts | 82 +++++++++++-------- 10 files changed, 84 insertions(+), 50 deletions(-) diff --git a/app/client/src/PluginActionEditor/PluginActionContext.tsx b/app/client/src/PluginActionEditor/PluginActionContext.tsx index 6a4e3672dad8..af915fbdcf8e 100644 --- a/app/client/src/PluginActionEditor/PluginActionContext.tsx +++ b/app/client/src/PluginActionEditor/PluginActionContext.tsx @@ -8,12 +8,13 @@ import type { Action } from "entities/Action"; import type { Plugin } from "entities/Plugin"; import type { Datasource, EmbeddedRestDatasource } from "entities/Datasource"; import type { ActionResponse } from "api/ActionAPI"; +import type { PluginActionSettingsConfig } from "./types/PluginActionTypes"; interface PluginActionContextType { action: Action; actionResponse?: ActionResponse; editorConfig?: unknown[]; - settingsConfig?: unknown[]; + settingsConfig?: PluginActionSettingsConfig[]; plugin: Plugin; datasource?: EmbeddedRestDatasource | Datasource; } diff --git a/app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx b/app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx index af8fc1658519..1d3f8f175751 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx @@ -8,7 +8,7 @@ import { API_EDITOR_TAB_TITLES, MORE_ON_QUERY_SETTINGS, } from "ee/constants/messages"; -import { useDispatch, useSelector } from "react-redux"; +import { useDispatch, useSelector, type DefaultRootState } from "react-redux"; import { isPluginActionSettingsOpen, openPluginActionSettings, @@ -16,6 +16,8 @@ import { import { THEME } from "../../types/PluginActionTypes"; import { type DocsLink, openDoc } from "constants/DocumentationLinks"; import { ToolbarSettingsPopover } from "IDE"; +import { updateRunBehaviourForActionSettings } from "utils/PluginUtils"; +import { selectFeatureFlagCheck } from "ee/selectors/featureFlagsSelectors"; export interface SettingsProps { formName: string; @@ -41,6 +43,15 @@ const PluginActionSettingsPopover = (props: SettingsProps) => { const [isOpen, setIsOpen] = useState(false); const dispatch = useDispatch(); + const featureFlagEnabled: boolean = useSelector((state: DefaultRootState) => + selectFeatureFlagCheck(state, "release_reactive_actions_enabled"), + ); + + const updateSettingsConfig = updateRunBehaviourForActionSettings( + settingsConfig || [], + featureFlagEnabled, + ); + const handleOpenChange = useCallback( (open: boolean) => { setIsOpen(open); @@ -74,7 +85,7 @@ const PluginActionSettingsPopover = (props: SettingsProps) => { > diff --git a/app/client/src/PluginActionEditor/types/PluginActionTypes.ts b/app/client/src/PluginActionEditor/types/PluginActionTypes.ts index 90c2e8f3b42f..9769cfb0b101 100644 --- a/app/client/src/PluginActionEditor/types/PluginActionTypes.ts +++ b/app/client/src/PluginActionEditor/types/PluginActionTypes.ts @@ -10,7 +10,7 @@ export enum ActionRunBehaviour { export type ActionRunBehaviourType = `${ActionRunBehaviour}`; -interface PluginActionSettingsConfigChildren { +export interface PluginActionSettingsConfigChildren { label: string; configProperty: string; controlType: string; diff --git a/app/client/src/ce/selectors/featureFlagsSelectors.ts b/app/client/src/ce/selectors/featureFlagsSelectors.ts index e6c554b49511..7d4ee2d4df18 100644 --- a/app/client/src/ce/selectors/featureFlagsSelectors.ts +++ b/app/client/src/ce/selectors/featureFlagsSelectors.ts @@ -5,7 +5,11 @@ import type { OverriddenFeatureFlags } from "utils/hooks/useFeatureFlagOverride" const combineFeatureFlags = memoize( (featureFlags: FeatureFlags, overriddenFlags: OverriddenFeatureFlags) => { - return { ...featureFlags, ...overriddenFlags }; + return { + ...featureFlags, + ...overriddenFlags, + release_reactive_actions_enabled: false, + }; }, ); diff --git a/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts b/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts index 9a2f84a8b2ac..c74936e79a4c 100644 --- a/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts +++ b/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts @@ -10,6 +10,7 @@ import { RUN_BEHAVIOR_VALUES, RUN_BEHAVIOR_CONFIG_PROPERTY, } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; +import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes"; export default [ { @@ -20,7 +21,7 @@ export default [ label: "Run behavior", configProperty: RUN_BEHAVIOR_CONFIG_PROPERTY, controlType: "DROP_DOWN", - initialValue: "MANUAL", + initialValue: ActionRunBehaviour.MANUAL, options: RUN_BEHAVIOR_VALUES, }, { diff --git a/app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts b/app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts index 780f1f22d814..73a5ca299b2f 100644 --- a/app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts +++ b/app/client/src/constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig.ts @@ -2,6 +2,7 @@ import { RUN_BEHAVIOR_VALUES, RUN_BEHAVIOR_CONFIG_PROPERTY, } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; +import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes"; export default [ { @@ -12,7 +13,7 @@ export default [ label: "Run behavior", configProperty: RUN_BEHAVIOR_CONFIG_PROPERTY, controlType: "DROP_DOWN", - initialValue: "MANUAL", + initialValue: ActionRunBehaviour.MANUAL, options: RUN_BEHAVIOR_VALUES, }, { diff --git a/app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts b/app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts index 0b872e7c53d0..28611ae53012 100644 --- a/app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts +++ b/app/client/src/constants/AppsmithActionConstants/formConfig/QuerySettingsConfig.ts @@ -2,6 +2,7 @@ import { RUN_BEHAVIOR_VALUES, RUN_BEHAVIOR_CONFIG_PROPERTY, } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; +import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes"; export default [ { @@ -12,7 +13,7 @@ export default [ label: "Run behavior", configProperty: RUN_BEHAVIOR_CONFIG_PROPERTY, controlType: "DROP_DOWN", - initialValue: "MANUAL", + initialValue: ActionRunBehaviour.MANUAL, options: RUN_BEHAVIOR_VALUES, }, { 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 d8af31da2af1..489b6c12a9b4 100644 --- a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx +++ b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx @@ -46,15 +46,14 @@ interface FunctionSettingsRowProps extends Omit { const FunctionSettingRow = (props: FunctionSettingsRowProps) => { const [runBehaviour, setRunBehaviour] = useState(props.action.runBehaviour); - let options = RUN_BEHAVIOR_VALUES as SelectOptionProps[]; const flagValueForReactiveActions = useFeatureFlag( "release_reactive_actions_enabled", ); - - if (!flagValueForReactiveActions) { - options = [...options.filter((option) => option.value !== "AUTOMATIC")]; - } - + const options = RUN_BEHAVIOR_VALUES.filter( + (option) => + (option.value !== "AUTOMATIC" && !flagValueForReactiveActions) || + flagValueForReactiveActions, + ) as SelectOptionProps[]; const selectedValue = options.find((opt) => opt.value === runBehaviour); const onSelectOptions = useCallback( diff --git a/app/client/src/sagas/PluginSagas.ts b/app/client/src/sagas/PluginSagas.ts index c3eccd2b610a..96dda98a0ad2 100644 --- a/app/client/src/sagas/PluginSagas.ts +++ b/app/client/src/sagas/PluginSagas.ts @@ -45,7 +45,7 @@ import type { } from "utils/DynamicBindingUtils"; import type { ActionDataState } from "ee/reducers/entityReducers/actionsReducer"; import { getFromServerWhenNoPrefetchedResult } from "./helper"; -import { updatePluginRunBehaviourForPluginSettings } from "utils/PluginUtils"; +import { updateDefaultPluginSettings } from "utils/PluginUtils"; import { selectFeatureFlagCheck } from "ee/selectors/featureFlagsSelectors"; function* fetchPluginsSaga( @@ -171,7 +171,7 @@ function* fetchPluginFormConfigsSaga(action?: { "release_reactive_actions_enabled", ); - const updatedPluginSettings = updatePluginRunBehaviourForPluginSettings( + const updatedPluginSettings = updateDefaultPluginSettings( defaultActionSettings, featureFlagEnabled, ); @@ -253,7 +253,7 @@ export function* checkAndGetPluginFormConfigsSaga(pluginId: string) { "release_reactive_actions_enabled", ); - const updatedPluginSettings = updatePluginRunBehaviourForPluginSettings( + const updatedPluginSettings = updateDefaultPluginSettings( defaultActionSettings, featureFlagEnabled, ); diff --git a/app/client/src/utils/PluginUtils.ts b/app/client/src/utils/PluginUtils.ts index add433ca7d0a..b4cb458dd1df 100644 --- a/app/client/src/utils/PluginUtils.ts +++ b/app/client/src/utils/PluginUtils.ts @@ -1,45 +1,61 @@ -import { objectKeys } from "@appsmith/utils"; import type { PluginType } from "entities/Plugin"; import { RUN_BEHAVIOR_CONFIG_PROPERTY } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; -import type { PluginActionSettingsConfig } from "PluginActionEditor/types/PluginActionTypes"; +import type { + PluginActionSettingsConfig, + PluginActionSettingsConfigChildren, +} from "PluginActionEditor/types/PluginActionTypes"; -export const updatePluginRunBehaviourForPluginSettings = ( +export const updateDefaultPluginSettings = ( pluginSettings: Record, flagValueForReactiveActions: boolean, -) => { +): Record => { if (!flagValueForReactiveActions) { - return objectKeys(pluginSettings).reduce( - (acc: Record, pluginType) => { - acc[pluginType] = pluginSettings[pluginType].map( - (plugin: PluginActionSettingsConfig) => { - return { - ...plugin, - children: plugin.children.map((child) => { - if ( - child.configProperty === RUN_BEHAVIOR_CONFIG_PROPERTY && - child.options - ) { - return { - ...child, - options: [ - ...child.options.filter( - (option) => option.value !== "AUTOMATIC", - ), - ], - }; - } + return Object.fromEntries( + Object.entries(pluginSettings).map(([pluginType, settings]) => { + let newSettings = settings; - return child; - }), - }; - }, - ); + if (newSettings.length > 0) { + newSettings = updateRunBehaviourForActionSettings( + settings, + flagValueForReactiveActions, + ); + } - return acc; - }, - pluginSettings, - ); + return [pluginType, newSettings]; + }), + ) as Record; } return pluginSettings; }; + +export const updateRunBehaviourForActionSettings = ( + pluginSettings: PluginActionSettingsConfig[], + flagValueForReactiveActions: boolean, +): PluginActionSettingsConfig[] => { + return pluginSettings.map((settings) => ({ + ...settings, + children: settings.children.map( + (settings: PluginActionSettingsConfigChildren) => { + if ( + settings.configProperty === RUN_BEHAVIOR_CONFIG_PROPERTY && + settings.options + ) { + return { + ...settings, + options: [ + ...settings.options.filter( + (option) => + (!flagValueForReactiveActions && + option.value !== "AUTOMATIC") || + flagValueForReactiveActions, + ), + ], + }; + } + + return settings; + }, + ), + })); +}; From 0823335202d6f7b7fbcf832fbe9b53e6153e63d6 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Sat, 10 May 2025 00:13:45 +0530 Subject: [PATCH 04/10] reverting a change --- app/client/src/ce/selectors/featureFlagsSelectors.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/client/src/ce/selectors/featureFlagsSelectors.ts b/app/client/src/ce/selectors/featureFlagsSelectors.ts index 7d4ee2d4df18..e6c554b49511 100644 --- a/app/client/src/ce/selectors/featureFlagsSelectors.ts +++ b/app/client/src/ce/selectors/featureFlagsSelectors.ts @@ -5,11 +5,7 @@ import type { OverriddenFeatureFlags } from "utils/hooks/useFeatureFlagOverride" const combineFeatureFlags = memoize( (featureFlags: FeatureFlags, overriddenFlags: OverriddenFeatureFlags) => { - return { - ...featureFlags, - ...overriddenFlags, - release_reactive_actions_enabled: false, - }; + return { ...featureFlags, ...overriddenFlags }; }, ); From db1eb04be2b1d1293bead30f8cfe02dedec334af Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Sat, 10 May 2025 00:33:05 +0530 Subject: [PATCH 05/10] fixing client build --- .../UQIEditor/hooks/useGoogleSheetsSetDefaultProperty.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/hooks/useGoogleSheetsSetDefaultProperty.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/hooks/useGoogleSheetsSetDefaultProperty.ts index c017261fbccf..6bc03ad4ff72 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/hooks/useGoogleSheetsSetDefaultProperty.ts +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/hooks/useGoogleSheetsSetDefaultProperty.ts @@ -7,6 +7,7 @@ import { getPathAndValueFromActionDiffObject } from "utils/getPathAndValueFromAc import { setActionProperty } from "actions/pluginActionActions"; import { usePluginActionContext } from "../../../../../PluginActionContext"; import { useDispatch } from "react-redux"; +import type { PluginActionSettingsConfig } from "PluginActionEditor/types/PluginActionTypes"; export const useGoogleSheetsSetDefaultProperty = () => { const { @@ -30,7 +31,9 @@ export const useGoogleSheetsSetDefaultProperty = () => { merge( initialValues, - getConfigInitialValues(settingsConfig as Record[]), + getConfigInitialValues( + settingsConfig as PluginActionSettingsConfig[], + ), ); // initialValues contains merge of action, editorConfig, settingsConfig and will be passed to redux form From 164db73f8c5e19afb6b91d86a1c30bea518f7c43 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Sat, 10 May 2025 02:21:11 +0530 Subject: [PATCH 06/10] minor refactoring --- .../PluginActionSettings/SettingsPopover.tsx | 15 ++-------- .../components/ActionSettings.tsx | 16 +++++++++-- app/client/src/sagas/PluginSagas.ts | 28 ++----------------- app/client/src/utils/PluginUtils.ts | 25 ----------------- 4 files changed, 19 insertions(+), 65 deletions(-) diff --git a/app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx b/app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx index 1d3f8f175751..af8fc1658519 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx @@ -8,7 +8,7 @@ import { API_EDITOR_TAB_TITLES, MORE_ON_QUERY_SETTINGS, } from "ee/constants/messages"; -import { useDispatch, useSelector, type DefaultRootState } from "react-redux"; +import { useDispatch, useSelector } from "react-redux"; import { isPluginActionSettingsOpen, openPluginActionSettings, @@ -16,8 +16,6 @@ import { import { THEME } from "../../types/PluginActionTypes"; import { type DocsLink, openDoc } from "constants/DocumentationLinks"; import { ToolbarSettingsPopover } from "IDE"; -import { updateRunBehaviourForActionSettings } from "utils/PluginUtils"; -import { selectFeatureFlagCheck } from "ee/selectors/featureFlagsSelectors"; export interface SettingsProps { formName: string; @@ -43,15 +41,6 @@ const PluginActionSettingsPopover = (props: SettingsProps) => { const [isOpen, setIsOpen] = useState(false); const dispatch = useDispatch(); - const featureFlagEnabled: boolean = useSelector((state: DefaultRootState) => - selectFeatureFlagCheck(state, "release_reactive_actions_enabled"), - ); - - const updateSettingsConfig = updateRunBehaviourForActionSettings( - settingsConfig || [], - featureFlagEnabled, - ); - const handleOpenChange = useCallback( (open: boolean) => { setIsOpen(open); @@ -85,7 +74,7 @@ const PluginActionSettingsPopover = (props: SettingsProps) => { > diff --git a/app/client/src/PluginActionEditor/components/PluginActionToolbar/components/ActionSettings.tsx b/app/client/src/PluginActionEditor/components/PluginActionToolbar/components/ActionSettings.tsx index cccd1dfe1404..e18920d18182 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionToolbar/components/ActionSettings.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionToolbar/components/ActionSettings.tsx @@ -6,6 +6,9 @@ import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorC import styled from "styled-components"; import { Text } from "@appsmith/ads"; import CenteredWrapper from "components/designSystems/appsmith/CenteredWrapper"; +import { useSelector, type DefaultRootState } from "react-redux"; +import { selectFeatureFlagCheck } from "ee/selectors/featureFlagsSelectors"; +import { updateRunBehaviourForActionSettings } from "utils/PluginUtils"; interface ActionSettingsProps { // TODO: Fix this the next time the file is edited @@ -41,9 +44,18 @@ const ActionSettingsWrapper = styled.div` `; function ActionSettings(props: ActionSettingsProps): JSX.Element { + const featureFlagEnabled: boolean = useSelector((state: DefaultRootState) => + selectFeatureFlagCheck(state, "release_reactive_actions_enabled"), + ); + + const updateSettingsConfig = updateRunBehaviourForActionSettings( + props.actionSettingsConfig || [], + featureFlagEnabled, + ); + return ( - {!props.actionSettingsConfig ? ( + {!updateSettingsConfig ? ( Error: No settings config found @@ -52,7 +64,7 @@ function ActionSettings(props: ActionSettingsProps): JSX.Element { ) : ( /* TODO: Fix this the next time the file is edited */ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ - props.actionSettingsConfig.map((section: any) => + updateSettingsConfig.map((section: any) => renderEachConfig(section, props.formName), ) )} diff --git a/app/client/src/sagas/PluginSagas.ts b/app/client/src/sagas/PluginSagas.ts index 96dda98a0ad2..9c887c2c4907 100644 --- a/app/client/src/sagas/PluginSagas.ts +++ b/app/client/src/sagas/PluginSagas.ts @@ -45,8 +45,6 @@ import type { } from "utils/DynamicBindingUtils"; import type { ActionDataState } from "ee/reducers/entityReducers/actionsReducer"; import { getFromServerWhenNoPrefetchedResult } from "./helper"; -import { updateDefaultPluginSettings } from "utils/PluginUtils"; -import { selectFeatureFlagCheck } from "ee/selectors/featureFlagsSelectors"; function* fetchPluginsSaga( action: ReduxAction< @@ -166,21 +164,11 @@ function* fetchPluginFormConfigsSaga(action?: { const dependencies: FormDependencyConfigs = {}; const datasourceFormButtonConfigs: FormDatasourceButtonConfigs = {}; - const featureFlagEnabled: boolean = yield select( - selectFeatureFlagCheck, - "release_reactive_actions_enabled", - ); - - const updatedPluginSettings = updateDefaultPluginSettings( - defaultActionSettings, - featureFlagEnabled, - ); - Array.from(pluginIdFormsToFetch).forEach((pluginId, index) => { const plugin = plugins.find((plugin) => plugin.id === pluginId); if (plugin && plugin.type === PluginType.JS) { - settingConfigs[pluginId] = updatedPluginSettings[plugin.type]; + settingConfigs[pluginId] = defaultActionSettings[plugin.type]; editorConfigs[pluginId] = defaultActionEditorConfigs[plugin.type]; formConfigs[pluginId] = []; dependencies[pluginId] = defaultActionDependenciesConfig[plugin.type]; @@ -198,7 +186,7 @@ function* fetchPluginFormConfigsSaga(action?: { // Action settings form if not available use default if (plugin && !pluginFormData[index].setting) { - settingConfigs[pluginId] = updatedPluginSettings[plugin.type]; + settingConfigs[pluginId] = defaultActionSettings[plugin.type]; } else { settingConfigs[pluginId] = pluginFormData[index].setting; } @@ -248,16 +236,6 @@ export function* checkAndGetPluginFormConfigsSaga(pluginId: string) { pluginId, ); - const featureFlagEnabled: boolean = yield select( - selectFeatureFlagCheck, - "release_reactive_actions_enabled", - ); - - const updatedPluginSettings = updateDefaultPluginSettings( - defaultActionSettings, - featureFlagEnabled, - ); - if (!formConfig) { const formConfigResponse: ApiResponse = yield PluginApi.fetchFormConfig(pluginId); @@ -265,7 +243,7 @@ export function* checkAndGetPluginFormConfigsSaga(pluginId: string) { yield validateResponse(formConfigResponse); if (!formConfigResponse.data.setting) { - formConfigResponse.data.setting = updatedPluginSettings[plugin.type]; + formConfigResponse.data.setting = defaultActionSettings[plugin.type]; } if (!formConfigResponse.data.editor) { diff --git a/app/client/src/utils/PluginUtils.ts b/app/client/src/utils/PluginUtils.ts index b4cb458dd1df..c812e496822d 100644 --- a/app/client/src/utils/PluginUtils.ts +++ b/app/client/src/utils/PluginUtils.ts @@ -1,34 +1,9 @@ -import type { PluginType } from "entities/Plugin"; import { RUN_BEHAVIOR_CONFIG_PROPERTY } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; import type { PluginActionSettingsConfig, PluginActionSettingsConfigChildren, } from "PluginActionEditor/types/PluginActionTypes"; -export const updateDefaultPluginSettings = ( - pluginSettings: Record, - flagValueForReactiveActions: boolean, -): Record => { - if (!flagValueForReactiveActions) { - return Object.fromEntries( - Object.entries(pluginSettings).map(([pluginType, settings]) => { - let newSettings = settings; - - if (newSettings.length > 0) { - newSettings = updateRunBehaviourForActionSettings( - settings, - flagValueForReactiveActions, - ); - } - - return [pluginType, newSettings]; - }), - ) as Record; - } - - return pluginSettings; -}; - export const updateRunBehaviourForActionSettings = ( pluginSettings: PluginActionSettingsConfig[], flagValueForReactiveActions: boolean, From 45a3faecd376ecccb91bf3621ff3f52502cfcc60 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Mon, 12 May 2025 12:58:09 +0530 Subject: [PATCH 07/10] addressing review comments --- app/client/src/utils/PluginUtils.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/client/src/utils/PluginUtils.ts b/app/client/src/utils/PluginUtils.ts index c812e496822d..35c8817a32a7 100644 --- a/app/client/src/utils/PluginUtils.ts +++ b/app/client/src/utils/PluginUtils.ts @@ -1,7 +1,8 @@ import { RUN_BEHAVIOR_CONFIG_PROPERTY } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; -import type { - PluginActionSettingsConfig, - PluginActionSettingsConfigChildren, +import { + ActionRunBehaviour, + type PluginActionSettingsConfig, + type PluginActionSettingsConfigChildren, } from "PluginActionEditor/types/PluginActionTypes"; export const updateRunBehaviourForActionSettings = ( @@ -22,7 +23,7 @@ export const updateRunBehaviourForActionSettings = ( ...settings.options.filter( (option) => (!flagValueForReactiveActions && - option.value !== "AUTOMATIC") || + option.value !== ActionRunBehaviour.AUTOMATIC) || flagValueForReactiveActions, ), ], From 7929ff86a573eebd6d13d54a5ebc329020a8168f Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Mon, 12 May 2025 12:59:32 +0530 Subject: [PATCH 08/10] addressing review comments --- .../JSEditorToolbar/components/JSFunctionSettings.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 489b6c12a9b4..18d5b3f206bf 100644 --- a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx +++ b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx @@ -14,7 +14,10 @@ import { } from "ee/constants/messages"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import type { OnUpdateSettingsProps } from "../types"; -import { type ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes"; +import { + ActionRunBehaviour, + type ActionRunBehaviourType, +} from "PluginActionEditor/types/PluginActionTypes"; import styled from "styled-components"; import { RUN_BEHAVIOR_VALUES } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; @@ -51,7 +54,8 @@ const FunctionSettingRow = (props: FunctionSettingsRowProps) => { ); const options = RUN_BEHAVIOR_VALUES.filter( (option) => - (option.value !== "AUTOMATIC" && !flagValueForReactiveActions) || + (option.value !== ActionRunBehaviour.AUTOMATIC && + !flagValueForReactiveActions) || flagValueForReactiveActions, ) as SelectOptionProps[]; const selectedValue = options.find((opt) => opt.value === runBehaviour); From 45fead2da78a652c509284108f0ac922b0de5cf4 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Mon, 12 May 2025 13:02:04 +0530 Subject: [PATCH 09/10] addressing review comments --- .../PluginActionEditor/types/PluginActionTypes.ts | 6 +++--- app/client/src/utils/PluginUtils.ts | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/client/src/PluginActionEditor/types/PluginActionTypes.ts b/app/client/src/PluginActionEditor/types/PluginActionTypes.ts index 9769cfb0b101..f81d82a24857 100644 --- a/app/client/src/PluginActionEditor/types/PluginActionTypes.ts +++ b/app/client/src/PluginActionEditor/types/PluginActionTypes.ts @@ -10,7 +10,7 @@ export enum ActionRunBehaviour { export type ActionRunBehaviourType = `${ActionRunBehaviour}`; -export interface PluginActionSettingsConfigChildren { +export interface ActionSettingsConfigChildren { label: string; configProperty: string; controlType: string; @@ -23,8 +23,8 @@ export interface PluginActionSettingsConfigChildren { name?: string; } -export interface PluginActionSettingsConfig { +export interface ActionSettingsConfig { sectionName: string; id: number; - children: PluginActionSettingsConfigChildren[]; + children: ActionSettingsConfigChildren[]; } diff --git a/app/client/src/utils/PluginUtils.ts b/app/client/src/utils/PluginUtils.ts index 35c8817a32a7..1fe73696a1ec 100644 --- a/app/client/src/utils/PluginUtils.ts +++ b/app/client/src/utils/PluginUtils.ts @@ -1,18 +1,18 @@ import { RUN_BEHAVIOR_CONFIG_PROPERTY } from "constants/AppsmithActionConstants/formConfig/PluginSettings"; import { ActionRunBehaviour, - type PluginActionSettingsConfig, - type PluginActionSettingsConfigChildren, + type ActionSettingsConfig, + type ActionSettingsConfigChildren, } from "PluginActionEditor/types/PluginActionTypes"; export const updateRunBehaviourForActionSettings = ( - pluginSettings: PluginActionSettingsConfig[], + actionSettings: ActionSettingsConfig[], flagValueForReactiveActions: boolean, -): PluginActionSettingsConfig[] => { - return pluginSettings.map((settings) => ({ +): ActionSettingsConfig[] => { + return actionSettings.map((settings) => ({ ...settings, children: settings.children.map( - (settings: PluginActionSettingsConfigChildren) => { + (settings: ActionSettingsConfigChildren) => { if ( settings.configProperty === RUN_BEHAVIOR_CONFIG_PROPERTY && settings.options From 372a411d4a7be362adac4f2644377f6107dd5264 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Mon, 12 May 2025 13:19:49 +0530 Subject: [PATCH 10/10] addressing review comments --- .../JSEditorToolbar/components/JSFunctionSettings.tsx | 5 ++--- app/client/src/utils/PluginUtils.ts | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) 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 18d5b3f206bf..7c2aa679996b 100644 --- a/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx +++ b/app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx @@ -54,9 +54,8 @@ const FunctionSettingRow = (props: FunctionSettingsRowProps) => { ); const options = RUN_BEHAVIOR_VALUES.filter( (option) => - (option.value !== ActionRunBehaviour.AUTOMATIC && - !flagValueForReactiveActions) || - flagValueForReactiveActions, + flagValueForReactiveActions || + option.value !== ActionRunBehaviour.AUTOMATIC, ) as SelectOptionProps[]; const selectedValue = options.find((opt) => opt.value === runBehaviour); diff --git a/app/client/src/utils/PluginUtils.ts b/app/client/src/utils/PluginUtils.ts index 1fe73696a1ec..72aaaa9ccb1d 100644 --- a/app/client/src/utils/PluginUtils.ts +++ b/app/client/src/utils/PluginUtils.ts @@ -22,9 +22,8 @@ export const updateRunBehaviourForActionSettings = ( options: [ ...settings.options.filter( (option) => - (!flagValueForReactiveActions && - option.value !== ActionRunBehaviour.AUTOMATIC) || - flagValueForReactiveActions, + flagValueForReactiveActions || + option.value !== ActionRunBehaviour.AUTOMATIC, ), ], };