diff --git a/src/features/auth/ClusterInstanceSignIn.tsx b/src/features/auth/ClusterInstanceSignIn.tsx index b2f9ff2dd..3a7f49f86 100644 --- a/src/features/auth/ClusterInstanceSignIn.tsx +++ b/src/features/auth/ClusterInstanceSignIn.tsx @@ -23,6 +23,7 @@ import { getOperationsUrlForInstance } from '@/lib/urls/getOperationsUrlForInsta import { zodResolver } from '@hookform/resolvers/zod'; import { useQuery } from '@tanstack/react-query'; import { Link, Navigate, useParams } from '@tanstack/react-router'; +import { cx } from 'class-variance-authority'; import { useMemo } from 'react'; import { useForm } from 'react-hook-form'; @@ -100,8 +101,13 @@ export function ClusterInstanceSignIn() { )} -
-
+
+

Sign in to Harper {properNoun}

diff --git a/src/features/clusters/components/ClusterCard.tsx b/src/features/clusters/components/ClusterCard.tsx index 92062cac1..85fdeaf29 100644 --- a/src/features/clusters/components/ClusterCard.tsx +++ b/src/features/clusters/components/ClusterCard.tsx @@ -145,6 +145,11 @@ export function ClusterCard({ cluster }: { cluster: Cluster }) { ), + isActive && view && !!operationsUrl && !auth.isLoading && isDirectConnect && ( + + Direct Sign Out + + ), isActive && update && ( @@ -186,11 +191,6 @@ export function ClusterCard({ cluster }: { cluster: Cluster }) { ), - isActive && view && !!operationsUrl && !auth.isLoading && isDirectConnect && ( - - Direct Sign Out - - ), clusterHasFailed && create && ( Try Again diff --git a/src/features/clusters/components/ClusterCardAction.tsx b/src/features/clusters/components/ClusterCardAction.tsx index 3f13621d2..d6d4f98d3 100644 --- a/src/features/clusters/components/ClusterCardAction.tsx +++ b/src/features/clusters/components/ClusterCardAction.tsx @@ -7,12 +7,17 @@ import { Cluster } from '@/integrations/api/api.patch'; import { clusterIsSelfManaged } from '@/integrations/api/clusterIsSelfManaged'; import { Link } from '@tanstack/react-router'; import { ArrowRight } from 'lucide-react'; +import { useCallback } from 'react'; export function ClusterCardAction({ cluster }: { cluster: Cluster }) { const auth = useInstanceAuth(cluster.id); const { view, update } = useOrganizationClusterPermissions(cluster.organizationId, cluster.id); const isFabricConnect = authStore.checkForFabricConnect(cluster.id); const isDirectConnect = !isFabricConnect && !!auth.user; + const prepareForDirectSignIn = useCallback(() => { + authStore.setUserForEntity(cluster, null); + authStore.flagForFabricConnect(cluster.id, false); + }, [cluster]); if (!view) { return undefined; @@ -95,6 +100,7 @@ export function ClusterCardAction({ cluster }: { cluster: Cluster }) { className="text-sm text-nowrap" aria-label={`Sign In to ${cluster.name}`} title={`Sign In to ${cluster.name}`} + onClick={prepareForDirectSignIn} > Direct Sign In