Closed (duplicate)
Project:
Drupal core
Version:
9.2.x-dev
Component:
views_ui.module
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Dec 2017 at 11:30 UTC
Updated:
8 Dec 2020 at 16:27 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #2
joachim commentedComment #3
pvsureshmca commentedComment #4
pvsureshmca commented@joachim,
Thanks for your contribution. Given patch is working as expected to me. Please refer the attached image for more reference.
Thank you.
Comment #5
pvsureshmca commentedComment #7
joachim commented> 1) Drupal\Tests\rest\Functional\EntityResource\User\UserXmlBasicAuthTest::testPost
Exception: Warning: apcu_store(): Unable to allocate memory for pool.
Symfony\Component\ClassLoader\ApcClassLoader->findFile()() (Line: 128)
That's a problem with the test runner.
Comment #8
larowlanIf this is something we care about, we need a test
Thanks
Comment #10
joachim commentedI'm not sure how a test is going to work here. We can assert the items are in order, but it could always be the case that it's a fluke and they just happen to have been loaded in that order.
> If this is something we care about, we need a test
Also, yes we do. On a site with custom entity types, Commerce, etc, this list is huge. Finding the entity type you want becomes a real pain.
Comment #11
Rajender Rajan commentedComment #12
Rajender Rajan commentedComment #13
lendudeFixing this makes sense to me, but the fix in 11 still doesn't look right because we are sorting on objects I suspect. Casting the titles to strings makes it look good.
Expanded the IS, added some screenshots and some title clean up.
Still needs tests.
Also not 100% convinced this is the best we can do. Using the example of commerce, it might be nice to group entities by package or something. But maybe alphabetically is a good first step...
Comment #14
joachim commented> Also not 100% convinced this is the best we can do. Using the example of commerce, it might be nice to group entities by package or something. But maybe alphabetically is a good first step...
The perfect is the enemy of the good!
At the moment, this dropdown is a UX bug. Getting it alphabetical means it's actually usable. We can make it even better in a future issue :)
Comment #15
lendudeHere is a test for this. Test only file is the interdiff.
Comment #17
amietpatial commentedHI Lendude I have applied your patch successfully it's showing sorted content now
Comment #18
joachim commentedLooks good, though should we use natcasesort() here?
Granted, it's highly unlikely that an entity type's label will have a lowercase first letter.
What's the difference between asort() and natsort()?
Comment #19
chanderbhushan commented@joachim
The asort() function sorts an associative array in ascending order, according to the value
AND
The natsort() function sorts an array by using a "natural order" algorithm. The values keep their original keys.
example :- In a natural algorithm, the number 2 is less than the number 10. In computer sorting, 10 is less than 2, because the first number in "10" is less than 2.
Comment #20
joachim commentedI think we should use natcasesort. It's unlikely, but it's possible, that entity types could be called things like 'iPad Models', or 'Level 10 items'.
Comment #21
chanderbhushan commented@joachim applied patch for same. thanks
Comment #22
lendude@chanderbhushan thanks! but can we get the test coverage in the patch too?
Comment #27
Kumar Kundan commentedComment #28
Kumar Kundan commentedComment #29
Kumar Kundan commentedComment #30
Kumar Kundan commentedComment #31
joachim commentedThanks for writing the test!
I'd say this is ready.
Comment #32
alexpottLet's install all these modules in one go and then do one assert. The piecemeal install doesn't really prove too much. Note that ->install() takes a list of all modules to install so it's only necessary to have a single call.
Comment #33
Kumar Kundan commentedComment #34
Kumar Kundan commentedThanks to @alexpott for reviewing the patch.
Comment #35
Kumar Kundan commentedComment #36
tanubansal commentedTested via above mentioned steps and latest patch. This can be moved to RTBC
Comment #38
benjifisherI did not find this issue when I created #3183106: Sort the options in the "Add view" wizard. One of these issues should be closed as a duplicate.
Even though this issue is older, I suggest closing it since the approach used on the other issue is simpler. As I said in #3183106-1: Sort the options in the "Add view" wizard,
If I remember correctly, a lot of effort went into #3065903: Add label sort ability to Select element to make sure that the sort is done at the correct time. I do not think there are any variable substitutions in this use case, but has anyone tested the patch here with translations?
If no one objects, then I will close this issue as a duplicate and transfer the issue credits to #3183106.
Comment #39
alexpottClosing in favour of the other issue. I've transferred issue credit.