Bug 30394 - Add 'draw' handling to the datatables wrapper and REST API
Summary: Add 'draw' handling to the datatables wrapper and REST API
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 30393
Blocks: 30408
  Show dependency treegraph
 
Reported: 2022-03-29 10:58 UTC by Tomás Cohen Arazi
Modified: 2022-12-12 21:25 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00


Attachments
Bug 30394: Unit tests (1.31 KB, patch)
2022-03-30 12:03 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30394: Add x-koha-request-id handling in controllers (1.81 KB, patch)
2022-03-30 12:03 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30394: Add x-koha-request-id support on API routes (13.69 KB, patch)
2022-03-30 12:03 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30394: Make datatables.js aware of x-koha-request-id (2.64 KB, patch)
2022-03-30 12:03 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30394: Unit tests (1.39 KB, patch)
2022-03-30 12:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30394: Add x-koha-request-id handling in controllers (1.89 KB, patch)
2022-03-30 12:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30394: Add x-koha-request-id support on API routes (13.81 KB, patch)
2022-03-30 12:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30394: Make datatables.js aware of x-koha-request-id (2.72 KB, patch)
2022-03-30 12:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30394: Unit tests (1.45 KB, patch)
2022-03-30 12:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30394: Add x-koha-request-id handling in controllers (1.95 KB, patch)
2022-03-30 12:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30394: Add x-koha-request-id support on API routes (13.83 KB, patch)
2022-03-30 12:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30394: Make datatables.js aware of x-koha-request-id (2.78 KB, patch)
2022-03-30 12:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30408: Make API and OpenAPI versions strings in spec (974 bytes, patch)
2022-03-30 12:41 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2022-03-29 10:58:07 UTC
A new header handling should be added so it is passed back and forth when requests are made. It should then be translated into/from the 'draw' parameter by the wrapper. We could name the headerr x-koha-request-id.
Comment 1 Tomás Cohen Arazi 2022-03-30 12:03:33 UTC
Created attachment 132576 [details] [review]
Bug 30394: Unit tests

This patch adds tests for checking the x-koha-request-id header is
returned on GET routes that have it enabled, and then the request
includes it.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> FAIL: The feature is not implemented, tests fail

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi 2022-03-30 12:03:36 UTC
Created attachment 132577 [details] [review]
Bug 30394: Add x-koha-request-id handling in controllers

This patch adds 'x-koha-request-id' to the reserved param names list,
and makes the objects.search helper read it and send it back in the
response headers.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Tomás Cohen Arazi 2022-03-30 12:03:41 UTC
Created attachment 132578 [details] [review]
Bug 30394: Add x-koha-request-id support on API routes

This patch adds the x-koha-request-id to all GET routes that rely on
objects.search, for immediate support for the header.

The patch itself is trivial:
- It adds the header parameter definition to the top level swagger.yaml
- It adds a reference on each route that already implements q params,
  etc

To test:
1. Apply the patch
2. Reload plack
3. Notice the API still works
4. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> SUCCESS: It now passes! The /cities route implements the
x-koha-request-id header pass through.
5. Run the rest of the API tests
=> SUCCESS: All good
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2022-03-30 12:03:44 UTC
Created attachment 132579 [details] [review]
Bug 30394: Make datatables.js aware of x-koha-request-id

This patch makes the wrapper handle the data.draw parameter (from
DataTables) translating it into the x-koha-request-id header for making
the Koha request, and then translates the received header into data.draw
for proper use in DataTables.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Jonathan Druart 2022-03-30 12:15:35 UTC
Created attachment 132582 [details] [review]
Bug 30394: Unit tests

This patch adds tests for checking the x-koha-request-id header is
returned on GET routes that have it enabled, and then the request
includes it.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> FAIL: The feature is not implemented, tests fail

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2022-03-30 12:15:41 UTC
Created attachment 132583 [details] [review]
Bug 30394: Add x-koha-request-id handling in controllers

This patch adds 'x-koha-request-id' to the reserved param names list,
and makes the objects.search helper read it and send it back in the
response headers.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2022-03-30 12:15:46 UTC
Created attachment 132584 [details] [review]
Bug 30394: Add x-koha-request-id support on API routes

This patch adds the x-koha-request-id to all GET routes that rely on
objects.search, for immediate support for the header.

The patch itself is trivial:
- It adds the header parameter definition to the top level swagger.yaml
- It adds a reference on each route that already implements q params,
  etc

To test:
1. Apply the patch
2. Reload plack
3. Notice the API still works
4. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> SUCCESS: It now passes! The /cities route implements the
x-koha-request-id header pass through.
5. Run the rest of the API tests
=> SUCCESS: All good
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2022-03-30 12:15:51 UTC
Created attachment 132585 [details] [review]
Bug 30394: Make datatables.js aware of x-koha-request-id

This patch makes the wrapper handle the data.draw parameter (from
DataTables) translating it into the x-koha-request-id header for making
the Koha request, and then translates the received header into data.draw
for proper use in DataTables.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Martin Renvoize 2022-03-30 12:41:16 UTC
Created attachment 132598 [details] [review]
Bug 30394: Unit tests

This patch adds tests for checking the x-koha-request-id header is
returned on GET routes that have it enabled, and then the request
includes it.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> FAIL: The feature is not implemented, tests fail

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize 2022-03-30 12:41:21 UTC
Created attachment 132599 [details] [review]
Bug 30394: Add x-koha-request-id handling in controllers

This patch adds 'x-koha-request-id' to the reserved param names list,
and makes the objects.search helper read it and send it back in the
response headers.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize 2022-03-30 12:41:26 UTC
Created attachment 132600 [details] [review]
Bug 30394: Add x-koha-request-id support on API routes

This patch adds the x-koha-request-id to all GET routes that rely on
objects.search, for immediate support for the header.

The patch itself is trivial:
- It adds the header parameter definition to the top level swagger.yaml
- It adds a reference on each route that already implements q params,
  etc

To test:
1. Apply the patch
2. Reload plack
3. Notice the API still works
4. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> SUCCESS: It now passes! The /cities route implements the
x-koha-request-id header pass through.
5. Run the rest of the API tests
=> SUCCESS: All good
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize 2022-03-30 12:41:31 UTC
Created attachment 132601 [details] [review]
Bug 30394: Make datatables.js aware of x-koha-request-id

This patch makes the wrapper handle the data.draw parameter (from
DataTables) translating it into the x-koha-request-id header for making
the Koha request, and then translates the received header into data.draw
for proper use in DataTables.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize 2022-03-30 12:41:37 UTC
Created attachment 132602 [details] [review]
Bug 30408: Make API and OpenAPI versions strings in spec

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize 2022-03-30 12:42:19 UTC
Another QA stamp never hurts.
Comment 15 Fridolin Somers 2022-04-05 15:29:17 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 16 Tomás Cohen Arazi 2022-05-08 13:22:47 UTC
This could actually be backported?