From 1b524875692c92b837577c5631454cdbda3bf725 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Thu, 14 Nov 2024 15:49:29 +0530 Subject: [PATCH 1/2] chore: Plugin Action Editor routing --- .../Editor/IDE/EditorPane/Query/hooks.tsx | 105 ++++++++++++++---- .../AppPluginActionEditor.tsx | 3 - .../PackageIDE/MainPane/useRoutes.ts | 0 .../WorkflowIDE/MainPane/useRoutes.ts | 0 .../src/pages/Editor/APIEditor/index.tsx | 9 -- .../components/AppPluginActionToolbar.tsx | 0 .../ConvertToModule/ConvertToModuleCTA.tsx | 0 .../ConvertToModuleCallout.tsx | 0 .../ConvertToModuleDisabler.tsx | 0 .../components/ConvertToModule/index.tsx | 0 .../components/ToolbarMenu/Copy.tsx | 0 .../components/ToolbarMenu/Delete.tsx | 0 .../components/ToolbarMenu/Move.tsx | 0 .../components/ToolbarMenu/PageMenuItem.tsx | 0 .../components/ToolbarMenu/Rename.tsx | 0 .../components/ToolbarMenu/ToolbarMenu.tsx | 0 .../components/ToolbarMenu/index.ts | 0 .../Editor/AppPluginActionEditor/index.ts | 1 - .../Editor/AppPluginActionEditor/index.tsx} | 0 .../src/pages/Editor/QueryEditor/index.tsx | 9 -- 20 files changed, 85 insertions(+), 42 deletions(-) delete mode 100644 app/client/src/ee/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx create mode 100644 app/client/src/ee/pages/Editor/PackageEditor/PackageIDE/MainPane/useRoutes.ts create mode 100644 app/client/src/ee/pages/Editor/WorkflowEditor/WorkflowIDE/MainPane/useRoutes.ts rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/AppPluginActionToolbar.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleCTA.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleCallout.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleDisabler.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ConvertToModule/index.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ToolbarMenu/Copy.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ToolbarMenu/Delete.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ToolbarMenu/Move.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ToolbarMenu/PageMenuItem.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ToolbarMenu/Rename.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ToolbarMenu/ToolbarMenu.tsx (100%) rename app/client/src/{ce => }/pages/Editor/AppPluginActionEditor/components/ToolbarMenu/index.ts (100%) delete mode 100644 app/client/src/pages/Editor/AppPluginActionEditor/index.ts rename app/client/src/{ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx => pages/Editor/AppPluginActionEditor/index.tsx} (100%) diff --git a/app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx b/app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx index 7eeba362e2e1..9d58eceb7a99 100644 --- a/app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx +++ b/app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx @@ -51,18 +51,16 @@ export const useQueryAdd = () => { return; } - let url = ""; + const url = getQueryUrl(currentEntityInfo); - url = getQueryUrl(currentEntityInfo); history.push(url); - }, [currentEntityInfo]); + }, [currentEntityInfo, dispatch, ideViewMode]); const closeAddQuery = useCallback(() => { - let url = ""; + const url = getQueryUrl(currentEntityInfo, false); - url = getQueryUrl(currentEntityInfo, false); history.push(url); - }, [currentEntityInfo, ideViewMode]); + }, [currentEntityInfo]); return { openAddQuery, closeAddQuery }; }; @@ -113,6 +111,15 @@ export const useGroupedAddQueryOperations = (): GroupedAddOperations => { return groups; }; +const PluginActionEditor = lazy(async () => + retryPromise( + async () => + import( + /* webpackChunkName: "PluginActionEditor" */ "pages/Editor/AppPluginActionEditor" + ), + ), +); + const ApiEditor = lazy(async () => retryPromise( async () => @@ -145,13 +152,65 @@ const QueryEmpty = lazy(async () => ); export const useQueryEditorRoutes = (path: string): UseRoutes => { - return useMemo( + const isActionRedesignEnabled = useFeatureFlag( + FEATURE_FLAG.release_actions_redesign_enabled, + ); + + const skeleton = useMemo(() => , []); + + const newComponents = useMemo( + () => [ + { + key: "PluginActionEditor", + component: () => { + return ( + + + + ); + }, + path: [ + BUILDER_PATH + API_EDITOR_ID_PATH, + BUILDER_CUSTOM_PATH + API_EDITOR_ID_PATH, + BUILDER_PATH_DEPRECATED + API_EDITOR_ID_PATH, + BUILDER_PATH + SAAS_EDITOR_API_ID_PATH, + BUILDER_CUSTOM_PATH + SAAS_EDITOR_API_ID_PATH, + BUILDER_PATH_DEPRECATED + SAAS_EDITOR_API_ID_PATH, + path + "/:baseQueryId", + ], + exact: true, + }, + { + key: "AddQuery", + exact: true, + component: () => ( + + + + ), + path: [`${path}${ADD_PATH}`, `${path}/:baseQueryId${ADD_PATH}`], + }, + { + key: "QueryEmpty", + component: () => ( + + + + ), + exact: true, + path: [path], + }, + ], + [path, skeleton], + ); + + const oldComponents = useMemo( () => [ { key: "ApiEditor", - component: (args) => { + component: (args: object) => { return ( - }> + ); @@ -166,18 +225,18 @@ export const useQueryEditorRoutes = (path: string): UseRoutes => { { key: "AddQuery", exact: true, - component: (args) => ( - }> - + component: () => ( + + ), path: [`${path}${ADD_PATH}`, `${path}/:baseQueryId${ADD_PATH}`], }, { key: "SAASEditor", - component: (args) => { + component: (args: object) => { return ( - }> + ); @@ -191,9 +250,9 @@ export const useQueryEditorRoutes = (path: string): UseRoutes => { }, { key: "QueryEditor", - component: (args) => { + component: (args: object) => { return ( - }> + ); @@ -203,17 +262,23 @@ export const useQueryEditorRoutes = (path: string): UseRoutes => { }, { key: "QueryEmpty", - component: (args) => ( - }> - + component: () => ( + + ), exact: true, path: [path], }, ], - [path], + [path, skeleton], ); + + if (isActionRedesignEnabled) { + return newComponents; + } + + return oldComponents; }; export const useAddQueryListItems = () => { diff --git a/app/client/src/ee/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx b/app/client/src/ee/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx deleted file mode 100644 index 2d974cc98581..000000000000 --- a/app/client/src/ee/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import { default as CE_AppPluginActionEditor } from "ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor"; - -export default CE_AppPluginActionEditor; diff --git a/app/client/src/ee/pages/Editor/PackageEditor/PackageIDE/MainPane/useRoutes.ts b/app/client/src/ee/pages/Editor/PackageEditor/PackageIDE/MainPane/useRoutes.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/app/client/src/ee/pages/Editor/WorkflowEditor/WorkflowIDE/MainPane/useRoutes.ts b/app/client/src/ee/pages/Editor/WorkflowEditor/WorkflowIDE/MainPane/useRoutes.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/app/client/src/pages/Editor/APIEditor/index.tsx b/app/client/src/pages/Editor/APIEditor/index.tsx index 568fca9c0199..8e97ac8ec2c7 100644 --- a/app/client/src/pages/Editor/APIEditor/index.tsx +++ b/app/client/src/pages/Editor/APIEditor/index.tsx @@ -38,7 +38,6 @@ import { resolveIcon } from "../utils"; import { ENTITY_ICON_SIZE, EntityIcon } from "../Explorer/ExplorerIcons"; import { getIDEViewMode } from "selectors/ideSelectors"; import { EditorViewMode } from "ee/entities/IDE/constants"; -import { AppPluginActionEditor } from "pages/Editor/AppPluginActionEditor"; type ApiEditorWrapperProps = RouteComponentProps; @@ -164,14 +163,6 @@ function ApiEditorWrapper(props: ApiEditorWrapperProps) { return ; }, [action?.name, isConverting, icon]); - const isActionRedesignEnabled = useFeatureFlag( - FEATURE_FLAG.release_actions_redesign_enabled, - ); - - if (isActionRedesignEnabled) { - return ; - } - return ( ; @@ -187,14 +186,6 @@ function QueryEditor(props: QueryEditorProps) { ); }, [action?.name, isConverting, icon]); - const isActionRedesignEnabled = useFeatureFlag( - FEATURE_FLAG.release_actions_redesign_enabled, - ); - - if (isActionRedesignEnabled) { - return ; - } - return ( Date: Thu, 14 Nov 2024 15:57:33 +0530 Subject: [PATCH 2/2] removed ee files --- .../pages/Editor/PackageEditor/PackageIDE/MainPane/useRoutes.ts | 0 .../pages/Editor/WorkflowEditor/WorkflowIDE/MainPane/useRoutes.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/client/src/ee/pages/Editor/PackageEditor/PackageIDE/MainPane/useRoutes.ts delete mode 100644 app/client/src/ee/pages/Editor/WorkflowEditor/WorkflowIDE/MainPane/useRoutes.ts diff --git a/app/client/src/ee/pages/Editor/PackageEditor/PackageIDE/MainPane/useRoutes.ts b/app/client/src/ee/pages/Editor/PackageEditor/PackageIDE/MainPane/useRoutes.ts deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/app/client/src/ee/pages/Editor/WorkflowEditor/WorkflowIDE/MainPane/useRoutes.ts b/app/client/src/ee/pages/Editor/WorkflowEditor/WorkflowIDE/MainPane/useRoutes.ts deleted file mode 100644 index e69de29bb2d1..000000000000