LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-2682 [MISC] Revert auto-save and add explicit Save button with validation enhancements (#1509)
Chandrasekharan M35df637aeecb
diff --git a/backend/workflow_manager/endpoint_v2/static/dest/db.json b/backend/workflow_manager/endpoint_v2/static/dest/db.jsonindex 2dbd21695..ed0748080 100644--- a/backend/workflow_manager/endpoint_v2/static/dest/db.json+++ b/backend/workflow_manager/endpoint_v2/static/dest/db.json@@ -12,7 +12,9 @@"type": "string","title": "Table","default": "",- "description": "Table to store the output. If your database supports schemas, use the format `schema.table`"+ "description": "Table to store the output. If your database supports schemas, use the format `schema.table`",+ "minLength": 1+},"includeAgent": {"type": "boolean",diff --git a/backend/workflow_manager/endpoint_v2/static/src/file.json b/backend/workflow_manager/endpoint_v2/static/src/file.jsonindex af36abf55..c84bc68db 100644--- a/backend/workflow_manager/endpoint_v2/static/src/file.json+++ b/backend/workflow_manager/endpoint_v2/static/src/file.json@@ -33,10 +33,11 @@}},"maxFiles": {- "type": "number",+ "type": "integer","title": "Max files to process","default": 100,- "description": "The maximum number of files to process"+ "description": "The maximum number of files to process",+ "minimum": 1}}}diff --git a/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.css b/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.cssindex 6e42fd6e4..3f26e7ad8 100644--- a/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.css+++ b/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.css@@ -110,7 +110,13 @@}.conn-modal-fs-config {- overflow-y: hidden;+ overflow-y: auto;+}++.conn-modal-footer {+ display: flex;+ justify-content: flex-end;+ gap: 8px;}.file-browser-section {diff --git a/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.jsx b/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.jsxindex 9f3dafb88..2a066179c 100644--- a/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.jsx+++ b/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.jsx@@ -1,4 +1,14 @@-import { Col, Modal, Row, Typography, Select, Space, Image, Tabs } from "antd";+import {+ Col,+ Modal,+ Row,+ Typography,+ Select,+ Space,+ Image,+ Tabs,+ Button,+} from "antd";import { CloudDownloadOutlined, CloudUploadOutlined } from "@ant-design/icons";import PropTypes from "prop-types";import { useEffect, useState, useRef, useCallback } from "react";@@ -55,8 +65,10 @@ function ConfigureConnectorModal({const [isFolderSelected, setIsFolderSelected] = useState(false);const [initialFormDataConfig, setInitialFormDataConfig] = useState({});const [initialConnectorId, setInitialConnectorId] = useState(null);+ const [showUnsavedChangesModal, setShowUnsavedChangesModal] = useState(false);const fileExplorerRef = useRef(null);+ const formRef = useRef(null);const { setAlertDetails } = useAlertStore();const axiosPrivate = useAxiosPrivate();@@ -244,12 +256,17 @@ function ConfigureConnectorModal({const currentConfig =folderSectionConfig[connType] || folderSectionConfig.input;- const handleModalClose = async () => {+ const hasUnsavedChanges = () => {const hasConfigChanges = !isEqual(formDataConfig, initialFormDataConfig);const hasConnectorChanged = connDetails?.id !== initialConnectorId;+ return hasConfigChanges || hasConnectorChanged;+ };++ const handleValidateAndSubmit = async (validatedFormData) => {+ const hasConfigChanges = !isEqual(validatedFormData, initialFormDataConfig);+ const hasConnectorChanged = connDetails?.id !== initialConnectorId;const hasChanges = hasConfigChanges || hasConnectorChanged;- // Auto-save if there are actual changesif (hasChanges && connDetails?.id) {setIsSavingEndpoint(true);try {@@ -257,13 +274,19 @@ function ConfigureConnectorModal({if (hasConnectorChanged) {updatePayload.connector_instance_id = connDetails.id;}- if (hasConfigChanges && Object.keys(formDataConfig).length > 0) {- updatePayload.configuration = formDataConfig;+ if (hasConfigChanges) {+ updatePayload.configuration = validatedFormData;}if (Object.keys(updatePayload).length > 0) {await handleEndpointUpdate(updatePayload);}- setOpen(false);+ // Update initial values after successful save+ setInitialFormDataConfig(cloneDeep(validatedFormData));+ setInitialConnectorId(connDetails?.id);+ setAlertDetails({+ type: "success",+ content: "Configuration saved successfully.",+ });} catch (error) {setAlertDetails({type: "error",@@ -273,11 +296,73 @@ function ConfigureConnectorModal({} finally {setIsSavingEndpoint(false);}+ }+ };++ const handleSave = async () => {+ const hasConfigChanges = !isEqual(formDataConfig, initialFormDataConfig);++ if (hasConfigChanges && formRef?.current) {+ if (formRef?.current?.validateForm()) {+ await handleValidateAndSubmit(formDataConfig);+ return true;+ } else {+ // RJSF shows validation errors+ return false;+ }+ } else {+ // No config changes, just save connector changes if any+ await handleValidateAndSubmit(formDataConfig);+ return true;+ }+ };++ const handleModalClose = () => {+ if (hasUnsavedChanges()) {+ setShowUnsavedChangesModal(true);} else {setOpen(false);}};+ const handleConfirmClose = () => {+ const hasConfigChanges = !isEqual(formDataConfig, initialFormDataConfig);+ const hasConnectorChanged = connDetails?.id !== initialConnectorId;++ // Reset form data to original DB values only if changed+ if (hasConfigChanges) {+ setFormDataConfig(cloneDeep(initialFormDataConfig));+ }++ // Reset connector to original selection only if changed+ if (hasConnectorChanged) {+ if (initialConnectorId && availableConnectors.length > 0) {+ const originalConnector = availableConnectors.find(+ (conn) => conn.value === initialConnectorId+ );+ if (originalConnector?.connector) {+ setConnDetails(originalConnector.connector);+ }+ } else if (!initialConnectorId) {+ // If no initial connector, reset to no selection+ setConnDetails(null);+ }+ }++ setShowUnsavedChangesModal(false);+ // Delay closing the main modal to allow confirmation modal to close first+ setTimeout(() => setOpen(false), 0);+ };++ const handleSaveAndClose = async () => {+ const saveSuccessful = await handleSave();+ setShowUnsavedChangesModal(false);+ if (saveSuccessful) {+ // Delay closing the main modal to allow confirmation modal to close first+ setTimeout(() => setOpen(false), 0);+ }+ };+// Load plugin tab for Human In The Loop (DATABASE connectors only)useEffect(() => {if (connMode !== "DATABASE") {@@ -329,13 +414,11 @@ function ConfigureConnectorModal({// Capture initial configuration and connector when modal opensuseEffect(() => {if (open) {- // Store a deep copy of the initial configurationif (endpointDetails?.configuration) {setInitialFormDataConfig(cloneDeep(endpointDetails.configuration));}setInitialConnectorId(endpointDetails?.connector_instance?.id || null);} else {- // Reset when modal closessetInitialFormDataConfig({});setInitialConnectorId(null);}@@ -397,7 +480,21 @@ function ConfigureConnectorModal({confirmLoading={isSavingEndpoint}closable={!isSavingEndpoint}centered- footer={null}+ footer={+ connDetails?.id ? (+ <div className="conn-modal-footer">+ <Button onClick={handleModalClose}>Cancel</Button>+ <Button+ type="primary"+ loading={isSavingEndpoint}+ onClick={handleSave}+ disabled={!hasUnsavedChanges()}+ >+ Save+ </Button>+ </div>+ ) : null+ }width={1200}maskClosable={false}>@@ -493,6 +590,8 @@ function ConfigureConnectorModal({formDataConfig={formDataConfig}setFormDataConfig={setFormDataConfig}isSpecConfigLoading={isSpecConfigLoading}+ formRef={formRef}+ validateAndSubmit={handleValidateAndSubmit}/>)}{item.key === "MANUALREVIEW" && DBRules && (@@ -513,6 +612,8 @@ function ConfigureConnectorModal({formDataConfig={formDataConfig}setFormDataConfig={setFormDataConfig}isSpecConfigLoading={isSpecConfigLoading}+ formRef={formRef}+ validateAndSubmit={handleValidateAndSubmit}/></div></Col>@@ -563,11 +664,39 @@ function ConfigureConnectorModal({setOpen={setShowAddSourceModal}isConnector={true}type={connType}+ connectorMode={connMode}addNewItem={handleConnectorCreated}editItemId={null}setEditItemId={() => {}}/>)}++ {/* Unsaved Changes Confirmation Modal */}+ <Modal+ title="Unsaved Changes"+ open={showUnsavedChangesModal}+ onCancel={() => setShowUnsavedChangesModal(false)}+ footer={[+ <Button+ key="discard"+ onClick={handleConfirmClose}+ disabled={isSavingEndpoint}+ >+ Close without Saving+ </Button>,+ <Button+ key="save"+ type="primary"+ onClick={handleSaveAndClose}+ loading={isSavingEndpoint}+ >+ Save+ </Button>,+ ]}+ centered+ >+ You have unsaved changes. Do you want to save them before closing?+ </Modal></Modal>);}diff --git a/frontend/src/components/agency/configure-forms-layout/ConfigureFormsLayout.css b/frontend/src/components/agency/configure-forms-layout/ConfigureFormsLayout.cssindex d6865e0e1..a27517618 100644--- a/frontend/src/components/agency/configure-forms-layout/ConfigureFormsLayout.css+++ b/frontend/src/components/agency/configure-forms-layout/ConfigureFormsLayout.css@@ -1,6 +1,5 @@.config-content-area {padding: 16px;- height: 100%;overflow-y: auto;overflow-x: hidden;}diff --git a/frontend/src/components/agency/configure-forms-layout/ConfigureFormsLayout.jsx b/frontend/src/components/agency/configure-forms-layout/ConfigureFormsLayout.jsxindex a270d4852..f5019e06b 100644--- a/frontend/src/components/agency/configure-forms-layout/ConfigureFormsLayout.jsx+++ b/frontend/src/components/agency/configure-forms-layout/ConfigureFormsLayout.jsx@@ -1,6 +1,6 @@import PropTypes from "prop-types";-import { SettingsForm } from "../settings-form/SettingsForm";+import { RjsfFormLayout } from "../../../layouts/rjsf-form-layout/RjsfFormLayout";import { EmptyState } from "../../widgets/empty-state/EmptyState";import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";@@ -11,6 +11,8 @@ function ConfigureFormsLayout({formDataConfig,setFormDataConfig,isSpecConfigLoading,+ formRef,+ validateAndSubmit,}) {// First check: Still loadingif (isSpecConfigLoading) {@@ -32,11 +34,14 @@ function ConfigureFormsLayout({return (<div className="config-content-area">- <SettingsForm- spec={specConfig}+ <RjsfFormLayout+ schema={specConfig}formData={formDataConfig}setFormData={setFormDataConfig}isLoading={isSpecConfigLoading}+ isStateUpdateRequired={true}+ formRef={formRef}+ validateAndSubmit={validateAndSubmit}/></div>);@@ -47,6 +52,8 @@ ConfigureFormsLayout.propTypes = {formDataConfig: PropTypes.object,setFormDataConfig: PropTypes.func.isRequired,isSpecConfigLoading: PropTypes.bool.isRequired,+ formRef: PropTypes.object,+ validateAndSubmit: PropTypes.func,};export { ConfigureFormsLayout };diff --git a/frontend/src/components/agency/settings-form/SettingsForm.jsx b/frontend/src/components/agency/settings-form/SettingsForm.jsxdeleted file mode 100644index f7e4c162f..000000000--- a/frontend/src/components/agency/settings-form/SettingsForm.jsx+++ /dev/null@@ -1,24 +0,0 @@-import PropTypes from "prop-types";--import { RjsfFormLayout } from "../../../layouts/rjsf-form-layout/RjsfFormLayout";--function SettingsForm({ spec, formData, setFormData, isLoading }) {- return (- <RjsfFormLayout- schema={spec}- formData={formData}- setFormData={setFormData}- isLoading={isLoading}- isStateUpdateRequired={true}- />- );-}--SettingsForm.propTypes = {- spec: PropTypes.object,- formData: PropTypes.object,- setFormData: PropTypes.func.isRequired,- isLoading: PropTypes.bool.isRequired,-};--export { SettingsForm };diff --git a/frontend/src/components/agency/tool-settings/ToolSettings.jsx b/frontend/src/components/agency/tool-settings/ToolSettings.jsxindex ebae35438..925816dd0 100644--- a/frontend/src/components/agency/tool-settings/ToolSettings.jsx+++ b/frontend/src/components/agency/tool-settings/ToolSettings.jsx@@ -22,30 +22,50 @@ function ToolSettings({ spec, isSpecLoading }) {const axiosPrivate = useAxiosPrivate();const handleException = useExceptionHandler();+ // Transform adapter names to IDs for validation compatibility+ const transformAdapterNamesToIds = (metadata, schema) => {+ if (!metadata || !schema?.properties) {+ return metadata || {};+ }++ const transformedMetadata = { ...metadata };++ // Find all fields that have enum and enumNames (these are adapter fields)+ Object.keys(schema.properties).forEach((fieldName) => {+ const fieldSchema = schema.properties[fieldName];+ if (+ fieldSchema?.enum &&+ fieldSchema?.enumNames &&+ transformedMetadata[fieldName]+ ) {+ const currentValue = transformedMetadata[fieldName];++ // Find the index of the current name in enumNames+ const nameIndex = fieldSchema.enumNames.indexOf(currentValue);+ if (nameIndex !== -1 && fieldSchema.enum[nameIndex]) {+ // Replace name with corresponding ID from enum array+ transformedMetadata[fieldName] = fieldSchema.enum[nameIndex];+ }+ }+ });++ return transformedMetadata;+ };+useEffect(() => {// Set existing metadataconst toolInstanceId = toolSettings?.id;const metadata = getMetadata(toolInstanceId);- setFormData(metadata);+ const transformedMetadata = transformAdapterNamesToIds(metadata, spec);+ setFormData(transformedMetadata);}, [toolSettings, spec]);const isObjectEmpty = (obj) => {return obj && Object.keys(obj).length === 0;};- const isFormValid = () => {- if (formRef) {- formRef?.current?.validateFields((errors) => {- if (errors) {- return false;- }- });- }- return true;- };-const validateAndSubmit = (updatedFormData) => {- if (!isFormValid()) {+ if (formRef && !formRef.current?.validateForm()) {return;}handleSubmit(updatedFormData);diff --git a/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx b/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsxindex bd803a816..2d3021062 100644--- a/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx+++ b/frontend/src/components/input-output/add-source-modal/AddSourceModal.jsx@@ -15,6 +15,7 @@ function AddSourceModal({setOpen,type,isConnector,+ connectorMode,addNewItem,editItemId,setEditItemId,@@ -109,13 +110,16 @@ function AddSourceModal({const getListOfSources = () => {let url;if (isConnector) {- // For centralized connectors, get all connectors- url = getUrl(`supported_connectors/`);+ if (connectorMode) {+ url = getUrl(`supported_connectors/?connector_mode=${connectorMode}`);+ } else {+ url = getUrl(`supported_connectors/`);+ }} else {if (!type) return;url = getUrl(`supported_adapters/?adapter_type=${type.toUpperCase()}`);}- // API to get the list of adapters.+const requestOptions = {method: "GET",url,@@ -172,9 +176,10 @@ function AddSourceModal({) : (<ListOfSourcessetSelectedSourceId={setSelectedSourceId}- open={open}sourcesList={sourcesList}type={type}+ isConnector={isConnector}+ connectorMode={connectorMode}/>)}</Modal>@@ -186,6 +191,7 @@ AddSourceModal.propTypes = {setOpen: PropTypes.func.isRequired,type: PropTypes.any,isConnector: PropTypes.bool,+ connectorMode: PropTypes.string,addNewItem: PropTypes.func.isRequired,editItemId: PropTypes.string,setEditItemId: PropTypes.func.isRequired,diff --git a/frontend/src/components/input-output/configure-ds/ConfigureDs.jsx b/frontend/src/components/input-output/configure-ds/ConfigureDs.jsxindex 12c81062a..dd8b134ab 100644--- a/frontend/src/components/input-output/configure-ds/ConfigureDs.jsx+++ b/frontend/src/components/input-output/configure-ds/ConfigureDs.jsx@@ -132,20 +132,9 @@ function ConfigureDs({}}, [selectedSourceId, oAuthProvider, oauthStatusKey, oauthCacheKey]);- const isFormValid = () => {- if (formRef) {- formRef?.current?.validateFields((errors, values) => {- if (errors) {- return false;- }- });- }- return true;- };-const handleTestConnection = (updatedFormData) => {// Check if there any error in form proceed to test connection only there is no error.- if (!isFormValid()) {+ if (formRef && !formRef.current?.validateForm()) {return;}if (oAuthProvider?.length && (status !== "success" || !cacheKey?.length)) {diff --git a/frontend/src/components/input-output/list-of-sources/ListOfSources.css b/frontend/src/components/input-output/list-of-sources/ListOfSources.cssindex 031ee02c1..b066ffc04 100644--- a/frontend/src/components/input-output/list-of-sources/ListOfSources.css+++ b/frontend/src/components/input-output/list-of-sources/ListOfSources.css@@ -6,10 +6,56 @@overflow-x: hidden;}-.list-of-srcs > .searchbox {+.list-of-srcs .search-and-filters {+ display: flex;+ align-items: center;+ gap: 16px;+ margin-bottom: 16px;+ flex-wrap: wrap;+}++.list-of-srcs .searchbox {max-width: 300px;+ flex: 1;+}++@media (max-width: 768px) {+ .list-of-srcs .search-and-filters {+ flex-direction: column;+ align-items: stretch;+ gap: 12px;+ }++ .list-of-srcs .searchbox {+ max-width: 100%;+ }++ .list-of-srcs .mode-filter-segment {+ width: 100%;+ }++ .list-of-srcs .mode-filter-segment .ant-segmented-item {+ flex: 1;+ }+}++.list-of-srcs .no-sources {+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ min-height: 200px;+ text-align: center;+ color: #8c8c8c;+}++.list-of-srcs .no-sources p {+ margin: 0;+ font-size: 16px;}-.list-of-srcs > .list {- padding-top: 20px;+.list-of-srcs .filter-hint {+ margin-top: 8px !important;+ font-size: 14px !important;+ color: #bfbfbf !important;}diff --git a/frontend/src/components/input-output/list-of-sources/ListOfSources.jsx b/frontend/src/components/input-output/list-of-sources/ListOfSources.jsxindex 9a4e4d13a..41f75e5c1 100644--- a/frontend/src/components/input-output/list-of-sources/ListOfSources.jsx+++ b/frontend/src/components/input-output/list-of-sources/ListOfSources.jsx@@ -1,5 +1,5 @@import { SearchOutlined } from "@ant-design/icons";-import { Input, List } from "antd";+import { Input, List, Segmented } from "antd";import PropTypes from "prop-types";import { useEffect, useState } from "react";import debounce from "lodash/debounce";@@ -7,61 +7,118 @@ import debounce from "lodash/debounce";import { DataSourceCard } from "../data-source-card/DataSourceCard";import "./ListOfSources.css";-function ListOfSources({ setSelectedSourceId, open, sourcesList, type }) {+function ListOfSources({+ setSelectedSourceId,+ sourcesList,+ type,+ isConnector,+ connectorMode,+}) {const [filteredSourcesList, setFilteredSourcesList] = useState([]);const [searchText, setSearchText] = useState("");+ const [localModeFilter, setLocalModeFilter] = useState(null);+ // Apply both search and mode filteringuseEffect(() => {- onSearch(searchText);- }, [sourcesList]);+ let filteredList = [...sourcesList];- useEffect(() => {- const filteredList = [...sourcesList].filter((source) => {- const name = source?.name?.toUpperCase();- const searchUpperCase = searchText.toUpperCase();- return name.includes(searchUpperCase);- });- setFilteredSourcesList(filteredList);- }, [sourcesList]);+ // Apply mode filter if selected+ if (localModeFilter && isConnector && !connectorMode) {+ filteredList = filteredList.filter((source) => {+ return source?.connector_mode === localModeFilter;+ });+ }++ // Apply search filter+ if (searchText) {+ const searchUpperCase = searchText.toUpperCase().trim();+ filteredList = filteredList.filter((source) => {+ const name = source?.name?.toUpperCase();+ return name.includes(searchUpperCase);+ });+ }- const onSearch = debounce((searchText) => {- const searchUpperCase = searchText?.toUpperCase()?.trim();- const filteredList = sourcesList?.filter((source) => {- const name = source?.name?.toUpperCase();- return name.includes(searchUpperCase);- });setFilteredSourcesList(filteredList);- setSearchText(searchText);- }, 600);+ }, [sourcesList, searchText, localModeFilter, isConnector, connectorMode]);- const handleInputChange = (event) => {+ const handleInputChange = debounce((event) => {const { value } = event.target;- onSearch(value);+ setSearchText(value);+ }, 300);++ const renderModeFilters = () => {+ if (!isConnector || connectorMode) return null;++ return (+ <Segmented+ className="mode-filter-segment"+ options={[+ { label: "All", value: "ALL" },+ { label: "File Systems", value: "FILESYSTEM" },+ { label: "Databases", value: "DATABASE" },+ ]}+ value={localModeFilter || "ALL"}+ onChange={(value) => {+ const newValue = value === "ALL" ? null : value;+ setLocalModeFilter(newValue);+ }}+ />+ );};return (<div className="list-of-srcs">- <div className="searchbox">- <Input- placeholder="Search"- prefix={<SearchOutlined className="search-outlined" />}- onChange={handleInputChange}- />+ <div className="search-and-filters">+ <div className="searchbox">+ <Input+ placeholder="Search"+ prefix={<SearchOutlined className="search-outlined" />}+ onChange={handleInputChange}+ />+ </div>+ {renderModeFilters()}</div><div className="list">- <List- grid={{ gutter: 16, column: 4 }}- dataSource={filteredSourcesList}- renderItem={(srcDetails) => (- <List.Item>- <DataSourceCard- srcDetails={srcDetails}- setSelectedSourceId={setSelectedSourceId}- type={type}- />- </List.Item>- )}- />+ {filteredSourcesList.length === 0 ? (+ <div className="no-sources">+ <p>+ {searchText && localModeFilter+ ? `No sources found matching "${searchText}" in ${+ localModeFilter === "FILESYSTEM"+ ? "File Systems"+ : "Databases"+ }`+ : searchText+ ? `No sources found matching "${searchText}"`+ : localModeFilter+ ? `No ${+ localModeFilter === "FILESYSTEM"+ ? "File System"+ : "Database"+ } connectors available`+ : "No sources available"}+ </p>+ {localModeFilter && (+ <p className="filter-hint">+ Try selecting "All" to show all connectors+ </p>+ )}+ </div>+ ) : (+ <List+ grid={{ gutter: 16, column: 4 }}+ dataSource={filteredSourcesList}+ renderItem={(srcDetails) => (+ <List.Item>+ <DataSourceCard+ srcDetails={srcDetails}+ setSelectedSourceId={setSelectedSourceId}+ type={type}+ />+ </List.Item>+ )}+ />+ )}</div></div>);@@ -69,9 +126,10 @@ function ListOfSources({ setSelectedSourceId, open, sourcesList, type }) {ListOfSources.propTypes = {setSelectedSourceId: PropTypes.func.isRequired,- open: PropTypes.bool,sourcesList: PropTypes.array,type: PropTypes.string.isRequired,+ isConnector: PropTypes.bool,+ connectorMode: PropTypes.string,};export { ListOfSources };diff --git a/frontend/src/layouts/rjsf-form-layout/CustomFieldTemplate.css b/frontend/src/layouts/rjsf-form-layout/CustomFieldTemplate.cssnew file mode 100644index 000000000..2faae1072--- /dev/null+++ b/frontend/src/layouts/rjsf-form-layout/CustomFieldTemplate.css@@ -0,0 +1,15 @@+.field-with-errors {+ border: 1px solid #ff4d4f;+ border-radius: 4px;+ padding: 8px;+ background-color: #fff2f0;+}++.field-error-alert {+ margin-top: 4px;+}++.field-error-list {+ margin: 0;+ padding-left: 1.2em;+}diff --git a/frontend/src/layouts/rjsf-form-layout/CustomFieldTemplate.jsx b/frontend/src/layouts/rjsf-form-layout/CustomFieldTemplate.jsxindex 077aae697..80386d6d6 100644--- a/frontend/src/layouts/rjsf-form-layout/CustomFieldTemplate.jsx+++ b/frontend/src/layouts/rjsf-form-layout/CustomFieldTemplate.jsx@@ -1,12 +1,35 @@-import { Typography } from "antd";+import { Alert } from "antd";import PropTypes from "prop-types";+import "./CustomFieldTemplate.css";const CustomFieldTemplate = (props) => {- const { classNames, errors, children, help } = props;+ const { classNames, children, help, rawErrors } = props;+ const hasErrors = rawErrors && rawErrors.length > 0;+return (- <div className={classNames}>+ <div className={`${classNames} ${hasErrors ? "field-with-errors" : ""}`}>{children}- <Typography.Text type="danger">{errors}</Typography.Text>+ {hasErrors && (+ <Alert+ type="error"+ showIcon+ className="field-error-alert"+ message={+ rawErrors.length === 1+ ? rawErrors[0]+ : "Multiple validation errors:"+ }+ description={+ rawErrors.length > 1 ? (+ <ul className="field-error-list">+ {rawErrors.map((error, index) => (+ <li key={`err-${error}-${index}`}>{error}</li>+ ))}+ </ul>+ ) : undefined+ }+ />+ )}{help}</div>);@@ -15,8 +38,8 @@ const CustomFieldTemplate = (props) => {CustomFieldTemplate.propTypes = {classNames: PropTypes.string,help: PropTypes.node,- errors: PropTypes.node,children: PropTypes.node,+ rawErrors: PropTypes.array,};export { CustomFieldTemplate };diff --git a/frontend/src/layouts/rjsf-form-layout/RjsfFormLayout.jsx b/frontend/src/layouts/rjsf-form-layout/RjsfFormLayout.jsxindex 3799a7790..020d61260 100644--- a/frontend/src/layouts/rjsf-form-layout/RjsfFormLayout.jsx+++ b/frontend/src/layouts/rjsf-form-layout/RjsfFormLayout.jsx@@ -97,17 +97,145 @@ function RjsfFormLayout({return schema;}, []);- const transformErrors = useCallback((errors) => {- return errors.map((error) => {- if (error.name === "required") {+ // Validation message generators to reduce complexity+ const validationMessageGenerators = {+ // Numeric validations+ minimum: (fieldTitle, params) =>+ `'${fieldTitle}' must be at least ${params?.limit}`,+ maximum: (fieldTitle, params) =>+ `'${fieldTitle}' must not exceed ${params?.limit}`,+ exclusiveMinimum: (fieldTitle, params) =>+ `'${fieldTitle}' must be greater than ${params?.limit}`,+ exclusiveMaximum: (fieldTitle, params) =>+ `'${fieldTitle}' must be less than ${params?.limit}`,+ multipleOf: (fieldTitle, params) =>+ `'${fieldTitle}' must be a multiple of ${params?.multipleOf}`,++ // String validations+ minLength: (fieldTitle, params) =>+ `'${fieldTitle}' must be at least ${params?.limit} characters`,+ maxLength: (fieldTitle, params) =>+ `'${fieldTitle}' must not exceed ${params?.limit} characters`,+ pattern: (fieldTitle) => `'${fieldTitle}' must match the required format`,++ // Array validations+ minItems: (fieldTitle, params) =>+ `'${fieldTitle}' must have at least ${params?.limit} items`,+ maxItems: (fieldTitle, params) =>+ `'${fieldTitle}' must not exceed ${params?.limit} items`,+ uniqueItems: (fieldTitle) =>+ `'${fieldTitle}' must contain only unique items`,++ // Object validations+ minProperties: (fieldTitle, params) =>+ `'${fieldTitle}' must have at least ${params?.limit} properties`,+ maxProperties: (fieldTitle, params) =>+ `'${fieldTitle}' must not exceed ${params?.limit} properties`,++ // Simple validations+ const: (fieldTitle, params) =>+ `'${fieldTitle}' must be exactly ${params?.allowedValue}`,+ type: (fieldTitle, params) =>+ `'${fieldTitle}' must be of type ${params?.type}`,+ format: (fieldTitle, params) =>+ `'${fieldTitle}' must be a valid ${params?.format}`,+ additionalProperties: (fieldTitle, params) =>+ `'${fieldTitle}' has an unsupported property '${params?.additionalProperty}'`,+ dependentRequired: (fieldTitle, params) =>+ `'${fieldTitle}' requires '${params?.missingProperty}'`,+ };++ // Extract complex enum logic to separate function+ const generateEnumMessage = useCallback((fieldTitle, fieldSchema) => {+ let enumMessage = `'${fieldTitle}' must be one of the allowed values`;+ if (fieldSchema?.enumNames && fieldSchema.enumNames.length > 0) {+ const options = fieldSchema.enumNames;+ const maxShow = 4; // Maximum options to show before truncating++ if (options.length <= maxShow) {+ // Show all options if list is small+ enumMessage = `'${fieldTitle}' must be one of: ${options.join(", ")}`;+ } else {+ // Truncate long lists with "and X others" suffix+ const firstFew = options.slice(0, maxShow).join(", ");+ const remaining = options.length - maxShow;+ enumMessage = `'${fieldTitle}' must be one of: ${firstFew} (and ${remaining} ${+ remaining === 1 ? "other" : "others"+ })`;+ }+ }+ return enumMessage;+ }, []);++ const transformErrors = useCallback(+ (errors) => {+ return errors.map((error) => {+ const { name, params, property } = error;++ // Try to resolve nested schema/title from property path like ".a.b[0].c"+ const path = (property || "").replace(/^\./, "");+ const getFieldSchema = (root, pathStr) => {+ if (!root || !pathStr) return undefined;+ const tokens = pathStr+ .replace(/\[(\d+)\]/g, ".$1")+ .split(".")+ .filter(Boolean);+ let cur = root;+ for (const tok of tokens) {+ if (cur?.type === "array" && cur?.items) {+ cur = cur.items;+ }+ if (cur?.properties?.[tok]) {+ cur = cur.properties[tok];+ }+ }+ return cur;+ };+ const schemaProps = schema?.properties ?? {};+ const fieldSchema = getFieldSchema(schema, path);+ const fieldName = path;+ const fieldTitle = fieldSchema?.title || fieldName || "This field";++ // Handle required fields separately (special case)+ if (name === "required") {+ const missingField = params?.missingProperty;+ const missingSchema = schemaProps[missingField];+ const missingTitle =+ missingSchema?.title || missingField || "This field";+ return {+ ...error,+ message: `'${missingTitle}' is required`,+ };+ }++ // Handle enum separately due to complexity+ if (name === "enum") {+ return {+ ...error,+ message: generateEnumMessage(fieldTitle, fieldSchema),+ };+ }++ // Use lookup table for simple cases+ const messageGenerator = validationMessageGenerators[name];+ if (messageGenerator) {+ return {+ ...error,+ message: messageGenerator(fieldTitle, params),+ };+ }++ // Default fallbackreturn {...error,- message: "This field is mandatory. Please provide a value.",+ message: error.stack?.trim()+ ? error.stack+ : `'${fieldTitle}': ${error.message}`,};- }- return error;- });- }, []);+ });+ },+ [schema, generateEnumMessage, validationMessageGenerators]+ );const handleChange = useCallback((event) => {@@ -133,7 +261,7 @@ function RjsfFormLayout({/>)}<Form- form={formRef}+ ref={formRef}schema={removeBlankDefault(formSchema)}uiSchema={uiSchema}validator={validator}diff --git a/frontend/src/pages/ConnectorsPage.jsx b/frontend/src/pages/ConnectorsPage.jsxindex 44f8c1776..658561df3 100644--- a/frontend/src/pages/ConnectorsPage.jsx+++ b/frontend/src/pages/ConnectorsPage.jsx@@ -163,6 +163,7 @@ function ConnectorsPage() {handleDelete={handleDeleteConnector}handleEdit={handleEditConnector}handleShare={handleShareConnector}+ setOpenAddTool={setModalVisible}idProp="id"titleProp="connector_name"descriptionProp="connector_type"