Skip to content

Commit

Permalink
fix: update label to indicate job is attempting to run now
Browse files Browse the repository at this point in the history
  • Loading branch information
ismay authored and ismay committed Feb 6, 2024
1 parent 92c0415 commit eab8605
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/components/JobTable/NextRun.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ const NextRun = ({ nextExecutionTime, enabled }) => {
const nextRunIsInPast = nextRun.getTime() <= now

/**
* If the time is in the past, that could mean that the task is running,
* and the nextExecutionTime hasn't been updated yet.
* If the nextExecutionTime is in the past that means that
* the scheduled execution time has passed, but the allowed
* startup delay hasn't expired yet. Effectively this means
* that the backend will start the job as soon as possible.
*
* If the window expires before the job can execute the
* nextExecutionTime will be updated to a time in the future.
*/

if (nextRunIsInPast) {
return i18n.t('Not scheduled')
return i18n.t('Now')
}

return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/JobTable/NextRun.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ describe('<NextRun>', () => {
expect(wrapper.find(Tooltip).prop('content')).toEqual(expected)
})

it('returns fallback message for an enabled job and a past execution time', () => {
const expected = 'Not scheduled'
it('returns message for an enabled job and a past execution time', () => {
const expected = 'Now'
jest.spyOn(global.Date, 'now').mockImplementation(() => now)

const wrapper = shallow(
Expand Down

1 comment on commit eab8605

@dhis2-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.