Needs review
Project:
Ray Enterprise Translation
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
28 Jul 2017 at 22:57 UTC
Updated:
10 Nov 2017 at 14:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mdahl328151 commentedComment #4
mdahl328151 commentedComment #6
mdahl328151 commentedThis adds a sort function to each column in manage

*missing tests
Comment #8
mdahl328151 commentedAdded tests
Comment #10
dpolant commentedI don't think this is the right direction for this patch. We probably want to use the tablesort API. This blog post seems to have a good start: http://w3shaman.com/article/drupal-8-sortable-table-pager.
The problem with using uasort for sorting is that the sorting won't affect pagination (e.g. you'll sort once and then page 2 will still be page 2 from the default sort). Also using GET variables for pagination direction preferable to a tempstore variable since then you have a persistent url for the sort. Tablesort API provides all of this I think.
Also I'm not sure sorting by "Source" or "Translations" makes sense. Both are multivalue columns so filtering is a better option.
Comment #11
dpolant commentedUploading a patch that uses tablesort.
Some things to note:
1) This only adds sorting to the title column
2) I added a number of alter hooks to allow developers to change the management form as needed. So additional behaviors can be done by third parties.
3) I did not add tests yet.
Comment #12
dpolant commentedComment #14
dpolant commentedThat was the wrong patch. Here is the right one to go with my last comments.
Comment #16
dpolant commentedQueueing another patch. This one fixes the failures in the management form.
Comment #18
dpolant commentedSigh. Getting these mocks to line up is hard. This next patch should at least fix the LingotekManagementFormTest failure. I'll have to see about the others. Something is causing my local VM to fail many of these tests spuriously so it is difficult to test.
Comment #20
dpolant commentedThis patch ought to fix nearly all of the fails. We'll see .. maybe there's a few leftovers.
Comment #21
dpolant commentedComment #23
dpolant commentedOk hopefully this is the last iteration. A lot of test expectations had to be re-written because the order of the dummy nodes changes when you add a default Title sort.
Comment #25
dpolant commentedI got a spurious fail on the last test run that went away with a retest. Tests are green!
The good news is that the other tests now ensure that the sort order is correct.
Adding one more iteration containing updates to lingotek.api.php. To summarize, I added three alter hooks that will allow third parties to customize the management form without having to reverse engineer a lot of tricky logic in a form alter.
Long term, I'd love to see the management form become a View. I'm curious if there are any known major concerns about this, other than the fact that it will be a big lift due to all the forms.
I think the the alter hooks I've added provide a good intermediate measure of customizability to the bulk management form.
Comment #26
krlucas commentedAdding the Feature Request issue for Views, VBO integration as related. :-)
Comment #27
t.murphy commented@dpolant thank you for working on this! We will review, test and then release.
Comment #28
t.murphy commented@krlucas, thank you for relating those tickets. We will also take a look at that.
Comment #29
penyaskito@dpolant I'm totally convinced we should add this feature. But altering the default order I think it's a bad idea.
Comment #30
dpolant commentedWhat's the argument against a default sort order? I feel like if an entity type has a title that's probably the best thing to sort by. Right now it's pretty much random.
Comment #31
penyaskitoIt's ordered by created time. Actually tests worked because it was consistent, not "random".
Comment #32
dpolant commentedAh gotcha. I bet there is a way to have title sortable but not by default. We can probably revert a lot of those tests in that case.
Comment #33
dpolant commentedHere is a new patch without the default sort order on label. For this approach we don't need to change the sort order expectations on the old tests, but we should probably write a new test for label sort. Let's see if current tests pass first.