File tree Expand file tree Collapse file tree 5 files changed +58
-12
lines changed
Expand file tree Collapse file tree 5 files changed +58
-12
lines changed Original file line number Diff line number Diff line change 5757
5858[ RFC #33 ] : https://github.com/concourse/rfcs/pull/33
5959
60+ #### <sub ><sup ><a name =" 5458 " href =" #5458 " >:link : </a ></sup ></sub > feature
61+
62+ * Add loading indicator on dashboard while awaiting initial API/cache response. #5458
63+
64+
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ import SideBar.SideBar as SideBar
6666import StrictEvents exposing (onScroll )
6767import Time
6868import UserState
69+ import Views.Spinner as Spinner
6970import Views.Styles
7071
7172
@@ -766,7 +767,19 @@ dashboardView session model =
766767 :: onScroll Scrolled
767768 :: Styles . content model. highDensity
768769 )
769- ( welcomeCard session model :: pipelinesView session model)
770+ ( if model. pipelines == None then
771+ [ loadingView ]
772+
773+ else
774+ welcomeCard session model :: pipelinesView session model
775+ )
776+
777+
778+ loadingView : Html Message
779+ loadingView =
780+ Html . div
781+ ( class " loading" :: Styles . loadingView)
782+ [ Spinner . spinner { sizePx = 36 , margin = " 0" } ]
770783
771784
772785welcomeCard :
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ module Dashboard.Styles exposing
1717 , legend
1818 , legendItem
1919 , legendSeparator
20+ , loadingView
2021 , noPipelineCard
2122 , noPipelineCardHd
2223 , noPipelineCardHeader
@@ -796,3 +797,13 @@ clusterName =
796797 , style " letter-spacing" " 0.1em"
797798 , style " margin-left" " 10px"
798799 ]
800+
801+
802+ loadingView : List (Html .Attribute msg )
803+ loadingView =
804+ [ style " display" " flex"
805+ , style " justify-content" " center"
806+ , style " align-items" " center"
807+ , style " width" " 100%"
808+ , style " height" " 100%"
809+ ]
Original file line number Diff line number Diff line change @@ -116,17 +116,6 @@ all =
116116 |> Common . queryView
117117 |> Query . find [ class " pipeline-wrapper" ]
118118 |> Query . has [ class " parallel-grid" ]
119- , test " renders team sections when receive cached teams delivery" <|
120- \ _ ->
121- Common . init " /"
122- |> Application . handleDelivery
123- ( CachedTeamsReceived <|
124- Ok <|
125- [ { id = 0 , name = " team-0" } ]
126- )
127- |> Tuple . first
128- |> Common . queryView
129- |> Query . has [ class " dashboard-team-group" , containing [ text " team-0" ] ]
130119 , test " ignores the job cache after fetching successfully" <|
131120 \ _ ->
132121 Common . init " /"
Original file line number Diff line number Diff line change @@ -347,6 +347,34 @@ all =
347347 |> Common . queryView
348348 |> Query . find [ id " top-bar-app" ]
349349 |> Query . has [ style " height" " 54px" ]
350+ , describe " loading section" <|
351+ [ test " has a loading section when awaiting API data" <|
352+ \ _ ->
353+ Common . init " /"
354+ |> Common . queryView
355+ |> Query . has [ class " loading" ]
356+ , test " centers spinner" <|
357+ \ _ ->
358+ Common . init " /"
359+ |> Common . queryView
360+ |> Query . has
361+ [ style " display" " flex"
362+ , style " justify-content" " center"
363+ , style " align-items" " center"
364+ , style " width" " 100%"
365+ , style " height" " 100%"
366+ ]
367+ , test " contains a spinner" <|
368+ \ _ ->
369+ Common . init " /"
370+ |> Common . queryView
371+ |> Query . find [ class " loading" ]
372+ |> Query . has
373+ [ style " animation" " container-rotate 1568ms linear infinite"
374+ , style " height" " 36px"
375+ , style " width" " 36px"
376+ ]
377+ ]
350378 , test " high density view has no vertical scroll" <|
351379 \ _ ->
352380 whenOnDashboard { highDensity = True }
You can’t perform that action at this time.
0 commit comments