Skip to content

Commit

Permalink
fix: pagination for schedules (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 authored Jun 15, 2023
1 parent 7a6033c commit ed0251a
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/elm/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ import Vela
, updateRepoLimit
, updateRepoTimeout
, updateSchedules
, updateSchedulesPage
, updateSchedulesPager
, updateSchedulesPerPage
)


Expand Down Expand Up @@ -682,6 +684,11 @@ update msg model =
, Navigation.pushUrl model.navigationKey <| Routes.routeToUrl <| Routes.SharedSecrets engine org team (Just pageNumber) maybePerPage
)

Pages.Schedules org repo _ maybePerPage ->
( { model | repo = updateSchedules Loading rm }
, Navigation.pushUrl model.navigationKey <| Routes.routeToUrl <| Routes.Schedules org repo (Just pageNumber) maybePerPage
)

_ ->
( model, Cmd.none )

Expand Down Expand Up @@ -3476,6 +3483,19 @@ loadRepoSubPage model org repo toPage =
|> updateHooksPage Nothing
|> updateHooksPerPage Nothing
)
-- update schedules pagination
|> (\rm_ ->
case toPage of
Pages.Schedules _ _ maybePage maybePerPage ->
rm_
|> updateSchedulesPage maybePage
|> updateSchedulesPerPage maybePerPage

_ ->
rm_
|> updateSchedulesPage Nothing
|> updateSchedulesPerPage Nothing
)
}
, Cmd.batch
[ getCurrentUser model
Expand Down Expand Up @@ -3542,8 +3562,15 @@ loadRepoSubPage model org repo toPage =
Pages.RepoSecrets _ o r _ _ ->
( model, fetchSecrets o r )

Pages.Schedules o r _ _ ->
( model, getSchedules model o r Nothing Nothing )
Pages.Schedules o r maybePage maybePerPage ->
( { model
| repo =
rm
|> updateSchedulesPage maybePage
|> updateSchedulesPerPage maybePerPage
}
, getSchedules model o r maybePage maybePerPage
)

Pages.Hooks o r maybePage maybePerPage ->
( { model
Expand Down

0 comments on commit ed0251a

Please sign in to comment.