Skip to content

Commit

Permalink
enhance(schedule): show next run for a schedule (#800)
Browse files Browse the repository at this point in the history
Co-authored-by: Kelly Merrick <[email protected]>
  • Loading branch information
wsan3 and KellyMerrick authored May 21, 2024
1 parent 3fe00d0 commit e2aa22c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
6 changes: 4 additions & 2 deletions cypress/fixtures/schedules.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"updated_by": "CookieCat",
"scheduled_at": 0,
"branch": "main",
"error": ""
"error": "",
"next_run": 1685037152
},
{
"id": 2,
Expand Down Expand Up @@ -125,6 +126,7 @@
"updated_by": "CookieCat",
"scheduled_at": 0,
"branch": "main",
"error": "unable to trigger build for schedule Hourly: unable to schedule build: unable to compile pipeline configuration for github/octocat: 1 error occurred: * no \"version:\" YAML property provided"
"error": "unable to trigger build for schedule Hourly: unable to schedule build: unable to compile pipeline configuration for github/octocat: 1 error occurred: * no \"version:\" YAML property provided",
"next_run": 1685037152
}
]
5 changes: 5 additions & 0 deletions cypress/integration/schedules.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ context('Schedules', () => {
cy.get('[data-label=scheduled-at]').should('exist');
});
});
it('should show next run', () => {
cy.get('@dailySchedule').within(() => {
cy.get('[data-label=next-run]').should('exist');
});
});
it('should show updated by', () => {
cy.get('@dailySchedule').within(() => {
cy.get('[data-label=updated-by]').contains('CookieCat');
Expand Down
4 changes: 2 additions & 2 deletions src/elm/Pages/Org_/Repo_/Hooks.elm
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ viewHookError hook =
case hook.status of
"skipped" ->
tr [ class "skipped-data", Util.testAttribute "hooks-skipped" ]
[ td [ attribute "colspan" "6" ]
[ td [ attribute "colspan" (String.fromInt <| List.length tableHeaders) ]
[ span
[ class "skipped-content" ]
[ text hook.error ]
Expand All @@ -454,7 +454,7 @@ viewHookError hook =

_ ->
tr [ class "error-data", Util.testAttribute "hooks-error" ]
[ td [ attribute "colspan" "6" ]
[ td [ attribute "colspan" (String.fromInt <| List.length tableHeaders) ]
[ code
[ class "error-content" ]
[ text hook.error ]
Expand Down
11 changes: 10 additions & 1 deletion src/elm/Pages/Org_/Repo_/Schedules.elm
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ tableHeaders =
, ( Nothing, "enabled" )
, ( Nothing, "branch" )
, ( Nothing, "last scheduled at" )
, ( Nothing, "next run" )
, ( Nothing, "updated by" )
, ( Nothing, "updated at" )
]
Expand Down Expand Up @@ -391,6 +392,14 @@ viewSchedule zone org repo schedule =
[ text <| Util.humanReadableDateTimeWithDefault zone schedule.scheduled_at
]
}
, Components.Table.viewItemCell
{ dataLabel = "next-run"
, parentClassList = []
, itemClassList = []
, children =
[ text <| Util.humanReadableDateTimeWithDefault zone schedule.next_run
]
}
, Components.Table.viewItemCell
{ dataLabel = "updated-by"
, parentClassList = []
Expand Down Expand Up @@ -426,7 +435,7 @@ viewScheduleError schedule =
let
msgRow =
tr [ class "error-data", Util.testAttribute "schedules-error" ]
[ td [ attribute "colspan" "6" ]
[ td [ attribute "colspan" (String.fromInt <| List.length tableHeaders) ]
[ code
[ class "error-content" ]
[ text schedule.error ]
Expand Down
2 changes: 2 additions & 0 deletions src/elm/Vela.elm
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,7 @@ type alias Schedule =
, updated_by : String
, branch : String
, error : String
, next_run : Int
}


Expand Down Expand Up @@ -1606,6 +1607,7 @@ decodeSchedule =
|> optional "updated_by" string ""
|> optional "branch" string ""
|> optional "error" string ""
|> optional "next_run" int 0


decodeSchedules : Decoder (List Schedule)
Expand Down

0 comments on commit e2aa22c

Please sign in to comment.