88 Dropdown ,
99 OverlayTrigger ,
1010 Row ,
11+ Spinner ,
1112 Table ,
1213 Tooltip as OverlayTooltip ,
1314} from 'react-bootstrap'
@@ -16,7 +17,7 @@ import {useLocation, useNavigate} from 'react-router-dom'
1617import Navbar from '../components/Navbar'
1718import { Labels , labelsString , MetricName , parseLabels } from '../labels'
1819import { createConnectTransport } from '@bufbuild/connect-web'
19- import { createPromiseClient } from '@connectrpc/connect'
20+ import { createPromiseClient , Code } from '@connectrpc/connect'
2021import { ObjectiveService } from '../proto/objectives/v1alpha1/objectives_connect'
2122import {
2223 Alert as ObjectiveAlert ,
@@ -463,7 +464,7 @@ const List = () => {
463464 // TODO: Pass in the search to the useObjectivesList hook
464465 const {
465466 response : objectiveResponse ,
466- // error: objectiveError,
467+ error : objectiveError ,
467468 status : objectiveStatus ,
468469 } = useObjectivesList ( client , labelsString ( filterLabels ) , '' )
469470
@@ -674,6 +675,54 @@ const List = () => {
674675 ) } `
675676 }
676677
678+ if ( objectiveStatus === 'loading' ) {
679+ return (
680+ < >
681+ < Navbar />
682+ < Container className = "content list" >
683+ < Row className = "mt-3 justify-content-center" >
684+ < Col xs = "auto" className = "text-center" >
685+ < Spinner animation = "border" role = "status" >
686+ < span className = "visually-hidden" > Loading objectives...</ span >
687+ </ Spinner >
688+ < p className = "mt-3" > Loading objectives...</ p >
689+ </ Col >
690+ </ Row >
691+ </ Container >
692+ </ >
693+ )
694+ }
695+
696+ if ( objectiveError !== null && objectiveError !== undefined ) {
697+ return (
698+ < >
699+ < Navbar />
700+ < Container className = "content list" >
701+ < Row className = "mt-3" >
702+ < Col >
703+ { objectiveError . code === Code . Unavailable && (
704+ < Alert variant = "danger" >
705+ < h5 > Backend connection failed</ h5 >
706+ < p className = "mb-0" >
707+ Cannot reach the backend service. Ensure the < b > filesystem</ b > or{ ' ' }
708+ < b > Kubernetes</ b > backend is running.
709+ </ p >
710+ </ Alert >
711+ ) }
712+ { objectiveError . code !== Code . NotFound &&
713+ objectiveError . code !== Code . Unavailable && (
714+ < Alert variant = "danger" >
715+ < h5 > Error loading objectives</ h5 >
716+ < p className = "mb-0" > { objectiveError . message } </ p >
717+ </ Alert >
718+ ) }
719+ </ Col >
720+ </ Row >
721+ </ Container >
722+ </ >
723+ )
724+ }
725+
677726 return (
678727 < >
679728 < Navbar />
0 commit comments