Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

UN-3097 [FIX] Fix logs screen pagination and other issues in card-based deployment layout (#1821)

Chandrasekharan M8a33c4392a45
diff --git a/frontend/src/components/agency/agency/Agency.jsx b/frontend/src/components/agency/agency/Agency.jsx
index fb6b9ee59..966b2e4fd 100644
--- a/frontend/src/components/agency/agency/Agency.jsx
+++ b/frontend/src/components/agency/agency/Agency.jsx
@@ -327,13 +327,14 @@ function Agency() {
return;
}
- const apiDeploymentData = apiDeployments?.data || [];
- const pipelineData = pipelines?.data || [];
+ const apiDeploymentData =
+ apiDeployments?.data?.results || apiDeployments?.data || [];
+ const pipelineData = pipelines?.data?.results || pipelines?.data || [];
- // Find active deployments
- const activeApiDeployment = apiDeploymentData.find(
- (deployment) => deployment.is_active,
- );
+ // Show banner for any API deployment linked to this workflow, prefer active one
+ const apiDeployment =
+ apiDeploymentData.find((deployment) => deployment.is_active) ||
+ apiDeploymentData[0];
// For pipelines, any pipeline associated with this workflow is considered a deployment
// regardless of active status, since workflows can only have one deployment
@@ -341,11 +342,11 @@ function Agency() {
// Set deployment info
let deploymentInfo = null;
- if (activeApiDeployment) {
+ if (apiDeployment) {
deploymentInfo = {
type: "API",
- name: activeApiDeployment.display_name,
- id: activeApiDeployment.id,
+ name: apiDeployment.display_name,
+ id: apiDeployment.id,
};
} else if (workflowPipelines.length > 0) {
// If multiple pipelines, prioritize by type: ETL > TASK
diff --git a/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx b/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx
index 7805e1640..e5033e05a 100644
--- a/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx
+++ b/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx
@@ -23,7 +23,6 @@ import { NotificationModal } from "../../pipelines-or-deployments/notification-m
import { SharePermission } from "../../widgets/share-permission/SharePermission";
import { workflowService } from "../../workflows/workflow/workflow-service.js";
import { CreateApiDeploymentModal } from "../create-api-deployment-modal/CreateApiDeploymentModal";
-import { DeleteModal } from "../delete-modal/DeleteModal";
import { DisplayCode } from "../display-code/DisplayCode";
import { Layout } from "../layout/Layout";
import { ManageKeys } from "../manage-keys/ManageKeys";
@@ -38,7 +37,6 @@ function ApiDeployment() {
const workflowApiService = workflowService();
const [isTableLoading, setIsTableLoading] = useState(true);
const [openAddApiModal, setOpenAddApiModal] = useState(false);
- const [openDeleteModal, setOpenDeleteModal] = useState(false);
const [openCodeModal, setOpenCodeModal] = useState(false);
const [openManageKeysModal, setOpenManageKeysModal] = useState(false);
const [selectedRow, setSelectedRow] = useState({});
@@ -164,11 +162,11 @@ function ApiDeployment() {
fetchListRef.current = getApiDeploymentList;
- const deleteApiDeployment = () => {
+ const deleteApiDeployment = (item) => {
+ const id = item?.id || selectedRow.id;
apiDeploymentsApiService
- .deleteApiDeployment(selectedRow.id)
- .then((res) => {
- setOpenDeleteModal(false);
+ .deleteApiDeployment(id)
+ .then(() => {
getApiDeploymentList(
pagination.current,
pagination.pageSize,
@@ -215,8 +213,8 @@ function ApiDeployment() {
openAddModal(true);
};
- const handleDeleteDeployment = () => {
- setOpenDeleteModal(true);
+ const handleDeleteDeployment = (item) => {
+ deleteApiDeployment(item);
};
const handleViewLogsDeployment = (deployment) => {
@@ -306,6 +304,7 @@ function ApiDeployment() {
pageSize: pagination.pageSize,
total: pagination.total,
onChange: handlePaginationChange,
+ itemLabel: "APIs",
}}
/>
{openAddApiModal && (
@@ -320,11 +319,6 @@ function ApiDeployment() {
workflowEndpointList={workflowEndpointList}
/>
)}
- <DeleteModal
- open={openDeleteModal}
- setOpen={setOpenDeleteModal}
- deleteRecord={deleteApiDeployment}
- />
<ManageKeys
isDialogOpen={openManageKeysModal}
setDialogOpen={setOpenManageKeysModal}
diff --git a/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx b/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx
index f6fc25ae5..8562b3264 100644
--- a/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx
+++ b/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx
@@ -25,7 +25,7 @@ const CreateApiDeploymentModal = ({
openCodeModal,
setSelectedRow,
workflowId,
- workflowEndpointList,
+ workflowEndpointList = [],
setDeploymentName,
onDeploymentCreated,
}) => {
@@ -83,7 +83,7 @@ const CreateApiDeploymentModal = ({
};
const createApiDeployment = () => {
- const wf = workflowEndpointList.find(
+ const wf = workflowEndpointList?.find(
(item) => item?.workflow === formDetails?.workflow,
);
setPostHogCustomEvent("intent_success_api_deployment", {
@@ -262,7 +262,7 @@ const CreateApiDeploymentModal = ({
help={getBackendErrorDetail("workflow", backendErrors)}
>
<Select>
- {workflowEndpointList.map((endpoint) => {
+ {workflowEndpointList?.map((endpoint) => {
return (
<Option
value={endpoint.workflow}
diff --git a/frontend/src/components/logging/execution-logs/ExecutionLogs.jsx b/frontend/src/components/logging/execution-logs/ExecutionLogs.jsx
index 10aa141c0..0f33f72c2 100644
--- a/frontend/src/components/logging/execution-logs/ExecutionLogs.jsx
+++ b/frontend/src/components/logging/execution-logs/ExecutionLogs.jsx
@@ -103,6 +103,7 @@ function ExecutionLogs() {
];
const onChange = (key) => {
navigate(`/${sessionDetails?.orgName}/logs`);
+ setPagination((prev) => ({ ...prev, current: 1 }));
setActiveTab(key);
};
const onOk = (value) => {
diff --git a/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx b/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx
index 67acbf4e7..46a49eb7a 100644
--- a/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx
+++ b/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx
@@ -10,7 +10,6 @@ import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate.js";
import { useAlertStore } from "../../../store/alert-store.js";
import { useSessionStore } from "../../../store/session-store.js";
import { Layout } from "../../deployments/layout/Layout.jsx";
-import { DeleteModal } from "../delete-modal/DeleteModal.jsx";
import { EtlTaskDeploy } from "../etl-task-deploy/EtlTaskDeploy.jsx";
import FileHistoryModal from "../file-history-modal/FileHistoryModal.jsx";
import { LogsModal } from "../log-modal/LogsModal.jsx";
@@ -38,7 +37,6 @@ import { createPipelineCardConfig } from "./PipelineCardConfig.jsx";
function Pipelines({ type }) {
const [tableData, setTableData] = useState([]);
const [openEtlOrTaskModal, setOpenEtlOrTaskModal] = useState(false);
- const [openDeleteModal, setOpenDeleteModal] = useState(false);
const [selectedPorD, setSelectedPorD] = useState({});
const [tableLoading, setTableLoading] = useState(true);
const { sessionDetails } = useSessionStore();
@@ -169,24 +167,16 @@ function Pipelines({ type }) {
const handleSync = (params) => {
const body = { ...params, pipeline_type: type.toUpperCase() };
const pipelineId = params?.pipeline_id;
- const fieldsToUpdate = {
- last_run_status: "processing",
- };
- handleLoaderInTableData(fieldsToUpdate, pipelineId);
handleSyncApiReq(body)
.then((res) => {
- const data = res?.data?.pipeline;
- fieldsToUpdate.last_run_status = data?.last_run_status;
- fieldsToUpdate.last_run_time = data?.last_run_time;
+ const pipelineData = res?.data?.pipeline;
+ if (pipelineData) {
+ handleLoaderInTableData(pipelineData, pipelineId);
+ }
})
.catch((err) => {
setAlertDetails(handleException(err, "Failed to sync."));
- fieldsToUpdate.last_run_status = "FAILURE";
- fieldsToUpdate.last_run_time = new Date().toISOString();
- })
- .finally(() => {
- handleLoaderInTableData(fieldsToUpdate, pipelineId);
});
};
@@ -240,18 +230,17 @@ function Pipelines({ type }) {
});
};
- const deletePipeline = () => {
+ const deletePipeline = (item) => {
+ const id = item?.id || selectedPorD.id;
const requestOptions = {
method: "DELETE",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/pipeline/${selectedPorD.id}/`,
+ url: `/api/v1/unstract/${sessionDetails?.orgId}/pipeline/${id}/`,
headers: {
"X-CSRFToken": sessionDetails?.csrfToken,
},
};
axiosPrivate(requestOptions)
.then(() => {
- setOpenDeleteModal(false);
- // Refresh with current pagination
getPipelineList(pagination.current, pagination.pageSize, searchTerm);
setAlertDetails({
type: "success",
@@ -265,10 +254,7 @@ function Pipelines({ type }) {
const clearFileMarkers = async (workflowId) => {
const id = workflowId || selectedPorD?.workflow_id;
- const success = await clearFileHistory(id);
- if (success && openDeleteModal) {
- setOpenDeleteModal(false);
- }
+ await clearFileHistory(id);
};
// Handlers for icon actions (top-right)
@@ -276,8 +262,8 @@ function Pipelines({ type }) {
openAddModal(true);
};
- const handleDeletePipeline = () => {
- setOpenDeleteModal(true);
+ const handleDeletePipeline = (item) => {
+ deletePipeline(item);
};
// Handlers for expanded view actions
@@ -394,6 +380,7 @@ function Pipelines({ type }) {
pageSize: pagination.pageSize,
total: pagination.total,
onChange: handlePaginationChange,
+ itemLabel: "pipelines",
}}
/>
{openEtlOrTaskModal && (
@@ -416,11 +403,6 @@ function Pipelines({ type }) {
fetchExecutionLogs={handleFetchLogs}
loading={isFetchingLogs}
/>
- <DeleteModal
- open={openDeleteModal}
- setOpen={setOpenDeleteModal}
- deleteRecord={deletePipeline}
- />
<ManageKeys
isDialogOpen={openManageKeysModal}
setDialogOpen={setOpenManageKeysModal}
diff --git a/frontend/src/components/widgets/card-grid-view/CardFieldComponents.jsx b/frontend/src/components/widgets/card-grid-view/CardFieldComponents.jsx
index f5e215880..dbc2f7a94 100644
--- a/frontend/src/components/widgets/card-grid-view/CardFieldComponents.jsx
+++ b/frontend/src/components/widgets/card-grid-view/CardFieldComponents.jsx
@@ -293,16 +293,6 @@ function ApiEndpointSection({ apiEndpoint }) {
return null;
}
- // Validate URL scheme to prevent javascript: or other malicious protocols
- const isValidUrl = (() => {
- try {
- const parsed = new URL(apiEndpoint, globalThis.location.origin);
- return ["http:", "https:"].includes(parsed.protocol);
- } catch {
- return false;
- }
- })();
-
return (
<div className="card-list-endpoint-wrapper">
<Card size="small" className="card-list-endpoint-row">
@@ -312,19 +302,9 @@ function ApiEndpointSection({ apiEndpoint }) {
</Typography.Text>
<div className="card-list-endpoint-value">
<Tooltip title={apiEndpoint} overlayStyle={{ maxWidth: 500 }}>
- {isValidUrl ? (
- <Typography.Link
- href={apiEndpoint}
- target="_blank"
- onClick={(e) => e.stopPropagation()}
- >
- {shortenApiEndpoint(apiEndpoint)}
- </Typography.Link>
- ) : (
- <Typography.Text>
- {shortenApiEndpoint(apiEndpoint)}
- </Typography.Text>
- )}
+ <Typography.Text>
+ {shortenApiEndpoint(apiEndpoint)}
+ </Typography.Text>
</Tooltip>
<Tooltip title="Copy endpoint">
<Button
diff --git a/frontend/src/components/widgets/card-grid-view/CardGridView.jsx b/frontend/src/components/widgets/card-grid-view/CardGridView.jsx
index 703f83edd..61207ff03 100644
--- a/frontend/src/components/widgets/card-grid-view/CardGridView.jsx
+++ b/frontend/src/components/widgets/card-grid-view/CardGridView.jsx
@@ -143,7 +143,7 @@ function CardGridView({
showSizeChanger
pageSizeOptions={["10", "20", "50"]}
showTotal={(total, range) =>
- `${range[0]}-${range[1]} of ${total} items`
+ `${range[0]}-${range[1]} of ${total} ${pagination.itemLabel || "items"}`
}
/>
</Flex>
@@ -196,6 +196,7 @@ CardGridView.propTypes = {
pageSize: PropTypes.number,
total: PropTypes.number,
onChange: PropTypes.func,
+ itemLabel: PropTypes.string,
}),
};
diff --git a/unstract/connectors/src/unstract/connectors/filesystems/azure_cloud_storage/exceptions.py b/unstract/connectors/src/unstract/connectors/filesystems/azure_cloud_storage/exceptions.py
index 519fe1394..960cd9842 100644
--- a/unstract/connectors/src/unstract/connectors/filesystems/azure_cloud_storage/exceptions.py
+++ b/unstract/connectors/src/unstract/connectors/filesystems/azure_cloud_storage/exceptions.py
@@ -24,28 +24,23 @@ def parse_azure_error(e: Exception) -> ConnectorError:
client_error = e.message if hasattr(e, "message") else str(e)
error_message += (
f"Authentication failed. Please check your connection credentials. \n"
- f"Error: \n```\n{client_error}\n```"
+ f"```\n{client_error}\n```"
)
# ClientAuthenticationError typically indicates 401 Unauthorized
status_code = getattr(e, "status_code", None) or 401
return ConnectorError(error_message, status_code=status_code)
elif isinstance(e, AzureException.ServiceRequestError):
client_error = e.message if hasattr(e, "message") else str(e)
- error_message += (
- f"Failed to connect to Azure service. \n" f"Error: \n```\n{client_error}\n```"
- )
+ error_message += f"Failed to connect to Azure service. \n```\n{client_error}\n```"
return ConnectorError(error_message)
elif isinstance(e, AzureException.HttpResponseError):
client_error = e.message if hasattr(e, "message") else str(e)
error_message += (
- f"Azure service returned an error response. \n"
- f"Error: \n```\n{client_error}\n```"
+ f"Azure service returned an error response. \n```\n{client_error}\n```"
)
# Preserve the HTTP status code from Azure's response
status_code = getattr(e, "status_code", None)
return AzureHttpError(error_message, status_code=status_code)
else:
- error_message += (
- f"Error from Azure Cloud Storage. \n" f"Error: \n```\n{str(e)}\n```"
- )
+ error_message += f"Error from Azure Cloud Storage. \n```\n{str(e)}\n```"
return ConnectorError(error_message)