From ff07d7a7986c8a37ca80e99c981ffc58f0e8bcb6 Mon Sep 17 00:00:00 2001 From: Ayush Pahwa Date: Thu, 9 Jan 2025 17:07:22 +0700 Subject: [PATCH 1/2] Sync changes from EE excluding enterprise directory --- app/client/src/workers/Evaluation/formEval.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/client/src/workers/Evaluation/formEval.ts b/app/client/src/workers/Evaluation/formEval.ts index 7439a85ebb64..a53921917b6e 100644 --- a/app/client/src/workers/Evaluation/formEval.ts +++ b/app/client/src/workers/Evaluation/formEval.ts @@ -15,6 +15,7 @@ import { extractEvalConfigFromFormConfig } from "components/formControls/utils"; import { isDynamicValue } from "utils/DynamicBindingUtils"; import { isTrueObject } from "ee/workers/Evaluation/evaluationUtils"; import type { DatasourceConfiguration } from "entities/Datasource"; +import { objectKeys } from "@appsmith/utils"; export enum ConditionType { HIDE = "hide", // When set, the component will be shown until condition is true @@ -71,7 +72,7 @@ const generateInitialEvalState = (formConfig: FormConfigType) => { // Any element is only added to the eval state if they have a conditional statement present, if not they are allowed to be rendered if ("conditionals" in formConfig && !!formConfig.conditionals) { - const allConditionTypes = Object.keys(formConfig.conditionals); + const allConditionTypes = objectKeys(formConfig.conditionals); if ( allConditionTypes.includes(ConditionType.HIDE) || @@ -311,7 +312,7 @@ function evaluateFormConfigElements( /* eslint-disable @typescript-eslint/no-unused-vars */ datasourceConfiguration?: DatasourceConfiguration, ) { - const paths = Object.keys(config); + const paths = objectKeys(config); if (paths.length > 0) { paths.forEach((path) => { @@ -336,13 +337,13 @@ function evaluate( hasRouteChanged?: boolean, datasourceConfiguration?: DatasourceConfiguration, ) { - Object.keys(currentEvalState).forEach((key: string) => { + objectKeys(currentEvalState).forEach((key: string) => { try { if (currentEvalState[key].hasOwnProperty("conditionals")) { const conditionBlock = currentEvalState[key].conditionals; if (!!conditionBlock) { - Object.keys(conditionBlock).forEach((conditionType: string) => { + objectKeys(conditionBlock).forEach((conditionType: string) => { const output = eval(conditionBlock[conditionType]); if (conditionType === ConditionType.HIDE) { From dca4a76287bd032a265da065403040930d61bfff Mon Sep 17 00:00:00 2001 From: Ayush Pahwa Date: Thu, 9 Jan 2025 22:02:21 +0700 Subject: [PATCH 2/2] Sync changes from EE excluding enterprise directory --- app/client/src/actions/evaluationActions.ts | 3 +++ app/client/src/sagas/FormEvaluationSaga.ts | 9 +++++++-- app/client/src/sagas/QueryPaneSagas.ts | 7 +++++-- app/client/src/sagas/ReplaySaga.ts | 2 ++ app/client/src/workers/Evaluation/formEval.ts | 11 +++++++++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/client/src/actions/evaluationActions.ts b/app/client/src/actions/evaluationActions.ts index e633077c713e..5a119cbbcf1b 100644 --- a/app/client/src/actions/evaluationActions.ts +++ b/app/client/src/actions/evaluationActions.ts @@ -11,6 +11,7 @@ import { LINT_REDUX_ACTIONS, LOG_REDUX_ACTIONS, } from "ee/actions/evaluationActionsList"; +import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers"; export const shouldTriggerEvaluation = (action: ReduxAction) => { return ( @@ -99,6 +100,7 @@ export const startFormEvaluations = ( formData: QueryActionConfig, datasourceId: string, pluginId: string, + editorContextType: ActionParentEntityTypeInterface, actionDiffPath?: string, hasRouteChanged?: boolean, datasourceConfiguration?: DatasourceConfiguration, @@ -110,6 +112,7 @@ export const startFormEvaluations = ( actionConfiguration: formData, datasourceId, pluginId, + editorContextType, actionDiffPath, hasRouteChanged, datasourceConfiguration, diff --git a/app/client/src/sagas/FormEvaluationSaga.ts b/app/client/src/sagas/FormEvaluationSaga.ts index 548adba699a1..6e5fbbc8e6dd 100644 --- a/app/client/src/sagas/FormEvaluationSaga.ts +++ b/app/client/src/sagas/FormEvaluationSaga.ts @@ -29,13 +29,18 @@ import { import type { DatasourceConfiguration } from "entities/Datasource"; import { buffers } from "redux-saga"; import type { Plugin } from "api/PluginApi"; -import { doesPluginRequireDatasource } from "ee/entities/Engine/actionHelpers"; +import { + doesPluginRequireDatasource, + type ActionParentEntityTypeInterface, +} from "ee/entities/Engine/actionHelpers"; import { klonaLiteWithTelemetry } from "utils/helpers"; +import { objectKeys } from "@appsmith/utils"; export interface FormEvalActionPayload { formId: string; datasourceId?: string; pluginId?: string; + editorContextType: ActionParentEntityTypeInterface; actionConfiguration?: ActionConfig; editorConfig?: FormConfigType[]; settingConfig?: FormConfigType[]; @@ -138,7 +143,7 @@ export function* fetchDynamicValuesSaga( datasourceId: string, pluginId: string, ) { - for (const key of Object.keys(queueOfValuesToBeFetched)) { + for (const key of objectKeys(queueOfValuesToBeFetched)) { queueOfValuesToBeFetched[key].fetchDynamicValues = yield call( fetchDynamicValueSaga, queueOfValuesToBeFetched[key], diff --git a/app/client/src/sagas/QueryPaneSagas.ts b/app/client/src/sagas/QueryPaneSagas.ts index 8fb02f41bed1..157b83f82765 100644 --- a/app/client/src/sagas/QueryPaneSagas.ts +++ b/app/client/src/sagas/QueryPaneSagas.ts @@ -85,6 +85,7 @@ import { TEMP_DATASOURCE_ID } from "constants/Datasource"; import { doesPluginRequireDatasource } from "ee/entities/Engine/actionHelpers"; import { convertToBasePageIdSelector } from "selectors/pageListSelectors"; import { openGeneratePageModalWithSelectedDS } from "../utils/GeneratePageUtils"; +import { objectKeys } from "@appsmith/utils"; // Called whenever the query being edited is changed via the URL or query pane function* changeQuerySaga(actionPayload: ReduxAction) { @@ -184,6 +185,7 @@ function* changeQuerySaga(actionPayload: ReduxAction) { //@ts-expect-error: id does not exists action.datasource.id, pluginId, + action.contextType, ), ); } @@ -272,7 +274,7 @@ function* formValueChangeSaga( type: ReduxActionTypes.SET_TRIGGER_VALUES_LOADING, payload: { formId: values.id, - keys: Object.keys(allTriggers), + keys: objectKeys(allTriggers), value: true, }, }); @@ -314,7 +316,7 @@ function* formValueChangeSaga( "datasourceConfiguration", ) ) { - currentEnvironment = Object.keys(datasourceStorages)[0]; + currentEnvironment = objectKeys(datasourceStorages)[0]; } let dsConfig = { @@ -335,6 +337,7 @@ function* formValueChangeSaga( values.actionConfiguration, values.datasource.id, values.pluginId, + values.contextType, field, hasRouteChanged, dsConfig, diff --git a/app/client/src/sagas/ReplaySaga.ts b/app/client/src/sagas/ReplaySaga.ts index 942c4f880d9f..1cb2c1d6b421 100644 --- a/app/client/src/sagas/ReplaySaga.ts +++ b/app/client/src/sagas/ReplaySaga.ts @@ -83,6 +83,7 @@ import { UIComponentTypes } from "api/PluginApi"; import { getCurrentEnvironmentId } from "ee/selectors/environmentSelectors"; import { updateAndSaveAnvilLayout } from "layoutSystems/anvil/utils/anvilChecksUtils"; import type { ReplayOperation } from "entities/Replay/ReplayEntity/ReplayOperations"; +import { ActionParentEntityType } from "ee/entities/Engine/actionHelpers"; export interface UndoRedoPayload { operation: ReplayOperation; @@ -358,6 +359,7 @@ function* replayActionSaga( replayEntity.actionConfiguration, replayEntity.datasource.id || "", replayEntity.pluginId, + replayEntity.contextType || ActionParentEntityType.PAGE, u.modifiedProperty, true, datasource?.datasourceStorages[currentEnvironment] diff --git a/app/client/src/workers/Evaluation/formEval.ts b/app/client/src/workers/Evaluation/formEval.ts index a53921917b6e..44e678cdbabe 100644 --- a/app/client/src/workers/Evaluation/formEval.ts +++ b/app/client/src/workers/Evaluation/formEval.ts @@ -16,6 +16,7 @@ import { isDynamicValue } from "utils/DynamicBindingUtils"; import { isTrueObject } from "ee/workers/Evaluation/evaluationUtils"; import type { DatasourceConfiguration } from "entities/Datasource"; import { objectKeys } from "@appsmith/utils"; +import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers"; export enum ConditionType { HIDE = "hide", // When set, the component will be shown until condition is true @@ -307,9 +308,12 @@ function evaluateDynamicValuesConfig( } function evaluateFormConfigElements( + /* eslint-disable @typescript-eslint/no-unused-vars */ actionConfiguration: ActionConfig, config: FormConfigEvalObject, /* eslint-disable @typescript-eslint/no-unused-vars */ + editorContextType: ActionParentEntityTypeInterface, + /* eslint-disable @typescript-eslint/no-unused-vars */ datasourceConfiguration?: DatasourceConfiguration, ) { const paths = objectKeys(config); @@ -333,6 +337,7 @@ function evaluateFormConfigElements( function evaluate( actionConfiguration: ActionConfig, currentEvalState: FormEvalOutput, + editorContextType: ActionParentEntityTypeInterface, actionDiffPath?: string, hasRouteChanged?: boolean, datasourceConfiguration?: DatasourceConfiguration, @@ -432,6 +437,7 @@ function evaluate( currentEvalState[key] .evaluateFormConfig as EvaluatedFormConfig ).evaluateFormConfigObject, + editorContextType, datasourceConfiguration, ); } @@ -449,6 +455,7 @@ function getFormEvaluation( formId: string, actionConfiguration: ActionConfig, currentEvalState: FormEvaluationState, + editorContextType: ActionParentEntityTypeInterface, actionDiffPath?: string, hasRouteChanged?: boolean, datasourceConfiguration?: DatasourceConfiguration, @@ -503,6 +510,7 @@ function getFormEvaluation( conditionToBeEvaluated = evaluate( actionConfiguration, currentEvalState[formId], + editorContextType, actionDiffPath, hasRouteChanged, datasourceConfiguration, @@ -515,6 +523,7 @@ function getFormEvaluation( conditionToBeEvaluated = evaluate( actionConfiguration, conditionToBeEvaluated, + editorContextType, actionDiffPath, hasRouteChanged, datasourceConfiguration, @@ -573,6 +582,7 @@ export function setFormEvaluationSaga( actionConfiguration, actionDiffPath, datasourceConfiguration, + editorContextType, formId, hasRouteChanged, } = payload; @@ -585,6 +595,7 @@ export function setFormEvaluationSaga( formId, actionConfiguration, currentEvalState, + editorContextType, actionDiffPath, hasRouteChanged, datasourceConfiguration,