feat: workflows editor code split (#28779)
## Description Code split for workflows code editor setup #### PR fixes following issue(s) Fixes [#2873](https://github.com/appsmithorg/appsmith-ee/issues/2873) #### 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 - New feature (non-breaking change which adds functionality) ## 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 --------- Co-authored-by: Ayush Pahwa <ayushpahwa96@gmail.com>
This commit is contained in:
parent
d1f9b2456e
commit
15fda56084
|
|
@ -8,6 +8,7 @@ export interface ChangeQueryPayload {
|
|||
applicationId?: string;
|
||||
pageId?: string;
|
||||
moduleId?: string;
|
||||
workflowId?: string;
|
||||
newQuery?: boolean;
|
||||
action?: Action;
|
||||
}
|
||||
|
|
|
|||
17
app/client/src/ce/constants/WorkflowConstants.ts
Normal file
17
app/client/src/ce/constants/WorkflowConstants.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
type ID = string;
|
||||
|
||||
// Type for the workflow object.
|
||||
export interface Workflow {
|
||||
id: ID;
|
||||
name: string; // Name of the workflow.
|
||||
icon: string;
|
||||
color: string;
|
||||
workspaceId: ID; // ID of the workspace where the workflow is created.
|
||||
modifiedBy: string;
|
||||
modifiedAt: string;
|
||||
userPermissions: string[];
|
||||
new: boolean;
|
||||
slug: string; // Slug of the workflow (Not in use currently).
|
||||
}
|
||||
|
||||
export type WorkflowMetadata = Workflow;
|
||||
14
app/client/src/ce/pages/Applications/WorkflowCardList.tsx
Normal file
14
app/client/src/ce/pages/Applications/WorkflowCardList.tsx
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import type { Workflow } from "@appsmith/constants/WorkflowConstants";
|
||||
|
||||
export interface WorkflowCardListProps {
|
||||
isMobile: boolean;
|
||||
workspaceId: string;
|
||||
workflows?: Workflow[];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function WorkflowCardList(props: WorkflowCardListProps) {
|
||||
return null;
|
||||
}
|
||||
|
||||
export default WorkflowCardList;
|
||||
|
|
@ -104,6 +104,7 @@ import ResourceListLoader from "@appsmith/pages/Applications/ResourceListLoader"
|
|||
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
|
||||
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
||||
import { getHasCreateWorkspacePermission } from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
|
||||
import WorkflowCardList from "@appsmith/pages/Applications/WorkflowCardList";
|
||||
import { allowManageEnvironmentAccessForUser } from "@appsmith/selectors/environmentSelectors";
|
||||
import CreateNewAppsOption from "@appsmith/pages/Applications/CreateNewAppsOption";
|
||||
import { resetCurrentApplicationIdForCreateNewApp } from "actions/onboardingActions";
|
||||
|
|
@ -598,7 +599,8 @@ export function ApplicationsSection(props: any) {
|
|||
workspacesListComponent = updatedWorkspaces.map(
|
||||
(workspaceObject: any, index: number) => {
|
||||
const isLastWorkspace = updatedWorkspaces.length === index + 1;
|
||||
const { applications, packages, workspace } = workspaceObject;
|
||||
const { applications, packages, workflows, workspace } =
|
||||
workspaceObject;
|
||||
const hasManageWorkspacePermissions = isPermitted(
|
||||
workspace.userPermissions,
|
||||
PERMISSION_TYPE.MANAGE_WORKSPACE,
|
||||
|
|
@ -761,6 +763,13 @@ export function ApplicationsSection(props: any) {
|
|||
workspaceId={workspace.id}
|
||||
/>
|
||||
)}
|
||||
{!isLoadingResources && (
|
||||
<WorkflowCardList
|
||||
isMobile={isMobile}
|
||||
workflows={workflows}
|
||||
workspaceId={workspace.id}
|
||||
/>
|
||||
)}
|
||||
</WorkspaceSection>
|
||||
{!isLastWorkspace && <Divider />}
|
||||
</React.Fragment>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { createSelector } from "reselect";
|
||||
import { groupBy } from "lodash";
|
||||
import type { AppState } from "@appsmith/reducers";
|
||||
import type { WorkflowMetadata } from "@appsmith/constants/WorkflowConstants";
|
||||
import type {
|
||||
ApplicationsReduxState,
|
||||
creatingApplicationMap,
|
||||
|
|
@ -13,6 +14,7 @@ import { hasCreateNewAppPermission } from "@appsmith/utils/permissionHelpers";
|
|||
import { NAVIGATION_SETTINGS, SIDEBAR_WIDTH } from "constants/AppConstants";
|
||||
import { getPackagesList } from "@appsmith/selectors/packageSelectors";
|
||||
import type { PackageMetadata } from "@appsmith/constants/PackageConstants";
|
||||
import { getWorkflowsList } from "@appsmith/selectors/workflowSelectors";
|
||||
|
||||
const fuzzySearchOptions = {
|
||||
keys: ["applications.name", "workspace.name", "packages.name"],
|
||||
|
|
@ -36,14 +38,17 @@ const fuzzySearchOptions = {
|
|||
* workspace: {},
|
||||
* applications: [],
|
||||
* users:[],
|
||||
* packages: []
|
||||
* packages: [],
|
||||
* workflows: [],
|
||||
* }
|
||||
*/
|
||||
const injectPackagesToWorkspacesList = (
|
||||
const injectPackagesAndWorkflowsToWorkspacesList = (
|
||||
workspacesList: Workspaces[] = [],
|
||||
packages: PackageMetadata[] = [],
|
||||
workflows: WorkflowMetadata[] = [],
|
||||
) => {
|
||||
const packagesGroupByWorkspaceId = groupBy(packages, (p) => p.workspaceId);
|
||||
const workflowsGroupByWorkspaceId = groupBy(workflows, (w) => w?.workspaceId);
|
||||
|
||||
return workspacesList.map((workspacesObj) => {
|
||||
const { workspace } = workspacesObj;
|
||||
|
|
@ -51,6 +56,7 @@ const injectPackagesToWorkspacesList = (
|
|||
return {
|
||||
...workspacesObj,
|
||||
packages: packagesGroupByWorkspaceId[workspace.id] || [],
|
||||
workflows: workflowsGroupByWorkspaceId[workspace.id] || [],
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
@ -116,14 +122,17 @@ export const getUserApplicationsWorkspacesList = createSelector(
|
|||
getUserApplicationsWorkspaces,
|
||||
getApplicationSearchKeyword,
|
||||
getPackagesList,
|
||||
getWorkflowsList,
|
||||
(
|
||||
applicationsWorkspaces?: Workspaces[],
|
||||
keyword?: string,
|
||||
packages?: PackageMetadata[],
|
||||
workflows?: WorkflowMetadata[],
|
||||
) => {
|
||||
const workspacesList = injectPackagesToWorkspacesList(
|
||||
const workspacesList = injectPackagesAndWorkflowsToWorkspacesList(
|
||||
applicationsWorkspaces,
|
||||
packages,
|
||||
workflows,
|
||||
);
|
||||
|
||||
if (
|
||||
|
|
@ -144,11 +153,16 @@ export const getUserApplicationsWorkspacesList = createSelector(
|
|||
...fuzzySearchOptions,
|
||||
keys: ["name"],
|
||||
});
|
||||
const workflowFuzzy = new Fuse(workspace.workflows, {
|
||||
...fuzzySearchOptions,
|
||||
keys: ["name"],
|
||||
});
|
||||
|
||||
return {
|
||||
...workspace,
|
||||
applications: appFuzzy.search(keyword),
|
||||
packages: packageFuzzy.search(keyword),
|
||||
workflows: workflowFuzzy.search(keyword),
|
||||
};
|
||||
});
|
||||
} else if (
|
||||
|
|
|
|||
20
app/client/src/ce/selectors/workflowSelectors.ts
Normal file
20
app/client/src/ce/selectors/workflowSelectors.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import type { AppState } from "@appsmith/reducers";
|
||||
import type { WorkflowMetadata } from "@appsmith/constants/WorkflowConstants";
|
||||
|
||||
const DEFAULT_WORKFLOW_LIST: WorkflowMetadata[] = [];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const getIsFetchingWorkflows = (state: AppState) => false;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const getIsCreatingWorkflow = (state: AppState, workspaceId: string) =>
|
||||
false;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const getWorkflowsList = (state: AppState): WorkflowMetadata[] =>
|
||||
DEFAULT_WORKFLOW_LIST;
|
||||
|
||||
export const getIsCurrentEditorWorkflowType = (
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
state: AppState,
|
||||
) => false;
|
||||
1
app/client/src/ee/constants/WorkflowConstants.ts
Normal file
1
app/client/src/ee/constants/WorkflowConstants.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "ce/constants/WorkflowConstants";
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
export * from "ce/pages/Applications/WorkflowCardList";
|
||||
import { default as CE_WorkflowCardList } from "ce/pages/Applications/WorkflowCardList";
|
||||
export default CE_WorkflowCardList;
|
||||
1
app/client/src/ee/selectors/workflowSelectors.ts
Normal file
1
app/client/src/ee/selectors/workflowSelectors.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "ce/selectors/workflowSelectors";
|
||||
|
|
@ -101,6 +101,7 @@ import { selectFeatureFlags } from "@appsmith/selectors/featureFlagsSelectors";
|
|||
import { fetchFeatureFlagsInit } from "actions/userActions";
|
||||
import { parseUpdatesAndDeleteUndefinedUpdates } from "./EvaluationSaga.utils";
|
||||
import { getFeatureFlagsFetched } from "selectors/usersSelectors";
|
||||
import { getIsCurrentEditorWorkflowType } from "@appsmith/selectors/workflowSelectors";
|
||||
import { evalErrorHandler } from "./EvalErrorHandler";
|
||||
import AnalyticsUtil from "utils/AnalyticsUtil";
|
||||
|
||||
|
|
@ -607,7 +608,16 @@ function* evaluationChangeListenerSaga(): any {
|
|||
const initAction: EvaluationReduxAction<unknown> = yield take(
|
||||
FIRST_EVAL_REDUX_ACTIONS,
|
||||
);
|
||||
yield call(waitForWidgetConfigBuild);
|
||||
|
||||
// Wait for widget config build to complete before starting evaluation only if the current editor is not a workflow
|
||||
const isCurrentEditorWorkflowType = yield select(
|
||||
getIsCurrentEditorWorkflowType,
|
||||
);
|
||||
|
||||
if (!isCurrentEditorWorkflowType) {
|
||||
yield call(waitForWidgetConfigBuild);
|
||||
}
|
||||
|
||||
widgetTypeConfigMap = WidgetFactory.getWidgetTypeConfigMap();
|
||||
yield fork(evalAndLintingHandler, false, initAction, {
|
||||
shouldReplay: false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user