Skip to content

Commit

Permalink
enhance: elm-land opinionated tweaks (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 authored Mar 26, 2024
1 parent 0676888 commit de6be28
Show file tree
Hide file tree
Showing 53 changed files with 1,084 additions and 1,206 deletions.
32 changes: 16 additions & 16 deletions src/elm/Api/Endpoint.elm
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,29 @@ toUrl api endpoint =
Builds maybePage maybePerPage maybeEvent org repo ->
url api [ "repos", org, repo, "builds" ] <| Pagination.toQueryParams maybePage maybePerPage ++ [ UB.string "event" <| Maybe.withDefault "" maybeEvent ]

Build org repo buildNumber ->
url api [ "repos", org, repo, "builds", buildNumber ] []
Build org repo build ->
url api [ "repos", org, repo, "builds", build ] []

CancelBuild org repo buildNumber ->
url api [ "repos", org, repo, "builds", buildNumber, "cancel" ] []
CancelBuild org repo build ->
url api [ "repos", org, repo, "builds", build, "cancel" ] []

ApproveBuild org repo buildNumber ->
url api [ "repos", org, repo, "builds", buildNumber, "approve" ] []
ApproveBuild org repo build ->
url api [ "repos", org, repo, "builds", build, "approve" ] []

Services maybePage maybePerPage org repo buildNumber ->
url api [ "repos", org, repo, "builds", buildNumber, "services" ] <| Pagination.toQueryParams maybePage maybePerPage
Services maybePage maybePerPage org repo build ->
url api [ "repos", org, repo, "builds", build, "services" ] <| Pagination.toQueryParams maybePage maybePerPage

ServiceLogs org repo buildNumber serviceNumber ->
url api [ "repos", org, repo, "builds", buildNumber, "services", serviceNumber, "logs" ] []
ServiceLogs org repo build serviceNumber ->
url api [ "repos", org, repo, "builds", build, "services", serviceNumber, "logs" ] []

Steps maybePage maybePerPage org repo buildNumber ->
url api [ "repos", org, repo, "builds", buildNumber, "steps" ] <| Pagination.toQueryParams maybePage maybePerPage
Steps maybePage maybePerPage org repo build ->
url api [ "repos", org, repo, "builds", build, "steps" ] <| Pagination.toQueryParams maybePage maybePerPage

StepLogs org repo buildNumber stepNumber ->
url api [ "repos", org, repo, "builds", buildNumber, "steps", stepNumber, "logs" ] []
StepLogs org repo build stepNumber ->
url api [ "repos", org, repo, "builds", build, "steps", stepNumber, "logs" ] []

BuildGraph org repo buildNumber ->
url api [ "repos", org, repo, "builds", buildNumber, "graph" ] []
BuildGraph org repo build ->
url api [ "repos", org, repo, "builds", build, "graph" ] []

Secrets maybePage maybePerPage engine type_ org key ->
url api [ "secrets", engine, type_, org, key ] <| Pagination.toQueryParams maybePage maybePerPage
Expand Down
36 changes: 18 additions & 18 deletions src/elm/Api/Operations.elm
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ restartBuild :
{ a
| org : String
, repo : String
, buildNumber : String
, build : String
}
-> Request Vela.Build
restartBuild baseUrl session options =
post baseUrl
(Api.Endpoint.Build
options.org
options.repo
options.buildNumber
options.build
)
Http.emptyBody
Vela.decodeBuild
Expand All @@ -320,15 +320,15 @@ cancelBuild :
{ a
| org : String
, repo : String
, buildNumber : String
, build : String
}
-> Request Vela.Build
cancelBuild baseUrl session options =
delete baseUrl
(Api.Endpoint.CancelBuild
options.org
options.repo
options.buildNumber
options.build
)
Vela.decodeBuild
|> withAuth session
Expand All @@ -343,15 +343,15 @@ approveBuild :
{ a
| org : String
, repo : String
, buildNumber : String
, build : String
}
-> Request Vela.Build
approveBuild baseUrl session options =
post baseUrl
(Api.Endpoint.ApproveBuild
options.org
options.repo
options.buildNumber
options.build
)
Http.emptyBody
Vela.decodeBuild
Expand Down Expand Up @@ -586,15 +586,15 @@ getBuild :
{ a
| org : String
, repo : String
, buildNumber : String
, build : String
}
-> Request Vela.Build
getBuild baseUrl session options =
get baseUrl
(Api.Endpoint.Build
options.org
options.repo
options.buildNumber
options.build
)
Vela.decodeBuild
|> withAuth session
Expand All @@ -609,7 +609,7 @@ getBuildSteps :
{ a
| org : String
, repo : String
, buildNumber : String
, build : String
, pageNumber : Maybe Int
, perPage : Maybe Int
}
Expand All @@ -621,7 +621,7 @@ getBuildSteps baseUrl session options =
options.perPage
options.org
options.repo
options.buildNumber
options.build
)
Vela.decodeSteps
|> withAuth session
Expand All @@ -636,7 +636,7 @@ getBuildServices :
{ a
| org : String
, repo : String
, buildNumber : String
, build : String
, pageNumber : Maybe Int
, perPage : Maybe Int
}
Expand All @@ -648,7 +648,7 @@ getBuildServices baseUrl session options =
options.perPage
options.org
options.repo
options.buildNumber
options.build
)
Vela.decodeServices
|> withAuth session
Expand All @@ -663,7 +663,7 @@ getBuildStepLog :
{ a
| org : String
, repo : String
, buildNumber : String
, build : String
, stepNumber : String
}
-> Request Vela.Log
Expand All @@ -672,7 +672,7 @@ getBuildStepLog baseUrl session options =
(Api.Endpoint.StepLogs
options.org
options.repo
options.buildNumber
options.build
options.stepNumber
)
Vela.decodeLog
Expand All @@ -688,7 +688,7 @@ getBuildServiceLog :
{ a
| org : String
, repo : String
, buildNumber : String
, build : String
, serviceNumber : String
}
-> Request Vela.Log
Expand All @@ -697,7 +697,7 @@ getBuildServiceLog baseUrl session options =
(Api.Endpoint.ServiceLogs
options.org
options.repo
options.buildNumber
options.build
options.serviceNumber
)
Vela.decodeLog
Expand Down Expand Up @@ -783,15 +783,15 @@ getBuildGraph :
{ a
| org : String
, repo : String
, buildNumber : String
, build : String
}
-> Request Vela.BuildGraph
getBuildGraph baseUrl session options =
get baseUrl
(Api.Endpoint.BuildGraph
options.org
options.repo
options.buildNumber
options.build
)
Vela.decodeBuildGraph
|> withAuth session
Expand Down
2 changes: 1 addition & 1 deletion src/elm/Auth.elm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ onPageLoad shared route =

Unauthenticated ->
Auth.Action.replaceRoute
{ path = Route.Path.AccountLogin
{ path = Route.Path.Account_Login
, query =
Dict.fromList
[ ( "from", Route.toString route ) ]
Expand Down
Loading

0 comments on commit de6be28

Please sign in to comment.