diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx index 759ea60f1b7..27464dcb3ef 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx @@ -5,19 +5,24 @@ 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"; const PluginActionForm = () => { useChangeActionCall(); const { plugin } = usePluginActionContext(); return ( - + {plugin.uiComponent === UIComponentTypes.ApiEditorForm && ( )} {plugin.uiComponent === UIComponentTypes.GraphQLEditorForm && ( )} + {plugin.uiComponent === UIComponentTypes.DbEditorForm || + (plugin.uiComponent === UIComponentTypes.UQIDbEditorForm && ( + + ))} ); }; diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditorForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditorForm.tsx new file mode 100644 index 00000000000..5c51a2cab6e --- /dev/null +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditorForm.tsx @@ -0,0 +1,43 @@ +import React from "react"; +import FormRender from "pages/Editor/QueryEditor/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"; +import { useSelector } from "react-redux"; +import { getFormEvaluationState } from "selectors/formSelectors"; +import { Flex } from "@appsmith/ads"; + +const UQIEditorForm = () => { + const { editorConfig, plugin } = usePluginActionContext(); + + const formData = useSelector(getFormValues(QUERY_EDITOR_FORM_NAME)) as + | QueryAction + | SaaSAction; + + const formEvaluation = useSelector(getFormEvaluationState); + + let formEvaluationState = {}; + + // Fetching evaluations state only once the formData is populated + if (!!formData) { + formEvaluationState = formEvaluation[formData.id]; + } + + return ( + + + + ); +}; + +export default reduxForm({ + form: QUERY_EDITOR_FORM_NAME, + enableReinitialize: true, +})(UQIEditorForm); 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 8e44395d5a0..54e4fdf45e1 100644 --- a/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx +++ b/app/client/src/ce/PluginActionEditor/components/PluginActionResponse/hooks/usePluginActionResponseTabs.tsx @@ -21,12 +21,22 @@ import { noop } from "lodash"; import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig"; import { getErrorCount } from "selectors/debuggerSelectors"; import { getApiPaneDebuggerState } from "selectors/apiPaneSelectors"; +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 type { SourceEntity } from "entities/AppsmithConsole"; +import { ENTITY_TYPE as SOURCE_ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils"; function usePluginActionResponseTabs() { - const { action, actionResponse, plugin } = usePluginActionContext(); + const { action, actionResponse, datasource, plugin } = + usePluginActionContext(); const IDEViewMode = useSelector(getIDEViewMode); const errorCount = useSelector(getErrorCount); + const pluginRequireDatasource = doesPluginRequireDatasource(plugin); + + const showSchema = useShowSchema(plugin.id) && pluginRequireDatasource; const { responseTabHeight } = useSelector(getApiPaneDebuggerState); @@ -81,6 +91,55 @@ function usePluginActionResponseTabs() { ]); } + if ( + [ + PluginType.DB, + PluginType.AI, + PluginType.REMOTE, + PluginType.SAAS, + PluginType.INTERNAL, + ].includes(plugin.type) + ) { + const newTabs = []; + + const actionSource: SourceEntity = { + type: SOURCE_ENTITY_TYPE.ACTION, + name: action.name, + id: action.id, + }; + + if (showSchema) { + newTabs.push({ + key: "schema", + title: "Schema", + panelComponent: ( + + ), + }); + } + + newTabs.push({ + key: "response", + title: createMessage(DEBUGGER_RESPONSE), + panelComponent: ( + + ), + }); + + return tabs.concat(newTabs); + } + return tabs; }