Review main Merged

33654[FEATURE] Introduce AJAX functionality for list module

Frank Nägler CR +2 V +2 Normal +162 −10 updated 12/10/14, 00:36

Commit message

This patch add a new JavaScript file to optimize the list module
with AJAX calls for hide and unhide of records.

More functions like delete and the logic for the page module
will follow in a separate patch.

Review

  • Code review CR +2
    • Helmut Hummel +2
    • Benni Mack +1
  • Verified V +2
    • Helmut Hummel +2
    • Benni Mack +1

Issues 1

Files 6

Review log 51

Show 26 earlier messages
  1. Frank Nägler uploaded patch set 1 10/31/14, 00:55

  2. Frank Nägler voted on patch set 1 CR -2 10/31/14, 00:56

  3. Frank Nägler voted on patch set 1 V -1 10/31/14, 00:56

  4. Frank Nägler uploaded patch set 2 10/31/14, 23:39

  5. Markus Klein commented on patch set 2 11/01/14, 00:07

    ActionIconAjaxController.php:73

    the & is completely useless here. seems to be legacy from the times where objects have not been passed by ref
  6. Frank Nägler uploaded patch set 3 11/01/14, 00:35

  7. Frank Nägler commented on patch set 2 11/01/14, 00:36

    ActionIconAjaxController.php:73 Reply

    Done
  8. Frank Nägler commented on patch set 3 11/01/14, 00:37

    now pageTree refresh if page table changed per ajax
  9. Helmut Hummel commented on patch set 3 CR -1 11/01/14, 10:45

    ActionIconAjaxController.php:34

    do we need this *at all*? There is tce_db.php which can be called with POST arguments to achieve any DataHandler action. can't we just call this script via Ajax? If not, we should add an Ajax wrapper for DataHandler actions. I would like to have DataHandler entry points as low as possible, as every entry point needs separate CSRF protection. Adding this controller, makes all actions handled by this controller susceptible against CSRF.
  10. Helmut Hummel commented on patch set 3 11/01/14, 10:48

    ActionIconAjaxController.php:34 Reply

    ah, sorry I fixed the Ajax CSRF issue already ;) So no CSRF issue here, but anyway I'd like to propose to use a general DataHandler entry point
  11. Frank Nägler commented on patch set 3 11/01/14, 20:31

    ActionIconAjaxController.php:34 Reply

    I am not sure how this wrapper should work, imo DataHandler is a kind of wrapper for record manipulation. But let us discuss this the next days on slack.
  12. Frank Nägler uploaded patch set 4 12/05/14, 17:54

  13. Frank Nägler uploaded patch set 5 12/06/14, 20:52

  14. Frank Nägler uploaded patch set 6 12/06/14, 20:53

  15. Frank Nägler uploaded patch set 7 12/06/14, 20:57

  16. Frank Nägler commented on patch set 7 CR 0 12/06/14, 20:59

    thx @Helmut for the discussion yesterday, I think I found a good solution to prevent a new controller. If this patch goes into master we can add easy more AJAX calls e.g. for delete records.
  17. Frank Nägler uploaded patch set 8 12/06/14, 21:09

  18. Georg Ringer voted on patch set 8 CR +1 V +1 12/06/14, 21:11

  19. Stefan Neufeind commented on patch set 8 12/06/14, 21:21

    I'm not exactly sure about the naming - "ActionIconAjaxController" and inside "WebList" etc.
  20. Stefan Neufeind commented on patch set 8 12/06/14, 21:23

    Do we maybe need a spinner (instead of the icon) while waiting for the AJAX-call to return? "On -> spinner -> off"
    Maybe skip the exact filename. You're adding some more :-) I'd maybe just go for the functionality added instead.
    adds
  21. Frank Nägler commented on patch set 8 12/06/14, 21:50

    @Stefan: Spinner is a nice idea, I would take care of this in a follow-up
  22. Markus Klein commented on patch set 8 CR -1 12/06/14, 23:34

    DatabaseRecordList.php:1282

    hsc() missing, $param has '&' inside

    ActionIconAjaxController.js:16

    This is the doc block for the WebList variable. please move it there

    ActionIconAjaxController.js:18

    move that somewhere else. eg into the comment above

    ActionIconAjaxController.js:38

    a is a jquery object => $a as name

    ActionIconAjaxController.js:39

    a is already a jquery object, why running jQuery again on it?

    ActionIconAjaxController.js:44

    there should be a method named toggleClass() which takes the class and a state as params. That frees us of the variables above.

    ActionIconAjaxController.js:48

    don't calculate the same DOM elements over and over again.

    ActionIconAjaxController.js:66

    do this only once and not everytime.

    ActionIconAjaxController.js:72

    event.preventDefault()!!!

    ext_tables.php:22

    first param on new line as well

    ext_tables.php:23

    closing ); on new line

    tce_db.php:44

    I'd prefer a normal array, which is for sure faster than manipulating a class dynamically all the time
  23. Stefan Neufeind voted on patch set 8 V +1 12/06/14, 23:38

  24. Helmut Hummel commented on patch set 8 CR -1 12/06/14, 23:45

    Very nice Frank! This is going into a very good direction! There are still some things to clean up resolve. See my and Marcus' inline comments. Looking forward to get this in :)

    RecordList.php:238

    should be registered as requirejs module

    DatabaseRecordList.php:1278

    it is not necessary to create the token for each row since it is identical for all rows and actions

    ActionIconAjaxController.js:20

    in general, this should be an AMD module and registered with requirejs

    ext_tables.php:23

    This controller does not exist any more :)
  25. Benni Mack commented on patch set 8 CR -1 12/07/14, 08:46

    ActionIconAjaxController.js:20 Reply

    correct, also, this has nothing to do with web-list in my opinion. We need the same stuff in page module, so it should be hooked into there as well!

    ActionIconAjaxController.js:65

    use delegates, please!
  26. Benni Mack commented on patch set 8 12/07/14, 08:49

    Actually, I would like to see a ajaxID which is a wrapper for tce_db. Then you can deal with format stuff properly. I can do this in a followup though.

    ext_tables.php:23 Reply

    LOL. Exactly. Please drop this change in this file.
  1. Frank Nägler commented on patch set 8 CR -2 12/07/14, 10:46

    thx for all your feedback, will take care of it today.
  2. Frank Nägler commented on patch set 8 12/07/14, 12:48

    Reply

    Done

    Reply

    Done

    RecordList.php:238 Reply

    Done

    DatabaseRecordList.php:1278 Reply

    Done

    DatabaseRecordList.php:1282 Reply

    there is no '&' inside, hsc is added

    ActionIconAjaxController.js:16 Reply

    Done

    ActionIconAjaxController.js:18 Reply

    Done

    ActionIconAjaxController.js:20 Reply

    Done

    ActionIconAjaxController.js:20 Reply

    Done

    ActionIconAjaxController.js:38 Reply

    Done

    ActionIconAjaxController.js:39 Reply

    Done

    ActionIconAjaxController.js:65 Reply

    Done

    ActionIconAjaxController.js:72 Reply

    Done

    ext_tables.php:22 Reply

    Done

    ext_tables.php:23 Reply

    Done

    ext_tables.php:23 Reply

    Done

    ext_tables.php:23 Reply

    Done

    tce_db.php:44 Reply

    Done
  3. Frank Nägler uploaded patch set 9 12/07/14, 12:48

  4. Frank Nägler commented on patch set 9 CR 0 12/07/14, 12:49

    So take care of the most comments. @Markus don't understand all your hints, but I think the current patchset is much better.
  5. Stefan Neufeind commented on patch set 9 CR +1 12/07/14, 13:05

    ext_tables.php:32

    So actually this file remains unchanged / could be excluded from the patchset :-)
  6. Markus Klein commented on patch set 9 12/08/14, 00:13

    ActionIconAjaxController.js:56

    do this only once and save it to a variable, use it below
  7. Benni Mack uploaded patch set 10 12/08/14, 19:42

  8. Benni Mack uploaded patch set 11 12/08/14, 20:03

  9. Benni Mack uploaded patch set 12 12/08/14, 20:28

  10. Benni Mack commented on patch set 12 12/08/14, 20:28

    OK. Now I think this is a first version that should go in. One last question. With using AjaxIDs, do we need the formToken at all anymore?
  11. Helmut Hummel commented on patch set 12 12/09/14, 10:01

    Wow, cool stuff Benni! Thanks for the further cleanup! Looks great now: To your question: no, with this (cleaner) approach we don't need the form token any more. It is checked in tce_db.php which is not used any more and the Ajax call is already CSRF protected automatically. The whole form token handling can thus be removed here
  12. Benni Mack uploaded patch set 13 12/09/14, 10:24

  13. Frank Nägler commented on patch set 12 12/09/14, 10:24

    +1. very cool patchset! Many thx!
  14. Benni Mack uploaded patch set 14 12/09/14, 10:31

  15. Benni Mack commented on patch set 14 CR +1 V +1 12/09/14, 10:31

    Now I like it :)
  16. Wouter Wolters commented on patch set 14 12/09/14, 10:40

    SimpleDataHandlerController.php:250

    Processes all AJAX calls and returns a JSON formatted string

    SimpleDataHandlerController.php:264

    initliailize hasErrors to FALSE here

    SimpleDataHandlerController.php:275

    space after foreach

    AjaxDataHandler.js:32

    state === 'visible' is done 4 times now, maybe put that in a variable?
  17. Helmut Hummel uploaded patch set 15 12/09/14, 11:07

  18. Helmut Hummel commented on patch set 14 12/09/14, 11:08

    SimpleDataHandlerController.php:250 Reply

    Done

    SimpleDataHandlerController.php:264 Reply

    Done

    SimpleDataHandlerController.php:275 Reply

    Done

    AjaxDataHandler.js:32 Reply

    Done
  19. Helmut Hummel voted on patch set 15 CR +2 V +2 12/09/14, 11:08

  20. Benni Mack voted on patch set 15 CR +2 V +2 12/09/14, 11:11

  21. Benni Mack updated the commit message in patch set 16 12/09/14, 11:13

  22. Benni Mack voted on patch set 16 CR +1 V +1 12/09/14, 11:13

  23. Helmut Hummel commented on patch set 16 CR +2 V +2 12/09/14, 11:19

    Cool stuff! Great work!
  24. Helmut Hummel merged patch set 16 12/09/14, 11:19

  25. Felix Kopp commented on patch set 17 12/10/14, 00:36

    HAMMER!! Thank you all