From fccc07567b00f7392c7b453b8f47d4e1d763a660 Mon Sep 17 00:00:00 2001 From: davidvader Date: Mon, 5 Aug 2024 09:20:57 -0500 Subject: [PATCH 1/3] fix: get all build steps regression --- src/elm/Api/Operations.elm | 26 ++++++++++++++++++++++++++ src/elm/Effect.elm | 22 +++++++++++++++++++++- src/elm/Pages/Org_/Repo_/Build_.elm | 4 +--- src/elm/Vela.elm | 1 + 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/elm/Api/Operations.elm b/src/elm/Api/Operations.elm index 96d62acb5..25c96d921 100644 --- a/src/elm/Api/Operations.elm +++ b/src/elm/Api/Operations.elm @@ -20,6 +20,7 @@ module Api.Operations exposing , enableRepo , expandPipelineConfig , finishAuthentication + , getAllBuildSteps , getBuild , getBuildGraph , getBuildServiceLog @@ -681,6 +682,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 : diff --git a/src/elm/Effect.elm b/src/elm/Effect.elm index 7b8817a13..0be7159f1 100644 --- a/src/elm/Effect.elm +++ b/src/elm/Effect.elm @@ -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, 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 ) {-| @@ -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 diff --git a/src/elm/Pages/Org_/Repo_/Build_.elm b/src/elm/Pages/Org_/Repo_/Build_.elm index bd9d63a41..db70c54a0 100644 --- a/src/elm/Pages/Org_/Repo_/Build_.elm +++ b/src/elm/Pages/Org_/Repo_/Build_.elm @@ -195,7 +195,7 @@ init shared route () = , logFollow = 0 } , Effect.batch - [ Effect.getBuildSteps + [ Effect.getAllBuildSteps { baseUrl = shared.velaAPIBaseURL , session = shared.session , onResponse = @@ -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 diff --git a/src/elm/Vela.elm b/src/elm/Vela.elm index 08c9bf11f..7e87d2e1b 100644 --- a/src/elm/Vela.elm +++ b/src/elm/Vela.elm @@ -77,6 +77,7 @@ module Vela exposing , decodeServices , decodeSettings , decodeSourceRepositories + , decodeStep , decodeSteps , decodeUser , decodeWorkers From 9dea012004f6b562f975f4cd6f66964e0ad85db8 Mon Sep 17 00:00:00 2001 From: davidvader Date: Mon, 5 Aug 2024 09:22:31 -0500 Subject: [PATCH 2/3] fix: get all build steps regression --- src/elm/Pages/Org_/Repo_/Build_.elm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/elm/Pages/Org_/Repo_/Build_.elm b/src/elm/Pages/Org_/Repo_/Build_.elm index db70c54a0..aca3fafb3 100644 --- a/src/elm/Pages/Org_/Repo_/Build_.elm +++ b/src/elm/Pages/Org_/Repo_/Build_.elm @@ -545,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 From a9e9c51ef6fdc5f48088b0377023061ae499df20 Mon Sep 17 00:00:00 2001 From: davidvader Date: Mon, 5 Aug 2024 09:27:28 -0500 Subject: [PATCH 3/3] fix: get all build services --- src/elm/Api/Operations.elm | 26 ++++++++++++++++++++ src/elm/Effect.elm | 22 ++++++++++++++++- src/elm/Pages/Org_/Repo_/Build_/Services.elm | 8 ++---- src/elm/Vela.elm | 1 + 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/elm/Api/Operations.elm b/src/elm/Api/Operations.elm index 25c96d921..8581a5ab3 100644 --- a/src/elm/Api/Operations.elm +++ b/src/elm/Api/Operations.elm @@ -20,6 +20,7 @@ module Api.Operations exposing , enableRepo , expandPipelineConfig , finishAuthentication + , getAllBuildServices , getAllBuildSteps , getBuild , getBuildGraph @@ -734,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 : diff --git a/src/elm/Effect.elm b/src/elm/Effect.elm index 0be7159f1..9ad8363c8 100644 --- a/src/elm/Effect.elm +++ b/src/elm/Effect.elm @@ -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, 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 + , 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 ) {-| @@ -833,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 diff --git a/src/elm/Pages/Org_/Repo_/Build_/Services.elm b/src/elm/Pages/Org_/Repo_/Build_/Services.elm index a483bb64b..0cdca677f 100644 --- a/src/elm/Pages/Org_/Repo_/Build_/Services.elm +++ b/src/elm/Pages/Org_/Repo_/Build_/Services.elm @@ -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 @@ -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 diff --git a/src/elm/Vela.elm b/src/elm/Vela.elm index 7e87d2e1b..d7e91d96d 100644 --- a/src/elm/Vela.elm +++ b/src/elm/Vela.elm @@ -74,6 +74,7 @@ module Vela exposing , decodeSchedules , decodeSecret , decodeSecrets + , decodeService , decodeServices , decodeSettings , decodeSourceRepositories