Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

EZP-24998: Order of the elements when doing a search is wrong (and random) #622

Merged
merged 10 commits into from Jun 22, 2016

Conversation

dpobel
Copy link
Contributor

@dpobel dpobel commented Jun 20, 2016

JIRA: https://jira.ez.no/browse/EZP-24998

Description

This patch makes sure the Content Tree and the Subitem views receives the Location lists sorted as indicated by the parent Location sortOrder and sortField property.

Screencast:

5 sort clauses seem to not be fully implemented server side (see also https://github.com/ezsystems/PlatformUIBundle/pull/622/files#diff-3d4c2abab2b4c380f20d2e09ec804e3cR367):

So now the question is: how do we handle those before having the necessary server side code ?

Tasks

  • Fix EZP-25846
  • Expose the Location search as a public method in addition to the event so that it can be used from others plugins
  • Allow to sort the search result based on a Location model
  • Fix the Content Tree
  • Fix the Subitem views
  • Make sure the Subitem views and tree are updated when a Location sort order and/or sort field are updated

Tests

manual test + unit test

@dpobel dpobel changed the title EZP-24998: Order of the elements when doing a search is wrong (and random) [WIP] EZP-24998: Order of the elements when doing a search is wrong (and random) Jun 20, 2016
@dpobel dpobel changed the title [WIP] EZP-24998: Order of the elements when doing a search is wrong (and random) EZP-24998: Order of the elements when doing a search is wrong (and random) Jun 21, 2016
@dpobel
Copy link
Contributor Author

dpobel commented Jun 21, 2016

(ping @andrerom @bdunogier for the question)

@andrerom
Copy link
Contributor

So now the question is: how do we handle those before having the necessary server side code ?

got the impression you where handling this with @bdunogier this morning, but ok; how does it behave on unimplemented once? crashing or just sorting wrong?

@dpobel
Copy link
Contributor Author

dpobel commented Jun 21, 2016

well, in the subitem view it displays an error notification saying the subitems could not be loaded (the subitem view is an inconsistent state, I'm currently fixing that). In the tree, you can not unfold the element and there's a red cross next to the Content name.

@andrerom
Copy link
Contributor

well, in the subitem view it displays an error notification saying the subitems could not be loaded (the subitem view is an inconsistent state, I'm currently fixing that). In the tree, you can not unfold the element and there's a red cross next to the Content name.

Ok, it's clear we need to add implementation on that before we merge this then.

@dpobel
Copy link
Contributor Author

dpobel commented Jun 21, 2016

for the unimplemented sort clauses, we can also force another sort clause to be used instead, then the sorting would be wrong but the interface would be usable.

@andrerom
Copy link
Contributor

Whats @bdunogier's take? (as I said, I understood the two of you had talked about this already)

@dpobel
Copy link
Contributor Author

dpobel commented Jun 21, 2016

I'm sorry but given the time frame regarding the freeze it's a product decision: either no sorting, either a buggy one.

@bdunogier
Copy link
Member

bdunogier commented Jun 21, 2016

I don't see any reasons why those can't be implemented. I'll give it a shot.

Can I test the REST changes by pulling your PR in, @dpobel ?

@bdunogier
Copy link
Member

bdunogier commented Jun 21, 2016

Implemented the three (priority, path, depth) SortClauses that exist in the Public API. Unfortunately, ContentTypeName and ContentTypeIdentifier don't exist in the Public API.

@andrerom
Copy link
Contributor

Unfortunately, ContentTypeName and ContentTypeIdentifier don't exist in the Public API.

for the unimplemented sort clauses, we can also force another sort clause to be used instead, then the sorting would be wrong but the interface would be usable.

@dpobel For the two mentioned by @bdunogier that we on purpose are missing, and any undefined once, map them to not use anything at all or sane default as you prefer.

case 'CLASS_IDENTIFIER':
return 'ClassIdentifier'; // Not implemented server side !?!
case 'CLASS_NAME':
return 'ClassName'; // Not Implemented server side !?!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two will not be implemented.

Could for instance (since warning is not needed in this case, swap out console.log if something else if better):

+                case 'CLASS_IDENTIFIER':
+                case 'CLASS_NAME':
+                    console.log("Deprecated sort field used '" + this.get('sortField') + "', falling back to 'DateModified'.");
+                    return 'DateModified';

@mathieupoulenard
Copy link

I test some diff yesterday and sorting was correct. Great job !

@andrerom
Copy link
Contributor

+1, but @StephaneDiot and/or @dew326 should have a look perhaps, as it's big.

@dew326
Copy link
Member

dew326 commented Jun 22, 2016

it's ok for me, +1

@dpobel dpobel merged commit 0b06f0b into master Jun 22, 2016
@dpobel dpobel deleted the ezp-24998_order_random branch June 22, 2016 11:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
5 participants