vaidikgarg-bit opened a new pull request, #838:
URL: https://github.com/apache/fineract-backoffice-ui/pull/838
Closes #787.
The Scheduler Jobs screen could run a job but not change when it runs. Each
row now has an Edit action that opens `/system/scheduler-jobs/:id/edit`, where
an administrator can change the display name, the cron expression and the
active flag.
### Permissions
The route declares `UPDATE_SCHEDULER`, and `*appHasPermission` hides the row
action from an operator who holds only `EXECUTEJOB_SCHEDULER`. The issue
suggested `[appRequiresPermission]`. I hid it instead because the action
navigates to another screen, and
`shared/directives/requires-permission.directive.ts` keeps the disabled style
for actions on the record already on screen. I can switch to the
disabled-with-reason style if you prefer it.
### Cron validation
Fineract validates `PUT /jobs/{id}` with Quartz's
`CronExpression.isValidExpression`, so `core/utils/quartz-cron.ts` follows
Quartz's dialect: seconds first, six or seven fields, `?` in exactly one of
day-of-month and day-of-week, and the `L`, `W` and `#` options. I checked it
against the `CronExpression` source in Quartz 2.5. Anything the parser accepts,
Quartz accepts with the same meaning. The reverse doesn't hold for two rare
forms, which the parser refuses: Quartz ignores trailing characters after a day
name (`MON/2`) and accepts a step of zero. One accepted form reads differently:
for `31W` in a month shorter than 31 days, Quartz rolls into the next month,
while the preview skips that month. A `31W` limited to February is refused as
never firing.
`0 0 * * * *` is refused before it reaches the server, because Quartz
rejects an expression that specifies both day fields. An expression Quartz
parses but that never fires, such as `0 0 0 30 2 ?`, is refused too, because
Fineract can't schedule it.
A valid expression previews its next three runs, refreshed every 30 seconds.
The preview counts from the browser's clock because the screen doesn't know the
tenant's time zone, so the first run listed can be off by the difference
between the two zones.
### Other behaviour
- A job that is currently running opens read-only.
- A change queued by maker-checker shows "Submitted for approval." instead
of the success message.
- A failed load shows the shared load-error state with Try again. A 404 or a
malformed id shows the same state with Back instead, since retrying can't help.
### Adapter
Reads and writes go through a new `SCHEDULER_JOB_API` adapter, following ADR
0006. It turns the optional `jobId` into a required `id` (and refuses a job
without one), defaults the two booleans, trims the expression, and maps the
`PUT` response to a single `pendingApproval` flag using the existing
`isMakerCheckerPending`. The list and history screens still call the generated
client; I left them as they are to keep this PR focused.
### Testing
- Unit tests cover the parser (accepted and refused expressions; fire times
for L, W, #, wrapping ranges and years; schedules that never fire), the
adapter's payload and maker-checker result, the form (payload, each validation
message, the running and load-failure states) and who sees the Edit action.
- `e2e/scheduler-jobs.spec.ts` has a mocked Playwright test for the edit
flow. It type-checks, but I couldn't run Playwright locally, so CI will be its
first run.
- `npm run lint`, `npm run build`, `npm run typecheck:e2e`, `npm run
i18n:check`, `api:surface` and the `check:*` scripts pass locally.
- I haven't tested it against a running Fineract.
New strings are translated into French and Hindi.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]