Koha-clms/t/db_dependent/api/v1
Jonathan Druart eb2dfad0d1 Bug 30982: [22.05.x] Use the REST API for background job list view
Bug 30982: REST API specs

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: (QA follow-up) Double quoting and console.log

This patch fixes the issues highlighted by the QA script; We use double
quotes for translatable strings in JS and remove an errant console.log
call.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: Add tests and implement GET /background_jobs/$id

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: Make code more re-usable

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: Add 'context' to the REST API specs

context has been added by bug 30889

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: Add Koha::BackgroundJobs->filter_by_current

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: API tweaks

This patch makes the following changes to the 'background_jobs' API:

* We now call them 'jobs'
* Removed deprecated query parameter definitions
* Added only_current query parameter
* Controller gets adapted to use $rs->filter_by_current when
  only_current is passed

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: Adapt table to new API spec

Disclaimer: this patch is highly opinionated :-D

When I started looking at this patch I felt like the two tables
(current/past jobs) implemented on bug 30462 was the way to go.

In order to make this patches apply after it I had to redo all the
things. Or most of them.

But I decided to keep the idea of filtering out completed tasks, not
just having the option to display 'the last hour' tasks. For the task I
added some required helper methods and the relevant tests as well. So a
behavior change.

Hope you all agree with it.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: Rename 'Background Jobs' => 'Jobs'

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: (QA follow-up) Resolve pod warning

Empty section in previous paragraph at line 32 in file Koha/BackgroundJobs.pm

Test plan:
Run podchecker again on this module.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: (QA follow-up) Spelling

[1] Correct: BackgrounJob
[2] If should filter out not current jobs
=> Had a hard time reading that one until I replaced if by it.
=> Decided to rephrase it in a more positive way.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: (QA follow-up) Remove redundancy from template

The template now contains two lists for both status and type:
a TT list and a JS list. The type list already proves that
redundancy leads to bugs. We miss three types at one side:
    Unknown job type 'stage_marc_for_import'
    Unknown job type 'marc_import_commit_batch'
    Unknown job type 'marc_import_revert_batch'

This patch removes the TT list. And gets the status and type
via an additional js call. For that reason I hide the fieldset
until document ready. This can be improved later when needed.

Test plan:
Look at status and type on both job list and detail view.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 30982: (QA follow-up) No userenv, no jobs

+    # Assume permission if context has no user
+    my $can_manage_background_jobs = 1;
=> This felt a bit unsafe.

Test plan:
Try interface for jobs. Call API with cookie. Call API with OAuth.
Run t/db_dependent/Koha/BackgroundJobs.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2022-11-01 21:40:18 +00:00
..
acquisitions_baskets.t Bug 30596: Prevent api/v1/acquisitions_baskets.t and api/v1/acquisitions_funds.t to fail randomly 2022-04-25 20:52:28 -10:00
acquisitions_funds.t Bug 30596: Prevent api/v1/acquisitions_baskets.t and api/v1/acquisitions_funds.t to fail randomly 2022-04-25 20:52:28 -10:00
acquisitions_orders.t Bug 30677: Add tests 2022-07-12 17:11:18 +00:00
acquisitions_vendors.t
…
advanced_editor_macros.t
…
article_requests.t Bug 29759: (follow-up) Fix api/v1/article_requests.t 2022-02-02 09:48:33 -10:00
auth.t
…
auth_authenticate_api_request.t
…
auth_basic.t Bug 29924: Add tests for API Basic auth behavior 2022-05-06 10:33:09 -10:00
biblios.t Bug 30194: (follow-up) Remove invalid tests 2022-03-29 16:44:31 +02:00
cashups.t
…
checkouts.t
…
cities.t
…
clubs_holds.t
…
holds.t Bug 30780: Regression tests 2022-07-13 19:39:13 +00:00
illrequests.t
…
import_batch_profiles.t
…
import_record_matches.t Bug 30855: (follow-up) Rewrite tests using Basic authentication 2022-06-10 16:48:49 +00:00
items.t Bug 29105: Unit test 2022-08-23 19:18:47 +00:00
jobs.t Bug 30982: [22.05.x] Use the REST API for background job list view 2022-11-01 21:40:18 +00:00
libraries.t
…
oauth.t
…
pagination.t Bug 30125: (QA follow-up) Rename variable as cities 2022-03-03 16:11:49 -10:00
patrons.t Bug 29924: (QA follow-up) Remove password_expiration_date from API 2022-05-06 10:33:09 -10:00
patrons_accounts.t
…
patrons_extended_attributes.t
…
patrons_holds.t
…
patrons_password.t
…
patrons_password_expiration.t Bug 29926: (QA follow-up) Date format missing in spec 2022-05-06 10:33:10 -10:00
query.t Bug 30536: Unit tests 2022-05-03 11:19:51 -10:00
return_claims.t
…
smtp_servers.t
…
stockrotationstage.t
…
suggestions.t Bug 30663: Add x-koha-override options to /suggestions 2022-05-05 10:26:41 -03:00
transfer_limits.t Bug 29857: (follow-up) Fix t/db_dependent/api/v1/transfer_limits.t 2022-03-02 09:40:05 -10:00
unhandled_exceptions.t Bug 29857: Rename base class as Koha::Exception 2022-03-01 22:47:47 -10:00