Review main Merged

68664[TASK] Extract CSV output into separate functionality

Benni Mack CR +2 V +2 Hard +562 −112 updated 05/25/21, 12:08

Commit message

The CSV output of the database record list (= list module)
is one of the only parts that cannot be modified via middlewares
as its rendering directly exits PHP.

This makes it impossible to test this functionality.

This change moves the CsvExport into its own class CsvExportRecordList
which accumulates the records from the database records list.

The existing hooks are migrated and kept as is (due to the
Composition pattern).

The class is a composition for RecordList to extract
the querying logic into a separate code.

The Controller class is responsible of handling the CSV
response via the PSR-17 Response Factory.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Jochen Roth +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Jochen Roth +1
    • core-ci +1 CI

Issues 1

Files 5

Review log 2553

Show 1128 earlier messages
  1. Benni Mack uploaded patch set 1 03/31/21, 22:10

  2. TYPO3com voted on patch set 1 V -1 03/31/21, 22:16 Completed build in 06m 44s on Wed, 31 Mar, 10:16 PM Test Summary: 33267 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10421

  3. core-ci voted on patch set 1 V -1 03/31/21, 22:21 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1945

  4. Benni Mack uploaded patch set 2 04/01/21, 06:54

  5. TYPO3com voted on patch set 2 V +1 04/01/21, 07:02 Completed build in 07m 54s on Thu, 1 Apr, 07:02 AM Test Summary: 33267 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10422

  6. core-ci voted on patch set 2 V +1 04/01/21, 07:07 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1949

  7. Benni Mack uploaded patch set 3 04/01/21, 10:04

  8. TYPO3com voted on patch set 3 V -1 04/01/21, 10:04 Completed build in 19s on Thu, 1 Apr, 10:04 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10434

  9. core-ci voted on patch set 3 V +1 04/01/21, 10:19 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1963

  10. Benni Mack rebased onto patch set 4 04/01/21, 13:00

  11. TYPO3com voted on patch set 4 V +1 04/01/21, 13:07 Completed build in 07m 07s on Thu, 1 Apr, 01:07 PM Test Summary: 33267 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10444

  12. core-ci voted on patch set 4 V +1 04/01/21, 13:10 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1974

  13. Benni Mack uploaded patch set 5 04/02/21, 11:47

  14. TYPO3com voted on patch set 5 V -1 04/02/21, 11:54 Completed build in 07m 25s on Fri, 2 Apr, 11:54 AM Test Summary: 1 of 33509 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10461

  15. core-ci voted on patch set 5 V -1 04/02/21, 12:00 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1995

  16. Benni Mack uploaded patch set 6 04/02/21, 12:04

  17. TYPO3com voted on patch set 6 V -1 04/02/21, 12:10 Completed build in 05m 55s on Fri, 2 Apr, 12:10 PM Test Summary: 1 of 33509 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10462

  18. core-ci voted on patch set 6 V -1 04/02/21, 12:18 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1996

  19. Daniel Windloff commented on patch set 6 04/04/21, 07:00

    RecordListController.php:194

    A better solution would be to move this code including the csvExportAction to an own controller class and add a forward here for backward ompatibility.

    RecordListController.php:496

    I would suggest introducing a separate CsvResponse. I know that there is only a second csv export in the core, but it would be consistent with json and the other response types.

    CsvExportRecordList.php:55

    Why no event with a deprecated getter for the recordList?

    CsvExportRecordList.php:58

    This changes the hook params and should be described in the changelog.

    CsvExportRecordList.php:62 Unresolved

    I would suggest to deprecate this.

    CsvExportRecordList.php:79

    The columsToRender should be moved out of this class and should be part of the method arguments. Technically, the method is called twice (here and for the header row) and the coupling here makes it harder to add a selection wizard later for the columns which should be part of the export. At the moment the selection, which columns are part of the export, and the export button itself are scattered over the interface (above and below the table). Adding a wizard with the current selection as default for the export needs this column selection in the controller.

    CsvExportRecordList.php:84

    Add hideTranslations as method argument to decouple it here from recordlist

    CsvExportRecordList.php:145 Unresolved

    I would suggest to deprecate this.
  20. Benni Mack commented on patch set 6 04/07/21, 22:27

    RecordListController.php:194 Reply Unresolved

    Yeah, I think so too. However, as long as DatabaseRecordList contains the majority of this logic (queryBuilder logic), we would need to duplicate a lot of initialization code, which I wanted to avoid here for the time being, so this can be extracted further later-on.

    RecordListController.php:496 Reply Unresolved

    Actually we should use a PSR-17 based Factory to create the responses in general (that's also the reason why our PSR-7 implementation is still "internal" as PSRs are meant to become interchangeable). I'll see if I can use the ResponseFactory in this controller.

    CsvExportRecordList.php:55 Reply Unresolved

    The existing hook works as is. I would actually recommend to build a new CsvExportController which can do a lot more (e.g. re-formatting the values properly, exporting based on tt_content.CType, handle sorting etc), where a new Event would be a better fit as a feature.

    CsvExportRecordList.php:58 Reply Unresolved

    good point

    CsvExportRecordList.php:79 Reply Unresolved

    yes!

    CsvExportRecordList.php:84 Reply Unresolved

    Yes!
  21. Benni Mack uploaded patch set 7 04/07/21, 23:01

  22. Benni Mack uploaded patch set 8 04/07/21, 23:03

  23. TYPO3com voted on patch set 8 V -1 04/07/21, 23:03 Completed build in 15s on Wed, 7 Apr, 11:03 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10533

  24. core-ci voted on patch set 8 V -1 04/07/21, 23:08 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/2088

  25. TYPO3com voted on patch set 7 V -1 04/07/21, 23:09 Completed build in 07m 54s on Wed, 7 Apr, 11:08 PM Test Summary: 1 of 33509 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10532

  26. core-ci voted on patch set 7 V -1 04/07/21, 23:23 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/2087

  27. Benni Mack uploaded patch set 9 04/09/21, 13:27

  28. TYPO3com voted on patch set 9 V -1 04/09/21, 13:28 Completed build in 16s on Fri, 9 Apr, 01:28 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10575

  1. core-ci voted on patch set 9 V -1 04/09/21, 13:41 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/2141

  2. Benni Mack uploaded patch set 10 04/09/21, 17:52

  3. TYPO3com voted on patch set 10 V -1 04/09/21, 17:52 Completed build in 16s on Fri, 9 Apr, 05:52 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10584

  4. core-ci voted on patch set 10 V -1 04/09/21, 18:14 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/2151

  5. Benni Mack rebased onto patch set 11 04/09/21, 21:35

  6. TYPO3com voted on patch set 11 V -1 04/09/21, 21:42 Completed build in 06m 59s on Fri, 9 Apr, 09:42 PM Test Summary: 1 of 33509 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10593

  7. core-ci voted on patch set 11 V -1 04/09/21, 21:51 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/2160

  8. Benni Mack voted on patch set 11 V +2 CR +2 04/21/21, 08:00

  9. Benni Mack voted on patch set 11 V 0 CR 0 04/21/21, 08:00

  10. Benni Mack rebased onto patch set 12 04/27/21, 20:53

  11. core-ci voted on patch set 12 V -1 04/27/21, 21:06 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10791

  12. Benni Mack uploaded patch set 13 05/03/21, 08:09

  13. core-ci voted on patch set 13 V -1 05/03/21, 08:23 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11042

  14. Benni Mack uploaded patch set 14 05/18/21, 21:32

  15. core-ci voted on patch set 14 V -1 05/18/21, 21:48 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11649

  16. Benni Mack uploaded patch set 15 05/20/21, 19:52

  17. core-ci voted on patch set 15 V -1 05/20/21, 20:07 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11745

  18. Benni Mack uploaded patch set 16 05/21/21, 07:51

  19. core-ci voted on patch set 16 V +1 05/21/21, 08:02 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11760

  20. Jochen Roth uploaded patch set 17 05/25/21, 09:28

  21. core-ci voted on patch set 17 V +1 05/25/21, 09:39 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11820

  22. Jochen Roth voted on patch set 17 V +1 CR +1 05/25/21, 10:03

  23. Oli Bartsch voted on patch set 17 V +1 CR +1 05/25/21, 11:14

  24. Benni Mack voted on patch set 17 V +2 CR +2 05/25/21, 12:08

  25. Benni Mack merged patch set 18 05/25/21, 12:08