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(resources): get all build resources #811

Merged
merged 4 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
52 changes: 52 additions & 0 deletions src/elm/Api/Operations.elm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module Api.Operations exposing
, enableRepo
, expandPipelineConfig
, finishAuthentication
, getAllBuildServices
, getAllBuildSteps
, getBuild
, getBuildGraph
, getBuildServiceLog
Expand Down Expand Up @@ -681,6 +683,31 @@ getBuildSteps baseUrl session options =
|> withAuth session


{-| getAllBuildSteps : retrieves all steps for a build.
-}
getAllBuildSteps :
String
-> Session
->
{ a
| org : String
, repo : String
, build : String
}
-> Request Vela.Step
getAllBuildSteps baseUrl session options =
get baseUrl
(Api.Endpoint.Steps
(Just 1)
(Just 100)
options.org
options.repo
options.build
)
Vela.decodeStep
|> withAuth session


{-| getBuildServices : retrieves services for a build.
-}
getBuildServices :
Expand Down Expand Up @@ -708,6 +735,31 @@ getBuildServices baseUrl session options =
|> withAuth session


{-| getAllBuildServices : retrieves all services for a build.
-}
getAllBuildServices :
String
-> Session
->
{ a
| org : String
, repo : String
, build : String
}
-> Request Vela.Service
getAllBuildServices baseUrl session options =
get baseUrl
(Api.Endpoint.Services
(Just 1)
(Just 100)
options.org
options.repo
options.build
)
Vela.decodeService
|> withAuth session


{-| getBuildStepLog : retrieves a log for a step.
-}
getBuildStepLog :
Expand Down
42 changes: 41 additions & 1 deletion src/elm/Effect.elm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Effect exposing
, sendCmd, sendMsg
, pushRoute, replaceRoute, loadExternalUrl
, map, toCmd
, addAlertError, addAlertSuccess, addDeployment, addFavorites, addOrgSecret, addRepoSchedule, addRepoSecret, addSharedSecret, alertsUpdate, approveBuild, cancelBuild, chownRepo, clearRedirect, deleteOrgSecret, deleteRepoSchedule, deleteRepoSecret, deleteSharedSecret, disableRepo, downloadFile, enableRepo, expandPipelineConfig, finishAuthentication, focusOn, getBuild, getBuildGraph, getBuildServiceLog, getBuildServices, getBuildStepLog, getBuildSteps, getCurrentUser, getCurrentUserShared, getDashboard, getOrgBuilds, getOrgRepos, getOrgSecret, getOrgSecrets, getPipelineConfig, getPipelineTemplates, getRepo, getRepoBuilds, getRepoBuildsShared, getRepoDeployments, getRepoHooks, getRepoHooksShared, getRepoSchedule, getRepoSchedules, getRepoSecret, getRepoSecrets, getSettings, getSharedSecret, getSharedSecrets, getWorkers, handleHttpError, logout, pushPath, redeliverHook, repairRepo, replacePath, replaceRouteRemoveTabHistorySkipDomFocus, restartBuild, setRedirect, setTheme, updateFavicon, updateFavorite, updateOrgSecret, updateRepo, updateRepoSchedule, updateRepoSecret, updateSettings, updateSharedSecret, updateSourceReposShared
, addAlertError, addAlertSuccess, addDeployment, addFavorites, addOrgSecret, addRepoSchedule, addRepoSecret, addSharedSecret, alertsUpdate, approveBuild, cancelBuild, chownRepo, clearRedirect, deleteOrgSecret, deleteRepoSchedule, deleteRepoSecret, deleteSharedSecret, disableRepo, downloadFile, enableRepo, expandPipelineConfig, finishAuthentication, focusOn, getAllBuildServices, getAllBuildSteps, getBuild, getBuildGraph, getBuildServiceLog, getBuildServices, getBuildStepLog, getBuildSteps, getCurrentUser, getCurrentUserShared, getDashboard, getOrgBuilds, getOrgRepos, getOrgSecret, getOrgSecrets, getPipelineConfig, getPipelineTemplates, getRepo, getRepoBuilds, getRepoBuildsShared, getRepoDeployments, getRepoHooks, getRepoHooksShared, getRepoSchedule, getRepoSchedules, getRepoSecret, getRepoSecrets, getSettings, getSharedSecret, getSharedSecrets, getWorkers, handleHttpError, logout, pushPath, redeliverHook, repairRepo, replacePath, replaceRouteRemoveTabHistorySkipDomFocus, restartBuild, setRedirect, setTheme, updateFavicon, updateFavorite, updateOrgSecret, updateRepo, updateRepoSchedule, updateRepoSecret, updateSettings, updateSharedSecret, updateSourceReposShared
)

{-|
Expand Down Expand Up @@ -791,6 +791,26 @@ getBuildSteps options =
|> sendCmd


getAllBuildSteps :
{ baseUrl : String
, session : Auth.Session.Session
, onResponse : Result (Http.Detailed.Error String) ( Http.Metadata, List Vela.Step ) -> msg
, org : String
, repo : String
, build : String
}
-> Effect msg
getAllBuildSteps options =
Api.tryAll
options.onResponse
(Api.Operations.getAllBuildSteps
options.baseUrl
options.session
options
)
|> sendCmd


getBuildServices :
{ baseUrl : String
, session : Auth.Session.Session
Expand All @@ -813,6 +833,26 @@ getBuildServices options =
|> sendCmd


getAllBuildServices :
{ baseUrl : String
, session : Auth.Session.Session
, onResponse : Result (Http.Detailed.Error String) ( Http.Metadata, List Vela.Service ) -> msg
, org : String
, repo : String
, build : String
}
-> Effect msg
getAllBuildServices options =
Api.tryAll
options.onResponse
(Api.Operations.getAllBuildServices
options.baseUrl
options.session
options
)
|> sendCmd


getBuildStepLog :
{ baseUrl : String
, session : Auth.Session.Session
Expand Down
8 changes: 2 additions & 6 deletions src/elm/Pages/Org_/Repo_/Build_.elm
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ init shared route () =
, logFollow = 0
}
, Effect.batch
[ Effect.getBuildSteps
[ Effect.getAllBuildSteps
{ baseUrl = shared.velaAPIBaseURL
, session = shared.session
, onResponse =
Expand All @@ -206,8 +206,6 @@ init shared route () =
|> Maybe.withDefault "false"
|> (==) "false"
}
, pageNumber = Nothing
, perPage = Just 100
, org = route.params.org
, repo = route.params.repo
, build = route.params.build
Expand Down Expand Up @@ -547,12 +545,10 @@ update shared route msg model =
-- REFRESH
Tick options ->
( model
, Effect.getBuildSteps
, Effect.getAllBuildSteps
{ baseUrl = shared.velaAPIBaseURL
, session = shared.session
, onResponse = GetBuildStepsRefreshResponse
, pageNumber = Nothing
, perPage = Just 100
, org = route.params.org
, repo = route.params.repo
, build = route.params.build
Expand Down
8 changes: 2 additions & 6 deletions src/elm/Pages/Org_/Repo_/Build_/Services.elm
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,10 @@ init shared route () =
, logFollow = 0
}
, Effect.batch
[ Effect.getBuildServices
[ Effect.getAllBuildServices
{ baseUrl = shared.velaAPIBaseURL
, session = shared.session
, onResponse = GetBuildServicesResponse
, pageNumber = Nothing
, perPage = Just 100
, org = route.params.org
, repo = route.params.repo
, build = route.params.build
Expand Down Expand Up @@ -538,12 +536,10 @@ update shared route msg model =
-- REFRESH
Tick options ->
( model
, Effect.getBuildServices
, Effect.getAllBuildServices
{ baseUrl = shared.velaAPIBaseURL
, session = shared.session
, onResponse = GetBuildServicesRefreshResponse
, pageNumber = Nothing
, perPage = Just 100
, org = route.params.org
, repo = route.params.repo
, build = route.params.build
Expand Down
2 changes: 2 additions & 0 deletions src/elm/Vela.elm
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ module Vela exposing
, decodeSchedules
, decodeSecret
, decodeSecrets
, decodeService
, decodeServices
, decodeSettings
, decodeSourceRepositories
, decodeStep
, decodeSteps
, decodeUser
, decodeWorkers
Expand Down
Loading