Skip to content

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

UN-3380 [FIX] Dashboard UI/UX improvements (#1897)

Athul28a206b6988b
diff --git a/frontend/src/components/custom-tools/header/Header.jsx b/frontend/src/components/custom-tools/header/Header.jsx
index 54a0086ca..15e41c8a0 100644
--- a/frontend/src/components/custom-tools/header/Header.jsx
+++ b/frontend/src/components/custom-tools/header/Header.jsx
@@ -315,7 +315,9 @@ function Header({
setEditModalOpen(false);
setAlertDetails({ type: "success", content: "Updated successfully" });
} catch (err) {
- if (err?.errorFields) return;
+ if (err?.errorFields) {
+ return;
+ }
setAlertDetails(handleException(err, "Failed to update"));
}
}, [editForm, handleUpdateTool, setAlertDetails, handleException]);
diff --git a/frontend/src/components/metrics-dashboard/LLMUsageTable.jsx b/frontend/src/components/metrics-dashboard/LLMUsageTable.jsx
index 114228b8c..0a7bbbcc2 100644
--- a/frontend/src/components/metrics-dashboard/LLMUsageTable.jsx
+++ b/frontend/src/components/metrics-dashboard/LLMUsageTable.jsx
@@ -2,11 +2,9 @@ import {
CheckCircleOutlined,
CloseCircleOutlined,
InfoCircleOutlined,
- ReloadOutlined,
} from "@ant-design/icons";
import {
Alert,
- Button,
Card,
Empty,
Spin,
@@ -17,7 +15,7 @@ import {
Typography,
} from "antd";
import PropTypes from "prop-types";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { ApiDeployments, ETLIcon, Task, Workflows } from "../../assets/index";
import { useDeploymentUsage } from "../../hooks/useMetricsData";
@@ -26,6 +24,24 @@ import "./MetricsDashboard.css";
const { Text } = Typography;
+/**
+ * Format large numbers with K/M/B suffixes.
+ * Shows full value on hover via Tooltip.
+ */
+function formatCompactNumber(value) {
+ const num = value || 0;
+ if (num >= 1_000_000_000) {
+ return `${(num / 1_000_000_000).toFixed(1)}B`;
+ }
+ if (num >= 1_000_000) {
+ return `${(num / 1_000_000).toFixed(1)}M`;
+ }
+ if (num >= 10_000) {
+ return `${(num / 1_000).toFixed(1)}K`;
+ }
+ return num.toLocaleString();
+}
+
const columns = [
{
title: "Deployment",
@@ -47,8 +63,12 @@ const columns = [
key: "total_tokens",
sorter: (a, b) => a.total_tokens - b.total_tokens,
defaultSortOrder: "descend",
- render: (value) => (value || 0).toLocaleString(),
- width: 130,
+ render: (value) => (
+ <Tooltip title={(value || 0).toLocaleString()}>
+ {formatCompactNumber(value)}
+ </Tooltip>
+ ),
+ width: 120,
},
{
title: "LLM Calls",
@@ -68,26 +88,26 @@ const columns = [
const completed = record.completed_executions || 0;
const failed = record.failed_executions || 0;
return (
- <span>
- {total.toLocaleString()}{" "}
- {completed > 0 && (
- <Tooltip title={`${completed} completed`}>
- <Tag color="success" className="llm-usage-tag-compact">
- <CheckCircleOutlined /> {completed}
- </Tag>
- </Tooltip>
- )}
- {failed > 0 && (
- <Tooltip title={`${failed} failed`}>
- <Tag color="error">
- <CloseCircleOutlined /> {failed}
- </Tag>
- </Tooltip>
- )}
- </span>
+ <Tooltip
+ title={`${completed.toLocaleString()} completed, ${failed.toLocaleString()} failed`}
+ >
+ <span className="execution-compact">
+ <span>{total.toLocaleString()}</span>
+ {completed > 0 && (
+ <span className="execution-success">
+ <CheckCircleOutlined /> {formatCompactNumber(completed)}
+ </span>
+ )}
+ {failed > 0 && (
+ <span className="execution-error">
+ <CloseCircleOutlined /> {formatCompactNumber(failed)}
+ </span>
+ )}
+ </span>
+ </Tooltip>
);
},
- width: 180,
+ width: 170,
},
{
title: "Pages",
@@ -110,12 +130,14 @@ const columns = [
title: "Last Run",
dataIndex: "last_execution_at",
key: "last_execution_at",
+ sorter: (a, b) =>
+ (a.last_execution_at || "").localeCompare(b.last_execution_at || ""),
render: (value) => (value ? value.split("T")[0] : "-"),
width: 110,
},
];
-function DeploymentUsageTable({ startDate, endDate }) {
+function DeploymentUsageTable({ startDate, endDate, refetchRef }) {
const [activeType, setActiveType] = useState("API");
const { data, loading, error, refetch } = useDeploymentUsage(
@@ -124,6 +146,18 @@ function DeploymentUsageTable({ startDate, endDate }) {
endDate,
);
+ // Expose refetch to parent via ref
+ useEffect(() => {
+ if (refetchRef) {
+ refetchRef.current = refetch;
+ }
+ return () => {
+ if (refetchRef) {
+ refetchRef.current = null;
+ }
+ };
+ }, [refetch, refetchRef]);
+
const handleTabChange = (key) => {
setActiveType(key);
};
@@ -167,17 +201,6 @@ function DeploymentUsageTable({ startDate, endDate }) {
},
];
- const refreshButton = (
- <Tooltip title="Refresh (bypasses cache)">
- <Button
- icon={<ReloadOutlined />}
- size="small"
- onClick={refetch}
- loading={loading}
- />
- </Tooltip>
- );
-
const renderContent = () => {
if (loading) {
return (
@@ -222,7 +245,6 @@ function DeploymentUsageTable({ startDate, endDate }) {
<Text strong className="llm-usage-title">
Usage by Deployment
</Text>
- {refreshButton}
</div>
<Tabs
items={deploymentTabs}
@@ -244,11 +266,13 @@ function DeploymentUsageTable({ startDate, endDate }) {
DeploymentUsageTable.propTypes = {
startDate: PropTypes.string,
endDate: PropTypes.string,
+ refetchRef: PropTypes.shape({ current: PropTypes.func }),
};
DeploymentUsageTable.defaultProps = {
startDate: null,
endDate: null,
+ refetchRef: null,
};
export { DeploymentUsageTable };
diff --git a/frontend/src/components/metrics-dashboard/MetricsDashboard.css b/frontend/src/components/metrics-dashboard/MetricsDashboard.css
index ed7e8e4f1..12f9d1557 100644
--- a/frontend/src/components/metrics-dashboard/MetricsDashboard.css
+++ b/frontend/src/components/metrics-dashboard/MetricsDashboard.css
@@ -1,21 +1,24 @@
/* Metrics Dashboard Styles */
.metrics-dashboard {
- padding: 24px;
+ padding: 12px;
background: #f5f5f5;
height: calc(100vh - 64px);
+}
+
+.metrics-dashboard-container {
+ background: #ffffff;
+ height: 100%;
overflow-y: auto;
}
-/* Topbar - Full width covering entire space */
+/* Topbar */
.metrics-topbar {
display: flex;
justify-content: space-between;
align-items: center;
- margin: -24px -24px 20px -24px;
- padding: 12px 24px;
- background: white;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
+ padding: 12px 14px;
+ border-bottom: 1px solid #f0f0f0;
}
.metrics-topbar-left {
@@ -48,6 +51,18 @@
margin-bottom: 16px;
}
+/* Tabs alignment — direct child only to avoid nested deployment tabs */
+.metrics-dashboard-container > .ant-tabs > .ant-tabs-nav {
+ padding: 0 14px;
+}
+
+/* Tab content padding — direct child only */
+.metrics-dashboard-container > .ant-tabs
+ > .ant-tabs-content-holder
+ > .ant-tabs-content {
+ padding: 16px;
+}
+
/* Summary Cards - Matching Reference Design */
.metrics-summary {
margin-bottom: 24px;
@@ -228,8 +243,7 @@
flex-direction: column;
align-items: stretch;
gap: 12px;
- margin: -16px -16px 16px -16px;
- padding: 12px 16px;
+ padding: 12px 14px;
}
.metrics-topbar-left {
@@ -242,7 +256,7 @@
}
.metrics-dashboard {
- padding: 16px;
+ padding: 12px;
}
}
@@ -320,7 +334,7 @@
font-size: 12px;
}
-/* Subscription Usage Tab */
+/* Subscription Usage Tab — Legacy */
.subscription-usage-tab {
max-width: 600px;
margin: 0 auto;
@@ -348,10 +362,166 @@
color: #595959;
}
+/* Subscription Usage Tab — V2 */
+.subscription-usage-tab-v2 {
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+}
+
+.subscription-loading {
+ display: flex;
+ justify-content: center;
+ padding: 60px;
+}
+
+.subscription-overdue-tag-v2 {
+ margin-bottom: 4px;
+}
+
+/* Plan Card V2 */
+.subscription-plan-card-v2 {
+ border-radius: 8px;
+}
+
+.subscription-plan-info {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+}
+
+.subscription-plan-total {
+ display: flex;
+ align-items: baseline;
+ gap: 8px;
+}
+
+.subscription-plan-total-value {
+ font-size: 32px;
+ font-weight: 700;
+ color: #262626;
+ line-height: 1;
+}
+
+.subscription-plan-total-label {
+ font-size: 14px;
+ color: #8c8c8c;
+}
+
+.subscription-plan-renewal {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ font-size: 13px;
+ color: #595959;
+}
+
+.subscription-upgrade-btn {
+ align-self: flex-start;
+ margin-top: 4px;
+ color: #52c41a;
+ border-color: #52c41a;
+}
+
+.subscription-upgrade-btn:hover {
+ color: #389e0d;
+ border-color: #389e0d;
+}
+
+/* Stat cards inside plan card */
+.subscription-stat {
+ text-align: center;
+ padding: 12px 8px;
+ background: #fafafa;
+ border-radius: 8px;
+}
+
+.subscription-stat-icon {
+ font-size: 16px;
+ color: #1890ff;
+ margin-bottom: 6px;
+}
+
+.subscription-stat-value {
+ font-size: 20px;
+ font-weight: 600;
+ color: #262626;
+ line-height: 1.2;
+}
+
+.subscription-stat-label {
+ font-size: 11px;
+ color: #8c8c8c;
+ margin-top: 2px;
+}
+
+/* Chart & Table cards */
+.subscription-chart-card,
+.subscription-table-card {
+ border-radius: 8px;
+}
+
+.subscription-chart-card .ant-card-head-title,
+.subscription-table-card .ant-card-head-title {
+ font-size: 14px;
+ font-weight: 600;
+}
+
+/* Stat sub-label (e.g. peak date) */
+.subscription-stat-sub {
+ font-size: 10px;
+ color: #b0b0b0;
+ margin-top: 2px;
+}
+
+/* Window note on chart card */
+.subscription-window-note {
+ font-size: 12px;
+ color: #8c8c8c;
+ font-weight: 400;
+}
+
+/* Peak day row highlight in table */
+.subscription-peak-row td {
+ background: #fff7e6 !important;
+}
+
+.subscription-peak-row:hover td {
+ background: #fff1cc !important;
+}
+
+@media (max-width: 768px) {
+ .subscription-plan-total-value {
+ font-size: 24px;
+ }
+
+ .subscription-stat-value {
+ font-size: 16px;
+ }
+}
+
.subscription-overdue-tag {
margin-bottom: 12px;
}
+/* Compact execution display */
+.execution-compact {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ white-space: nowrap;
+}
+
+.execution-success {
+ color: #52c41a;
+ font-size: 12px;
+}
+
+.execution-error {
+ color: #ff4d4f;
+ font-size: 12px;
+}
+
/* Deployment Type Tabs */
.deployment-type-tabs {
padding-left: 24px;
diff --git a/frontend/src/components/metrics-dashboard/MetricsDashboard.jsx b/frontend/src/components/metrics-dashboard/MetricsDashboard.jsx
index 41bcc2fff..d9ad91cf6 100644
--- a/frontend/src/components/metrics-dashboard/MetricsDashboard.jsx
+++ b/frontend/src/components/metrics-dashboard/MetricsDashboard.jsx
@@ -18,7 +18,7 @@ import {
Typography,
} from "antd";
import dayjs from "dayjs";
-import { useCallback, useEffect, useMemo, useState } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useNavigate } from "react-router-dom";
import { EmptyPlaceholder } from "../../assets";
@@ -119,6 +119,9 @@ function MetricsDashboard() {
refetch: refetchSubscription,
} = useSubscriptionUsage();
+ // Ref to deployment usage refetch (exposed by DeploymentUsageTable)
+ const deploymentRefetchRef = useRef(null);
+
// Active tab (controls date picker visibility)
const [activeTab, setActiveTab] = useState("overview");
@@ -135,6 +138,7 @@ function MetricsDashboard() {
refetchChart();
refetchActivity();
refetchSubscription();
+ deploymentRefetchRef.current?.();
}, [refetchOverview, refetchChart, refetchActivity, refetchSubscription]);
// Check if all data sources are empty (no activity at all)
@@ -218,6 +222,7 @@ function MetricsDashboard() {
<DeploymentUsageTable
startDate={dateRange[0]?.toISOString()}
endDate={dateRange[1]?.toISOString()}
+ refetchRef={deploymentRefetchRef}
/>
</Col>
</Row>
@@ -247,103 +252,105 @@ function MetricsDashboard() {
return (
<div className="metrics-dashboard">
- <div className="metrics-topbar">
- <div className="metrics-topbar-left">
- <Typography
- style={{
- fontWeight: 600,
- fontSize: "16px",
- display: "inline",
- lineHeight: "24px",
- }}
- >
- Dashboard
- </Typography>
+ <div className="metrics-dashboard-container">
+ <div className="metrics-topbar">
+ <div className="metrics-topbar-left">
+ <Typography
+ style={{
+ fontWeight: 600,
+ fontSize: "16px",
+ display: "inline",
+ lineHeight: "24px",
+ }}
+ >
+ Dashboard
+ </Typography>
+ </div>
+
+ <Space className="metrics-topbar-right">
+ <Button
+ icon={<FileSearchOutlined />}
+ type="link"
+ onClick={() =>
+ window.open(
+ "https://docs.unstract.com/unstract/index.html",
+ "_blank",
+ "noopener,noreferrer",
+ )
+ }
+ className="metrics-header-button"
+ >
+ Documentation
+ </Button>
+ <Button
+ icon={<SlackOutlined />}
+ type="link"
+ onClick={() =>
+ window.open(
+ "https://join-slack.unstract.com/",
+ "_blank",
+ "noopener,noreferrer",
+ )
+ }
+ className="metrics-header-button"
+ >
+ Slack Community
+ </Button>
+ </Space>
</div>
- <Space className="metrics-topbar-right">
- <Button
- icon={<FileSearchOutlined />}
- type="link"
- onClick={() =>
- window.open(
- "https://docs.unstract.com/unstract/index.html",
- "_blank",
- "noopener,noreferrer",
- )
- }
- className="metrics-header-button"
- >
- Documentation
- </Button>
- <Button
- icon={<SlackOutlined />}
- type="link"
- onClick={() =>
- window.open(
- "https://join-slack.unstract.com/",
- "_blank",
- "noopener,noreferrer",
- )
- }
- className="metrics-header-button"
- >
- Slack Community
- </Button>
- </Space>
- </div>
+ {PlanBanner && subscriptionData && <PlanBanner />}
- {PlanBanner && subscriptionData && <PlanBanner />}
+ {overviewError && (
+ <Alert
+ message="Error loading metrics"
+ description={overviewError}
+ type="error"
+ showIcon
+ closable
+ className="metrics-error"
+ />
+ )}
- {overviewError && (
- <Alert
- message="Error loading metrics"
- description={overviewError}
- type="error"
- showIcon
- closable
- className="metrics-error"
+ <Tabs
+ items={tabItems}
+ activeKey={activeTab}
+ onChange={setActiveTab}
+ tabBarExtraContent={
+ <Space>
+ {activeTab !== "subscription" && (
+ <RangePicker
+ value={dateRange}
+ onChange={handleDateChange}
+ disabledDate={(current) => current && current > dayjs()}
+ allowClear={false}
+ size="middle"
+ presets={[
+ {
+ label: "Last 7 Days",
+ value: [dayjs().subtract(7, "day"), dayjs()],
+ },
+ {
+ label: "Last 30 Days",
+ value: [dayjs().subtract(30, "day"), dayjs()],
+ },
+ // 90-day preset only for overview (deployment usage capped at 30 days)
+ ...(activeTab === "llm-usage"
+ ? []
+ : [
+ {
+ label: "Last 90 Days",
+ value: [dayjs().subtract(90, "day"), dayjs()],
+ },
+ ]),
+ ]}
+ />
+ )}
+ <Button icon={<ReloadOutlined />} onClick={handleRefresh} />
+ </Space>
+ }
/>
- )}
-
- <Tabs
- items={tabItems}
- activeKey={activeTab}
- onChange={setActiveTab}
- tabBarExtraContent={
- <Space>
- {activeTab !== "subscription" && (
- <RangePicker
- value={dateRange}
- onChange={handleDateChange}
- disabledDate={(current) => current && current > dayjs()}
- allowClear={false}
- size="middle"
- presets={[
- {
- label: "Last 7 Days",
- value: [dayjs().subtract(7, "day"), dayjs()],
- },
- {
- label: "Last 30 Days",
- value: [dayjs().subtract(30, "day"), dayjs()],
- },
- // 90-day preset only for overview (deployment usage capped at 30 days)
- ...(activeTab === "llm-usage"
- ? []
- : [
- {
- label: "Last 90 Days",
- value: [dayjs().subtract(90, "day"), dayjs()],
- },
- ]),
- ]}
- />
- )}
- <Button icon={<ReloadOutlined />} onClick={handleRefresh} />
- </Space>
- }
- />
+ </div>
</div>
);
}