mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 10:58:10 +00:00
Keep optional GitLab job warnings consistent in details
This commit is contained in:
@@ -246,7 +246,7 @@ export type DetailPayload =
|
||||
comments: DetailComment[]
|
||||
labels: string[]
|
||||
assignees: string[]
|
||||
pipelineJobs: Array<{
|
||||
pipelineJobs: {
|
||||
id?: number
|
||||
name: string
|
||||
stage: string
|
||||
@@ -254,7 +254,7 @@ export type DetailPayload =
|
||||
allowFailure?: boolean
|
||||
webUrl?: string | null
|
||||
duration?: number | null
|
||||
}>
|
||||
}[]
|
||||
}
|
||||
| {
|
||||
provider: 'linear'
|
||||
|
||||
@@ -322,6 +322,7 @@ export function CheckRunDetailsPanel({
|
||||
return hasJobs ? (
|
||||
<CheckRunJobs
|
||||
key="jobs"
|
||||
check={check}
|
||||
jobs={jobs}
|
||||
hasFailedJobs={failedJobs.length > 0}
|
||||
positionOwner={positionOwner}
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
import React from 'react'
|
||||
import { CheckCircle2, ChevronDown, CircleDashed, MinusCircle, XCircle } from 'lucide-react'
|
||||
import {
|
||||
AlertTriangle,
|
||||
CheckCircle2,
|
||||
ChevronDown,
|
||||
CircleDashed,
|
||||
MinusCircle,
|
||||
XCircle
|
||||
} from 'lucide-react'
|
||||
import { isGitLabAllowedFailureJob } from '@/components/github/pr-check-presentation'
|
||||
import { CheckJobLogTail } from '@/components/right-sidebar/checks-panel/logs/check-job-log-tail'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { PRCheckJob, PRCheckStep } from '../../../../../../shared/github/check-types'
|
||||
import type {
|
||||
PRCheckDetail,
|
||||
PRCheckJob,
|
||||
PRCheckStep
|
||||
} from '../../../../../../shared/github/check-types'
|
||||
import {
|
||||
resolveStepOutcome,
|
||||
summarizeJobSteps,
|
||||
@@ -105,10 +117,12 @@ function OtherJobSteps({
|
||||
}
|
||||
|
||||
function JobCard({
|
||||
check,
|
||||
job,
|
||||
identity,
|
||||
owner
|
||||
}: {
|
||||
check: PRCheckDetail
|
||||
job: PRCheckJob
|
||||
identity: string
|
||||
owner?: CheckDetailsReadingOwner
|
||||
@@ -149,7 +163,9 @@ function JobCard({
|
||||
return (
|
||||
<div className="px-3 py-3">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
{jobFailed ? (
|
||||
{isGitLabAllowedFailureJob(check, job) ? (
|
||||
<AlertTriangle className="size-4 shrink-0 text-amber-500" />
|
||||
) : jobFailed ? (
|
||||
<XCircle className="size-4 shrink-0 text-destructive" />
|
||||
) : (
|
||||
<CheckCircle2 className="size-4 shrink-0 text-status-success" />
|
||||
@@ -202,10 +218,12 @@ function JobCard({
|
||||
}
|
||||
|
||||
export function CheckRunJobs({
|
||||
check,
|
||||
jobs,
|
||||
hasFailedJobs,
|
||||
positionOwner
|
||||
}: {
|
||||
check: PRCheckDetail
|
||||
jobs: PRCheckJob[]
|
||||
hasFailedJobs: boolean
|
||||
positionOwner?: CheckDetailsReadingOwner
|
||||
@@ -235,7 +253,13 @@ export function CheckRunJobs({
|
||||
</div>
|
||||
<div className="divide-y divide-border/50">
|
||||
{visible.map(({ job, identity }) => (
|
||||
<JobCard key={identity} job={job} identity={identity} owner={positionOwner} />
|
||||
<JobCard
|
||||
key={identity}
|
||||
check={check}
|
||||
job={job}
|
||||
identity={identity}
|
||||
owner={positionOwner}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -42,6 +42,16 @@ export function getCheckStatusLabel(check: PRCheckDetail, t: Translate = transla
|
||||
return t('auto.components.editor.CheckRunDetailsPanel.3d9f2b8e14', 'Pending')
|
||||
}
|
||||
|
||||
export function isGitLabAllowedFailureJob(check: PRCheckDetail, job: PRCheckJob): boolean {
|
||||
return (
|
||||
check.gitlabAllowedFailure === true &&
|
||||
check.conclusion === 'neutral' &&
|
||||
job.conclusion === 'neutral' &&
|
||||
check.gitlabJobId !== undefined &&
|
||||
job.id === check.gitlabJobId
|
||||
)
|
||||
}
|
||||
|
||||
export function getCheckDetailsKey(check: PRCheckDetail): string {
|
||||
return String(check.checkRunId ?? check.workflowRunId ?? check.url ?? check.name)
|
||||
}
|
||||
|
||||
+14
-11
@@ -11,16 +11,17 @@ import { CheckJobLogTail } from '../logs/check-job-log-tail'
|
||||
import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
|
||||
import { checkJobIdentities } from '@/components/editor/check-details/reading/check-details-reading-cache'
|
||||
import { resolveStepOutcome } from '../../../../../../shared/source-control/checks/pr-check-step-status'
|
||||
import {
|
||||
getCheckStatusLabel,
|
||||
isGitLabAllowedFailureJob
|
||||
} from '@/components/github/pr-check-presentation'
|
||||
import {
|
||||
type CheckDetailsLoadState,
|
||||
type CheckDetailsStickySurface,
|
||||
formatCheckTimestamp,
|
||||
getCheckDetailsStickySurfaceClass
|
||||
} from './check-details-model'
|
||||
import {
|
||||
getCheckConclusion,
|
||||
getCheckStatusLabel
|
||||
} from '../../../../../../shared/source-control/checks/pr-check-status-label'
|
||||
import { getCheckConclusion } from '../../../../../../shared/source-control/checks/pr-check-status-label'
|
||||
|
||||
function ViewFullCheckDetailsButton({
|
||||
onClick,
|
||||
@@ -129,7 +130,7 @@ export function CheckRunDetails({
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-0.5 text-2xs text-muted-foreground">
|
||||
<span>
|
||||
{t('auto.components.right.sidebar.checks.panel.content.a54ae21c6f', 'Status:')}{' '}
|
||||
{details ? getCheckStatusLabel(detailsStatusCheck) : getCheckStatusLabel(check)}
|
||||
{getCheckStatusLabel(detailsStatusCheck, t)}
|
||||
</span>
|
||||
{startedAt && (
|
||||
<span>
|
||||
@@ -202,12 +203,14 @@ export function CheckRunDetails({
|
||||
{job.name}
|
||||
</span>
|
||||
<span className="shrink-0 text-2xs text-muted-foreground">
|
||||
{job.conclusion ??
|
||||
job.status ??
|
||||
t(
|
||||
'auto.components.right.sidebar.checks.panel.content.ee07b33924',
|
||||
'unknown'
|
||||
)}
|
||||
{isGitLabAllowedFailureJob(check, job)
|
||||
? getCheckStatusLabel(check, t)
|
||||
: (job.conclusion ??
|
||||
job.status ??
|
||||
t(
|
||||
'auto.components.right.sidebar.checks.panel.content.ee07b33924',
|
||||
'unknown'
|
||||
))}
|
||||
</span>
|
||||
</div>
|
||||
{job.steps.length > 0 && (
|
||||
|
||||
Reference in New Issue
Block a user