chore: split for module instance evaluation on ee (#29027)
## Description Module instance evaluation required split to be extended on EE #### PR fixes following issue(s) Fixes # (issue number) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
parent
a8380a0f76
commit
6e39d11b14
|
|
@ -1,5 +1,11 @@
|
|||
type ID = string;
|
||||
|
||||
export enum MODULE_TYPE {
|
||||
QUERY = "QUERY_MODULE",
|
||||
JS = "JS",
|
||||
UI = "UI",
|
||||
}
|
||||
|
||||
export interface ModuleInput {
|
||||
id: string;
|
||||
propertyName: string;
|
||||
|
|
|
|||
23
app/client/src/ce/constants/ModuleInstanceConstants.ts
Normal file
23
app/client/src/ce/constants/ModuleInstanceConstants.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import type { MODULE_TYPE } from "@appsmith/constants/ModuleConstants";
|
||||
|
||||
export type ModuleId = string;
|
||||
export type ModuleInstanceId = string;
|
||||
|
||||
export enum ModuleInstanceCreatorType {
|
||||
MODULE = "MODULE",
|
||||
PAGE = "PAGE",
|
||||
}
|
||||
export interface ModuleInstance {
|
||||
id: ModuleInstanceId;
|
||||
type: MODULE_TYPE;
|
||||
moduleId: ModuleId;
|
||||
name: string;
|
||||
creatorId: string;
|
||||
creatorType: ModuleInstanceCreatorType;
|
||||
inputs: {
|
||||
[key: string]: string;
|
||||
};
|
||||
jsonPathKeys: {
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { PluginType } from "entities/Action";
|
||||
import { generateDataTreeJSAction } from "entities/DataTree/dataTreeJSAction";
|
||||
import { generateDataTreeJSAction } from "./dataTreeJSAction";
|
||||
import type { JSCollectionData } from "reducers/entityReducers/jsActionsReducer";
|
||||
|
||||
describe("generateDataTreeJSAction", () => {
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import type { ModuleInstance } from "@appsmith/constants/ModuleInstanceConstants";
|
||||
|
||||
export const generateModuleInstance = (
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
moduleInstance: ModuleInstance,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
moduleInstanceEntities: any,
|
||||
) => {
|
||||
return {
|
||||
configEntity: null,
|
||||
unEvalEntity: null,
|
||||
};
|
||||
};
|
||||
|
|
@ -18,6 +18,7 @@ import type { AppTheme } from "entities/AppTheming";
|
|||
import type { LoadingEntitiesState } from "reducers/evaluationReducers/loadingEntitiesReducer";
|
||||
import type { LayoutSystemTypes } from "layoutSystems/types";
|
||||
import type { Module } from "@appsmith/constants/ModuleConstants";
|
||||
import type { ModuleInstance } from "@appsmith/constants/ModuleInstanceConstants";
|
||||
|
||||
export type ActionDispatcher = (...args: any[]) => ActionDescription;
|
||||
|
||||
|
|
@ -64,6 +65,9 @@ export interface ActionEntityConfig extends EntityConfig {
|
|||
pluginId: PluginId;
|
||||
actionId: string;
|
||||
name: string;
|
||||
moduleId?: string;
|
||||
moduleInstanceId?: string;
|
||||
isPublic?: boolean;
|
||||
}
|
||||
|
||||
// JSAction (JSObject) entity Types
|
||||
|
|
@ -188,6 +192,8 @@ export interface DataTreeSeed {
|
|||
metaWidgets: MetaWidgetsReduxState;
|
||||
isMobile: boolean;
|
||||
moduleInputs: Module["inputsForm"];
|
||||
moduleInstances: Record<string, ModuleInstance>;
|
||||
moduleInstanceEntities: any;
|
||||
layoutSystemType: LayoutSystemTypes;
|
||||
loadingEntities: LoadingEntitiesState;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import { getFormValues } from "redux-form";
|
|||
import { TEMP_DATASOURCE_ID } from "constants/Datasource";
|
||||
import { MAX_DATASOURCE_SUGGESTIONS } from "pages/Editor/Explorer/hooks";
|
||||
import type { Module } from "@appsmith/constants/ModuleConstants";
|
||||
import type { ModuleInstance } from "@appsmith/constants/ModuleInstanceConstants";
|
||||
import type { Plugin } from "api/PluginApi";
|
||||
|
||||
export const getEntities = (state: AppState): AppState["entities"] =>
|
||||
|
|
@ -1313,3 +1314,14 @@ export const getEntityExplorerDatasources = (state: AppState): Datasource[] => {
|
|||
export function getInputsForModule(): Module["inputsForm"] {
|
||||
return [];
|
||||
}
|
||||
|
||||
export const getModuleInstances = (): Record<string, ModuleInstance> => {
|
||||
return {};
|
||||
};
|
||||
|
||||
export const getModuleInstanceEntities = () => {
|
||||
return {
|
||||
actions: [],
|
||||
jsCollections: [],
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -972,7 +972,7 @@ export const isAPathDynamicBindingPath = (
|
|||
propertyPath: string,
|
||||
) => {
|
||||
return (
|
||||
(isAction(entity) || isWidget(entity) || isJSAction(entity)) &&
|
||||
isWidgetActionOrJsObject(entity) &&
|
||||
isPathADynamicBinding(entityConfig, propertyPath)
|
||||
);
|
||||
};
|
||||
|
|
|
|||
1
app/client/src/ee/constants/ModuleInstanceConstants.ts
Normal file
1
app/client/src/ee/constants/ModuleInstanceConstants.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "ce/constants/ModuleInstanceConstants";
|
||||
1
app/client/src/ee/entities/DataTree/dataTreeAction.ts
Normal file
1
app/client/src/ee/entities/DataTree/dataTreeAction.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "ce/entities/DataTree/dataTreeAction";
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from "ce/entities/DataTree/dataTreeJSAction.test";
|
||||
1
app/client/src/ee/entities/DataTree/dataTreeJSAction.ts
Normal file
1
app/client/src/ee/entities/DataTree/dataTreeJSAction.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "ce/entities/DataTree/dataTreeJSAction";
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from "ce/entities/DataTree/dataTreeModuleInstance";
|
||||
|
|
@ -159,6 +159,7 @@ export interface BaseAction {
|
|||
errorReports?: Array<LayoutOnLoadActionErrors>;
|
||||
isPublic?: boolean;
|
||||
moduleId?: string;
|
||||
moduleInstanceId?: string;
|
||||
}
|
||||
|
||||
interface BaseApiAction extends BaseAction {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { generateDataTreeAction } from "entities/DataTree/dataTreeAction";
|
||||
import { generateDataTreeJSAction } from "entities/DataTree/dataTreeJSAction";
|
||||
import { generateDataTreeAction } from "@appsmith/entities/DataTree/dataTreeAction";
|
||||
import { generateDataTreeJSAction } from "@appsmith/entities/DataTree/dataTreeJSAction";
|
||||
import { generateDataTreeWidget } from "entities/DataTree/dataTreeWidget";
|
||||
import log from "loglevel";
|
||||
import {
|
||||
|
|
@ -18,7 +18,7 @@ import type {
|
|||
UnEvalTree,
|
||||
} from "entities/DataTree/dataTreeTypes";
|
||||
import { isEmpty } from "lodash";
|
||||
|
||||
import { generateModuleInstance } from "@appsmith/entities/DataTree/dataTreeModuleInstance";
|
||||
export class DataTreeFactory {
|
||||
static create({
|
||||
actions,
|
||||
|
|
@ -30,6 +30,8 @@ export class DataTreeFactory {
|
|||
loadingEntities,
|
||||
metaWidgets,
|
||||
moduleInputs,
|
||||
moduleInstanceEntities,
|
||||
moduleInstances,
|
||||
pluginDependencyConfig,
|
||||
theme,
|
||||
widgets,
|
||||
|
|
@ -73,6 +75,19 @@ export class DataTreeFactory {
|
|||
}
|
||||
}
|
||||
|
||||
if (!isEmpty(moduleInstances)) {
|
||||
Object.values(moduleInstances).forEach((moduleInstance) => {
|
||||
const { configEntity, unEvalEntity } = generateModuleInstance(
|
||||
moduleInstance,
|
||||
moduleInstanceEntities,
|
||||
);
|
||||
if (!!configEntity && !!unEvalEntity) {
|
||||
dataTree[moduleInstance.name] = unEvalEntity;
|
||||
configTree[moduleInstance.name] = configEntity;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Object.values(widgets).forEach((widget) => {
|
||||
const { configEntity, unEvalEntity } = generateDataTreeWidget(
|
||||
widget,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import {
|
|||
getPluginEditorConfigs,
|
||||
getCurrentJSCollections,
|
||||
getInputsForModule,
|
||||
getModuleInstances,
|
||||
getModuleInstanceEntities,
|
||||
} from "@appsmith/selectors/entitiesSelector";
|
||||
import type { WidgetEntity } from "@appsmith/entities/DataTree/types";
|
||||
import type { DataTree } from "entities/DataTree/dataTreeTypes";
|
||||
|
|
@ -58,6 +60,19 @@ const getCurrentActionEntities = createSelector(
|
|||
},
|
||||
);
|
||||
|
||||
const getModulesData = createSelector(
|
||||
getInputsForModule,
|
||||
getModuleInstances,
|
||||
getModuleInstanceEntities,
|
||||
(moduleInputs, moduleInstances, moduleInstanceEntities) => {
|
||||
return {
|
||||
moduleInputs: moduleInputs,
|
||||
moduleInstances: moduleInstances,
|
||||
moduleInstanceEntities: moduleInstanceEntities,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
export const getUnevaluatedDataTree = createSelector(
|
||||
getCurrentActionEntities,
|
||||
getWidgetsForEval,
|
||||
|
|
@ -68,9 +83,9 @@ export const getUnevaluatedDataTree = createSelector(
|
|||
getPluginDependencyConfig,
|
||||
getSelectedAppThemeProperties,
|
||||
getMetaWidgets,
|
||||
getInputsForModule,
|
||||
getLayoutSystemPayload,
|
||||
getLoadingEntities,
|
||||
getModulesData,
|
||||
(
|
||||
currentActionEntities,
|
||||
widgets,
|
||||
|
|
@ -81,9 +96,9 @@ export const getUnevaluatedDataTree = createSelector(
|
|||
pluginDependencyConfig,
|
||||
selectedAppThemeProperty,
|
||||
metaWidgets,
|
||||
moduleInputs,
|
||||
layoutSystemPayload,
|
||||
loadingEntities,
|
||||
modulesData,
|
||||
) => {
|
||||
const pageList = pageListPayload || [];
|
||||
return DataTreeFactory.create({
|
||||
|
|
@ -96,9 +111,9 @@ export const getUnevaluatedDataTree = createSelector(
|
|||
pluginDependencyConfig,
|
||||
theme: selectedAppThemeProperty,
|
||||
metaWidgets,
|
||||
moduleInputs,
|
||||
loadingEntities,
|
||||
...layoutSystemPayload,
|
||||
...modulesData,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user