From 00135dfa02539b8ced5c15f4986cd2e263f19d2b Mon Sep 17 00:00:00 2001 From: Saxon Fletcher Date: Fri, 27 Jun 2025 16:01:24 +1000 Subject: [PATCH] error positioning --- .../BranchManagement/WorkflowLogsCard.tsx | 74 ++++++++++------ apps/studio/pages/project/[ref]/merge.tsx | 84 ++++++++++--------- 2 files changed, 91 insertions(+), 67 deletions(-) diff --git a/apps/studio/components/interfaces/BranchManagement/WorkflowLogsCard.tsx b/apps/studio/components/interfaces/BranchManagement/WorkflowLogsCard.tsx index c8992b5975e..9643fd6d1c8 100644 --- a/apps/studio/components/interfaces/BranchManagement/WorkflowLogsCard.tsx +++ b/apps/studio/components/interfaces/BranchManagement/WorkflowLogsCard.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Card, CardHeader, CardContent, CardTitle, Button } from 'ui' import { motion } from 'framer-motion' -import { CircleDotDashed, GitMerge, X } from 'lucide-react' +import { CircleDotDashed, GitMerge, X, AlertTriangle } from 'lucide-react' import Link from 'next/link' import { useWorkflowRunQuery } from 'data/workflow-runs/workflow-run-query' import { useWorkflowRunsQuery } from 'data/workflow-runs/workflow-runs-query' @@ -13,6 +13,10 @@ interface WorkflowLogsCardProps { onStatusChange?: (status: string, workflowRunId: string) => void statusComplete?: string // Status that indicates completion (e.g., 'FUNCTIONS_DEPLOYED') statusFailed?: string[] // Statuses that indicate failure (e.g., ['MIGRATIONS_FAILED', 'FUNCTIONS_FAILED']) + headerTitle?: string // Additional header title + headerDescription?: string // Additional header description + headerIcon?: React.ReactNode // Additional header icon + headerAction?: React.ReactNode // Additional header action button } const WorkflowLogsCard: React.FC = ({ @@ -22,6 +26,10 @@ const WorkflowLogsCard: React.FC = ({ onStatusChange, statusComplete = 'FUNCTIONS_DEPLOYED', statusFailed = ['MIGRATIONS_FAILED', 'FUNCTIONS_FAILED'], + headerTitle, + headerDescription, + headerIcon, + headerAction, }) => { const scrollRef = React.useRef(null) @@ -76,12 +84,14 @@ const WorkflowLogsCard: React.FC = ({ (!currentWorkflowRun?.status || !statusFailed.includes(currentWorkflowRun.status)) return ( - - + +
- - {/* Activity / success indicator */} - {isPolling ? ( +
+ {/* Custom icon or activity / success indicator */} + {headerIcon ? ( + headerIcon + ) : isPolling ? ( = ({ ) : ( showSuccessIcon && )} - {/* Status text */} - {isPolling - ? 'Processing...' - : showSuccessIcon - ? 'Workflow completed successfully' - : isFailed - ? 'Workflow failed' - : 'Workflow completed'} - - {currentWorkflowRun?.id && ( -
-
#{currentWorkflowRun.id}
- {onClose && ( -
+
+ {/* Custom action or default close button */} + {headerAction && headerAction} + {onClose && ( +
{ ) - // Workflow failure notice component - const WorkflowFailureNotice = () => ( - -
-
-

Workflow failed

-

- The deployment workflow encountered an error. Consider creating a fresh branch from the - latest production branch to resolve potential conflicts. -

-
- -
-
- ) - console.log('workflow:', currentWorkflowRunId) return ( @@ -509,26 +486,53 @@ const MergePage: NextPageWithLayout = () => { >
- {/* Show out of date notice, workflow failure notice, or workflow logs */} + {/* Show out of date notice or workflow logs */} {isBranchOutOfDate && !currentWorkflowRunId ? ( - ) : hasCurrentWorkflowFailed ? ( - ) : currentWorkflowRunId ? ( - { - const { workflow_run_id, ...queryWithoutWorkflowId } = router.query - router.push({ - pathname: router.pathname, - query: queryWithoutWorkflowId, - }) - }} - onStatusChange={handleWorkflowStatusChange} - statusComplete="FUNCTIONS_DEPLOYED" - statusFailed={['MIGRATIONS_FAILED', 'FUNCTIONS_FAILED']} - /> +
+ { + const { workflow_run_id, ...queryWithoutWorkflowId } = router.query + router.push({ + pathname: router.pathname, + query: queryWithoutWorkflowId, + }) + }} + onStatusChange={handleWorkflowStatusChange} + statusComplete="FUNCTIONS_DEPLOYED" + statusFailed={['MIGRATIONS_FAILED', 'FUNCTIONS_FAILED']} + headerTitle={hasCurrentWorkflowFailed ? 'Workflow failed' : undefined} + headerDescription={ + hasCurrentWorkflowFailed + ? 'Consider creating a fresh branch from the latest production branch to resolve potential conflicts.' + : undefined + } + headerIcon={ + hasCurrentWorkflowFailed ? ( + + ) : undefined + } + headerAction={ + hasCurrentWorkflowFailed ? ( + + ) : undefined + } + /> +
) : null} {/* Tab navigation */}