From 7ff703c7ded563f3c92112d6d7f7b5f5073b21bb Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Wed, 16 Oct 2024 18:29:10 +0530 Subject: [PATCH] chore: Migrate sub components into Plugin Action Editor (#36844) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description - Moving older components, utils and constants into the Plugin Action Editor to complete the modularisation project. - Update Plugin Action Editor to expect an action ID instead of fetching it from the URL. - Add a Readme Fixes #34324 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: c36241f8cb19d57365c2555a02284b72aa849a67 > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Wed, 16 Oct 2024 12:40:23 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Introduced a new utility function `formatBytes` for byte formatting. - Added comprehensive documentation for the Plugin Action Editor module. - **Improvements** - Simplified action retrieval logic in the Plugin Action Editor. - Enhanced import organization across various components for better maintainability. - **Bug Fixes** - Resolved import path issues for several components and constants to ensure correct functionality. - **Chores** - Updated multiple import paths to reflect the new directory structure for improved modularity. --- .../PluginActionEditor/PluginActionEditor.tsx | 10 +- .../PluginActionForm/PluginActionForm.tsx | 6 +- .../components}/ActionForm/Section/index.tsx | 0 .../ActionForm/Section/styles.module.css | 0 .../components}/ActionForm/Zone/index.tsx | 0 .../ActionForm/Zone/styles.module.css | 0 .../components}/ActionForm/index.ts | 0 .../{ => ApiEditor}/APIEditorForm.tsx | 10 +- .../components/ApiEditor}/Pagination.tsx | 6 +- .../components/ApiEditor}/PostBodyData.tsx | 4 +- .../components/ApiEditor/index.ts | 1 + .../CommonEditorForm/InfoFields.tsx | 2 +- .../CommonEditorForm/RequestTabs.tsx | 4 +- .../components}/ApiAuthentication.tsx | 2 +- .../EmbeddedDatasourcePathField.tsx | 8 +- .../components}/StoreAsDatasource.tsx | 0 .../hooks/useSelectedFormTab.ts | 2 +- .../components/CommonEditorForm/index.ts | 4 - .../utils/getDatasourceInfo.ts | 0 .../GraphQLEditor/GraphQLEditorForm.tsx | 6 +- .../components/GraphQLEditor}/Pagination.tsx | 2 +- .../components/GraphQLEditor/PostBodyData.tsx | 2 +- .../components/GraphQLEditor/index.ts | 1 + .../components/UQIEditor}/FormRender.tsx | 2 +- .../components/UQIEditor}/TemplateMenu.tsx | 0 .../{ => UQIEditor}/UQIEditorForm.tsx | 4 +- .../components/UQIEditor/index.ts | 1 + .../hooks/useChangeActionCall.test.tsx | 4 +- .../hooks/useChangeActionCall.ts | 4 +- .../components/PluginActionNameEditor.tsx | 2 +- .../PluginActionResponse.tsx | 2 +- .../components/ApiFormatSegmentedResponse.tsx | 2 +- .../components/ApiResponse.tsx | 2 +- .../components}/ApiResponseMeta.tsx | 4 +- .../components}/BindDataButton.tsx | 0 .../components}/QueryResponseTab.test.tsx | 0 .../components}/QueryResponseTab.tsx | 10 +- .../components/ResponseFormatTabs.tsx | 4 +- .../components}/Schema.tsx | 9 +- .../components}/Table.tsx | 0 .../PluginActionResponse}/constants.ts | 0 .../hooks}/useShowSchema.ts | 0 .../PluginActionResponse/utils/formatBytes.ts | 14 + .../components/PluginActionToolbar.tsx | 4 +- .../constants}/ApiEditorConstants.ts | 0 .../constants}/AppsmithAIEditorConstants.ts | 0 .../constants}/CommonApiConstants.ts | 0 .../constants}/GraphQLEditorConstants.ts | 0 app/client/src/PluginActionEditor/readme.md | 102 +++++++ .../{ => store}/constants.ts | 0 .../store/pluginActionEditorSelectors.ts | 2 +- .../store/pluginEditorReducer.ts | 2 +- .../CurlImportTransformer.test.ts | 2 +- .../transformers/CurlImportTransformer.ts | 0 .../RestAPIDatasourceFormTransformer.ts | 0 .../transformers/RestActionTransformer.ts | 2 +- .../RestActionTransformers.test.ts | 5 +- .../api/helpers/validateJsonResponseMeta.ts | 2 +- .../hooks/usePluginActionResponseTabs.tsx | 6 +- .../hooks/useBlockExecution.ts | 2 +- .../src/ce/navigation/FocusElements/AppIDE.ts | 4 +- .../AppPluginActionEditor.tsx | 7 +- .../viewComponents/ActionBlockTree/utils.tsx | 2 +- .../editorComponents/ApiResponseView.tsx | 2 +- .../Debugger/DebuggerTabs.tsx | 2 +- .../Debugger/Resizer/index.tsx | 2 +- .../form/fields/KeyValueFieldArray.tsx | 2 +- .../formConfig/ApiSettingsConfig.ts | 2 +- .../src/entities/AppsmithConsole/index.ts | 2 +- .../Editor/APIEditor/CommonEditorForm.tsx | 10 +- .../APIEditor/GraphQL/GraphQLEditorForm.tsx | 4 +- .../APIEditor/GraphQL/QueryWrapperWithCSS.tsx | 250 ------------------ .../pages/Editor/APIEditor/RestAPIForm.tsx | 6 +- .../Editor/DataSourceEditor/Debugger.tsx | 2 +- .../RestAPIDatasourceForm.tsx | 2 +- .../pages/Editor/DataSourceEditor/index.tsx | 2 +- .../DatasourceViewModeSchema.tsx | 2 +- .../DatasourceInfo/GoogleSheetSchema.tsx | 2 +- .../ActionPane/ApiPaneNavigation.ts | 2 +- .../pages/Editor/Explorer/ExplorerIcons.tsx | 6 +- app/client/src/pages/Editor/FormControl.tsx | 4 +- .../Editor/QueryEditor/EditorJSONtoForm.tsx | 6 +- .../Editor/QueryEditor/QueryDebuggerTabs.tsx | 4 +- .../__tests__/QueryEditorTable.test.tsx | 5 +- .../uiReducers/datasourcePaneReducer.ts | 2 +- .../reducers/uiReducers/debuggerReducer.ts | 2 +- .../src/reducers/uiReducers/jsPaneReducer.ts | 2 +- app/client/src/sagas/ActionSagas.ts | 6 +- app/client/src/sagas/ApiPaneSagas.ts | 10 +- app/client/src/sagas/CurlImportSagas.ts | 2 +- app/client/src/sagas/ReplaySaga.ts | 2 +- app/client/src/utils/ApiPaneUtils.test.ts | 2 +- app/client/src/utils/ApiPaneUtils.tsx | 2 +- app/client/src/utils/helpers.tsx | 17 +- 94 files changed, 250 insertions(+), 392 deletions(-) rename app/client/src/{pages/Editor => PluginActionEditor/components/PluginActionForm/components}/ActionForm/Section/index.tsx (100%) rename app/client/src/{pages/Editor => PluginActionEditor/components/PluginActionForm/components}/ActionForm/Section/styles.module.css (100%) rename app/client/src/{pages/Editor => PluginActionEditor/components/PluginActionForm/components}/ActionForm/Zone/index.tsx (100%) rename app/client/src/{pages/Editor => PluginActionEditor/components/PluginActionForm/components}/ActionForm/Zone/styles.module.css (100%) rename app/client/src/{pages/Editor => PluginActionEditor/components/PluginActionForm/components}/ActionForm/index.ts (100%) rename app/client/src/PluginActionEditor/components/PluginActionForm/components/{ => ApiEditor}/APIEditorForm.tsx (84%) rename app/client/src/{pages/Editor/APIEditor => PluginActionEditor/components/PluginActionForm/components/ApiEditor}/Pagination.tsx (97%) rename app/client/src/{pages/Editor/APIEditor => PluginActionEditor/components/PluginActionForm/components/ApiEditor}/PostBodyData.tsx (98%) create mode 100644 app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/index.ts rename app/client/src/{pages/Editor/APIEditor => PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components}/ApiAuthentication.tsx (98%) rename app/client/src/{components/editorComponents/form/fields => PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components}/EmbeddedDatasourcePathField.tsx (98%) rename app/client/src/{components/editorComponents => PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components}/StoreAsDatasource.tsx (100%) rename app/client/src/PluginActionEditor/components/PluginActionForm/{ => components/CommonEditorForm}/utils/getDatasourceInfo.ts (100%) rename app/client/src/{pages/Editor/APIEditor/GraphQL => PluginActionEditor/components/PluginActionForm/components/GraphQLEditor}/Pagination.tsx (99%) create mode 100644 app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/index.ts rename app/client/src/{pages/Editor/QueryEditor => PluginActionEditor/components/PluginActionForm/components/UQIEditor}/FormRender.tsx (99%) rename app/client/src/{pages/Editor/QueryEditor => PluginActionEditor/components/PluginActionForm/components/UQIEditor}/TemplateMenu.tsx (100%) rename app/client/src/PluginActionEditor/components/PluginActionForm/components/{ => UQIEditor}/UQIEditorForm.tsx (90%) create mode 100644 app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/index.ts rename app/client/src/{components/editorComponents => PluginActionEditor/components/PluginActionResponse/components}/ApiResponseMeta.tsx (96%) rename app/client/src/{pages/Editor/QueryEditor => PluginActionEditor/components/PluginActionResponse/components}/BindDataButton.tsx (100%) rename app/client/src/{pages/Editor/QueryEditor => PluginActionEditor/components/PluginActionResponse/components}/QueryResponseTab.test.tsx (100%) rename app/client/src/{pages/Editor/QueryEditor => PluginActionEditor/components/PluginActionResponse/components}/QueryResponseTab.tsx (96%) rename app/client/src/{components/editorComponents/Debugger => PluginActionEditor/components/PluginActionResponse/components}/Schema.tsx (94%) rename app/client/src/{pages/Editor/QueryEditor => PluginActionEditor/components/PluginActionResponse/components}/Table.tsx (100%) rename app/client/src/{pages/Editor/APIEditor => PluginActionEditor/components/PluginActionResponse}/constants.ts (100%) rename app/client/src/{components/editorComponents/ActionRightPane => PluginActionEditor/components/PluginActionResponse/hooks}/useShowSchema.ts (100%) create mode 100644 app/client/src/PluginActionEditor/components/PluginActionResponse/utils/formatBytes.ts rename app/client/src/{constants/ApiEditorConstants => PluginActionEditor/constants}/ApiEditorConstants.ts (100%) rename app/client/src/{constants/ApiEditorConstants => PluginActionEditor/constants}/AppsmithAIEditorConstants.ts (100%) rename app/client/src/{constants/ApiEditorConstants => PluginActionEditor/constants}/CommonApiConstants.ts (100%) rename app/client/src/{constants/ApiEditorConstants => PluginActionEditor/constants}/GraphQLEditorConstants.ts (100%) create mode 100644 app/client/src/PluginActionEditor/readme.md rename app/client/src/PluginActionEditor/{ => store}/constants.ts (100%) rename app/client/src/{ => PluginActionEditor}/transformers/CurlImportTransformer.test.ts (88%) rename app/client/src/{ => PluginActionEditor}/transformers/CurlImportTransformer.ts (100%) rename app/client/src/{ => PluginActionEditor}/transformers/RestAPIDatasourceFormTransformer.ts (100%) rename app/client/src/{ => PluginActionEditor}/transformers/RestActionTransformer.ts (98%) rename app/client/src/{ => PluginActionEditor}/transformers/RestActionTransformers.test.ts (98%) delete mode 100644 app/client/src/pages/Editor/APIEditor/GraphQL/QueryWrapperWithCSS.tsx diff --git a/app/client/src/PluginActionEditor/PluginActionEditor.tsx b/app/client/src/PluginActionEditor/PluginActionEditor.tsx index 8eaa3bc51b..ec035c0363 100644 --- a/app/client/src/PluginActionEditor/PluginActionEditor.tsx +++ b/app/client/src/PluginActionEditor/PluginActionEditor.tsx @@ -1,6 +1,4 @@ import React from "react"; -import { useLocation } from "react-router"; -import { identifyEntityFromPath } from "../navigation/FocusEntity"; import { useSelector } from "react-redux"; import { getActionByBaseId, @@ -20,15 +18,15 @@ import { useActionSettingsConfig } from "./hooks"; interface ChildrenProps { children: React.ReactNode | React.ReactNode[]; + actionId: string; } const PluginActionEditor = (props: ChildrenProps) => { - const { pathname } = useLocation(); - const isEditorInitialized = useIsEditorInitialised(); - const entity = identifyEntityFromPath(pathname); - const action = useSelector((state) => getActionByBaseId(state, entity.id)); + const action = useSelector((state) => + getActionByBaseId(state, props.actionId), + ); const pluginId = get(action, "pluginId", ""); const plugin = useSelector((state) => getPlugin(state, pluginId)); diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx index 27464dcb3e..d7ac7a2138 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx @@ -1,11 +1,11 @@ import React from "react"; -import APIEditorForm from "./components/APIEditorForm"; import { Flex } from "@appsmith/ads"; import { useChangeActionCall } from "./hooks/useChangeActionCall"; import { usePluginActionContext } from "../../PluginActionContext"; import { UIComponentTypes } from "api/PluginApi"; -import GraphQLEditorForm from "./components/GraphQLEditor/GraphQLEditorForm"; -import UQIEditorForm from "./components/UQIEditorForm"; +import APIEditorForm from "./components/ApiEditor"; +import GraphQLEditorForm from "./components/GraphQLEditor"; +import UQIEditorForm from "./components/UQIEditor"; const PluginActionForm = () => { useChangeActionCall(); diff --git a/app/client/src/pages/Editor/ActionForm/Section/index.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Section/index.tsx similarity index 100% rename from app/client/src/pages/Editor/ActionForm/Section/index.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Section/index.tsx diff --git a/app/client/src/pages/Editor/ActionForm/Section/styles.module.css b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Section/styles.module.css similarity index 100% rename from app/client/src/pages/Editor/ActionForm/Section/styles.module.css rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Section/styles.module.css diff --git a/app/client/src/pages/Editor/ActionForm/Zone/index.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/index.tsx similarity index 100% rename from app/client/src/pages/Editor/ActionForm/Zone/index.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/index.tsx diff --git a/app/client/src/pages/Editor/ActionForm/Zone/styles.module.css b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/styles.module.css similarity index 100% rename from app/client/src/pages/Editor/ActionForm/Zone/styles.module.css rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/Zone/styles.module.css diff --git a/app/client/src/pages/Editor/ActionForm/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/index.ts similarity index 100% rename from app/client/src/pages/Editor/ActionForm/index.ts rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ActionForm/index.ts diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/APIEditorForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/APIEditorForm.tsx similarity index 84% rename from app/client/src/PluginActionEditor/components/PluginActionForm/components/APIEditorForm.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/APIEditorForm.tsx index a3065ba2e5..1546fcef01 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/APIEditorForm.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/APIEditorForm.tsx @@ -1,14 +1,14 @@ import React from "react"; -import CommonEditorForm from "./CommonEditorForm"; -import { usePluginActionContext } from "PluginActionEditor"; +import CommonEditorForm from "../CommonEditorForm"; +import { usePluginActionContext } from "../../../../PluginActionContext"; import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig"; import { API_EDITOR_FORM_NAME } from "ee/constants/forms"; -import { HTTP_METHOD_OPTIONS } from "constants/ApiEditorConstants/CommonApiConstants"; -import PostBodyData from "pages/Editor/APIEditor/PostBodyData"; +import { HTTP_METHOD_OPTIONS } from "../../../../constants/CommonApiConstants"; +import PostBodyData from "./PostBodyData"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; import { getHasManageActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers"; -import Pagination from "pages/Editor/APIEditor/Pagination"; +import Pagination from "./Pagination"; import { reduxForm } from "redux-form"; import { useHandleRunClick, diff --git a/app/client/src/pages/Editor/APIEditor/Pagination.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/Pagination.tsx similarity index 97% rename from app/client/src/pages/Editor/APIEditor/Pagination.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/Pagination.tsx index d188cd0aa5..ef9bb7321e 100644 --- a/app/client/src/pages/Editor/APIEditor/Pagination.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/Pagination.tsx @@ -7,8 +7,10 @@ import { PaginationType } from "entities/Action"; import RadioFieldGroup from "components/editorComponents/form/fields/RadioGroupField"; import { Classes, Text, TextType } from "@appsmith/ads-old"; import { Button } from "@appsmith/ads"; -import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig"; -import { CodeEditorBorder } from "components/editorComponents/CodeEditor/EditorConfig"; +import { + CodeEditorBorder, + type EditorTheme, +} from "components/editorComponents/CodeEditor/EditorConfig"; import { GifPlayer } from "@appsmith/ads-old"; import thumbnail from "assets/icons/gifs/thumbnail.png"; import configPagination from "assets/icons/gifs/config_pagination.gif"; diff --git a/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/PostBodyData.tsx similarity index 98% rename from app/client/src/pages/Editor/APIEditor/PostBodyData.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/PostBodyData.tsx index 72009d651d..0ea4a678b2 100644 --- a/app/client/src/pages/Editor/APIEditor/PostBodyData.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/PostBodyData.tsx @@ -5,7 +5,7 @@ import { formValueSelector } from "redux-form"; import { POST_BODY_FORMAT_OPTIONS, POST_BODY_FORMAT_TITLES, -} from "constants/ApiEditorConstants/CommonApiConstants"; +} from "../../../../constants/CommonApiConstants"; import { API_EDITOR_FORM_NAME } from "ee/constants/forms"; import KeyValueFieldArray from "components/editorComponents/form/fields/KeyValueFieldArray"; import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField"; @@ -22,7 +22,7 @@ import { Classes } from "@appsmith/ads-old"; import { getPostBodyFormat, updatePostBodyContentType, -} from "PluginActionEditor/store"; +} from "../../../../store"; import type { CodeEditorExpected } from "components/editorComponents/CodeEditor"; import { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType"; import { createMessage, API_PANE_NO_BODY } from "ee/constants/messages"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/index.ts new file mode 100644 index 0000000000..e244d7c168 --- /dev/null +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/ApiEditor/index.ts @@ -0,0 +1 @@ +export { default } from "./APIEditorForm"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields.tsx index a2f1f7b7fc..9df885b2c5 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields.tsx @@ -2,7 +2,7 @@ import React from "react"; import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig"; import RequestDropdownField from "components/editorComponents/form/fields/RequestDropdownField"; import { replayHighlightClass } from "globalStyles/portals"; -import EmbeddedDatasourcePathField from "components/editorComponents/form/fields/EmbeddedDatasourcePathField"; +import EmbeddedDatasourcePathField from "./components/EmbeddedDatasourcePathField"; import styled from "styled-components"; import { Flex } from "@appsmith/ads"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs.tsx index eda49d1463..f3e0adb906 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs.tsx @@ -4,10 +4,10 @@ import FormLabel from "components/editorComponents/FormLabel"; import type { AutoGeneratedHeader } from "pages/Editor/APIEditor/helpers"; import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig"; import React from "react"; -import { API_EDITOR_TABS } from "constants/ApiEditorConstants/CommonApiConstants"; +import { API_EDITOR_TABS } from "../../../../constants/CommonApiConstants"; import { DatasourceConfig } from "./components/DatasourceConfig"; import KeyValueFieldArray from "components/editorComponents/form/fields/KeyValueFieldArray"; -import ApiAuthentication from "pages/Editor/APIEditor/ApiAuthentication"; +import ApiAuthentication from "./components/ApiAuthentication"; import ActionSettings from "pages/Editor/ActionSettings"; import { API_EDITOR_TAB_TITLES, createMessage } from "ee/constants/messages"; import { useSelectedFormTab } from "./hooks/useSelectedFormTab"; diff --git a/app/client/src/pages/Editor/APIEditor/ApiAuthentication.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/ApiAuthentication.tsx similarity index 98% rename from app/client/src/pages/Editor/APIEditor/ApiAuthentication.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/ApiAuthentication.tsx index 89468ca751..dab9c52f0d 100644 --- a/app/client/src/pages/Editor/APIEditor/ApiAuthentication.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/ApiAuthentication.tsx @@ -13,7 +13,7 @@ import { SAVE_DATASOURCE_MESSAGE, createMessage, } from "ee/constants/messages"; -import StoreAsDatasource from "components/editorComponents/StoreAsDatasource"; +import StoreAsDatasource from "./StoreAsDatasource"; import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors"; import { Icon, Text } from "@appsmith/ads"; import { getCurrentEnvironmentId } from "ee/selectors/environmentSelectors"; diff --git a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/EmbeddedDatasourcePathField.tsx similarity index 98% rename from app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/EmbeddedDatasourcePathField.tsx index 02671a9b06..136c51b0cc 100644 --- a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/EmbeddedDatasourcePathField.tsx @@ -23,7 +23,7 @@ import { import { entityMarker } from "components/editorComponents/CodeEditor/MarkHelpers/entityMarker"; import { bindingHintHelper } from "components/editorComponents/CodeEditor/hintHelpers"; -import StoreAsDatasource from "components/editorComponents/StoreAsDatasource"; +import StoreAsDatasource from "./StoreAsDatasource"; import { DATASOURCE_URL_EXACT_MATCH_REGEX } from "constants/AppsmithActionConstants/ActionConstants"; import styled from "styled-components"; import * as FontFamilies from "constants/Fonts"; @@ -42,7 +42,7 @@ import { getDatasource, getDatasourcesByPluginId, } from "ee/selectors/entitiesSelector"; -import { extractApiUrlPath } from "transformers/RestActionTransformer"; +import { extractApiUrlPath } from "../../../../../transformers/RestActionTransformer"; import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors"; import { Text } from "@appsmith/ads"; import { TEMP_DATASOURCE_ID } from "constants/Datasource"; @@ -50,7 +50,7 @@ import LazyCodeEditor from "components/editorComponents/LazyCodeEditor"; import { getCodeMirrorNamespaceFromEditor } from "utils/getCodeMirrorNamespace"; import { isDynamicValue } from "utils/DynamicBindingUtils"; import { isEnvironmentValid } from "ee/utils/Environments"; -import { DEFAULT_DATASOURCE_NAME } from "constants/ApiEditorConstants/ApiEditorConstants"; +import { DEFAULT_DATASOURCE_NAME } from "../../../../../constants/ApiEditorConstants"; import { isString } from "lodash"; import { getCurrentEnvironmentId } from "ee/selectors/environmentSelectors"; import { @@ -59,7 +59,7 @@ import { } from "ee/utils/BusinessFeatures/permissionPageHelpers"; import { isGACEnabled } from "ee/utils/planHelpers"; import { selectFeatureFlags } from "ee/selectors/featureFlagsSelectors"; -import { getDatasourceInfo } from "PluginActionEditor/components/PluginActionForm/utils/getDatasourceInfo"; +import { getDatasourceInfo } from "../utils/getDatasourceInfo"; interface ReduxStateProps { workspaceId: string; diff --git a/app/client/src/components/editorComponents/StoreAsDatasource.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/StoreAsDatasource.tsx similarity index 100% rename from app/client/src/components/editorComponents/StoreAsDatasource.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/components/StoreAsDatasource.tsx diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useSelectedFormTab.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useSelectedFormTab.ts index 6e3aada35d..10da87f2b9 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useSelectedFormTab.ts +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useSelectedFormTab.ts @@ -3,7 +3,7 @@ import { useDispatch, useSelector } from "react-redux"; import { getPluginActionConfigSelectedTab, setPluginActionEditorSelectedTab, -} from "PluginActionEditor/store"; +} from "../../../../../store"; export function useSelectedFormTab(): [ string | undefined, diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/index.ts index 46cb3624cb..d954cb3129 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/index.ts +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/index.ts @@ -1,5 +1 @@ export { default } from "./CommonEditorForm"; - -export { HintMessages } from "./HintMessages"; -export { InfoFields } from "./InfoFields"; -export { RequestTabs } from "./RequestTabs"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/utils/getDatasourceInfo.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/utils/getDatasourceInfo.ts similarity index 100% rename from app/client/src/PluginActionEditor/components/PluginActionForm/utils/getDatasourceInfo.ts rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/utils/getDatasourceInfo.ts diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/GraphQLEditorForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/GraphQLEditorForm.tsx index 96a9782c98..677bf16e03 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/GraphQLEditorForm.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/GraphQLEditorForm.tsx @@ -2,10 +2,10 @@ import React from "react"; import { reduxForm } from "redux-form"; import { API_EDITOR_FORM_NAME } from "ee/constants/forms"; import CommonEditorForm from "../CommonEditorForm"; -import Pagination from "pages/Editor/APIEditor/GraphQL/Pagination"; -import { GRAPHQL_HTTP_METHOD_OPTIONS } from "constants/ApiEditorConstants/GraphQLEditorConstants"; +import Pagination from "./Pagination"; +import { GRAPHQL_HTTP_METHOD_OPTIONS } from "../../../../constants/GraphQLEditorConstants"; import PostBodyData from "./PostBodyData"; -import { usePluginActionContext } from "PluginActionEditor"; +import { usePluginActionContext } from "../../../../PluginActionContext"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; import { getHasManageActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers"; diff --git a/app/client/src/pages/Editor/APIEditor/GraphQL/Pagination.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/Pagination.tsx similarity index 99% rename from app/client/src/pages/Editor/APIEditor/GraphQL/Pagination.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/Pagination.tsx index 07b74cf2e4..56a62a6f86 100644 --- a/app/client/src/pages/Editor/APIEditor/GraphQL/Pagination.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/Pagination.tsx @@ -12,7 +12,7 @@ import { connect } from "react-redux"; import type { AppState } from "ee/reducers"; import { FormLabel } from "components/editorComponents/form/fields/StyledFormComponents"; import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField"; -import type { GRAPHQL_PAGINATION_TYPE } from "constants/ApiEditorConstants/GraphQLEditorConstants"; +import type { GRAPHQL_PAGINATION_TYPE } from "../../../../constants/GraphQLEditorConstants"; import { LIMITBASED_PREFIX, CURSORBASED_PREFIX, diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx index 2110424527..c66aa40485 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData.tsx @@ -8,7 +8,7 @@ import { TabBehaviour, } from "components/editorComponents/CodeEditor/EditorConfig"; import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField"; -import { Section, Zone } from "pages/Editor/ActionForm"; +import { Section, Zone } from "../ActionForm"; import { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType"; import FormLabel from "components/editorComponents/FormLabel"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/index.ts new file mode 100644 index 0000000000..ecf70ec114 --- /dev/null +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/index.ts @@ -0,0 +1 @@ +export { default } from "./GraphQLEditorForm"; diff --git a/app/client/src/pages/Editor/QueryEditor/FormRender.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender.tsx similarity index 99% rename from app/client/src/pages/Editor/QueryEditor/FormRender.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender.tsx index ca9b82a5d4..ce0e49eebc 100644 --- a/app/client/src/pages/Editor/QueryEditor/FormRender.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender.tsx @@ -20,7 +20,7 @@ import { updateEvaluatedSectionConfig, } from "components/formControls/utils"; import { isValidFormConfig } from "reducers/evaluationReducers/formEvaluationReducer"; -import FormControl from "../FormControl"; +import FormControl from "pages/Editor/FormControl"; import type { ControlProps } from "components/formControls/BaseControl"; import { Spinner } from "@appsmith/ads"; import type { QueryAction, SaaSAction } from "entities/Action"; diff --git a/app/client/src/pages/Editor/QueryEditor/TemplateMenu.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/TemplateMenu.tsx similarity index 100% rename from app/client/src/pages/Editor/QueryEditor/TemplateMenu.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/TemplateMenu.tsx diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditorForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/UQIEditorForm.tsx similarity index 90% rename from app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditorForm.tsx rename to app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/UQIEditorForm.tsx index 5c51a2cab6..fdee4e7371 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditorForm.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/UQIEditorForm.tsx @@ -1,6 +1,6 @@ import React from "react"; -import FormRender from "pages/Editor/QueryEditor/FormRender"; -import { usePluginActionContext } from "../../../PluginActionContext"; +import FormRender from "./FormRender"; +import { usePluginActionContext } from "../../../../PluginActionContext"; import { QUERY_EDITOR_FORM_NAME } from "ee/constants/forms"; import { getFormValues, reduxForm } from "redux-form"; import type { QueryAction, SaaSAction } from "entities/Action"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/index.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/index.ts new file mode 100644 index 0000000000..0aa4780f41 --- /dev/null +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/index.ts @@ -0,0 +1 @@ +export { default } from "./UQIEditorForm"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.test.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.test.tsx index f68dfa38cd..55029fbaef 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.test.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.test.tsx @@ -1,7 +1,7 @@ import { renderHook } from "@testing-library/react-hooks/dom"; import { useDispatch } from "react-redux"; import { PluginType } from "entities/Action"; -import { usePluginActionContext } from "PluginActionEditor"; +import { usePluginActionContext } from "../../../PluginActionContext"; import { changeApi, changeQuery } from "../../../store"; import usePrevious from "utils/hooks/usePrevious"; import { useChangeActionCall } from "./useChangeActionCall"; @@ -15,7 +15,7 @@ jest.mock("../../../store", () => ({ changeQuery: jest.fn(), })); -jest.mock("PluginActionEditor", () => ({ +jest.mock("../../../PluginActionContext", () => ({ usePluginActionContext: jest.fn(), })); diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.ts index be76f258b7..ac1620ddcb 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.ts +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/hooks/useChangeActionCall.ts @@ -1,8 +1,8 @@ import { useEffect } from "react"; import { useDispatch } from "react-redux"; import { PluginType } from "entities/Action"; -import { usePluginActionContext } from "PluginActionEditor"; -import { changeApi, changeQuery } from "PluginActionEditor/store"; +import { usePluginActionContext } from "../../../PluginActionContext"; +import { changeApi, changeQuery } from "../../../store"; import usePrevious from "utils/hooks/usePrevious"; export const useChangeActionCall = () => { diff --git a/app/client/src/PluginActionEditor/components/PluginActionNameEditor.tsx b/app/client/src/PluginActionEditor/components/PluginActionNameEditor.tsx index a51d6006de..55f32a5e4c 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionNameEditor.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionNameEditor.tsx @@ -1,7 +1,7 @@ import React from "react"; import { useSelector } from "react-redux"; import ActionNameEditor from "components/editorComponents/ActionNameEditor"; -import { usePluginActionContext } from "PluginActionEditor/PluginActionContext"; +import { usePluginActionContext } from "../PluginActionContext"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; import { getHasManageActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers"; import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx index d2c5b0a252..88524b915e 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx @@ -1,6 +1,6 @@ import React, { useCallback } from "react"; import { IDEBottomView, ViewHideBehaviour } from "IDE"; -import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants"; +import { ActionExecutionResizerHeight } from "./constants"; import EntityBottomTabs from "components/editorComponents/EntityBottomTabs"; import { useDispatch, useSelector } from "react-redux"; import { setPluginActionEditorDebuggerState } from "../../store"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiFormatSegmentedResponse.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiFormatSegmentedResponse.tsx index 4fe9f53b90..d83a11b15f 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiFormatSegmentedResponse.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiFormatSegmentedResponse.tsx @@ -7,7 +7,7 @@ import { Flex, SegmentedControl } from "@appsmith/ads"; import type { ActionResponse } from "api/ActionAPI"; import { setActionResponseDisplayFormat } from "actions/pluginActionActions"; import { actionResponseDisplayDataFormats } from "pages/Editor/utils"; -import { ResponseDisplayFormats } from "constants/ApiEditorConstants/CommonApiConstants"; +import { ResponseDisplayFormats } from "../../../constants/CommonApiConstants"; import { useDispatch } from "react-redux"; import styled from "styled-components"; import { ResponseFormatTabs } from "./ResponseFormatTabs"; diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx index bb32f43ad1..a33f161f47 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx @@ -10,7 +10,7 @@ import { import type { ActionResponse } from "api/ActionAPI"; import type { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig"; import type { SourceEntity } from "entities/AppsmithConsole"; -import ApiResponseMeta from "components/editorComponents/ApiResponseMeta"; +import ApiResponseMeta from "./ApiResponseMeta"; import ActionExecutionInProgressView from "components/editorComponents/ActionExecutionInProgressView"; import LogAdditionalInfo from "components/editorComponents/Debugger/ErrorLogs/components/LogAdditionalInfo"; import LogHelper from "components/editorComponents/Debugger/ErrorLogs/components/LogHelper"; diff --git a/app/client/src/components/editorComponents/ApiResponseMeta.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseMeta.tsx similarity index 96% rename from app/client/src/components/editorComponents/ApiResponseMeta.tsx rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseMeta.tsx index 928791c971..36eea06baa 100644 --- a/app/client/src/components/editorComponents/ApiResponseMeta.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseMeta.tsx @@ -2,12 +2,12 @@ import type { PropsWithChildren } from "react"; import React from "react"; import { Flex } from "@appsmith/ads"; import { Text, TextType } from "@appsmith/ads-old"; -import { formatBytes } from "../../utils/helpers"; import { isEmpty } from "lodash"; -import BindDataButton from "pages/Editor/QueryEditor/BindDataButton"; +import BindDataButton from "./BindDataButton"; import styled from "styled-components"; import type { ActionResponse } from "api/ActionAPI"; import { Text as BlueprintText } from "@blueprintjs/core/lib/esm/components/text/text"; +import { formatBytes } from "../utils/formatBytes"; interface TextStyleProps { accent: "primary" | "secondary" | "error"; diff --git a/app/client/src/pages/Editor/QueryEditor/BindDataButton.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/BindDataButton.tsx similarity index 100% rename from app/client/src/pages/Editor/QueryEditor/BindDataButton.tsx rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/BindDataButton.tsx diff --git a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.test.tsx similarity index 100% rename from app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.test.tsx diff --git a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.tsx similarity index 96% rename from app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.tsx index 97ecdfa432..525df80a8a 100644 --- a/app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab.tsx @@ -6,9 +6,9 @@ import { ResponseTabErrorContainer, ResponseTabErrorContent, ResponseTabErrorDefaultMessage, -} from "PluginActionEditor/components/PluginActionResponse/components/ApiResponse"; -import { ResponseFormatTabs } from "PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs"; -import { NoResponse } from "PluginActionEditor/components/PluginActionResponse/components/NoResponse"; +} from "./ApiResponse"; +import { ResponseFormatTabs } from "./ResponseFormatTabs"; +import { NoResponse } from "./NoResponse"; import LogAdditionalInfo from "components/editorComponents/Debugger/ErrorLogs/components/LogAdditionalInfo"; import LogHelper from "components/editorComponents/Debugger/ErrorLogs/components/LogHelper"; import LOG_TYPE from "entities/AppsmithConsole/logtype"; @@ -27,7 +27,7 @@ import { getUpdateTimestamp } from "components/editorComponents/Debugger/ErrorLo import type { SourceEntity } from "entities/AppsmithConsole"; import type { Action } from "entities/Action"; import { getActionData } from "ee/selectors/entitiesSelector"; -import { actionResponseDisplayDataFormats } from "../utils"; +import { actionResponseDisplayDataFormats } from "pages/Editor/utils"; import { getErrorAsString } from "sagas/ActionExecution/errorUtils"; import { isString } from "lodash"; import ActionExecutionInProgressView from "components/editorComponents/ActionExecutionInProgressView"; @@ -36,7 +36,7 @@ import BindDataButton from "./BindDataButton"; import { getPluginActionDebuggerState, setPluginActionEditorSelectedTab, -} from "PluginActionEditor/store"; +} from "../../../store"; import { EDITOR_TABS } from "constants/QueryEditorConstants"; import { createMessage, diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs.tsx index eb8dec8a7b..ab642d829c 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/ResponseFormatTabs.tsx @@ -1,8 +1,8 @@ import React from "react"; -import { ResponseDisplayFormats } from "constants/ApiEditorConstants/CommonApiConstants"; +import { ResponseDisplayFormats } from "../../../constants/CommonApiConstants"; import ReadOnlyEditor from "components/editorComponents/ReadOnlyEditor"; import { isString } from "lodash"; -import Table from "pages/Editor/QueryEditor/Table"; +import Table from "./Table"; type ResponseData = string | Record[]; diff --git a/app/client/src/components/editorComponents/Debugger/Schema.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx similarity index 94% rename from app/client/src/components/editorComponents/Debugger/Schema.tsx rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx index ffd16c40e3..cc29f5a715 100644 --- a/app/client/src/components/editorComponents/Debugger/Schema.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Schema.tsx @@ -1,7 +1,10 @@ import { Flex } from "@appsmith/ads"; import React, { useEffect, useState } from "react"; -import type { DatasourceColumns, DatasourceKeys } from "entities/Datasource"; -import { DatasourceStructureContext } from "entities/Datasource"; +import { + DatasourceStructureContext, + type DatasourceColumns, + type DatasourceKeys, +} from "entities/Datasource"; import { DatasourceStructureContainer as DatasourceStructureList } from "pages/Editor/DatasourceInfo/DatasourceStructureContainer"; import { useSelector } from "react-redux"; import { @@ -12,7 +15,7 @@ import DatasourceField from "pages/Editor/DatasourceInfo/DatasourceField"; import { find } from "lodash"; import type { AppState } from "ee/reducers"; import RenderInterimDataState from "pages/Editor/DatasourceInfo/RenderInterimDataState"; -import { getPluginActionDebuggerState } from "PluginActionEditor/store"; +import { getPluginActionDebuggerState } from "../../../store"; interface Props { datasourceId: string; diff --git a/app/client/src/pages/Editor/QueryEditor/Table.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/components/Table.tsx similarity index 100% rename from app/client/src/pages/Editor/QueryEditor/Table.tsx rename to app/client/src/PluginActionEditor/components/PluginActionResponse/components/Table.tsx diff --git a/app/client/src/pages/Editor/APIEditor/constants.ts b/app/client/src/PluginActionEditor/components/PluginActionResponse/constants.ts similarity index 100% rename from app/client/src/pages/Editor/APIEditor/constants.ts rename to app/client/src/PluginActionEditor/components/PluginActionResponse/constants.ts diff --git a/app/client/src/components/editorComponents/ActionRightPane/useShowSchema.ts b/app/client/src/PluginActionEditor/components/PluginActionResponse/hooks/useShowSchema.ts similarity index 100% rename from app/client/src/components/editorComponents/ActionRightPane/useShowSchema.ts rename to app/client/src/PluginActionEditor/components/PluginActionResponse/hooks/useShowSchema.ts diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/utils/formatBytes.ts b/app/client/src/PluginActionEditor/components/PluginActionResponse/utils/formatBytes.ts new file mode 100644 index 0000000000..dff56245df --- /dev/null +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/utils/formatBytes.ts @@ -0,0 +1,14 @@ +export const formatBytes = (bytes: string | number) => { + if (!bytes) return; + + const value = typeof bytes === "string" ? parseInt(bytes) : bytes; + const sizes = ["Bytes", "KB", "MB", "GB", "TB"]; + + if (value === 0) return "0 bytes"; + + const i = parseInt(String(Math.floor(Math.log(value) / Math.log(1024)))); + + if (i === 0) return bytes + " " + sizes[i]; + + return (value / Math.pow(1024, i)).toFixed(1) + " " + sizes[i]; +}; diff --git a/app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx b/app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx index 5c0362be31..c60a751490 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx @@ -7,10 +7,10 @@ import { useBlockExecution, useHandleRunClick, useAnalyticsOnRunClick, -} from "PluginActionEditor/hooks"; +} from "../hooks"; import { useToggle } from "@mantine/hooks"; import { useSelector } from "react-redux"; -import { isActionRunning } from "PluginActionEditor/store"; +import { isActionRunning } from "../store"; interface PluginActionToolbarProps { runOptions?: React.ReactNode; diff --git a/app/client/src/constants/ApiEditorConstants/ApiEditorConstants.ts b/app/client/src/PluginActionEditor/constants/ApiEditorConstants.ts similarity index 100% rename from app/client/src/constants/ApiEditorConstants/ApiEditorConstants.ts rename to app/client/src/PluginActionEditor/constants/ApiEditorConstants.ts diff --git a/app/client/src/constants/ApiEditorConstants/AppsmithAIEditorConstants.ts b/app/client/src/PluginActionEditor/constants/AppsmithAIEditorConstants.ts similarity index 100% rename from app/client/src/constants/ApiEditorConstants/AppsmithAIEditorConstants.ts rename to app/client/src/PluginActionEditor/constants/AppsmithAIEditorConstants.ts diff --git a/app/client/src/constants/ApiEditorConstants/CommonApiConstants.ts b/app/client/src/PluginActionEditor/constants/CommonApiConstants.ts similarity index 100% rename from app/client/src/constants/ApiEditorConstants/CommonApiConstants.ts rename to app/client/src/PluginActionEditor/constants/CommonApiConstants.ts diff --git a/app/client/src/constants/ApiEditorConstants/GraphQLEditorConstants.ts b/app/client/src/PluginActionEditor/constants/GraphQLEditorConstants.ts similarity index 100% rename from app/client/src/constants/ApiEditorConstants/GraphQLEditorConstants.ts rename to app/client/src/PluginActionEditor/constants/GraphQLEditorConstants.ts diff --git a/app/client/src/PluginActionEditor/readme.md b/app/client/src/PluginActionEditor/readme.md new file mode 100644 index 0000000000..8b72c5896f --- /dev/null +++ b/app/client/src/PluginActionEditor/readme.md @@ -0,0 +1,102 @@ +## Plugin Action Editor + +Appsmith allows its users to connect their UI to various different +data sources e.g. API end points or SQL Query Databases. +These data sources are configured using "Plugins" that define various details about +the configuration and execution. Each data source is a specific connection and +users can have multiple "Actions" built on top of these data sources. + +Actions are implementations that can store and retrieve data from the data source. + +The Plugin Action Editor is a module that exposes the UX that is used by the users +to implement details about these actions, its settings and test them in edit mode. + +### Contents + +This module is divided into 3 major composable sections. + +- **Toolbar**: A row for the tools on top of the Action. Comes with Settings, Run Buttons and an overflow menu CTA to add further management items like copy or delete. Allows to add more items in it +- **Form**: A preset form based defined by the Plugin config. +- **Response**: A tabbed bottom view to show the Response and other debugging tools + +One can use these 3 sections to define their compose different experiences. + +#### Plugin Action Context + +All the sections and its children are connected via the "Plugin Action Context" that allows for easy data passing. + +The Wrapper "PluginActionEditor" will pass this context down. This includes: + +- Action +- Action Response +- Plugin +- Datasource +- Form Configs +- Setting Configs + +#### UI Store + +The UI state is managed via redux, and it is exposed out as well for use + +### How to use + +Below we illustrate how by using a Composable structure to create the Action Editor + +```typescript jsx +const AppPluginActionEditor = () => { + // Define the actionId that needs to be configured via the editor. + // In the example we fetch it from the route + const actionId = getActionIDFromRoute(); + return ( + /** Plugin Action Editor is our wrapper composable fragment. + * This will fetch the action and other related info + * from state and pass it down to its children via "context". + * This will ensure all children have the same way to access the action + * i.e. via context. Hence, this component is only responsible for + * abstracting the + * action state management + */ + + + + + + ) +} + +``` + +It is completely possible to mix and match these components, and compose them further to build +other experiences with them. +For example if you need to just have the Response view without the form +you can do the following + +```typescript jsx +const PluginActionResponseView = () => { + // Define the actionId that needs to be configured via the editor. + // In the example we fetch it from the route + const actionId = getActionIDFromRoute(); + return ( + + + + ) +} +``` + +### Update Guide + +1. Update an existing functionality to be reflected in all variations + - Functionality updates should be done at the point of definition itself. + - Prefer having separate files for each functionality if it has a lot of logic or can be extended in EE +2. Add new functionality for all variations + - Add the functionality close to the usage point. + - Avoid configuration of functionality via props since it is used for all. +3. Add an EE variation to a functionality. + - Avoid adding any EE logic for this functionality as much as possible + - Ideally it should be exposed as a prop that can be updated in the EE usage point + - In case it needs to be done in place, make sure the functionality is its own file so that only that functionality + needs extension. +4. Create a specific variance for a certain use case not applicable for all + - Avoid adding the logic inside the module instead override via composition + - If it affects any feature in the module, expose via prop diff --git a/app/client/src/PluginActionEditor/constants.ts b/app/client/src/PluginActionEditor/store/constants.ts similarity index 100% rename from app/client/src/PluginActionEditor/constants.ts rename to app/client/src/PluginActionEditor/store/constants.ts diff --git a/app/client/src/PluginActionEditor/store/pluginActionEditorSelectors.ts b/app/client/src/PluginActionEditor/store/pluginActionEditorSelectors.ts index a4cd810f1c..7e0a1f5420 100644 --- a/app/client/src/PluginActionEditor/store/pluginActionEditorSelectors.ts +++ b/app/client/src/PluginActionEditor/store/pluginActionEditorSelectors.ts @@ -1,7 +1,7 @@ import type { AppState } from "ee/reducers"; import { createSelector } from "reselect"; -import { POST_BODY_FORM_DATA_KEY } from "../constants"; +import { POST_BODY_FORM_DATA_KEY } from "./constants"; export const getActionEditorSavingMap = (state: AppState) => state.ui.pluginActionEditor.isSaving; diff --git a/app/client/src/PluginActionEditor/store/pluginEditorReducer.ts b/app/client/src/PluginActionEditor/store/pluginEditorReducer.ts index 781ce8d716..93a3d36bdc 100644 --- a/app/client/src/PluginActionEditor/store/pluginEditorReducer.ts +++ b/app/client/src/PluginActionEditor/store/pluginEditorReducer.ts @@ -5,7 +5,7 @@ import { ReduxActionErrorTypes, } from "ee/constants/ReduxActionConstants"; import type { Action } from "entities/Action"; -import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants"; +import { ActionExecutionResizerHeight } from "../components/PluginActionResponse/constants"; import { DEBUGGER_TAB_KEYS } from "components/editorComponents/Debugger/constants"; import type { ActionResponse } from "api/ActionAPI"; import { omit, set } from "lodash"; diff --git a/app/client/src/transformers/CurlImportTransformer.test.ts b/app/client/src/PluginActionEditor/transformers/CurlImportTransformer.test.ts similarity index 88% rename from app/client/src/transformers/CurlImportTransformer.test.ts rename to app/client/src/PluginActionEditor/transformers/CurlImportTransformer.test.ts index e0ce45e174..bd1a9e10aa 100644 --- a/app/client/src/transformers/CurlImportTransformer.test.ts +++ b/app/client/src/PluginActionEditor/transformers/CurlImportTransformer.test.ts @@ -1,4 +1,4 @@ -import transformCurlImport from "transformers/CurlImportTransformer"; +import transformCurlImport from "./CurlImportTransformer"; describe("CurlImportTransformer", () => { it("has quotes in start and end and escapes special characters", () => { diff --git a/app/client/src/transformers/CurlImportTransformer.ts b/app/client/src/PluginActionEditor/transformers/CurlImportTransformer.ts similarity index 100% rename from app/client/src/transformers/CurlImportTransformer.ts rename to app/client/src/PluginActionEditor/transformers/CurlImportTransformer.ts diff --git a/app/client/src/transformers/RestAPIDatasourceFormTransformer.ts b/app/client/src/PluginActionEditor/transformers/RestAPIDatasourceFormTransformer.ts similarity index 100% rename from app/client/src/transformers/RestAPIDatasourceFormTransformer.ts rename to app/client/src/PluginActionEditor/transformers/RestAPIDatasourceFormTransformer.ts diff --git a/app/client/src/transformers/RestActionTransformer.ts b/app/client/src/PluginActionEditor/transformers/RestActionTransformer.ts similarity index 98% rename from app/client/src/transformers/RestActionTransformer.ts rename to app/client/src/PluginActionEditor/transformers/RestActionTransformer.ts index ccd31d3020..1ea3995f78 100644 --- a/app/client/src/transformers/RestActionTransformer.ts +++ b/app/client/src/PluginActionEditor/transformers/RestActionTransformer.ts @@ -1,7 +1,7 @@ import { HTTP_METHOD, CONTENT_TYPE_HEADER_KEY, -} from "constants/ApiEditorConstants/CommonApiConstants"; +} from "../constants/CommonApiConstants"; import type { ApiAction } from "entities/Action"; import isEmpty from "lodash/isEmpty"; import isString from "lodash/isString"; diff --git a/app/client/src/transformers/RestActionTransformers.test.ts b/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts similarity index 98% rename from app/client/src/transformers/RestActionTransformers.test.ts rename to app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts index d24ead8b43..f775df96e2 100644 --- a/app/client/src/transformers/RestActionTransformers.test.ts +++ b/app/client/src/PluginActionEditor/transformers/RestActionTransformers.test.ts @@ -1,15 +1,14 @@ import { extractApiUrlPath, transformRestAction, -} from "transformers/RestActionTransformer"; +} from "./RestActionTransformer"; import type { ApiAction } from "entities/Action"; import { PluginType } from "entities/Action"; import { HTTP_PROTOCOL, MultiPartOptionTypes, POST_BODY_FORMAT_OPTIONS, - // POST_BODY_FORMAT_OPTIONS_ENUM, -} from "constants/ApiEditorConstants/CommonApiConstants"; +} from "../constants/CommonApiConstants"; // jest.mock("POST_"); diff --git a/app/client/src/api/helpers/validateJsonResponseMeta.ts b/app/client/src/api/helpers/validateJsonResponseMeta.ts index de295660ab..084e9b23f3 100644 --- a/app/client/src/api/helpers/validateJsonResponseMeta.ts +++ b/app/client/src/api/helpers/validateJsonResponseMeta.ts @@ -1,6 +1,6 @@ import * as Sentry from "@sentry/react"; import type { AxiosResponse } from "axios"; -import { CONTENT_TYPE_HEADER_KEY } from "constants/ApiEditorConstants/CommonApiConstants"; +import { CONTENT_TYPE_HEADER_KEY } from "PluginActionEditor/constants/CommonApiConstants"; export const validateJsonResponseMeta = (response: AxiosResponse) => { if ( diff --git a/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx b/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx index 5f6c174846..0ca2ba333b 100644 --- a/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx +++ b/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx @@ -24,9 +24,9 @@ import { isActionRunning, } from "PluginActionEditor/store"; import { doesPluginRequireDatasource } from "ee/entities/Engine/actionHelpers"; -import useShowSchema from "components/editorComponents/ActionRightPane/useShowSchema"; -import Schema from "components/editorComponents/Debugger/Schema"; -import QueryResponseTab from "pages/Editor/QueryEditor/QueryResponseTab"; +import useShowSchema from "PluginActionEditor/components/PluginActionResponse/hooks/useShowSchema"; +import Schema from "PluginActionEditor/components/PluginActionResponse/components/Schema"; +import QueryResponseTab from "PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab"; import type { SourceEntity } from "entities/AppsmithConsole"; import { ENTITY_TYPE as SOURCE_ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils"; import { diff --git a/app/client/src/ce/PluginActionEditor/hooks/useBlockExecution.ts b/app/client/src/ce/PluginActionEditor/hooks/useBlockExecution.ts index e02bcc7231..a2acdd1f55 100644 --- a/app/client/src/ce/PluginActionEditor/hooks/useBlockExecution.ts +++ b/app/client/src/ce/PluginActionEditor/hooks/useBlockExecution.ts @@ -1,7 +1,7 @@ import { getHasExecuteActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers"; import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; -import { DEFAULT_DATASOURCE_NAME } from "constants/ApiEditorConstants/ApiEditorConstants"; +import { DEFAULT_DATASOURCE_NAME } from "PluginActionEditor/constants/ApiEditorConstants"; import { UIComponentTypes } from "api/PluginApi"; import { SQL_DATASOURCES } from "constants/QueryEditorConstants"; import { usePluginActionContext } from "PluginActionEditor/PluginActionContext"; diff --git a/app/client/src/ce/navigation/FocusElements/AppIDE.ts b/app/client/src/ce/navigation/FocusElements/AppIDE.ts index a351dcb15b..3806454b5b 100644 --- a/app/client/src/ce/navigation/FocusElements/AppIDE.ts +++ b/app/client/src/ce/navigation/FocusElements/AppIDE.ts @@ -73,7 +73,7 @@ import { import { getFirstDatasourceId } from "selectors/datasourceSelectors"; import { FocusElement, FocusElementConfigType } from "navigation/FocusElements"; import type { FocusElementsConfigList } from "sagas/FocusRetentionSaga"; -import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants"; +import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants"; import { getPluginActionConfigSelectedTab, getPluginActionDebuggerState, @@ -81,7 +81,7 @@ import { setPluginActionEditorSelectedTab, } from "PluginActionEditor/store"; import { EDITOR_TABS } from "constants/QueryEditorConstants"; -import { API_EDITOR_TABS } from "constants/ApiEditorConstants/CommonApiConstants"; +import { API_EDITOR_TABS } from "PluginActionEditor/constants/CommonApiConstants"; export const AppIDEFocusElements: FocusElementsConfigList = { [FocusEntity.DATASOURCE_LIST]: [ diff --git a/app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx b/app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx index bad7cdba93..80f758bbca 100644 --- a/app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx +++ b/app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx @@ -9,10 +9,15 @@ import { ConvertToModuleCallout, } from "./components/ConvertToModule"; import AppPluginActionToolbar from "./components/AppPluginActionToolbar"; +import { useLocation } from "react-router"; +import { identifyEntityFromPath } from "navigation/FocusEntity"; const AppPluginActionEditor = () => { + const { pathname } = useLocation(); + const entity = identifyEntityFromPath(pathname); + return ( - + diff --git a/app/client/src/components/editorComponents/ActionCreator/viewComponents/ActionBlockTree/utils.tsx b/app/client/src/components/editorComponents/ActionCreator/viewComponents/ActionBlockTree/utils.tsx index 474ea6c4bf..b148e4e400 100644 --- a/app/client/src/components/editorComponents/ActionCreator/viewComponents/ActionBlockTree/utils.tsx +++ b/app/client/src/components/editorComponents/ActionCreator/viewComponents/ActionBlockTree/utils.tsx @@ -9,7 +9,7 @@ import { getCodeFromMoustache, getEvaluationVersion } from "../../utils"; import { ApiMethodIcon } from "pages/Editor/Explorer/ExplorerIcons"; import { getCurrentActions } from "ee/selectors/entitiesSelector"; import { useSelector } from "react-redux"; -import type { HTTP_METHOD } from "constants/ApiEditorConstants/CommonApiConstants"; +import type { HTTP_METHOD } from "PluginActionEditor/constants/CommonApiConstants"; function GetIconForAction( actionType: ActionTree["actionType"], diff --git a/app/client/src/components/editorComponents/ApiResponseView.tsx b/app/client/src/components/editorComponents/ApiResponseView.tsx index 8bf6a400ad..ef01cbd7d9 100644 --- a/app/client/src/components/editorComponents/ApiResponseView.tsx +++ b/app/client/src/components/editorComponents/ApiResponseView.tsx @@ -16,7 +16,7 @@ import type { BottomTab } from "./EntityBottomTabs"; import EntityBottomTabs from "./EntityBottomTabs"; import { DEBUGGER_TAB_KEYS } from "./Debugger/constants"; import { getErrorCount } from "selectors/debuggerSelectors"; -import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants"; +import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants"; import type { Action } from "entities/Action"; import { EMPTY_RESPONSE } from "./emptyResponse"; import { diff --git a/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx b/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx index b4a71622d2..60115c31c3 100644 --- a/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx +++ b/app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx @@ -22,7 +22,7 @@ import { } from "ee/constants/messages"; import { DEBUGGER_TAB_KEYS } from "./constants"; import EntityBottomTabs from "../EntityBottomTabs"; -import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants"; +import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants"; import { IDEBottomView, ViewHideBehaviour, ViewDisplayMode } from "IDE"; function DebuggerTabs() { diff --git a/app/client/src/components/editorComponents/Debugger/Resizer/index.tsx b/app/client/src/components/editorComponents/Debugger/Resizer/index.tsx index b4e7a5ecdd..9f887d30ed 100644 --- a/app/client/src/components/editorComponents/Debugger/Resizer/index.tsx +++ b/app/client/src/components/editorComponents/Debugger/Resizer/index.tsx @@ -2,7 +2,7 @@ import { Layers } from "constants/Layers"; import type { RefObject } from "react"; import React, { useState, useEffect } from "react"; import styled, { css } from "styled-components"; -import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants"; +import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants"; export const ResizerCSS = css` width: 100%; diff --git a/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx b/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx index 3d01a95506..8e5e514dc3 100644 --- a/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx +++ b/app/client/src/components/editorComponents/form/fields/KeyValueFieldArray.tsx @@ -17,7 +17,7 @@ import { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType"; import { DEFAULT_MULTI_PART_DROPDOWN_PLACEHOLDER, MULTI_PART_DROPDOWN_OPTIONS, -} from "constants/ApiEditorConstants/CommonApiConstants"; +} from "PluginActionEditor/constants/CommonApiConstants"; import { Button, Text } from "@appsmith/ads"; import RequestDropdownField from "./RequestDropdownField"; diff --git a/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts b/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts index 927e5fdc92..7816f5a280 100644 --- a/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts +++ b/app/client/src/constants/AppsmithActionConstants/formConfig/ApiSettingsConfig.ts @@ -5,7 +5,7 @@ import { import { HTTP_PROTOCOL, HTTP_PROTOCOL_VERSIONS, -} from "constants/ApiEditorConstants/CommonApiConstants"; +} from "PluginActionEditor/constants/CommonApiConstants"; export default [ { diff --git a/app/client/src/entities/AppsmithConsole/index.ts b/app/client/src/entities/AppsmithConsole/index.ts index 0692a902d9..bf8175040f 100644 --- a/app/client/src/entities/AppsmithConsole/index.ts +++ b/app/client/src/entities/AppsmithConsole/index.ts @@ -2,7 +2,7 @@ import type { ReduxAction } from "ee/constants/ReduxActionConstants"; import type LOG_TYPE from "./logtype"; import type { PropertyEvaluationErrorType } from "utils/DynamicBindingUtils"; import type { PluginType } from "entities/Action"; -import type { HTTP_METHOD } from "constants/ApiEditorConstants/CommonApiConstants"; +import type { HTTP_METHOD } from "PluginActionEditor/constants/CommonApiConstants"; import type { ENTITY_TYPE, PLATFORM_ERROR, diff --git a/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx b/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx index 43385e0143..84f5dd24b9 100644 --- a/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx +++ b/app/client/src/pages/Editor/APIEditor/CommonEditorForm.tsx @@ -15,7 +15,7 @@ import equal from "fast-deep-equal/es6"; import { getPlugin } from "ee/selectors/entitiesSelector"; import type { AutoGeneratedHeader } from "./helpers"; import { noop } from "lodash"; -import { DEFAULT_DATASOURCE_NAME } from "constants/ApiEditorConstants/ApiEditorConstants"; +import { DEFAULT_DATASOURCE_NAME } from "PluginActionEditor/constants/ApiEditorConstants"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; import { @@ -25,11 +25,9 @@ import { import { ApiEditorContext } from "./ApiEditorContext"; import ActionRightPane from "components/editorComponents/ActionRightPane"; import RunHistory from "ee/components/RunHistory"; -import { - HintMessages, - InfoFields, - RequestTabs, -} from "PluginActionEditor/components/PluginActionForm/components/CommonEditorForm"; +import { HintMessages } from "PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/HintMessages"; +import { InfoFields } from "PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/InfoFields"; +import { RequestTabs } from "PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/RequestTabs"; import { getSavingStatusForActionName } from "selectors/actionSelectors"; import { getAssetUrl } from "ee/utils/airgapHelpers"; import { ActionUrlIcon } from "../Explorer/ExplorerIcons"; diff --git a/app/client/src/pages/Editor/APIEditor/GraphQL/GraphQLEditorForm.tsx b/app/client/src/pages/Editor/APIEditor/GraphQL/GraphQLEditorForm.tsx index 45d6feb4cc..ed1510ea3a 100644 --- a/app/client/src/pages/Editor/APIEditor/GraphQL/GraphQLEditorForm.tsx +++ b/app/client/src/pages/Editor/APIEditor/GraphQL/GraphQLEditorForm.tsx @@ -12,8 +12,8 @@ import { } from "ee/selectors/entitiesSelector"; import type { CommonFormProps } from "../CommonEditorForm"; import CommonEditorForm from "../CommonEditorForm"; -import Pagination from "./Pagination"; -import { GRAPHQL_HTTP_METHOD_OPTIONS } from "constants/ApiEditorConstants/GraphQLEditorConstants"; +import Pagination from "PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/Pagination"; +import { GRAPHQL_HTTP_METHOD_OPTIONS } from "PluginActionEditor/constants/GraphQLEditorConstants"; import PostBodyData from "PluginActionEditor/components/PluginActionForm/components/GraphQLEditor/PostBodyData"; type APIFormProps = { diff --git a/app/client/src/pages/Editor/APIEditor/GraphQL/QueryWrapperWithCSS.tsx b/app/client/src/pages/Editor/APIEditor/GraphQL/QueryWrapperWithCSS.tsx deleted file mode 100644 index 37882af84d..0000000000 --- a/app/client/src/pages/Editor/APIEditor/GraphQL/QueryWrapperWithCSS.tsx +++ /dev/null @@ -1,250 +0,0 @@ -// import { Colors } from "constants/Colors"; -import styled from "styled-components"; - -const QueryWrapper = styled.div` - display: flex; - flex-direction: column; - width: 100%; - padding-left: 2px; - /* This CSS is adopted from GraphiQL to maintain the consistency with the GraphiQL playground */ - /* COLORS */ - - /* Comment */ - .cm-comment { - color: #999; - } - - /* Punctuation */ - .cm-punctuation { - color: #555; - } - - /* Keyword */ - .cm-keyword, - span.cm-m-graphql.cm-attribute { - color: #b11a04; - } - - /* OperationName, FragmentName */ - .cm-def { - color: #d2054e; - } - - /* FieldName */ - .cm-property { - color: #1f61a0; - } - - /* FieldAlias */ - .cm-qualifier { - color: #1c92a9; - } - - /* ArgumentName and ObjectFieldName */ - .cm-attribute { - color: #8b2bb9; - } - - /* Number */ - .cm-number { - color: #2882f9; - } - - /* String */ - .cm-string { - color: #d64292; - } - - /* Boolean */ - .cm-builtin { - color: #d47509; - } - - /* EnumValue */ - .cm-string-2 { - color: #0b7fc7; - } - - /* Variable */ - .cm-variable { - color: #397d13; - } - - /* Directive */ - .cm-meta { - color: #b33086; - } - - /* Type */ - .cm-atom { - color: #ca9800; - } - - /* CURSOR */ - - /* DEFAULT THEME */ - - .cm-s-default .cm-keyword { - color: #708; - } - - .cm-s-default .cm-atom { - color: #219; - } - - .cm-s-default .cm-number { - color: #164; - } - - .cm-s-default .cm-def { - color: #00f; - } - - .cm-s-default .cm-variable-2 { - color: #05a; - } - - .cm-s-default .cm-variable-3 { - color: #085; - } - - .cm-s-default .cm-comment { - color: #a50; - } - - .cm-s-default .cm-string { - color: #a11; - } - - .cm-s-default .cm-string-2 { - color: #f50; - } - - .cm-s-default .cm-meta { - color: #555; - } - - .cm-s-default .cm-qualifier { - color: #555; - } - - .cm-s-default .cm-builtin { - color: #30a; - } - - .cm-s-default .cm-bracket { - color: #997; - } - - .cm-s-default .cm-tag { - color: #170; - } - - .cm-s-default .cm-attribute { - color: #00c; - } - - .cm-s-default .cm-header { - color: blue; - } - - .cm-s-default .cm-quote { - color: #090; - } - - .cm-s-default .cm-hr { - color: #999; - } - - .cm-s-default .cm-link { - color: #00c; - } - - .cm-negative { - color: #d44; - } - - .cm-positive { - color: #292; - } - - .cm-header, - .cm-strong { - font-weight: bold; - } - - .cm-em { - font-style: italic; - } - - .cm-link { - text-decoration: underline; - } - - .cm-strikethrough { - text-decoration: line-through; - } - - .cm-s-default .cm-error { - color: #f00; - } - - .cm-invalidchar { - color: #f00; - } - - .CodeMirror-composing { - border-bottom: 2px solid; - } - - /* Default styles for common addons */ - - div.CodeMirror span.CodeMirror-matchingbracket { - color: #0f0; - } - - .CodeMirror-matchingtag { - background: rgba(255, 150, 0, 0.3); - } - - .CodeMirror-activeline-background { - background: #e8f2ff; - } - - /* STOP */ - - .CodeMirror-info .type-name { - color: #ca9800; - } - - .CodeMirror-info .field-name { - color: #1f61a0; - } - - .CodeMirror-info .enum-value { - color: #0b7fc7; - } - - .CodeMirror-info .arg-name { - color: #8b2bb9; - } - - .CodeMirror-info .directive-name { - color: #b33086; - } - - .CodeMirror-jump-token { - text-decoration: underline; - cursor: pointer; - } - - &&&&& .CodeMirror { - border: 0; - } - - &&& .CodeMirror-gutters { - background: var(--ads-v2-color-bg-subtle); - } -`; - -export default QueryWrapper; diff --git a/app/client/src/pages/Editor/APIEditor/RestAPIForm.tsx b/app/client/src/pages/Editor/APIEditor/RestAPIForm.tsx index 0df046c997..ab58d98d45 100644 --- a/app/client/src/pages/Editor/APIEditor/RestAPIForm.tsx +++ b/app/client/src/pages/Editor/APIEditor/RestAPIForm.tsx @@ -4,7 +4,7 @@ import type { InjectedFormProps } from "redux-form"; import { formValueSelector, reduxForm } from "redux-form"; import { API_EDITOR_FORM_NAME } from "ee/constants/forms"; import type { Action } from "entities/Action"; -import PostBodyData from "./PostBodyData"; +import PostBodyData from "PluginActionEditor/components/PluginActionForm/components/ApiEditor/PostBodyData"; import type { AppState } from "ee/reducers"; import { getApiName } from "selectors/formSelectors"; import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig"; @@ -12,9 +12,9 @@ import get from "lodash/get"; import { getAction, getActionResponses } from "ee/selectors/entitiesSelector"; import type { CommonFormProps } from "./CommonEditorForm"; import CommonEditorForm from "./CommonEditorForm"; -import Pagination from "./Pagination"; +import Pagination from "PluginActionEditor/components/PluginActionForm/components/ApiEditor/Pagination"; import { getCurrentEnvironmentId } from "ee/selectors/environmentSelectors"; -import { HTTP_METHOD_OPTIONS } from "constants/ApiEditorConstants/CommonApiConstants"; +import { HTTP_METHOD_OPTIONS } from "PluginActionEditor/constants/CommonApiConstants"; type APIFormProps = { httpMethodFromForm: string; diff --git a/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx b/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx index f02daa7801..943bf78b5a 100644 --- a/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx +++ b/app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx @@ -22,7 +22,7 @@ import { getErrorCount, getResponsePaneHeight, } from "selectors/debuggerSelectors"; -import { ActionExecutionResizerHeight } from "../APIEditor/constants"; +import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants"; import { IDEBottomView, ViewHideBehaviour } from "IDE"; export const ResizerMainContainer = styled.div` diff --git a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx index 4c0cfad1f8..b93acce4e8 100644 --- a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx +++ b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx @@ -19,7 +19,7 @@ import type { ReduxAction } from "ee/constants/ReduxActionConstants"; import { datasourceToFormValues, formValuesToDatasource, -} from "transformers/RestAPIDatasourceFormTransformer"; +} from "PluginActionEditor/transformers/RestAPIDatasourceFormTransformer"; import type { ApiDatasourceForm, AuthorizationCode, diff --git a/app/client/src/pages/Editor/DataSourceEditor/index.tsx b/app/client/src/pages/Editor/DataSourceEditor/index.tsx index abb3af2953..2d07855c50 100644 --- a/app/client/src/pages/Editor/DataSourceEditor/index.tsx +++ b/app/client/src/pages/Editor/DataSourceEditor/index.tsx @@ -81,7 +81,7 @@ import { } from "components/formControls/utils"; import type { ControlProps } from "components/formControls/BaseControl"; import type { ApiDatasourceForm } from "entities/Datasource/RestAPIForm"; -import { formValuesToDatasource } from "transformers/RestAPIDatasourceFormTransformer"; +import { formValuesToDatasource } from "PluginActionEditor/transformers/RestAPIDatasourceFormTransformer"; import { DSFormHeader } from "./DSFormHeader"; import type { PluginType } from "entities/Action"; import { PluginPackageName } from "entities/Action"; diff --git a/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx b/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx index f7bb63c49a..9685a2d263 100644 --- a/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx +++ b/app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx @@ -13,7 +13,7 @@ import { DATASOURCE_GENERATE_PAGE_BUTTON, createMessage, } from "ee/constants/messages"; -import Table from "pages/Editor/QueryEditor/Table"; +import Table from "PluginActionEditor/components/PluginActionResponse/components/Table"; import { generateTemplateToUpdatePage } from "actions/pageActions"; import { getCurrentApplicationId, diff --git a/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx b/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx index 53c06181a4..72ca15f920 100644 --- a/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx +++ b/app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx @@ -10,7 +10,7 @@ import { import type { DropdownOptions } from "../GeneratePage/components/constants"; import { DEFAULT_DROPDOWN_OPTION } from "../GeneratePage/components/constants"; import { isEmpty } from "lodash"; -import Table from "pages/Editor/QueryEditor/Table"; +import Table from "PluginActionEditor/components/PluginActionResponse/components/Table"; import { getCurrentApplicationId, getPagePermissions, diff --git a/app/client/src/pages/Editor/EntityNavigation/ActionPane/ApiPaneNavigation.ts b/app/client/src/pages/Editor/EntityNavigation/ActionPane/ApiPaneNavigation.ts index 4671eaae08..605b2aadd2 100644 --- a/app/client/src/pages/Editor/EntityNavigation/ActionPane/ApiPaneNavigation.ts +++ b/app/client/src/pages/Editor/EntityNavigation/ActionPane/ApiPaneNavigation.ts @@ -1,7 +1,7 @@ import { call, delay, put } from "redux-saga/effects"; import type { EntityInfo, IApiPaneNavigationConfig } from "../types"; import { ActionPaneNavigation } from "./exports"; -import { API_EDITOR_TABS } from "constants/ApiEditorConstants/CommonApiConstants"; +import { API_EDITOR_TABS } from "PluginActionEditor/constants/CommonApiConstants"; import { setPluginActionEditorSelectedTab } from "PluginActionEditor/store"; import { NAVIGATION_DELAY } from "../costants"; diff --git a/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx b/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx index 8aa0204af4..fe87497930 100644 --- a/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx +++ b/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx @@ -4,8 +4,10 @@ import { MenuIcons } from "icons/MenuIcons"; import type { Plugin } from "api/PluginApi"; import ImageAlt from "assets/images/placeholder-image.svg"; import styled from "styled-components"; -import type { HTTP_METHOD } from "constants/ApiEditorConstants/CommonApiConstants"; -import { HTTP_METHODS_COLOR } from "constants/ApiEditorConstants/CommonApiConstants"; +import { + HTTP_METHODS_COLOR, + type HTTP_METHOD, +} from "PluginActionEditor/constants/CommonApiConstants"; import { PRIMARY_KEY, FOREIGN_KEY } from "constants/DatasourceEditorConstants"; import { Icon } from "@appsmith/ads"; import { getAssetUrl } from "ee/utils/airgapHelpers"; diff --git a/app/client/src/pages/Editor/FormControl.tsx b/app/client/src/pages/Editor/FormControl.tsx index 6610130ee7..453696742e 100644 --- a/app/client/src/pages/Editor/FormControl.tsx +++ b/app/client/src/pages/Editor/FormControl.tsx @@ -27,8 +27,8 @@ import { } from "ee/selectors/entitiesSelector"; import { get } from "lodash"; import { SQL_PLUGINS_DEFAULT_TEMPLATE_TYPE } from "constants/Datasource"; -import TemplateMenu from "./QueryEditor/TemplateMenu"; -import { SQL_DATASOURCES } from "../../constants/QueryEditorConstants"; +import TemplateMenu from "PluginActionEditor/components/PluginActionForm/components/UQIEditor/TemplateMenu"; +import { SQL_DATASOURCES } from "constants/QueryEditorConstants"; import type { Datasource, DatasourceStructure } from "entities/Datasource"; import { getCurrentEditingEnvironmentId } from "ee/selectors/environmentSelectors"; diff --git a/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx b/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx index d68a398943..5fffcc1dc9 100644 --- a/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx +++ b/app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx @@ -29,12 +29,12 @@ import { } from "PluginActionEditor/store"; import type { SourceEntity } from "entities/AppsmithConsole"; import { ENTITY_TYPE as SOURCE_ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils"; -import { DocsLink, openDoc } from "../../../constants/DocumentationLinks"; +import { DocsLink, openDoc } from "constants/DocumentationLinks"; import { QueryEditorContext } from "./QueryEditorContext"; import QueryDebuggerTabs from "./QueryDebuggerTabs"; -import useShowSchema from "components/editorComponents/ActionRightPane/useShowSchema"; +import useShowSchema from "PluginActionEditor/components/PluginActionResponse/hooks/useShowSchema"; import { doesPluginRequireDatasource } from "ee/entities/Engine/actionHelpers"; -import FormRender from "./FormRender"; +import FormRender from "PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender"; import QueryEditorHeader from "./QueryEditorHeader"; import RunHistory from "ee/components/RunHistory"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; diff --git a/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx index 5e3b7ae6fe..7d283d140f 100644 --- a/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx +++ b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx @@ -14,12 +14,12 @@ import { } from "ee/constants/messages"; import DebuggerLogs from "components/editorComponents/Debugger/DebuggerLogs"; import ErrorLogs from "components/editorComponents/Debugger/Errors"; -import Schema from "components/editorComponents/Debugger/Schema"; +import Schema from "PluginActionEditor/components/PluginActionResponse/components/Schema"; import type { ActionResponse } from "api/ActionAPI"; import { isString } from "lodash"; import type { SourceEntity } from "entities/AppsmithConsole"; import type { Action } from "entities/Action"; -import QueryResponseTab from "./QueryResponseTab"; +import QueryResponseTab from "PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab"; import { getDatasourceStructureById, getPluginDatasourceComponentFromId, diff --git a/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx b/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx index fc854b4d51..71da172c95 100644 --- a/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx +++ b/app/client/src/pages/Editor/__tests__/QueryEditorTable.test.tsx @@ -1,8 +1,9 @@ import React from "react"; import { render, screen } from "test/testUtils"; import "@testing-library/jest-dom"; -import Table from "../QueryEditor/Table"; -import { getScrollBarWidth } from "../QueryEditor/Table"; +import Table, { + getScrollBarWidth, +} from "PluginActionEditor/components/PluginActionResponse/components/Table"; function createEle() { return { diff --git a/app/client/src/reducers/uiReducers/datasourcePaneReducer.ts b/app/client/src/reducers/uiReducers/datasourcePaneReducer.ts index 7d68494232..0790740e1f 100644 --- a/app/client/src/reducers/uiReducers/datasourcePaneReducer.ts +++ b/app/client/src/reducers/uiReducers/datasourcePaneReducer.ts @@ -3,7 +3,7 @@ import type { ReduxAction } from "ee/constants/ReduxActionConstants"; import { ReduxActionTypes } from "ee/constants/ReduxActionConstants"; import type { Datasource } from "entities/Datasource"; import _ from "lodash"; -import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants"; +import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants"; const initialState: DatasourcePaneReduxState = { drafts: {}, diff --git a/app/client/src/reducers/uiReducers/debuggerReducer.ts b/app/client/src/reducers/uiReducers/debuggerReducer.ts index 64e6b4df36..022d72939b 100644 --- a/app/client/src/reducers/uiReducers/debuggerReducer.ts +++ b/app/client/src/reducers/uiReducers/debuggerReducer.ts @@ -4,7 +4,7 @@ import type { ReduxAction } from "ee/constants/ReduxActionConstants"; import { ReduxActionTypes } from "ee/constants/ReduxActionConstants"; import { omit, isUndefined, isEmpty } from "lodash"; import equal from "fast-deep-equal"; -import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants"; +import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants"; import { klona } from "klona"; export const DefaultDebuggerContext = { diff --git a/app/client/src/reducers/uiReducers/jsPaneReducer.ts b/app/client/src/reducers/uiReducers/jsPaneReducer.ts index 362f3d7443..c8d8af615f 100644 --- a/app/client/src/reducers/uiReducers/jsPaneReducer.ts +++ b/app/client/src/reducers/uiReducers/jsPaneReducer.ts @@ -5,7 +5,7 @@ import { ReduxActionErrorTypes, } from "ee/constants/ReduxActionConstants"; import type { JSCollection } from "entities/JSCollection"; -import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants"; +import { ActionExecutionResizerHeight } from "PluginActionEditor/components/PluginActionResponse/constants"; export enum JSEditorTab { CODE = "CODE", diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index 8bb94aa0c5..2dc50983aa 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -50,7 +50,7 @@ import { } from "actions/pluginActionActions"; import { getDynamicBindingsChangesSaga } from "utils/DynamicBindingUtils"; import { validateResponse } from "./ErrorSagas"; -import { transformRestAction } from "transformers/RestActionTransformer"; +import { transformRestAction } from "PluginActionEditor/transformers/RestActionTransformer"; import { getCurrentBasePageId, getCurrentPageId, @@ -125,8 +125,8 @@ import { API_EDITOR_FORM_NAME, QUERY_EDITOR_FORM_NAME, } from "ee/constants/forms"; -import { DEFAULT_GRAPHQL_ACTION_CONFIG } from "constants/ApiEditorConstants/GraphQLEditorConstants"; -import { DEFAULT_API_ACTION_CONFIG } from "constants/ApiEditorConstants/ApiEditorConstants"; +import { DEFAULT_GRAPHQL_ACTION_CONFIG } from "PluginActionEditor/constants/GraphQLEditorConstants"; +import { DEFAULT_API_ACTION_CONFIG } from "PluginActionEditor/constants/ApiEditorConstants"; import { fetchDatasourceStructure } from "actions/datasourceActions"; import { setAIPromptTriggered } from "utils/storage"; import { getDefaultTemplateActionConfig } from "utils/editorContextUtils"; diff --git a/app/client/src/sagas/ApiPaneSagas.ts b/app/client/src/sagas/ApiPaneSagas.ts index cf6f4cf790..4c895bda0f 100644 --- a/app/client/src/sagas/ApiPaneSagas.ts +++ b/app/client/src/sagas/ApiPaneSagas.ts @@ -25,9 +25,9 @@ import { HTTP_METHOD, POST_BODY_FORMAT_OPTIONS, POST_BODY_FORMAT_OPTIONS_ARRAY, -} from "constants/ApiEditorConstants/CommonApiConstants"; -import { DEFAULT_CREATE_API_CONFIG } from "constants/ApiEditorConstants/ApiEditorConstants"; -import { DEFAULT_CREATE_GRAPHQL_CONFIG } from "constants/ApiEditorConstants/GraphQLEditorConstants"; +} from "PluginActionEditor/constants/CommonApiConstants"; +import { DEFAULT_CREATE_API_CONFIG } from "PluginActionEditor/constants/ApiEditorConstants"; +import { DEFAULT_CREATE_GRAPHQL_CONFIG } from "PluginActionEditor/constants/GraphQLEditorConstants"; import history from "utils/history"; import { autofill, change, initialize, reset } from "redux-form"; import type { Property } from "api/ActionAPI"; @@ -78,12 +78,12 @@ import { getApplicationByIdFromWorkspaces, getCurrentApplicationIdForCreateNewApp, } from "ee/selectors/applicationSelectors"; -import { DEFAULT_CREATE_APPSMITH_AI_CONFIG } from "constants/ApiEditorConstants/AppsmithAIEditorConstants"; +import { DEFAULT_CREATE_APPSMITH_AI_CONFIG } from "PluginActionEditor/constants/AppsmithAIEditorConstants"; import { checkAndGetPluginFormConfigsSaga } from "./PluginSagas"; import { convertToBasePageIdSelector } from "selectors/pageListSelectors"; import type { ApplicationPayload } from "entities/Application"; import { klonaLiteWithTelemetry } from "utils/helpers"; -import { POST_BODY_FORM_DATA_KEY } from "../PluginActionEditor/constants"; +import { POST_BODY_FORM_DATA_KEY } from "PluginActionEditor/store/constants"; function* syncApiParamsSaga( actionPayload: ReduxActionWithMeta, diff --git a/app/client/src/sagas/CurlImportSagas.ts b/app/client/src/sagas/CurlImportSagas.ts index bee2fe5539..631b040469 100644 --- a/app/client/src/sagas/CurlImportSagas.ts +++ b/app/client/src/sagas/CurlImportSagas.ts @@ -10,7 +10,7 @@ import CurlImportApi from "api/ImportApi"; import type { ApiResponse } from "api/ApiResponses"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import { getCurrentWorkspaceId } from "ee/selectors/selectedWorkspaceSelectors"; -import transformCurlImport from "transformers/CurlImportTransformer"; +import transformCurlImport from "PluginActionEditor/transformers/CurlImportTransformer"; import history from "utils/history"; import { CURL } from "constants/AppsmithActionConstants/ActionConstants"; import { apiEditorIdURL } from "ee/RouteBuilder"; diff --git a/app/client/src/sagas/ReplaySaga.ts b/app/client/src/sagas/ReplaySaga.ts index 8d49191a5a..942c4f880d 100644 --- a/app/client/src/sagas/ReplaySaga.ts +++ b/app/client/src/sagas/ReplaySaga.ts @@ -55,7 +55,7 @@ import { isQueryAction, isSaaSAction, } from "entities/Action"; -import { API_EDITOR_TABS } from "constants/ApiEditorConstants/CommonApiConstants"; +import { API_EDITOR_TABS } from "PluginActionEditor/constants/CommonApiConstants"; import { EDITOR_TABS } from "constants/QueryEditorConstants"; import _, { isEmpty } from "lodash"; import type { ReplayEditorUpdate } from "entities/Replay/ReplayEntity/ReplayEditor"; diff --git a/app/client/src/utils/ApiPaneUtils.test.ts b/app/client/src/utils/ApiPaneUtils.test.ts index a6cb658822..99c9ab11bb 100644 --- a/app/client/src/utils/ApiPaneUtils.test.ts +++ b/app/client/src/utils/ApiPaneUtils.test.ts @@ -1,4 +1,4 @@ -import { POST_BODY_FORMAT_OPTIONS } from "constants/ApiEditorConstants/CommonApiConstants"; +import { POST_BODY_FORMAT_OPTIONS } from "PluginActionEditor/constants/CommonApiConstants"; import { getContentTypeHeaderValue, getIndextoUpdate, diff --git a/app/client/src/utils/ApiPaneUtils.tsx b/app/client/src/utils/ApiPaneUtils.tsx index f4c3bdfaf0..7239ccfead 100644 --- a/app/client/src/utils/ApiPaneUtils.tsx +++ b/app/client/src/utils/ApiPaneUtils.tsx @@ -1,4 +1,4 @@ -import { CONTENT_TYPE_HEADER_KEY } from "constants/ApiEditorConstants/CommonApiConstants"; +import { CONTENT_TYPE_HEADER_KEY } from "../PluginActionEditor/constants/CommonApiConstants"; import { getDynamicStringSegments, isDynamicValue, diff --git a/app/client/src/utils/helpers.tsx b/app/client/src/utils/helpers.tsx index 520581f313..698a7d1228 100644 --- a/app/client/src/utils/helpers.tsx +++ b/app/client/src/utils/helpers.tsx @@ -10,7 +10,7 @@ import { DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS, JAVASCRIPT_KEYWORDS, } from "constants/WidgetValidation"; -import { get, isNil, has, uniq } from "lodash"; +import { get, has, isNil, uniq } from "lodash"; import type { Workspace } from "ee/constants/workspaceConstants"; import { hasCreateNewAppPermission } from "ee/utils/permissionHelpers"; import moment from "moment"; @@ -57,21 +57,6 @@ export const snapToGrid = ( return [snappedX, snappedY]; }; -export const formatBytes = (bytes: string | number) => { - if (!bytes) return; - - const value = typeof bytes === "string" ? parseInt(bytes) : bytes; - const sizes = ["Bytes", "KB", "MB", "GB", "TB"]; - - if (value === 0) return "0 bytes"; - - const i = parseInt(String(Math.floor(Math.log(value) / Math.log(1024)))); - - if (i === 0) return bytes + " " + sizes[i]; - - return (value / Math.pow(1024, i)).toFixed(1) + " " + sizes[i]; -}; - export const getAbsolutePixels = (size?: string | null) => { if (!size) return 0;