Skip to content

Commit a53768a

Browse files
authored
Merge pull request #2536 from trycompai/feat/github-2fa-check
fix: show actual integration monitor service names
2 parents 6a0397a + 95abc27 commit a53768a

File tree

1 file changed

+64
-36
lines changed

1 file changed

+64
-36
lines changed

apps/app/src/app/(app)/[orgId]/tasks/[taskId]/components/TaskIntegrationChecks.tsx

Lines changed: 64 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,14 @@ export function TaskIntegrationChecks({
162162

163163
const handleConfirmDisconnect = useCallback(async () => {
164164
if (!disconnectTarget) return;
165-
const { connectionId, checkId, checkName } = disconnectTarget;
165+
const { connectionId, checkId, checkName, integrationName } =
166+
disconnectTarget;
167+
const monitorName = integrationName || checkName;
166168
setTogglingCheck(checkId);
167169
setDisconnectError(null);
168170
try {
169171
await disconnectCheckFromTask(connectionId, checkId);
170-
toast.success(`Disconnected "${checkName}" from this task.`);
172+
toast.success(`Disconnected "${monitorName}" from this task.`);
171173
setDisconnectTarget(null);
172174
} catch (err) {
173175
console.error('Failed to disconnect check:', err);
@@ -198,6 +200,12 @@ export function TaskIntegrationChecks({
198200
[reconnectCheckToTask],
199201
);
200202

203+
const getMonitorDisplayName = useCallback(
204+
(check: Pick<TaskIntegrationCheck, 'integrationName' | 'checkName'>) =>
205+
check.integrationName || check.checkName,
206+
[],
207+
);
208+
201209
if (loading) {
202210
return (
203211
<div className="space-y-5">
@@ -380,6 +388,7 @@ export function TaskIntegrationChecks({
380388
const isRunning = runningCheck === check.checkId;
381389
const isExpanded = expandedCheck === check.checkId;
382390
const needsConfig = check.needsConfiguration;
391+
const monitorName = getMonitorDisplayName(check);
383392

384393
// Determine status from latest run
385394
const hasFailed = latestRun
@@ -459,8 +468,13 @@ export function TaskIntegrationChecks({
459468
<div className="flex-1 min-w-0">
460469
<div className="flex items-center gap-2">
461470
<p className="font-semibold text-foreground text-sm tracking-tight">
462-
{check.checkName}
471+
{monitorName}
463472
</p>
473+
{check.checkName !== monitorName && (
474+
<span className="text-xs text-muted-foreground">
475+
{check.checkName}
476+
</span>
477+
)}
464478
</div>
465479
{needsConfig ? (
466480
<p className="text-xs text-muted-foreground mt-0.5">
@@ -640,6 +654,7 @@ export function TaskIntegrationChecks({
640654
<div className="space-y-1">
641655
{disabledForTaskChecks.map((check) => {
642656
const isToggling = togglingCheck === check.checkId;
657+
const monitorName = getMonitorDisplayName(check);
643658
return (
644659
<div
645660
key={`disabled-${check.integrationId}-${check.checkId}`}
@@ -655,7 +670,7 @@ export function TaskIntegrationChecks({
655670
/>
656671
<div>
657672
<p className="text-sm text-muted-foreground line-through">
658-
{check.checkName}
673+
{monitorName}
659674
</p>
660675
<p className="text-[11px] text-muted-foreground/80">
661676
Will not run until reconnected
@@ -671,7 +686,7 @@ export function TaskIntegrationChecks({
671686
handleReconnect(
672687
check.connectionId!,
673688
check.checkId,
674-
check.checkName,
689+
monitorName,
675690
)
676691
}
677692
>
@@ -696,33 +711,36 @@ export function TaskIntegrationChecks({
696711
More integrations available
697712
</p>
698713
<div className="space-y-1">
699-
{disconnectedChecks.map((check) => (
700-
<Link
701-
key={`${check.integrationId}-${check.checkId}`}
702-
href={`/${orgId}/integrations`}
703-
className={cn(
704-
'flex flex-row items-center justify-between py-2 px-3 rounded-md',
705-
'hover:bg-muted/50 transition-colors',
706-
'cursor-pointer group',
707-
)}
708-
>
709-
<div className="flex items-center gap-3">
710-
<Image
711-
src={check.integrationLogoUrl}
712-
alt={check.integrationName}
713-
width={20}
714-
height={20}
715-
className="rounded opacity-50 group-hover:opacity-100 transition-opacity"
716-
/>
717-
<div>
718-
<p className="text-sm text-muted-foreground group-hover:text-foreground transition-colors">
719-
{check.checkName}
720-
</p>
714+
{disconnectedChecks.map((check) => {
715+
const monitorName = getMonitorDisplayName(check);
716+
return (
717+
<Link
718+
key={`${check.integrationId}-${check.checkId}`}
719+
href={`/${orgId}/integrations`}
720+
className={cn(
721+
'flex flex-row items-center justify-between py-2 px-3 rounded-md',
722+
'hover:bg-muted/50 transition-colors',
723+
'cursor-pointer group',
724+
)}
725+
>
726+
<div className="flex items-center gap-3">
727+
<Image
728+
src={check.integrationLogoUrl}
729+
alt={check.integrationName}
730+
width={20}
731+
height={20}
732+
className="rounded opacity-50 group-hover:opacity-100 transition-opacity"
733+
/>
734+
<div>
735+
<p className="text-sm text-muted-foreground group-hover:text-foreground transition-colors">
736+
{monitorName}
737+
</p>
738+
</div>
721739
</div>
722-
</div>
723-
<ExternalLink className="w-3.5 h-3.5 shrink-0 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" />
724-
</Link>
725-
))}
740+
<ExternalLink className="w-3.5 h-3.5 shrink-0 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" />
741+
</Link>
742+
);
743+
})}
726744
</div>
727745
</div>
728746
)}
@@ -748,11 +766,21 @@ export function TaskIntegrationChecks({
748766
<AlertDialogDescription>
749767
{disconnectTarget ? (
750768
<>
751-
<strong>{disconnectTarget.checkName}</strong> from{' '}
752-
<strong>{disconnectTarget.integrationName}</strong> will no
753-
longer run for this task. The integration itself stays
754-
connected and will continue running for other tasks. You can
755-
reconnect it to this task at any time.
769+
<strong>
770+
{disconnectTarget.integrationName ||
771+
disconnectTarget.checkName}
772+
</strong>
773+
{disconnectTarget.checkName !==
774+
(disconnectTarget.integrationName ||
775+
disconnectTarget.checkName) && (
776+
<>
777+
{' '}
778+
(<strong>{disconnectTarget.checkName}</strong> check)
779+
</>
780+
)}{' '}
781+
will no longer run for this task. The integration itself
782+
stays connected and will continue running for other tasks. You
783+
can reconnect it to this task at any time.
756784
</>
757785
) : null}
758786
</AlertDialogDescription>

0 commit comments

Comments
 (0)