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-2611 [FEAT] Add confirmation modal to display existing API deployments before creating new deployment (#1428)
jagadeeswaran-zipstack0e2b1072954b
diff --git a/frontend/src/components/custom-tools/header/Header.css b/frontend/src/components/custom-tools/header/Header.cssindex 0875e8af8..88df4dd94 100644--- a/frontend/src/components/custom-tools/header/Header.css+++ b/frontend/src/components/custom-tools/header/Header.css@@ -39,3 +39,50 @@display: flex;align-items: center;}++/* API Deployment Confirmation Modal Styles */+.api-deployment-modal-content {+ margin-bottom: 16px;+}++.api-deployment-actions-list {+ padding-left: 20px;+ margin-bottom: 16px;+}++.api-deployment-notice {+ padding: 12px;+ background: #fff7e6;+ border: 1px solid #ffd591;+ border-radius: 6px;+ margin-bottom: 16px;+}++.api-deployment-notice-title {+ margin: 0 0 8px 0;+ font-weight: bold;+ color: #fa8c16;+}++.api-deployment-notice-description {+ margin: 0 0 8px 0;+ font-size: 14px;+}++.api-deployment-existing-section {+ font-size: 14px;+}++.api-deployment-existing-list {+ margin: 4px 0 0 0;+ padding-left: 16px;+}++.api-deployment-existing-item {+ margin-bottom: 2px;+}++.api-deployment-api-name {+ color: #666;+ font-size: 12px;+}diff --git a/frontend/src/components/custom-tools/header/Header.jsx b/frontend/src/components/custom-tools/header/Header.jsxindex 663a35c8a..19f8b9fa1 100644--- a/frontend/src/components/custom-tools/header/Header.jsx+++ b/frontend/src/components/custom-tools/header/Header.jsx@@ -58,6 +58,11 @@ function Header({const [lastExportParams, setLastExportParams] = useState(null);const [openCreateApiDeploymentModal, setOpenCreateApiDeploymentModal] =useState(false);+ const [+ apiDeploymentConfirmModalVisible,+ setApiDeploymentConfirmModalVisible,+ ] = useState(false);+ const [existingApiDeployments, setExistingApiDeployments] = useState([]);const handleExport = (selectedUsers,@@ -250,9 +255,32 @@ function Header({// If an error occurs while setting custom posthog event, ignore it and continue}- setOpenCreateApiDeploymentModal(true);+ // Check for existing API deployments before proceeding+ const path = `/api/v1/unstract/${sessionDetails.orgId}`;+ const requestOptions = {+ method: "GET",+ url: `${path}/api/deployment/`,+ };+ axiosPrivate(requestOptions)+ .then((response) => {+ const deployments = response?.data || [];+ setExistingApiDeployments(deployments);+ setApiDeploymentConfirmModalVisible(true);+ })+ .catch((err) => {+ setAlertDetails(+ handleException(err, "Failed to check existing deployments")+ );+ // If check fails, still allow proceeding+ setOpenCreateApiDeploymentModal(true);+ });};+ const handleConfirmApiDeployment = useCallback(() => {+ setApiDeploymentConfirmModalVisible(false);+ setOpenCreateApiDeploymentModal(true);+ }, []);+return (<div className="custom-tools-header-layout">{isPublicSource ? (@@ -342,6 +370,55 @@ function Header({before exporting.{" "}<strong>Would you like to force export anyway?</strong></Modal>+ <Modal+ onOk={handleConfirmApiDeployment}+ onCancel={() => setApiDeploymentConfirmModalVisible(false)}+ open={apiDeploymentConfirmModalVisible}+ title="Create API Deployment"+ okText="Proceed"+ centered+ width={600}+ >+ <div className="api-deployment-modal-content">+ <p>+ <strong>+ You are about to create a new API deployment for this tool.+ </strong>+ </p>+ </div>+ {existingApiDeployments.length > 0 && (+ <div className="api-deployment-notice">+ <p className="api-deployment-notice-title">+ Notice: You have {existingApiDeployments.length} existing API+ deployment{existingApiDeployments.length > 1 ? "s" : ""}+ </p>+ <p className="api-deployment-notice-description">+ Creating a new deployment will add another API endpoint. Consider+ managing existing deployments if needed.+ </p>+ <div className="api-deployment-existing-section">+ <strong>Existing deployments:</strong>+ <ul className="api-deployment-existing-list">+ {existingApiDeployments.map((deployment) => (+ <li+ key={deployment.id}+ className="api-deployment-existing-item"+ >+ {deployment.display_name}+ {deployment.api_name && (+ <span className="api-deployment-api-name">+ {" "}+ (API: {deployment.api_name})+ </span>+ )}+ </li>+ ))}+ </ul>+ </div>+ </div>+ )}+ <p>Do you want to proceed with creating the API deployment?</p>+ </Modal></div>);}