Skip to content

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

[FEAT] File Centric Logging UI (#1139)

jagadeeswaran-zipstack72000ab72c3b
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index b566f0ef2..5daba5925 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -26,6 +26,7 @@
"axios": "^1.4.0",
"cron-validator": "^1.3.1",
"cronstrue": "^2.48.0",
+ "date-fns": "^4.1.0",
"emoji-picker-react": "^4.8.0",
"emoji-regex": "^10.3.0",
"file-saver": "^2.0.5",
@@ -7625,18 +7626,12 @@
}
},
"node_modules/date-fns": {
- "version": "2.30.0",
- "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
- "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",
- "dependencies": {
- "@babel/runtime": "^7.21.0"
- },
- "engines": {
- "node": ">=0.11"
- },
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz",
+ "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==",
"funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/date-fns"
+ "type": "github",
+ "url": "https://github.com/sponsors/kossnocorp"
}
},
"node_modules/dayjs": {
@@ -16917,6 +16912,21 @@
"react-dom": ">=16.9.0"
}
},
+ "node_modules/rc-picker/node_modules/date-fns": {
+ "version": "2.30.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
+ "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",
+ "dependencies": {
+ "@babel/runtime": "^7.21.0"
+ },
+ "engines": {
+ "node": ">=0.11"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/date-fns"
+ }
+ },
"node_modules/rc-progress": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/rc-progress/-/rc-progress-3.5.1.tgz",
@@ -26322,12 +26332,9 @@
}
},
"date-fns": {
- "version": "2.30.0",
- "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
- "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",
- "requires": {
- "@babel/runtime": "^7.21.0"
- }
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz",
+ "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg=="
},
"dayjs": {
"version": "1.11.10",
@@ -32907,6 +32914,16 @@
"rc-trigger": "^5.0.4",
"rc-util": "^5.37.0",
"shallowequal": "^1.1.0"
+ },
+ "dependencies": {
+ "date-fns": {
+ "version": "2.30.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
+ "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",
+ "requires": {
+ "@babel/runtime": "^7.21.0"
+ }
+ }
}
},
"rc-progress": {
diff --git a/frontend/package.json b/frontend/package.json
index 101b61d62..4b196cfd4 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -21,6 +21,7 @@
"axios": "^1.4.0",
"cron-validator": "^1.3.1",
"cronstrue": "^2.48.0",
+ "date-fns": "^4.1.0",
"emoji-picker-react": "^4.8.0",
"emoji-regex": "^10.3.0",
"file-saver": "^2.0.5",
diff --git a/frontend/src/assets/index.js b/frontend/src/assets/index.js
index 5115b0663..9375b0e4a 100644
--- a/frontend/src/assets/index.js
+++ b/frontend/src/assets/index.js
@@ -14,6 +14,8 @@ import { ReactComponent as UnstractLogo } from "./Unstract.svg";
import { ReactComponent as ListOfWfStepsPlaceholder } from "./list-of-wf-steps-placeholder.svg";
import { ReactComponent as ListOfToolsPlaceholder } from "./list-of-tools-placeholder.svg";
import { ReactComponent as ApiDeployments } from "./api-deployments.svg";
+import { ReactComponent as Workflows } from "./Workflows.svg";
+import { ReactComponent as Task } from "./task.svg";
import { ReactComponent as StepIcon } from "./steps.svg";
import { ReactComponent as CombinedOutputIcon } from "./combined-output.svg";
import { ReactComponent as EmptyPlaceholder } from "./empty.svg";
@@ -32,6 +34,8 @@ import { ReactComponent as RedGradCircle } from "./red-grad-circle.svg";
import { ReactComponent as YellowGradCircle } from "./yellow-grad-circle.svg";
import { ReactComponent as ExportToolIcon } from "./export-tool.svg";
import { ReactComponent as PlaceholderImg } from "./placeholder.svg";
+import { ReactComponent as CustomToolIcon } from "./custom-tools-icon.svg";
+import { ReactComponent as ETLIcon } from "./etl.svg";
export {
SunIcon,
@@ -50,6 +54,7 @@ export {
ListOfWfStepsPlaceholder,
ListOfToolsPlaceholder,
ApiDeployments,
+ Workflows,
StepIcon,
EmptyPlaceholder,
CombinedOutputIcon,
@@ -68,4 +73,7 @@ export {
YellowGradCircle,
ExportToolIcon,
PlaceholderImg,
+ CustomToolIcon,
+ ETLIcon,
+ Task,
};
diff --git a/frontend/src/assets/terminal.svg b/frontend/src/assets/terminal.svg
new file mode 100644
index 000000000..364fd62b0
--- /dev/null
+++ b/frontend/src/assets/terminal.svg
@@ -0,0 +1,3 @@
+<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M3.67208 16.0986C3.27833 16.0986 2.94313 15.9602 2.66646 15.6836C2.38993 15.407 2.25167 15.0718 2.25167 14.6779V5.32211C2.25167 4.92823 2.38993 4.59302 2.66646 4.31649C2.94313 4.03982 3.27833 3.90149 3.67208 3.90149H16.3279C16.7217 3.90149 17.0569 4.03982 17.3335 4.31649C17.6101 4.59302 17.7483 4.92823 17.7483 5.32211V14.6779C17.7483 15.0718 17.6101 15.407 17.3335 15.6836C17.0569 15.9602 16.7217 16.0986 16.3279 16.0986H3.67208ZM3.67396 14.9327H16.326C16.3902 14.9327 16.449 14.906 16.5025 14.8525C16.5558 14.7992 16.5825 14.7404 16.5825 14.6763V6.70045H3.4175V14.6763C3.4175 14.7404 3.44417 14.7992 3.4975 14.8525C3.55097 14.906 3.60979 14.9327 3.67396 14.9327ZM6.25 13.7925L5.44063 12.9832L7.58646 10.8165L5.41979 8.64982L6.25 7.83649L9.23 10.8165L6.25 13.7925ZM10.2525 13.8975V12.7317H14.7517V13.8975H10.2525Z" fill="#90A4B7"/>
+</svg>
diff --git a/frontend/src/components/logging/detailed-logs/DetailedLogs.css b/frontend/src/components/logging/detailed-logs/DetailedLogs.css
new file mode 100644
index 000000000..a047dc690
--- /dev/null
+++ b/frontend/src/components/logging/detailed-logs/DetailedLogs.css
@@ -0,0 +1,34 @@
+.logging-card-title {
+ font-weight: 600;
+ font-size: 14px;
+}
+
+.logs-details-card {
+ width: 250px;
+ margin: 0;
+ padding: 0;
+ height: 60px;
+ margin-right: 20px;
+}
+
+.logging-card-icons {
+ margin: 0 12px;
+}
+
+.view-log-button {
+ margin-right: 20px;
+}
+
+.column-filter-dropdown{
+ margin-bottom: 20px;
+}
+
+.search-container {
+ padding: 8px;
+}
+
+.search-input {
+ width: 188px;
+ margin-bottom: 8px;
+ display: block;
+}
diff --git a/frontend/src/components/logging/detailed-logs/DetailedLogs.jsx b/frontend/src/components/logging/detailed-logs/DetailedLogs.jsx
new file mode 100644
index 000000000..612d2f103
--- /dev/null
+++ b/frontend/src/components/logging/detailed-logs/DetailedLogs.jsx
@@ -0,0 +1,442 @@
+import { useEffect, useState } from "react";
+import { useNavigate, useParams } from "react-router-dom";
+import {
+ ArrowLeftOutlined,
+ CalendarOutlined,
+ ClockCircleOutlined,
+ CloseCircleFilled,
+ DownOutlined,
+ EyeOutlined,
+ FileTextOutlined,
+ HourglassOutlined,
+ InfoCircleFilled,
+ SearchOutlined,
+} from "@ant-design/icons";
+import {
+ Button,
+ Card,
+ Checkbox,
+ Dropdown,
+ Flex,
+ Table,
+ Tooltip,
+ Typography,
+ Input,
+} from "antd";
+
+import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
+import { useSessionStore } from "../../../store/session-store";
+import { useAlertStore } from "../../../store/alert-store";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
+import "./DetailedLogs.css";
+import {
+ formattedDateTime,
+ formattedDateTimeWithSeconds,
+} from "../../../helpers/GetStaticData";
+import { LogModal } from "../log-modal/LogModal";
+import { FilterIcon } from "../filter-dropdown/FilterDropdown";
+import useRequestUrl from "../../../hooks/useRequestUrl";
+
+const DetailedLogs = () => {
+ const { id, type } = useParams(); // Get the ID from the URL
+ const axiosPrivate = useAxiosPrivate();
+ const { sessionDetails } = useSessionStore();
+ const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
+ const navigate = useNavigate();
+ const { getUrl } = useRequestUrl();
+
+ const [executionDetails, setExecutionDetails] = useState();
+ const [executionFiles, setExecutionFiles] = useState();
+ const [loading, setLoading] = useState();
+ const [pagination, setPagination] = useState({
+ current: 1,
+ pageSize: 10,
+ total: 0,
+ });
+ const [logDescModalOpen, setLogDescModalOpen] = useState(false);
+ const [selectedRecord, setSelectedRecord] = useState(null);
+ const [ordering, setOrdering] = useState(null);
+ const [columnsVisibility, setColumnsVisibility] = useState({});
+ const [statusFilter, setStatusFilter] = useState(null);
+ const [searchText, setSearchText] = useState("");
+ const [searchTimeout, setSearchTimeout] = useState(null);
+
+ const filterOptions = ["COMPLETED", "PENDING", "ERROR", "EXECUTING"];
+
+ const fetchExecutionDetails = async (id) => {
+ try {
+ const url = getUrl(`/execution/${id}/`);
+ const response = await axiosPrivate.get(url);
+ const item = response?.data;
+ const total = item?.total_files || 0;
+ const processed =
+ (item?.successful_files || 0) + (item?.failed_files || 0);
+ const progress = total > 0 ? Math.round((processed / total) * 100) : 0;
+ const formattedData = {
+ executedAt: formattedDateTime(item?.created_at),
+ executionId: item?.id,
+ progress,
+ processed,
+ total,
+ status: item?.status,
+ executionName: item?.workflow_name,
+ ranFor: item?.execution_time,
+ executedAtWithSeconds: formattedDateTimeWithSeconds(item?.created_at),
+ successfulFiles: item?.successful_files,
+ failedFiles: item?.failed_files,
+ totalFiles: item?.total_files,
+ };
+
+ setExecutionDetails(formattedData);
+ } catch (err) {
+ setAlertDetails(handleException(err));
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const fetchExecutionFiles = async (id, page, customParams = null) => {
+ try {
+ const url = getUrl(`/execution/${id}/files/`);
+ const defaultParams = {
+ page_size: pagination.pageSize,
+ page,
+ ordering,
+ status: statusFilter || null,
+ file_name: searchText.trim() || null,
+ };
+
+ const params = customParams || defaultParams;
+ const response = await axiosPrivate.get(url, { params });
+ setPagination({
+ current: page,
+ pageSize: pagination.pageSize,
+ total: response?.data?.count,
+ });
+ const formattedData = response?.data?.results.map((item, index) => {
+ return {
+ key: `${index.toString()}-${item?.id}`,
+ fileName: item?.file_name,
+ statusMessage: item?.status_msg || "Yet to be processed",
+ fileSize: item?.file_size,
+ status: item?.status,
+ executedAt: formattedDateTime(item?.created_at),
+ executionTime: item?.execution_time,
+ executionId: item?.id,
+ executedAtWithSeconds: formattedDateTimeWithSeconds(item?.created_at),
+ filePath: item?.file_path,
+ };
+ });
+
+ setExecutionFiles(formattedData);
+ } catch (err) {
+ setAlertDetails(handleException(err));
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const handleSearch = (value) => {
+ if (searchTimeout) {
+ clearTimeout(searchTimeout);
+ }
+
+ setSearchText(value);
+
+ const timeoutId = setTimeout(() => {
+ const params = {
+ page_size: pagination.pageSize,
+ page: pagination.current,
+ ordering,
+ status: statusFilter || null,
+ file_name: value.trim() || null,
+ };
+ fetchExecutionFiles(id, pagination.current, params);
+ }, 1000);
+
+ setSearchTimeout(timeoutId);
+ };
+
+ useEffect(() => {
+ return () => {
+ if (searchTimeout) {
+ clearTimeout(searchTimeout);
+ }
+ };
+ }, [searchTimeout]);
+
+ const columnsDetailedTable = [
+ {
+ title: "Executed At",
+ dataIndex: "executedAt",
+ key: "executedAt",
+ sorter: true,
+ render: (_, record) => (
+ <Tooltip title={record.executedAtWithSeconds}>
+ {record.executedAt}
+ </Tooltip>
+ ),
+ },
+ {
+ title: "File Name",
+ dataIndex: "fileName",
+ key: "fileName",
+ filterDropdown: () => (
+ <div className="search-container">
+ <Input
+ placeholder="Search files"
+ value={searchText}
+ onChange={(e) => handleSearch(e.target.value)}
+ className="search-input"
+ />
+ </div>
+ ),
+ filterIcon: (filtered) => (
+ <SearchOutlined style={{ color: filtered ? "#1890ff" : undefined }} />
+ ),
+ },
+ {
+ title: "Status Message",
+ dataIndex: "statusMessage",
+ key: "statusMessage",
+ },
+ {
+ title: "Status",
+ dataIndex: "status",
+ key: "status",
+ filters: filterOptions.map((filter) => ({
+ text: filter,
+ value: filter,
+ })),
+ filterIcon: (filtered) => <FilterIcon filtered={filtered} />,
+ },
+ {
+ title: "File Size",
+ dataIndex: "fileSize",
+ key: "fileSize",
+ },
+ {
+ title: "Execution Time",
+ dataIndex: "executionTime",
+ key: "executionTime",
+ },
+ ...(type !== "API"
+ ? [
+ {
+ title: "File Path",
+ dataIndex: "filePath",
+ key: "filePath",
+ },
+ ]
+ : []),
+ {
+ title: "Action",
+ dataIndex: "action",
+ key: "action",
+ render: (_, record) => (
+ <Tooltip title="View logs">
+ <Button
+ icon={<EyeOutlined />}
+ onClick={() => handleLogsModalOpen(record)}
+ ></Button>
+ </Tooltip>
+ ),
+ },
+ ];
+
+ const handleTableChange = (pagination, filters, sorter) => {
+ setPagination((prev) => {
+ return { ...prev, ...pagination };
+ });
+
+ if (sorter.order) {
+ const order = sorter.order === "ascend" ? "created_at" : "-created_at";
+ setOrdering(order);
+ } else {
+ setOrdering(null);
+ }
+ if (filters?.status) {
+ setStatusFilter(filters.status);
+ } else {
+ setStatusFilter(null);
+ }
+ };
+
+ const handleLogsModalOpen = (record) => {
+ setLogDescModalOpen(true);
+ setSelectedRecord(record);
+ };
+
+ useEffect(() => {
+ fetchExecutionDetails(id);
+ fetchExecutionFiles(id, pagination.current);
+ }, [pagination.current, ordering, statusFilter]);
+
+ useEffect(() => {
+ let interval = null;
+ if (executionDetails?.status === "EXECUTING") {
+ interval = setInterval(() => {
+ fetchExecutionDetails(id);
+ fetchExecutionFiles(id, pagination.current);
+ }, 5000);
+ }
+ return () => {
+ if (interval) {
+ clearInterval(interval);
+ }
+ };
+ }, [executionDetails?.status, id, pagination.current]);
+
+ useEffect(() => {
+ const initialColumns = columnsDetailedTable.reduce((acc, col) => {
+ acc[col.key] = true;
+ return acc;
+ }, {});
+ setColumnsVisibility(initialColumns);
+ }, []);
+
+ const handleColumnToggle = (key) => {
+ setColumnsVisibility((prev) => ({
+ ...prev,
+ [key]: !prev[key],
+ }));
+ };
+ const columnsToShow = columnsDetailedTable.filter(
+ (col) => columnsVisibility[col.key]
+ );
+ const menu = {
+ items: columnsDetailedTable.map((col) => ({
+ key: col.key,
+ label: (
+ <Checkbox
+ checked={columnsVisibility[col.key]}
+ onChange={() => handleColumnToggle(col.key)}
+ >
+ {col.title}
+ </Checkbox>
+ ),
+ })),
+ };
+
+ return (
+ <>
+ <Typography.Title className="logs-title" level={4}>
+ <Button
+ type="text"
+ shape="circle"
+ icon={<ArrowLeftOutlined />}
+ onClick={() => navigate(`/${sessionDetails?.orgName}/logs`)}
+ />
+ {type} Session ID - {id}{" "}
+ </Typography.Title>
+ <Flex align="center" justify="space-between">
+ <Flex className="pad-12">
+ <Card className="logs-details-card">
+ <Flex justify="flex-start" align="center">
+ <CalendarOutlined className="logging-card-icons" />
+ <div>
+ <Typography className="logging-card-title">Started</Typography>
+ <Tooltip title={executionDetails?.executedAtWithSeconds}>
+ <Typography>{executionDetails?.executedAt}</Typography>
+ </Tooltip>
+ </div>
+ </Flex>
+ </Card>
+ <Card className="logs-details-card">
+ <Flex justify="flex-start" align="center">
+ <ClockCircleOutlined className="logging-card-icons" />
+ <div>
+ <Typography className="logging-card-title">
+ {executionDetails?.status.toLowerCase() === "executing"
+ ? "Running for"
+ : "Ran for"}
+ </Typography>
+ <Typography>{executionDetails?.ranFor}</Typography>
+ </div>
+ </Flex>
+ </Card>
+ <Card className="logs-details-card">
+ <Flex justify="flex-start" align="center">
+ <FileTextOutlined className="logging-card-icons" />
+ <div>
+ <Typography className="logging-card-title">
+ {executionDetails?.status.toLowerCase() === "executing"
+ ? "Processing files"
+ : "Processed files"}{" "}
+ -{" "}
+ <Tooltip title="Total files">
+ <span className="status-container">
+ <FileTextOutlined className="gen-index-progress" />{" "}
+ {executionDetails?.totalFiles}
+ </span>
+ </Tooltip>
+ </Typography>
+ <span>
+ <Tooltip title="Successful files">
+ <span className="status-container">
+ <InfoCircleFilled className="gen-index-success" />{" "}
+ {executionDetails?.successfulFiles}
+ </span>
+ </Tooltip>
+ <Tooltip title="Failed files">
+ <span className="status-container">
+ <CloseCircleFilled className="gen-index-fail" />{" "}
+ {executionDetails?.failedFiles}
+ </span>
+ </Tooltip>
+ <Tooltip title="In Progress files">
+ {executionDetails?.totalFiles -
+ (executionDetails?.successfulFiles +
+ executionDetails?.failedFiles) >
+ 0 && (
+ <span className="status-container">
+ <HourglassOutlined className="gen-index-progress" />{" "}
+ {executionDetails?.totalFiles -
+ (executionDetails?.successfulFiles +
+ executionDetails?.failedFiles)}
+ </span>
+ )}
+ </Tooltip>
+ </span>
+ </div>
+ </Flex>
+ </Card>
+ </Flex>
+ <Button
+ className="view-log-button"
+ type="link"
+ onClick={() => handleLogsModalOpen({})}
+ >
+ View Logs
+ </Button>
+ </Flex>
+ <div className="settings-layout">
+ <Dropdown
+ menu={menu}
+ trigger={["click"]}
+ className="column-filter-dropdown"
+ >
+ <Button icon={<DownOutlined />}>Show/Hide Columns</Button>
+ </Dropdown>
+ <Table
+ dataSource={executionFiles}
+ columns={columnsToShow}
+ pagination={{ ...pagination }}
+ loading={loading}
+ onChange={handleTableChange}
+ sortDirections={["ascend", "descend", "ascend"]}
+ scroll={{ y: 55 * 10 }}
+ />
+ </div>
+ <LogModal
+ executionId={id}
+ fileId={selectedRecord?.executionId}
+ logDescModalOpen={logDescModalOpen}
+ setLogDescModalOpen={setLogDescModalOpen}
+ filterParams={{ executionTime: "event_time" }}
+ />
+ </>
+ );
+};
+export { DetailedLogs };
diff --git a/frontend/src/components/logging/execution-logs/ExecutionLogs.css b/frontend/src/components/logging/execution-logs/ExecutionLogs.css
new file mode 100644
index 000000000..f1a4f9fad
--- /dev/null
+++ b/frontend/src/components/logging/execution-logs/ExecutionLogs.css
@@ -0,0 +1,49 @@
+.file-log-layout {
+ background-color: var(--white);
+ height: 100%;
+ margin: 12px;
+ overflow-y: auto;
+}
+
+.logs-title {
+ padding: 15px;
+ margin: 0;
+}
+
+.log-tab-icon {
+ width: 15px !important;
+ height: 15px !important;
+ vertical-align: middle;
+}
+
+.active.log-tab-icon > g > path,
+.active.log-tab-icon > path {
+ fill: #1677ff;
+}
+
+.invite-user-search .ant-tabs-nav {
+ margin: 0;
+}
+
+.logs-date-picker {
+ width: 300px;
+ height: 30px;
+}
+
+.log-tab{
+ height: 30px;
+}
+
+.log-tab .ant-tabs-nav {
+ height: 50px;
+ margin: 0;
+}
+
+.log-tab .ant-tabs-nav-list {
+ height: 30px;
+ line-height: 50px;
+}
+
+.log-tab .ant-tabs-ink-bar {
+ top: 40px !important;
+}
diff --git a/frontend/src/components/logging/execution-logs/ExecutionLogs.jsx b/frontend/src/components/logging/execution-logs/ExecutionLogs.jsx
new file mode 100644
index 000000000..9e7d81504
--- /dev/null
+++ b/frontend/src/components/logging/execution-logs/ExecutionLogs.jsx
@@ -0,0 +1,280 @@
+import { DatePicker, Flex, Tabs, Typography } from "antd";
+import { useNavigate, useParams } from "react-router-dom";
+import { useEffect, useState } from "react";
+
+import { LogsTable } from "../logs-table/LogsTable";
+import { DetailedLogs } from "../detailed-logs/DetailedLogs";
+import {
+ ApiDeployments,
+ ETLIcon,
+ Workflows,
+ Task,
+} from "../../../assets/index";
+import "./ExecutionLogs.css";
+import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
+import { useSessionStore } from "../../../store/session-store";
+import { useAlertStore } from "../../../store/alert-store";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
+import {
+ formattedDateTime,
+ formattedDateTimeWithSeconds,
+} from "../../../helpers/GetStaticData";
+import { ToolNavBar } from "../../navigations/tool-nav-bar/ToolNavBar";
+import useRequestUrl from "../../../hooks/useRequestUrl";
+
+function ExecutionLogs() {
+ const { RangePicker } = DatePicker;
+ const [activeTab, setActiveTab] = useState("ETL");
+ const { id } = useParams();
+ const axiosPrivate = useAxiosPrivate();
+ const { sessionDetails } = useSessionStore();
+ const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
+ const navigate = useNavigate();
+ const { getUrl } = useRequestUrl();
+
+ const [dataList, setDataList] = useState([]);
+ const [loading, setLoading] = useState(true);
+ const [pagination, setPagination] = useState({
+ current: 1,
+ pageSize: 10,
+ total: 0,
+ });
+ const [selectedDateRange, setSelectedDateRange] = useState([]);
+ const [datePickerValue, setDatePickerValue] = useState(null);
+ const [ordering, setOrdering] = useState(null);
+ const [pollingIds, setPollingIds] = useState(new Set());
+ const currentPath = location.pathname !== `/${sessionDetails?.orgName}/logs`;
+ const items = [
+ {
+ key: "ETL",
+ label: "ETL Sessions",
+ icon: (
+ <ETLIcon
+ className={`log-tab-icon ${activeTab === "ETL" ? "active" : ""}`}
+ />
+ ),
+ },
+ {
+ key: "API",
+ label: "API Sessions",
+ icon: (
+ <ApiDeployments
+ className={`log-tab-icon ${activeTab === "API" ? "active" : ""}`}
+ />
+ ),
+ },
+ {
+ key: "WF",
+ label: "Workflow Sessions",
+ icon: (
+ <Workflows
+ className={`log-tab-icon ${activeTab === "WF" ? "active" : ""}`}
+ />
+ ),
+ },
+ {
+ key: "TASK",
+ label: "Task Sessions",
+ icon: (
+ <Task
+ className={`log-tab-icon ${activeTab === "TASK" ? "active" : ""}`}
+ />
+ ),
+ },
+ ];
+ const onChange = (key) => {
+ navigate(`/${sessionDetails?.orgName}/logs`);
+ setActiveTab(key);
+ };
+ const onOk = (value) => {
+ if (value && value.length === 2 && value[0] && value[1]) {
+ setSelectedDateRange([value[0]?.toISOString(), value[1]?.toISOString()]);
+ setDatePickerValue(value);
+ }
+ };
+
+ const pollExecutingRecord = async (id) => {
+ try {
+ const url = getUrl(`/execution/${id}/`);
+ const response = await axiosPrivate.get(url);
+ const item = response?.data;
+
+ // Update the record in the dataList
+ setDataList((prevData) => {
+ const newData = [...prevData];
+ const index = newData.findIndex((record) => record.key === id);
+ if (index !== -1) {
+ const total = item.total_files || 0;
+ const processed =
+ (item?.successful_files || 0) + (item?.failed_files || 0);
+ const progress =
+ total > 0 ? Math.round((processed / total) * 100) : 0;
+
+ newData[index] = {
+ ...newData[index],
+ progress,
+ processed,
+ total,
+ success: item?.status === "COMPLETED",
+ isError: item?.status === "ERROR",
+ status: item?.status,
+ successfulFiles: item?.successful_files,
+ failedFiles: item?.failed_files,
+ };
+
+ // If status is no longer executing, remove from polling
+ if (item?.status.toLowerCase() !== "executing") {
+ setPollingIds((prev) => {
+ const newSet = new Set(prev);
+ newSet.delete(id);
+ return newSet;
+ });
+ }
+ }
+ return newData;
+ });
+
+ // Continue polling if still executing
+ if (item?.status === "EXECUTING") {
+ setTimeout(() => pollExecutingRecord(id), 5000); // Poll every 5 seconds
+ }
+ } catch (err) {
+ setPollingIds((prev) => {
+ const newSet = new Set(prev);
+ newSet.delete(id);
+ return newSet;
+ });
+ }
+ };
+
+ const startPollingForExecuting = (records) => {
+ records.forEach((record) => {
+ if (record.status === "EXECUTING" && !pollingIds.has(record.key)) {
+ setPollingIds((prev) => {
+ const newSet = new Set(prev);
+ newSet.add(record.key);
+ return newSet;
+ });
+ pollExecutingRecord(record.key);
+ }
+ });
+ };
+
+ const fetchLogs = async (page) => {
+ try {
+ setLoading(true);
+ const url = getUrl(`/execution/`);
+ const response = await axiosPrivate.get(url, {
+ params: {
+ execution_entity: activeTab,
+ page_size: pagination.pageSize,
+ page,
+ created_at_after: selectedDateRange[0] || null,
+ created_at_before: selectedDateRange[1] || null,
+ ordering,
+ },
+ });
+ setPagination({
+ current: page,
+ pageSize: pagination?.pageSize,
+ total: response?.data?.count, // Total number of records
+ });
+ const formattedData = response?.data?.results.map((item) => {
+ const total = item.total_files || 0;
+ const processed =
+ (item?.successful_files || 0) + (item?.failed_files || 0);
+ const progress = total > 0 ? Math.round((processed / total) * 100) : 0;
+ return {
+ key: item?.id,
+ executedAt: formattedDateTime(item?.created_at),
+ executedAtWithSeconds: formattedDateTimeWithSeconds(item?.created_at),
+ executionId: item?.id,
+ progress,
+ processed,
+ success: item?.status === "COMPLETED",
+ isError: item?.status === "ERROR",
+ workflowName: item?.workflow_name,
+ pipelineName: item?.pipeline_name || "Pipeline name not found",
+ successfulFiles: item?.successful_files,
+ failedFiles: item?.failed_files,
+ totalFiles: item?.total_files,
+ status: item?.status,
+ };
+ });
+ setDataList(formattedData);
+ startPollingForExecuting(formattedData);
+ } catch (err) {
+ setAlertDetails(handleException(err));
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const customButtons = () => {
+ return (
+ <Flex gap={10} className="log-controls">
+ <Tabs
+ activeKey={activeTab}
+ items={items}
+ onChange={onChange}
+ className="log-tab"
+ />
+ <RangePicker
+ showTime={{ format: "YYYY-MM-DDTHH:mm:ssZ[Z]" }}
+ value={datePickerValue}
+ onChange={(value) => {
+ setDatePickerValue(value);
+ setSelectedDateRange(
+ value ? [value[0].toISOString(), value[1].toISOString()] : []
+ );
+ }}
+ onOk={onOk}
+ className="logs-date-picker"
+ disabled={currentPath}
+ format="YYYY-MM-DD HH:mm:ss"
+ />
+ </Flex>
+ );
+ };
+
+ useEffect(() => {
+ if (!currentPath) {
+ setDataList([]);
+ fetchLogs(pagination.current);
+ }
+ }, [activeTab, pagination.current, selectedDateRange, ordering, currentPath]);
+
+ return (
+ <>
+ <ToolNavBar
+ title={"Logs"}
+ CustomButtons={customButtons}
+ enableSearch={false}
+ />
+ <div className="file-log-layout">
+ {id ? (
+ <DetailedLogs />
+ ) : (
+ <>
+ <Typography.Title className="logs-title" level={4}>
+ Execution Logs
+ </Typography.Title>
+ <div className="settings-layout">
+ <LogsTable
+ tableData={dataList}
+ loading={loading}
+ pagination={pagination}
+ setPagination={setPagination}
+ setOrdering={setOrdering}
+ activeTab={activeTab}
+ />
+ </div>
+ </>
+ )}
+ </div>
+ </>
+ );
+}
+
+export { ExecutionLogs };
diff --git a/frontend/src/components/logging/filter-dropdown/FilterDropdown.jsx b/frontend/src/components/logging/filter-dropdown/FilterDropdown.jsx
new file mode 100644
index 000000000..72bf0e294
--- /dev/null
+++ b/frontend/src/components/logging/filter-dropdown/FilterDropdown.jsx
@@ -0,0 +1,56 @@
+import { FilterOutlined } from "@ant-design/icons";
+import { Button, Radio, Space } from "antd";
+import PropTypes from "prop-types";
+
+const FilterIcon = ({ filtered }) => (
+ <FilterOutlined style={{ color: filtered ? "#1677ff" : undefined }} />
+);
+
+const FilterDropdown = ({
+ setSelectedKeys,
+ selectedKeys,
+ confirm,
+ handleClearFilter,
+ filterOptions,
+}) => (
+ <div style={{ padding: 8 }}>
+ <Radio.Group
+ onChange={(e) => {
+ setSelectedKeys(e.target.value ? [e.target.value] : []);
+ confirm();
+ }}
+ value={selectedKeys[0] || null}
+ >
+ <Space direction="vertical">
+ {filterOptions.map((filter) => (
+ <Radio key={filter} value={filter}>
+ {filter}
+ </Radio>
+ ))}
+ </Space>
+ </Radio.Group>
+ <br />
+ <Button
+ className="clear-button"
+ type="primary"
+ size="small"
+ onClick={() => handleClearFilter(confirm)}
+ >
+ Clear
+ </Button>
+ </div>
+);
+
+FilterIcon.propTypes = {
+ filtered: PropTypes.bool,
+};
+
+FilterDropdown.propTypes = {
+ setSelectedKeys: PropTypes.func,
+ selectedKeys: PropTypes.any,
+ confirm: PropTypes.func,
+ handleClearFilter: PropTypes.func,
+ filterOptions: PropTypes.array,
+};
+
+export { FilterDropdown, FilterIcon };
diff --git a/frontend/src/components/logging/log-modal/LogModal.css b/frontend/src/components/logging/log-modal/LogModal.css
new file mode 100644
index 000000000..b2ed5754b
--- /dev/null
+++ b/frontend/src/components/logging/log-modal/LogModal.css
@@ -0,0 +1,4 @@
+.clear-button{
+ margin-left: 50px;
+ margin-top: 10px;
+}
diff --git a/frontend/src/components/logging/log-modal/LogModal.jsx b/frontend/src/components/logging/log-modal/LogModal.jsx
new file mode 100644
index 000000000..61e5aed12
--- /dev/null
+++ b/frontend/src/components/logging/log-modal/LogModal.jsx
@@ -0,0 +1,185 @@
+import { Modal, Table, Tooltip } from "antd";
+import { useEffect, useState } from "react";
+import PropTypes from "prop-types";
+
+import "./LogModal.css";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
+import { useAlertStore } from "../../../store/alert-store";
+import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
+import {
+ formattedDateTime,
+ formattedDateTimeWithSeconds,
+} from "../../../helpers/GetStaticData";
+import { FilterDropdown, FilterIcon } from "../filter-dropdown/FilterDropdown";
+import useRequestUrl from "../../../hooks/useRequestUrl";
+
+function LogModal({
+ executionId,
+ fileId,
+ logDescModalOpen,
+ setLogDescModalOpen,
+ filterParams,
+}) {
+ const axiosPrivate = useAxiosPrivate();
+ const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
+ const { getUrl } = useRequestUrl();
+
+ const [executionLogs, setExecutionLogs] = useState([]);
+ const [loading, setLoading] = useState(false);
+ const [selectedLogLevel, setSelectedLogLevel] = useState(null);
+ const [ordering, setOrdering] = useState(null);
+ const [pagination, setPagination] = useState({
+ current: 1,
+ pageSize: 10,
+ total: 0,
+ });
+ const filterOptions = ["INFO", "WARN", "DEBUG", "ERROR"];
+
+ const fetchExecutionFileLogs = async (executionId, fileId, page) => {
+ try {
+ const url = getUrl(`/execution/${executionId}/logs/`);
+ const response = await axiosPrivate.get(url, {
+ params: {
+ page_size: pagination.pageSize,
+ page,
+ file_execution_id: fileId || "null",
+ log_level: selectedLogLevel,
+ ordering,
+ },
+ });
+ // Replace with your actual API URL
+ setPagination({
+ current: page,
+ pageSize: pagination?.pageSize,
+ total: response?.data?.count, // Total number of records
+ });
+ const formattedData = response?.data?.results.map((item) => {
+ return {
+ key: item?.id,
+ eventTime: formattedDateTime(item?.event_time),
+ eventStage: item.data?.stage,
+ logLevel: item.data?.level,
+ log: item?.data?.log,
+ executedAtWithSeconds: formattedDateTimeWithSeconds(item?.created_at),
+ };
+ });
+
+ setExecutionLogs(formattedData);
+ } catch (err) {
+ setAlertDetails(handleException(err));
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const handleClose = () => {
+ setLogDescModalOpen(false);
+ setExecutionLogs([]); // Clear logs
+ setPagination({ current: 1, pageSize: 10, total: 0 }); // Reset pagination
+ };
+
+ const logDetailsColumns = [
+ {
+ title: "Event Time",
+ dataIndex: "eventTime",
+ key: "eventTime",
+ sorter: true,
+ width: 200,
+ render: (_, record) => (
+ <Tooltip title={record.executedAtWithSeconds}>
+ {record.eventTime}
+ </Tooltip>
+ ),
+ },
+ {
+ title: "Event Stage",
+ dataIndex: "eventStage",
+ key: "stage",
+ },
+ {
+ title: "Log Level",
+ dataIndex: "logLevel",
+ key: "level",
+ filterDropdown: (props) => (
+ <FilterDropdown
+ {...props}
+ handleClearFilter={handleClearFilter}
+ filterOptions={filterOptions}
+ />
+ ),
+ filteredValue: selectedLogLevel ? [selectedLogLevel] : [],
+ filterIcon: (filtered) => <FilterIcon filtered={filtered} />,
+ render: (level) => <span className={level?.toLowerCase()}>{level}</span>,
+ },
+ {
+ title: "Log",
+ dataIndex: "log",
+ key: "log",
+ },
+ ];
+
+ const handleClearFilter = (confirm) => {
+ setSelectedLogLevel(null);
+ confirm();
+ };
+
+ const handleTableChange = (pagination, filters, sorter) => {
+ setPagination((prev) => {
+ return { ...prev, ...pagination };
+ });
+
+ if (sorter.order) {
+ // Determine ascending or descending order
+ const executionTimeParam = filterParams.executionTime || "created_at";
+ const order =
+ sorter.order === "ascend"
+ ? executionTimeParam
+ : `-${executionTimeParam}`;
+ setOrdering(order);
+ } else {
+ setOrdering(null);
+ }
+ setSelectedLogLevel(filters.level[0]);
+ };
+
+ useEffect(() => {
+ if (logDescModalOpen) {
+ fetchExecutionFileLogs(executionId, fileId, pagination.current);
+ }
+ }, [logDescModalOpen, pagination.current, selectedLogLevel, ordering]);
+ return (
+ <Modal
+ title={`Execution Log Details - ${fileId || executionId}`}
+ centered
+ open={logDescModalOpen}
+ onCancel={handleClose}
+ footer={null}
+ width="80%"
+ wrapClassName="modal-body"
+ destroyOnClose
+ >
+ <Table
+ columns={logDetailsColumns}
+ dataSource={executionLogs}
+ rowKey="id"
+ align="left"
+ pagination={{
+ ...pagination,
+ }}
+ loading={loading}
+ onChange={handleTableChange}
+ sortDirections={["ascend", "descend", "ascend"]}
+ />
+ </Modal>
+ );
+}
+LogModal.propTypes = {
+ executionId: PropTypes.string,
+ fileId: PropTypes.string,
+ logDescModalOpen: PropTypes.array,
+ setLogDescModalOpen: PropTypes.array,
+ filterParams: PropTypes.object,
+};
+
+export { LogModal };
diff --git a/frontend/src/components/logging/logs-table/LogsTable.css b/frontend/src/components/logging/logs-table/LogsTable.css
new file mode 100644
index 000000000..88fc1f854
--- /dev/null
+++ b/frontend/src/components/logging/logs-table/LogsTable.css
@@ -0,0 +1,21 @@
+.title-name-redirect{
+ word-break: break-all;
+}
+
+
+.gen-index-progress {
+ color: #FAAD14;
+}
+
+.gen-index-success {
+ color: #52C41A;
+}
+
+.gen-index-fail {
+ color: #ff4242;
+}
+
+.status-container {
+ display: inline-block;
+ margin-right: 10px;
+}
diff --git a/frontend/src/components/logging/logs-table/LogsTable.jsx b/frontend/src/components/logging/logs-table/LogsTable.jsx
new file mode 100644
index 000000000..8dae3ab1c
--- /dev/null
+++ b/frontend/src/components/logging/logs-table/LogsTable.jsx
@@ -0,0 +1,162 @@
+import { Table, Tooltip, Typography } from "antd";
+import "./LogsTable.css";
+import { useNavigate } from "react-router-dom";
+import PropTypes from "prop-types";
+import {
+ CloseCircleFilled,
+ HourglassOutlined,
+ InfoCircleFilled,
+} from "@ant-design/icons";
+
+import { EmptyState } from "../../widgets/empty-state/EmptyState";
+import { logsStaticContent } from "../../../helpers/GetStaticData";
+import { useSessionStore } from "../../../store/session-store";
+
+const LogsTable = ({
+ tableData,
+ loading,
+ pagination,
+ setPagination,
+ setOrdering,
+ activeTab,
+}) => {
+ const navigate = useNavigate();
+ const { sessionDetails } = useSessionStore();
+ const columns = [
+ {
+ title: "Executed At",
+ dataIndex: "executedAt",
+ key: "executedAt",
+ showSorterTooltip: { target: "full-header" },
+ sorter: true,
+ render: (_, record) => (
+ <Tooltip title={record.executedAtWithSeconds}>
+ {record.executedAt}
+ </Tooltip>
+ ),
+ },
+ {
+ title: "Execution ID",
+ dataIndex: "executionId",
+ key: "executionId",
+ render: (text) => (
+ <Typography.Link
+ className="title-name-redirect"
+ onClick={() => navigate(`${activeTab}/${text}`)}
+ >
+ {text}
+ </Typography.Link>
+ ),
+ },
+ {
+ title: "Execution Name",
+ dataIndex: "pipelineName",
+ key: "executionName",
+ render: (_, record) =>
+ activeTab === "WF" ? (
+ <Typography.Text strong>{record?.workflowName}</Typography.Text>
+ ) : (
+ <>
+ <Typography.Text strong>{record?.pipelineName}</Typography.Text>
+ <br />
+ <Typography.Text type="secondary" className="p-or-d-typography">
+ from {record?.workflowName}
+ </Typography.Text>
+ </>
+ ),
+ },
+ {
+ title: "Status",
+ dataIndex: "status",
+ key: "status",
+ render: (_, record) => (
+ <span>
+ <Tooltip title="Successful files">
+ <span className="status-container">
+ <InfoCircleFilled className="gen-index-success" />{" "}
+ {record?.successfulFiles}
+ </span>
+ </Tooltip>
+ <Tooltip title="Failed files">
+ <span className="status-container">
+ <CloseCircleFilled className="gen-index-fail" />{" "}
+ {record?.failedFiles}
+ </span>
+ </Tooltip>
+ <Tooltip title="Queued files">
+ {record?.totalFiles -
+ (record?.successfulFiles + record?.failedFiles) >
+ 0 && (
+ <span className="status-container">
+ <HourglassOutlined className="gen-index-progress" />{" "}
+ {record?.totalFiles -
+ (record?.successfulFiles + record?.failedFiles)}
+ </span>
+ )}
+ </Tooltip>
+ </span>
+ ),
+ },
+ {
+ title: "Files Processed",
+ dataIndex: "filesProcessed",
+ key: "filesProcessed",
+ render: (text, record) => `${record?.processed}/${record?.totalFiles}`,
+ },
+ ];
+
+ const handleTableChange = (pagination, filters, sorter) => {
+ setPagination((prev) => {
+ return { ...prev, ...pagination };
+ });
+
+ if (sorter.order) {
+ // Determine ascending or descending order
+ const order = sorter.order === "ascend" ? "created_at" : "-created_at";
+ setOrdering(order);
+ setPagination((prev) => {
+ return { ...prev, ...pagination, current: 1 };
+ });
+ } else {
+ setOrdering(null); // Default ordering if sorting is cleared
+ }
+ };
+
+ return (
+ <Table
+ columns={columns}
+ dataSource={tableData}
+ pagination={pagination}
+ bordered
+ size="small"
+ loading={loading}
+ onChange={handleTableChange}
+ sortDirections={["ascend", "descend", "ascend"]}
+ scroll={{ y: 55 * 10 }}
+ locale={{
+ emptyText: (
+ <EmptyState
+ text={`Currently you have no ${logsStaticContent[activeTab].addBtn}`}
+ btnText={`Add ${logsStaticContent[activeTab].addBtn}`}
+ handleClick={() =>
+ navigate(
+ `/${sessionDetails?.orgName}/${logsStaticContent[activeTab].route}`
+ )
+ }
+ />
+ ),
+ }}
+ />
+ );
+};
+
+LogsTable.propTypes = {
+ tableData: PropTypes.array,
+ loading: PropTypes.bool,
+ pagination: PropTypes.object,
+ setPagination: PropTypes.func,
+ setOrdering: PropTypes.func,
+ activeTab: PropTypes.string,
+};
+
+export { LogsTable };
diff --git a/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx b/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx
index 74f02af68..5f07a65c7 100644
--- a/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx
+++ b/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx
@@ -1,10 +1,10 @@
+import { useMemo } from "react";
import { BranchesOutlined } from "@ant-design/icons";
import { Divider, Image, Layout, Space, Tooltip, Typography } from "antd";
import PropTypes from "prop-types";
import { useNavigate } from "react-router-dom";
-import "./SideNavBar.css";
-const { Sider } = Layout;
+import { useSessionStore } from "../../../store/session-store";
import Workflows from "../../../assets/Workflows.svg";
import apiDeploy from "../../../assets/api-deployments.svg";
import CustomTools from "../../../assets/custom-tools-icon.svg";
@@ -15,8 +15,11 @@ import PlatformSettingsIcon from "../../../assets/platform-settings.svg";
import task from "../../../assets/task.svg";
import VectorDbIcon from "../../../assets/vector-db.svg";
import TextExtractorIcon from "../../../assets/text-extractor.svg";
-import { useSessionStore } from "../../../store/session-store";
-import { useMemo } from "react";
+import TerminalIcon from "../../../assets/terminal.svg";
+
+import "./SideNavBar.css";
+
+const { Sider } = Layout;
let getMenuItem;
try {
@@ -133,6 +136,14 @@ const SideNavBar = ({ collapsed }) => {
path: `/${orgName}/task`,
active: window.location.pathname.startsWith(`/${orgName}/task`),
},
+ {
+ id: 1.5,
+ title: "Logs",
+ description: "Records system events for monitoring and debugging",
+ image: TerminalIcon,
+ path: `/${orgName}/logs`,
+ active: window.location.pathname.startsWith(`/${orgName}/logs`),
+ },
],
},
{
diff --git a/frontend/src/helpers/GetStaticData.js b/frontend/src/helpers/GetStaticData.js
index 092da7e58..421b0ab3a 100644
--- a/frontend/src/helpers/GetStaticData.js
+++ b/frontend/src/helpers/GetStaticData.js
@@ -1,5 +1,6 @@
import moment from "moment";
import momentTz from "moment-timezone";
+import { format, parseISO } from "date-fns";
import { v4 as uuidv4 } from "uuid";
let cloudHomePagePath;
@@ -589,6 +590,29 @@ const generateCoverageKey = (promptId, profileId) => {
return `coverage_${promptId}_${profileId}`;
};
+function formatSecondsToHMS(seconds) {
+ if (isNaN(seconds) || seconds < 0) return "00:00:00";
+
+ const hrs = Math.floor(seconds / 3600);
+ const mins = Math.floor((seconds % 3600) / 60);
+ const secs = Math.floor(seconds % 60);
+
+ return [hrs, mins, secs]
+ .map((unit) => String(unit).padStart(2, "0"))
+ .join(":");
+}
+
+const formattedDateTimeWithSeconds = (ISOdateTime) => {
+ if (ISOdateTime) {
+ // eslint-disable-next-line new-cap
+ const zone = Intl.DateTimeFormat().resolvedOptions().timeZone;
+ const zonedDate = parseISO(ISOdateTime);
+ return format(zonedDate, "MMM d, yyyy h:mm:ss a zzz", { timeZone: zone });
+ } else {
+ return "";
+ }
+};
+
const TRIAL_PLAN = "TRIAL";
const homePagePath = cloudHomePagePath || "tools";
@@ -609,6 +633,25 @@ const convertTimestampToHHMMSS = (timestamp) => {
const UNSTRACT_ADMIN = "unstract_admin";
+const logsStaticContent = {
+ ETL: {
+ addBtn: "ETL Pipeline",
+ route: "etl",
+ },
+ TASK: {
+ addBtn: "Task Pipeline",
+ route: "task",
+ },
+ API: {
+ addBtn: "API Deployment",
+ route: "api",
+ },
+ WF: {
+ addBtn: "Workflow",
+ route: "workflows",
+ },
+};
+
export {
CONNECTOR_TYPE_MAP,
O_AUTH_PROVIDERS,
@@ -664,4 +707,7 @@ export {
homePagePath,
convertTimestampToHHMMSS,
UNSTRACT_ADMIN,
+ formatSecondsToHMS,
+ formattedDateTimeWithSeconds,
+ logsStaticContent,
};
diff --git a/frontend/src/layouts/page-layout/PageLayout.css b/frontend/src/layouts/page-layout/PageLayout.css
index b4261dd90..d0a18334c 100644
--- a/frontend/src/layouts/page-layout/PageLayout.css
+++ b/frontend/src/layouts/page-layout/PageLayout.css
@@ -18,8 +18,8 @@
.collapse_btn {
width: 32px;
height: 32px;
- position: absolute;
margin-left: -10px;
margin-top: -10px;
+ position: fixed;
z-index: 1000;
}
diff --git a/frontend/src/pages/LogsPage.jsx b/frontend/src/pages/LogsPage.jsx
new file mode 100644
index 000000000..d97453527
--- /dev/null
+++ b/frontend/src/pages/LogsPage.jsx
@@ -0,0 +1,7 @@
+import { ExecutionLogs } from "../components/logging/execution-logs/ExecutionLogs";
+
+function LogsPage() {
+ return <ExecutionLogs />;
+}
+
+export { LogsPage };
diff --git a/frontend/src/routes/useMainAppRoutes.js b/frontend/src/routes/useMainAppRoutes.js
index 04496eb48..e8ab9648c 100644
--- a/frontend/src/routes/useMainAppRoutes.js
+++ b/frontend/src/routes/useMainAppRoutes.js
@@ -19,6 +19,7 @@ import { CustomTools } from "../pages/CustomTools.jsx";
import { CustomToolsHelper } from "../components/helpers/custom-tools/CustomToolsHelper.js";
import { ToolIdePage } from "../pages/ToolIdePage.jsx";
import { OutputAnalyzerPage } from "../pages/OutputAnalyzerPage.jsx";
+import { LogsPage } from "../pages/LogsPage.jsx";
import { deploymentTypes } from "../helpers/GetStaticData.js";
let RequirePlatformAdmin;
@@ -141,6 +142,8 @@ function useMainAppRoutes() {
element={<OutputAnalyzerPage />}
/>
</Route>
+ <Route path="logs" element={<LogsPage />} />
+ <Route path="logs/:type/:id/" element={<LogsPage />} />
<Route
path="settings/llms"
element={<ToolsSettingsPage type="llm" />}