-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI: helper sort-objects to alphabetize list items #24103
Conversation
Build Results: |
@@ -5,7 +5,7 @@ | |||
|
|||
<Identity::EntityNav @identityType={{this.identityType}} @model={{this.model}} /> | |||
{{#if this.model.meta.total}} | |||
{{#each this.model as |item|}} | |||
{{#each (sort-objects this.model "name") as |item|}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll want to sort in lazyPaginatedQuery
instead, otherwise this will only sort the items on the current page
@@ -4,4 +4,29 @@ | |||
*/ | |||
|
|||
import IdentitySerializer from './_base'; | |||
export default IdentitySerializer.extend(); | |||
export default IdentitySerializer.extend({ | |||
extractLazyPaginatedData(payload) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to serialize the data here so that the information is sortable by name in lazyPaginatedQuery
…t metadata shows on list
export default IdentitySerializer.extend({ | ||
extractLazyPaginatedData(payload) { | ||
return payload.data.keys.map((key) => { | ||
const model = payload.data.key_info[key]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used the same logic that's in the IdentitySerializer's normalizeItems method so we still have metadata on the list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
teamwork 🎉
* move list to component * use helper instead * add changelog * clarify changelog copy * delete components now that helper is in use * move helper to util, remove template helper invokation * add optional sorting to lazyPaginatedQuery based on sortBy query attribute * Add serialization to entity-alias and entity so that they can be sorted by name on list view * Same logic as base normalizeItems for extractLazyPaginatedData so that metadata shows on list * Add headers --------- Co-authored-by: Chelsea Shaw <[email protected]> Co-authored-by: Chelsea Shaw <[email protected]>
* move list to component * use helper instead * add changelog * clarify changelog copy * delete components now that helper is in use * move helper to util, remove template helper invokation * add optional sorting to lazyPaginatedQuery based on sortBy query attribute * Add serialization to entity-alias and entity so that they can be sorted by name on list view * Same logic as base normalizeItems for extractLazyPaginatedData so that metadata shows on list * Add headers --------- Co-authored-by: Chelsea Shaw <[email protected]> Co-authored-by: Chelsea Shaw <[email protected]>
* move list to component * use helper instead * add changelog * clarify changelog copy * delete components now that helper is in use * move helper to util, remove template helper invokation * add optional sorting to lazyPaginatedQuery based on sortBy query attribute * Add serialization to entity-alias and entity so that they can be sorted by name on list view * Same logic as base normalizeItems for extractLazyPaginatedData so that metadata shows on list * Add headers --------- Co-authored-by: claire bontempo <[email protected]>
* move list to component * use helper instead * add changelog * clarify changelog copy * delete components now that helper is in use * move helper to util, remove template helper invokation * add optional sorting to lazyPaginatedQuery based on sortBy query attribute * Add serialization to entity-alias and entity so that they can be sorted by name on list view * Same logic as base normalizeItems for extractLazyPaginatedData so that metadata shows on list * Add headers ---------
Fixes #14176 by sorting models using a new helper
sort-objects
in the hbs templatebefore