@@ -7,6 +7,7 @@ import { FormItem } from '@/components/ui/form/FormItem';
77import { FormLabel } from '@/components/ui/form/FormLabel' ;
88import { FormMessage } from '@/components/ui/form/FormMessage' ;
99import { Input } from '@/components/ui/input' ;
10+ import { activeClusterStatuses } from '@/config/clusterStatuses' ;
1011import { defaultInstanceRoute , defaultInstanceRouteUpOne , isLocalStudio } from '@/config/constants' ;
1112import { useInstanceClientIdParams } from '@/config/useInstanceClient' ;
1213import { getClusterInfoQueryOptions } from '@/features/cluster/queries/getClusterInfoQuery' ;
@@ -39,6 +40,8 @@ export function ClusterInstanceSignIn() {
3940 const instance = useMemo (
4041 ( ) => instanceId && cluster && cluster ?. instances ?. find ( i => i . id === instanceId ) ,
4142 [ cluster , instanceId ] ) ;
43+ const isActive = useMemo ( ( ) => cluster ?. status && activeClusterStatuses . includes ( cluster . status ) , [ cluster ?. status ] ) ;
44+
4245 const properNoun = isLocalStudio ? 'Local' : instanceId ? 'Instance' : 'Cluster' ;
4346 const commonNoun = isLocalStudio ? 'instance' : instanceId ? 'instance' : 'cluster' ;
4447
@@ -95,7 +98,7 @@ export function ClusterInstanceSignIn() {
9598 }
9699 authStore . setUserForEntity ( instance || cluster || OverallAppSignIn , user ) ;
97100 void queryClient . invalidateQueries ( { queryKey : [ queryKeys . user ] , refetchType : 'none' } ) ;
98- router . invalidate ( ) ;
101+ void router . invalidate ( ) ;
99102 await navigate ( {
100103 to : redirect ?. startsWith ( '/' )
101104 ? redirect
@@ -111,9 +114,12 @@ export function ClusterInstanceSignIn() {
111114 return < Navigate to = "../instances" replace = { true } /> ;
112115 }
113116
114- if ( cluster ?. resetPassword ) {
117+ if ( isActive && cluster ?. resetPassword ) {
115118 return < Navigate to = { `/${ cluster . organizationId } /${ cluster . id } /finish-setup` } replace = { true } /> ;
116119 }
120+ if ( ! isActive && cluster ?. resetPassword ) {
121+ return < Navigate to = { `/${ cluster . organizationId } /${ cluster . id } /progress` } replace = { true } /> ;
122+ }
117123
118124 return (
119125 < >
@@ -165,7 +171,8 @@ export function ClusterInstanceSignIn() {
165171 </ Button >
166172 { healthy === false && (
167173 < div className = "p-4 mt-4 text-sm text-yellow-800 rounded-lg bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300" role = "alert" >
168- < span className = "font-medium" > Warning!</ span > This { commonNoun } is not responding to GET { operationsUrl } health. Is the server running? Have
174+ < span className = "font-medium" > Warning!</ span > This { commonNoun } is not responding to
175+ GET { operationsUrl } health. Is the server running? Have
169176 you < a href = "https://docs.harperdb.io/docs/developers/security/configuration#cors" target = "_blank" className = "underline" > enabled
170177 CORS</ a > for the operations API?
171178 </ div >
0 commit comments