Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pagination for schedules #677

Merged
merged 4 commits into from
Jun 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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