LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
feat/API-deployment-logs (#375)
Athul94e423db2e2c
diff --git a/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx b/frontend/src/components/deployments/api-deployment/ApiDeployment.jsxindex b9bf99c80..eefebdde0 100644--- a/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx+++ b/frontend/src/components/deployments/api-deployment/ApiDeployment.jsx@@ -6,6 +6,7 @@ import {EllipsisOutlined,KeyOutlined,CloudDownloadOutlined,+ FileSearchOutlined,} from "@ant-design/icons";import { Button, Dropdown, Space, Switch, Tooltip, Typography } from "antd";import { useEffect, useState } from "react";@@ -22,6 +23,9 @@ import { Layout } from "../layout/Layout";import { ManageKeys } from "../manage-keys/ManageKeys";import { apiDeploymentsService } from "./api-deployments-service";import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";+import { LogsModal } from "../../pipelines-or-deployments/log-modal/LogsModal.jsx";+import { fetchExecutionLogs } from "../../pipelines-or-deployments/log-modal/fetchExecutionLogs";+import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate.js";function ApiDeployment() {const { sessionDetails } = useSessionStore();@@ -40,6 +44,25 @@ function ApiDeployment() {const [isEdit, setIsEdit] = useState(false);const [workflowEndpointList, setWorkflowEndpointList] = useState([]);const handleException = useExceptionHandler();+ const [openLogsModal, setOpenLogsModal] = useState(false);+ const [executionLogs, setExecutionLogs] = useState([]);+ const [executionLogsTotalCount, setExecutionLogsTotalCount] = useState(0);+ const axiosPrivate = useAxiosPrivate();++ const handleFetchLogs = (page, pageSize) => {+ fetchExecutionLogs(+ axiosPrivate,+ handleException,+ sessionDetails,+ selectedRow,+ setExecutionLogs,+ setExecutionLogsTotalCount,+ setAlertDetails,+ page,+ pageSize+ );+ };+const columns = [{title: "API Name",@@ -342,6 +365,34 @@ function ApiDeployment() {},{key: "5",+ label: (+ <Space+ direction="horizontal"+ className="action-items"+ onClick={() => {+ setOpenLogsModal(true);+ fetchExecutionLogs(+ axiosPrivate,+ handleException,+ sessionDetails,+ selectedRow,+ setExecutionLogs,+ setExecutionLogsTotalCount,+ setAlertDetails+ );+ }}+ >+ <div>+ <FileSearchOutlined />+ </div>+ <div>+ <Typography.Text>View Logs</Typography.Text>+ </div>+ </Space>+ ),+ },+ {+ key: "6",label: (<Spacedirection="horizontal"@@ -397,6 +448,13 @@ function ApiDeployment() {setDialogOpen={setOpenCodeModal}url={displayURL(selectedRow?.api_endpoint)}/>+ <LogsModal+ open={openLogsModal}+ setOpen={setOpenLogsModal}+ logRecord={executionLogs}+ totalLogs={executionLogsTotalCount}+ fetchExecutionLogs={handleFetchLogs}+ /></>);}diff --git a/frontend/src/components/pipelines-or-deployments/log-modal/LogsModal.jsx b/frontend/src/components/pipelines-or-deployments/log-modal/LogsModal.jsxindex f8d520fbb..a41f9e041 100644--- a/frontend/src/components/pipelines-or-deployments/log-modal/LogsModal.jsx+++ b/frontend/src/components/pipelines-or-deployments/log-modal/LogsModal.jsx@@ -128,7 +128,6 @@ const LogsModal = ({rowKey="id"align="left"pagination={{- pageSize: 10,total: totalLogs,onChange: (page, pageSize) => {fetchExecutionLogs(page, pageSize);diff --git a/frontend/src/components/pipelines-or-deployments/log-modal/fetchExecutionLogs.js b/frontend/src/components/pipelines-or-deployments/log-modal/fetchExecutionLogs.jsnew file mode 100644index 000000000..ffed6034a--- /dev/null+++ b/frontend/src/components/pipelines-or-deployments/log-modal/fetchExecutionLogs.js@@ -0,0 +1,40 @@+const fetchExecutionLogs = (+ axiosPrivate,+ handleException,+ sessionDetails,+ selectedRow,+ setExecutionLogs,+ setExecutionLogsTotalCount,+ setAlertDetails,+ page = 1,+ pageSize = 10+) => {+ const requestOptions = {+ method: "GET",+ url: `/api/v1/unstract/${sessionDetails?.orgId}/pipeline/${selectedRow.id}/executions/`,+ headers: {+ "X-CSRFToken": sessionDetails?.csrfToken,+ },+ params: {+ page: page,+ page_size: pageSize,+ },+ };++ axiosPrivate(requestOptions)+ .then((res) => {+ const logs = res?.data?.results?.map((result) => ({+ created_at: result.created_at,+ execution_id: result.id,+ status: result.status,+ execution_time: result.execution_time,+ }));+ setExecutionLogs(logs);+ setExecutionLogsTotalCount(res.data.count);+ })+ .catch((err) => {+ setAlertDetails(handleException(err));+ });+};++export { fetchExecutionLogs };diff --git a/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx b/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsxindex 7fcaa9ea4..dd7318fe1 100644--- a/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx+++ b/frontend/src/components/pipelines-or-deployments/pipelines/Pipelines.jsx@@ -38,6 +38,21 @@ function Pipelines({ type }) {const [openLogsModal, setOpenLogsModal] = useState(false);const [executionLogs, setExecutionLogs] = useState([]);const [executionLogsTotalCount, setExecutionLogsTotalCount] = useState(0);+ const { fetchExecutionLogs } = require("../log-modal/fetchExecutionLogs.js");++ const handleFetchLogs = (page, pageSize) => {+ fetchExecutionLogs(+ axiosPrivate,+ handleException,+ sessionDetails,+ selectedPorD,+ setExecutionLogs,+ setExecutionLogsTotalCount,+ setAlertDetails,+ page,+ pageSize+ );+ };useEffect(() => {getPipelineList();@@ -216,34 +231,6 @@ function Pipelines({ type }) {});};- const fetchExecutionLogs = (page = 1, pageSize = 10) => {- const requestOptions = {- method: "GET",- url: `/api/v1/unstract/${sessionDetails?.orgId}/pipeline/${selectedPorD.id}/executions/`,- headers: {- "X-CSRFToken": sessionDetails?.csrfToken,- },- params: {- page: page,- page_size: pageSize,- },- };- axiosPrivate(requestOptions)- .then((res) => {- const logs = res?.data?.results?.map((result) => ({- created_at: result.created_at,- execution_id: result.id,- status: result.status,- execution_time: result.execution_time,- }));- setExecutionLogs(logs);- setExecutionLogsTotalCount(res.data.count);- })- .catch((err) => {- setAlertDetails(handleException(err));- });- };-const clearCache = () => {const requestOptions = {method: "GET",@@ -312,7 +299,15 @@ function Pipelines({ type }) {className="action-items"onClick={() => {setOpenLogsModal(true);- fetchExecutionLogs();+ fetchExecutionLogs(+ axiosPrivate,+ handleException,+ sessionDetails,+ selectedPorD,+ setExecutionLogs,+ setExecutionLogsTotalCount,+ setAlertDetails+ );}}><div>@@ -533,7 +528,7 @@ function Pipelines({ type }) {setOpen={setOpenLogsModal}logRecord={executionLogs}totalLogs={executionLogsTotalCount}- fetchExecutionLogs={fetchExecutionLogs}+ fetchExecutionLogs={handleFetchLogs}/><DeleteModalopen={openDeleteModal}