Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
wass3r committed Nov 19, 2024
1 parent 2557666 commit 8b05bc4
Show file tree
Hide file tree
Showing 19 changed files with 1,170 additions and 251 deletions.
8 changes: 7 additions & 1 deletion elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@
"krisajenkins/remotedata": "6.0.1",
"pablen/toasty": "1.2.0",
"ryan-haskell/date-format": "1.0.0",
"terezka/elm-charts": "4.0.0",
"vito/elm-ansi": "9.0.2"
},
"indirect": {
"K-Adam/elm-dom": "1.0.0",
"avh4/elm-fifo": "1.0.4",
"danhandrea/elm-time-extra": "1.1.0",
"elm/parser": "1.1.0",
"elm/random": "1.0.0",
"elm/regex": "1.0.0",
"elm/virtual-dom": "1.0.3",
"elm-community/intdict": "3.1.0",
"justinmimbs/date": "4.1.0",
"justinmimbs/time-extra": "1.2.0",
"myrho/elm-round": "1.0.5",
"rtfeldman/elm-iso8601-date-strings": "1.1.4"
"rtfeldman/elm-iso8601-date-strings": "1.1.4",
"terezka/intervals": "2.0.2"
}
},
"test-dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions src/elm/Api/Endpoint.elm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Endpoint
| Hooks (Maybe Pagination.Page) (Maybe Pagination.PerPage) Vela.Org Vela.Repo
| Hook Vela.Org Vela.Repo Vela.HookNumber
| OrgBuilds (Maybe Pagination.Page) (Maybe Pagination.PerPage) (Maybe Vela.Event) Vela.Org
| Builds (Maybe Pagination.Page) (Maybe Pagination.PerPage) (Maybe Vela.Event) Vela.Org Vela.Repo
| Builds (Maybe Pagination.Page) (Maybe Pagination.PerPage) (Maybe Vela.Event) (Maybe Int) Vela.Org Vela.Repo
| Build Vela.Org Vela.Repo Vela.BuildNumber
| CancelBuild Vela.Org Vela.Repo Vela.BuildNumber
| ApproveBuild Vela.Org Vela.Repo Vela.BuildNumber
Expand Down Expand Up @@ -106,8 +106,8 @@ toUrl api endpoint =
OrgBuilds maybePage maybePerPage maybeEvent org ->
url api [ "repos", org, "builds" ] <| Pagination.toQueryParams maybePage maybePerPage ++ [ UB.string "event" <| Maybe.withDefault "" maybeEvent ]

Builds maybePage maybePerPage maybeEvent org repo ->
url api [ "repos", org, repo, "builds" ] <| Pagination.toQueryParams maybePage maybePerPage ++ [ UB.string "event" <| Maybe.withDefault "" maybeEvent ]
Builds maybePage maybePerPage maybeEvent maybeAfter org repo ->
url api [ "repos", org, repo, "builds" ] <| Pagination.toQueryParams maybePage maybePerPage ++ [ UB.string "event" <| Maybe.withDefault "" maybeEvent, UB.int "after" <| Maybe.withDefault 0 maybeAfter ]

Build org repo build ->
url api [ "repos", org, repo, "builds", build ] []
Expand Down
29 changes: 29 additions & 0 deletions src/elm/Api/Operations.elm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module Api.Operations exposing
, finishAuthentication
, getAllBuildServices
, getAllBuildSteps
, getAllBuilds
, getBuild
, getBuildGraph
, getBuildServiceLog
Expand Down Expand Up @@ -279,6 +280,7 @@ getRepoBuilds :
, pageNumber : Maybe Int
, perPage : Maybe Int
, maybeEvent : Maybe String
, maybeAfter : Maybe Int
}
-> Request (List Vela.Build)
getRepoBuilds baseUrl session options =
Expand All @@ -287,6 +289,7 @@ getRepoBuilds baseUrl session options =
options.pageNumber
options.perPage
options.maybeEvent
options.maybeAfter
options.org
options.repo
)
Expand Down Expand Up @@ -684,6 +687,32 @@ getBuildSteps baseUrl session options =
|> withAuth session


{-| getAllBuilds : retrieves all builds.
-}
getAllBuilds :
String
-> Session
->
{ a
| org : String
, repo : String
, after : Int
}
-> Request Vela.Build
getAllBuilds baseUrl session options =
get baseUrl
(Api.Endpoint.Builds
(Just 1)
(Just 100)
Nothing
(Just options.after)
options.org
options.repo
)
Vela.decodeBuild
|> withAuth session


{-| getAllBuildSteps : retrieves all steps for a build.
-}
getAllBuildSteps :
Expand Down
5 changes: 5 additions & 0 deletions src/elm/Components/Tabs.elm
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ viewRepoTabs shared props =
, isAlerting = False
, show = showSchedules
}
, { name = "Insights"
, toPath = Route.Path.Org__Repo__Insights { org = props.org, repo = props.repo }
, isAlerting = False
, show = True
}
, { name = "Audit"
, toPath = Route.Path.Org__Repo__Hooks { org = props.org, repo = props.repo }
, isAlerting = auditAlerting
Expand Down
24 changes: 23 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, getAllBuildServices, getAllBuildSteps, getBuild, getBuildGraph, getBuildServiceLog, getBuildServices, getBuildStepLog, getBuildSteps, getCurrentUser, getCurrentUserShared, getDashboard, getDashboards, 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, updateRepoHooksShared, 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, getAllBuilds, getBuild, getBuildGraph, getBuildServiceLog, getBuildServices, getBuildStepLog, getBuildSteps, getCurrentUser, getCurrentUserShared, getDashboard, getDashboards, 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, updateRepoHooksShared, updateRepoSchedule, updateRepoSecret, updateSettings, updateSharedSecret, updateSourceReposShared
)

{-|
Expand Down Expand Up @@ -437,6 +437,7 @@ getRepoBuildsShared :
{ pageNumber : Maybe Int
, perPage : Maybe Int
, maybeEvent : Maybe String
, maybeAfter : Maybe Int
, org : String
, repo : String
}
Expand Down Expand Up @@ -796,6 +797,26 @@ getBuildSteps options =
|> sendCmd


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


getAllBuildSteps :
{ baseUrl : String
, session : Auth.Session.Session
Expand Down Expand Up @@ -1303,6 +1324,7 @@ getRepoBuilds :
, pageNumber : Maybe Int
, perPage : Maybe Int
, maybeEvent : Maybe String
, maybeAfter : Maybe Int
, org : String
, repo : String
}
Expand Down
8 changes: 4 additions & 4 deletions src/elm/Layouts.elm
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ map fn layout =
Default data

Default_Admin data ->
Default_Admin (Layouts.Default.Admin.map fn data)
Default_Admin (Layouts.Default.Admin.map fn data)

Default_Build data ->
Default_Build (Layouts.Default.Build.map fn data)
Default_Build (Layouts.Default.Build.map fn data)

Default_Org data ->
Default_Org (Layouts.Default.Org.map fn data)
Default_Org (Layouts.Default.Org.map fn data)

Default_Repo data ->
Default_Repo (Layouts.Default.Repo.map fn data)
Default_Repo (Layouts.Default.Repo.map fn data)
4 changes: 4 additions & 0 deletions src/elm/Layouts/Default/Build.elm
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ init props shared route _ =
{ pageNumber = Nothing
, perPage = Nothing
, maybeEvent = Nothing
, maybeAfter = Nothing
, org = props.org
, repo = props.repo
}
Expand Down Expand Up @@ -157,6 +158,7 @@ update props shared route msg model =
{ pageNumber = Nothing
, perPage = Nothing
, maybeEvent = Nothing
, maybeAfter = Nothing
, org = props.org
, repo = props.repo
}
Expand Down Expand Up @@ -225,6 +227,7 @@ update props shared route msg model =
{ pageNumber = Nothing
, perPage = Nothing
, maybeEvent = Nothing
, maybeAfter = Nothing
, org = props.org
, repo = props.repo
}
Expand Down Expand Up @@ -342,6 +345,7 @@ update props shared route msg model =
{ pageNumber = Nothing
, perPage = Nothing
, maybeEvent = Nothing
, maybeAfter = Nothing
, org = props.org
, repo = props.repo
}
Expand Down
1 change: 1 addition & 0 deletions src/elm/Layouts/Default/Repo.elm
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ init props shared route _ =
{ pageNumber = Nothing
, perPage = Nothing
, maybeEvent = Nothing
, maybeAfter = Nothing
, org = props.org
, repo = props.repo
}
Expand Down
Loading

0 comments on commit 8b05bc4

Please sign in to comment.