From 237be43cf33f605bea685c0bbd1bafccec8dbcfd Mon Sep 17 00:00:00 2001 From: Aseem Shrey Date: Thu, 12 Feb 2026 17:22:56 -0500 Subject: [PATCH] feat(frontend): disable View Analytics button when no analytics sink connected - Disable the View Analytics button when the workflow design doesn't contain an analytics sink node (core.analytics.sink) - Add a tooltip explaining why the button is disabled - Bypass the check when viewing a specific run, since historical runs may have indexed results even if the current design removed the sink Signed-off-by: Aseem Shrey --- frontend/src/components/layout/TopBar.tsx | 102 ++++++++++-------- .../workflow-builder/WorkflowBuilder.tsx | 10 ++ 2 files changed, 70 insertions(+), 42 deletions(-) diff --git a/frontend/src/components/layout/TopBar.tsx b/frontend/src/components/layout/TopBar.tsx index 2eb03ea3..2900f2b6 100644 --- a/frontend/src/components/layout/TopBar.tsx +++ b/frontend/src/components/layout/TopBar.tsx @@ -29,6 +29,7 @@ import { useWorkflowUiStore } from '@/store/workflowUiStore'; import { useAuthStore, DEFAULT_ORG_ID } from '@/store/authStore'; import { cn } from '@/lib/utils'; import { env } from '@/config/env'; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; interface TopBarProps { workflowId?: string; @@ -45,6 +46,7 @@ interface TopBarProps { onRedo?: () => void; canUndo?: boolean; canRedo?: boolean; + hasAnalyticsSink?: boolean; } const DEFAULT_WORKFLOW_NAME = 'Untitled Workflow'; @@ -63,6 +65,7 @@ export function TopBar({ onRedo, canUndo, canRedo, + hasAnalyticsSink = false, }: TopBarProps) { const navigate = useNavigate(); const [isSaving, setIsSaving] = useState(false); @@ -469,48 +472,63 @@ export function TopBar({ {env.VITE_OPENSEARCH_DASHBOARDS_URL && workflowId && (!selectedRunId || (selectedRunStatus && selectedRunStatus !== 'RUNNING')) && ( - + + + + + + + + + {!hasAnalyticsSink + ? 'Connect analytics sink to view analytics' + : !isOrgReady + ? 'Loading organization context...' + : selectedRunId + ? 'View analytics for this run in OpenSearch Dashboards' + : 'View analytics for this workflow in OpenSearch Dashboards'} + + + )}