Comments

mdahl328151 created an issue. See original summary.

mdahl328151’s picture

StatusFileSize
new5.19 KB

Status: Needs review » Needs work

The last submitted patch, 2: 2898264-sort-in-manage.patch, failed testing. View results

mdahl328151’s picture

Status: Needs work » Needs review
StatusFileSize
new6.34 KB

Status: Needs review » Needs work

The last submitted patch, 4: 2898264-sort-in-manage-3.patch, failed testing. View results

mdahl328151’s picture

Status: Needs work » Needs review
StatusFileSize
new7.02 KB

This adds a sort function to each column in manage
Only local images are allowed.
*missing tests

Status: Needs review » Needs work

The last submitted patch, 6: 2898264-sort-in-manage-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

mdahl328151’s picture

Status: Needs work » Needs review
StatusFileSize
new12.46 KB

Added tests

Status: Needs review » Needs work

The last submitted patch, 8: 2898264-sort-in-manage-5.patch, failed testing. View results

dpolant’s picture

I 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.

dpolant’s picture

StatusFileSize
new12.64 KB

Uploading 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.

dpolant’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 11: 2898264-sort-in-manage-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dpolant’s picture

Status: Needs work » Needs review
StatusFileSize
new5.58 KB

That was the wrong patch. Here is the right one to go with my last comments.

Status: Needs review » Needs work

The last submitted patch, 14: 2898264--title-sort-and-hooks.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dpolant’s picture

Status: Needs work » Needs review
StatusFileSize
new9.44 KB

Queueing another patch. This one fixes the failures in the management form.

Status: Needs review » Needs work

The last submitted patch, 16: 2898264--title-sort-and-hooks-1.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dpolant’s picture

Status: Needs work » Needs review
StatusFileSize
new9.44 KB

Sigh. 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.

Status: Needs review » Needs work

The last submitted patch, 18: 2898264--title-sort-and-hooks-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dpolant’s picture

Status: Needs work » Needs review
StatusFileSize
new11.92 KB

This patch ought to fix nearly all of the fails. We'll see .. maybe there's a few leftovers.

dpolant’s picture

Status: Needs review » Needs work

The last submitted patch, 20: 2898264--title-sort-and-hooks-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dpolant’s picture

Status: Needs work » Needs review
StatusFileSize
new14.34 KB

Ok 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.

Status: Needs review » Needs work

The last submitted patch, 23: 2898264--title-sort-and-hooks-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dpolant’s picture

Status: Needs work » Needs review
StatusFileSize
new15.89 KB

I 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.

krlucas’s picture

Adding the Feature Request issue for Views, VBO integration as related. :-)

t.murphy’s picture

@dpolant thank you for working on this! We will review, test and then release.

t.murphy’s picture

@krlucas, thank you for relating those tickets. We will also take a look at that.

penyaskito’s picture

@dpolant I'm totally convinced we should add this feature. But altering the default order I think it's a bad idea.

dpolant’s picture

What'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.

penyaskito’s picture

It's ordered by created time. Actually tests worked because it was consistent, not "random".

dpolant’s picture

Ah 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.

dpolant’s picture

StatusFileSize
new11.2 KB

Here 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.