-
Notifications
You must be signed in to change notification settings - Fork 44
NGSTACK-906 eztags priority sorting #170
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
Open
AntePrkacin
wants to merge
45
commits into
master
Choose a base branch
from
NGSTACK-906-eztags-priority-sorting
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 28 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
c843d14
NGSTACK-906 add 'priority' property to Tag objects
AntePrkacin 1c5b716
NGSTACK-906 add support for 'priority' property in the Mapper layer
AntePrkacin 2d27fc0
NGSTACK-906 modify createTagFindQuery method to select 'priority' pro…
AntePrkacin a8cf605
NGSTACK-906 add 'priority' column to 'eztags' table in MySQL and Post…
AntePrkacin 3a84111
NGSTACK-906 add translations for tag priority
AntePrkacin 8e535ea
NGSTACK-906 show 'priority' column for tag's children
AntePrkacin 7d59685
NGSTACK-906 add 'subitems' tab to the show tag template
AntePrkacin fe7ba81
NGSTACK-906 add 'subitems' tab template with dropdowns for sortBy and…
AntePrkacin 9158a5d
NGSTACK-906 add translations for tag subitems sorting
AntePrkacin 9ce9427
NGSTACK-906 update tag children sorting functionality in TagControlle…
AntePrkacin 60cf2cf
NGSTACK-906 add support for sorting in loadTagChildren() method in Se…
AntePrkacin 1041265
NGSTACK-906 add support for sorting in loadChildren() method for Tag …
AntePrkacin 0955f35
NGSTACK-906 add support for sorting in getChildren() method for Gatew…
AntePrkacin 43def26
NGSTACK-906 update subitems sort option value from 'tag_id' to 'id' i…
AntePrkacin f0aa890
NGSTACK-906 remove 'subitems' tag tab and add the tag sorting at the …
AntePrkacin f1e4e1a
NGSTACK-906 update tests to handle 'priority' property
AntePrkacin 6139978
NGSTACK-906 add enums for tag sortField and sortOrder properties
AntePrkacin df8003b
NGSTACK-906 add sortField and sortOrder properties to Tag objects and…
AntePrkacin ef0d60a
NGSTACK-906 update Mappers with sortField and sortOrder fields
AntePrkacin be00504
NGSTACK-906 remove sortBy and sortOrder parameters from the getChildr…
AntePrkacin d88c066
NGSTACK-906 remove sortBy and sortOrder parameters from the loadChild…
AntePrkacin c0bf0f4
NGSTACK-906 remove sortBy and sortOrder parameters from the loadTagCh…
AntePrkacin c719cc4
NGSTACK-906 rename subitems template to sort_children_tags template a…
AntePrkacin 93c1134
NGSTACK-906 add sortField and sortOrder properties to UpdateStruct an…
AntePrkacin 41e6787
NGSTACK-906 remove sorting logic in ChildrenTagsAdapter
AntePrkacin 705fc35
NGSTACK-906 add new route and controller method for updating sortFiel…
AntePrkacin 2397fcc
NGSTACK-906 rename sortField property to sortBy property everywhere
AntePrkacin c6c4555
NGSTACK-906 add logic for sorting children by sortBy and sortOrder in…
AntePrkacin 4a5391d
NGSTACK-906 fix tests regarding sortBy and sortOrder properties
AntePrkacin 4224d33
NGSTACK-906 update TagSortBy and TagSortOrder enums, iterate through …
AntePrkacin e16f73f
NGSTACK-906 throw BadRequestHttpException if sortBy or sortOrder para…
AntePrkacin dba4689
NGSTACK-906 change sort_by and sort_order column types from enums to …
AntePrkacin a6100ae
NGSTACK-906 add config params for sorting all child tags and for sort…
AntePrkacin 5733962
NGSTACK-906 update Mapper and DoctrineDatabase Gateway with logic for…
AntePrkacin 5479257
NGSTACK-906 add support for 'sort' config params in tests
AntePrkacin 148a3c3
NGSTACK-906 add ability to modify 'priority' property when editing a …
AntePrkacin 3704566
NGSTACK-906 fix the update() method in DoctrineDatabase and the test …
AntePrkacin 59beb45
NGSTACK-906 update 'sortBy' and 'sortOrder' properties to be null on …
AntePrkacin 84d9758
NGSTACK-906 update getChildren() and update() methods in DoctrineData…
AntePrkacin fd507dd
NGSTACK-906 update Mapper to properly handle the case when sortBy or …
AntePrkacin a81d3f6
NGSTACK-906 update sort_children_tags template to check if sortBy or …
AntePrkacin 0ce8c25
NGSTACK-906 add MySQL and PostgreSQL upgrade scripts for 'priority', …
AntePrkacin 3e9628a
NGSTACK-906 don't show 'priority' info on synonyms and remove 'priori…
AntePrkacin c6d1f47
NGSTACK-906 add 'priority', 'sort_by' and 'sort_order' fields to lega…
AntePrkacin 031c1aa
NGSTACK-906 add policy for sorting children tags
AntePrkacin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Netgen\TagsBundle\API\Repository\Values\Enums; | ||
|
|
||
| enum TagSortBy: string | ||
| { | ||
| case ID = 'id'; | ||
| case KEYWORD = 'keyword'; | ||
| case MODIFIED = 'modified'; | ||
| case PRIORITY = 'priority'; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Netgen\TagsBundle\API\Repository\Values\Enums; | ||
|
|
||
| enum TagSortOrder: string | ||
| { | ||
| case ASC = 'asc'; | ||
| case DESC = 'desc'; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 should add configuration for the default sort.
We also need configuration for the default sort for root tag (which has ID = 0), since we can't store this in the database.
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.
You can also try to instantiate the enum to double check that the value stored in the database is an allowed stored type and direction.
Uh oh!
There was an error while loading. Please reload this page.
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.
First four commits made on 25 June 2025 are regarding the config parameters for default sorting.
There are two new config parameters added:
sort.byandsort.order)sort.root.byandsort.root.order)These config parameters are enums (enumNode), so their values will always match the cases of enum. There is even an option to put an enum class in the node, but that is only for Symfony 7.3 (I don't know which Symfony versions you want this bundle to support).
Also, in the database, the 'sort_by' and 'sort_order' column types were changed from enums to just varchar(100). By default, when a new tag is added, it will have
empty string ('')NULL set at 'sort_by' and 'sort_order' columns - in this case, these two new config parameters will be fetched for sorting.Only when the user sorts the children tags of some tag, then will the 'sort_by' and 'sort_order' columns be set for that (parent) tag.
This was done because the
<someEnum>::tryFrom()method returns null if the corresponding (given) string has no matching case. In that case, the configResolver is used to get a parameter. Example: