Skip to content

Commit

Permalink
fix: removing id field and adding created at field to deployments tab…
Browse files Browse the repository at this point in the history
…le (#757)

Co-authored-by: Claire.Nicholas <Z00B3R3@w6nxmk4t6t.target.com>
  • Loading branch information
claire1618 and Claire.Nicholas committed Jan 25, 2024
1 parent edd0959 commit 1ae0459
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/elm/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import Html.Attributes
, type_
)
import Html.Events exposing (onClick)
import Html.Lazy exposing (lazy, lazy2, lazy3, lazy5, lazy7, lazy8)
import Html.Lazy exposing (lazy, lazy2, lazy3, lazy4, lazy5, lazy7, lazy8)
import Http
import Http.Detailed
import Interop
Expand Down Expand Up @@ -2974,7 +2974,7 @@ viewContent model =
Pages.RepositoryDeployments org repo maybePage _ ->
( String.join "/" [ org, repo ] ++ " deployments" ++ Util.pageToString maybePage
, div []
[ lazy3 Pages.Deployments.View.viewDeployments model.repo org repo
[ lazy4 Pages.Deployments.View.viewDeployments model.zone model.repo org repo
, Pager.view model.repo.deployments.pager Pager.defaultLabels GotoPage
]
)
Expand Down
32 changes: 16 additions & 16 deletions src/elm/Pages/Deployments/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Routes
import Svg.Attributes
import SvgBuilder exposing (hookSuccess)
import Table
import Time exposing (Zone)
import Util exposing (largeLoader)
import Vela exposing (Deployment, Org, Repo, RepoModel, Repository)

Expand Down Expand Up @@ -73,8 +74,8 @@ addForm deploymentModel =

{-| viewDeployments : renders a list of deployments
-}
viewDeployments : RepoModel -> Org -> Repo -> Html msg
viewDeployments repoModel org repo =
viewDeployments : Zone -> RepoModel -> Org -> Repo -> Html msg
viewDeployments zone repoModel org repo =
let
addButton =
a
Expand All @@ -101,7 +102,7 @@ viewDeployments repoModel org repo =
case ( repoModel.repo, repoModel.deployments.deployments ) of
( RemoteData.Success repo_, RemoteData.Success s ) ->
( text "No deployments found for this repo"
, deploymentsToRows repo_ s
, deploymentsToRows zone repo_ s
)

( _, RemoteData.Failure error ) ->
Expand Down Expand Up @@ -161,32 +162,32 @@ viewDeployments repoModel org repo =

{-| deploymentsToRows : takes list of deployments and produces list of Table rows
-}
deploymentsToRows : Repository -> List Deployment -> Table.Rows Deployment msg
deploymentsToRows repo_ deployments =
List.map (\deployment -> Table.Row deployment (renderDeployment repo_)) deployments
deploymentsToRows : Zone -> Repository -> List Deployment -> Table.Rows Deployment msg
deploymentsToRows zone repo_ deployments =
List.map (\deployment -> Table.Row deployment (renderDeployment zone repo_)) deployments


{-| tableHeaders : returns table headers for deployments table
-}
tableHeaders : Table.Columns
tableHeaders =
[ ( Just "-icon", "" )
, ( Nothing, "id" )
, ( Nothing, "number" )
, ( Nothing, "target" )
, ( Nothing, "commit" )
, ( Nothing, "ref" )
, ( Nothing, "description" )
, ( Nothing, "builds" )
, ( Nothing, "created by" )
, ( Nothing, "created at" )
, ( Nothing, "" )
]


{-| renderDeployment : takes deployment and renders a table row
-}
renderDeployment : Repository -> Deployment -> Html msg
renderDeployment repo_ deployment =
renderDeployment : Zone -> Repository -> Deployment -> Html msg
renderDeployment zone repo_ deployment =
tr [ Util.testAttribute <| "deployments-row" ]
[ td
[ attribute "data-label" ""
Expand All @@ -195,13 +196,6 @@ renderDeployment repo_ deployment =
, class "-icon"
]
[ hookSuccess ]
, td
[ attribute "data-label" "id"
, scope "row"
, class "break-word"
, Util.testAttribute <| "deployments-row-id"
]
[ text <| String.fromInt deployment.id ]
, td
[ attribute "data-label" "number"
, scope "row"
Expand Down Expand Up @@ -253,6 +247,12 @@ renderDeployment repo_ deployment =
, class "break-word"
]
[ text deployment.created_by ]
, td
[ attribute "data-label" "created at"
, scope "row"
, class "break-word"
]
[ text <| Util.humanReadableDateTimeWithDefault zone deployment.created_at ]
, td
[ attribute "data-label" ""
, scope "row"
Expand Down
2 changes: 2 additions & 0 deletions src/elm/Vela.elm
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,7 @@ type alias Deployment =
, repo_id : Int
, url : String
, created_by : String
, created_at : Int
, commit : String
, ref : String
, task : String
Expand Down Expand Up @@ -2543,6 +2544,7 @@ decodeDeployment =
|> optional "repo_id" int -1
|> optional "url" string ""
|> optional "created_by" string ""
|> optional "created_at" int 0
|> optional "commit" string ""
|> optional "ref" string ""
|> optional "task" string ""
Expand Down

0 comments on commit 1ae0459

Please sign in to comment.