Skip to content
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

A model relation field in a bootgrid is sorted via UUID #7383

Closed
2 tasks done
Monviech opened this issue Apr 16, 2024 · 4 comments
Closed
2 tasks done

A model relation field in a bootgrid is sorted via UUID #7383

Monviech opened this issue Apr 16, 2024 · 4 comments
Assignees
Labels
cleanup Low impact changes
Milestone

Comments

@Monviech
Copy link
Sponsor Member

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

Related to: opnsense/plugins#3914

When using a model relation field like this:
https://github.com/opnsense/plugins/blob/8f2490aa8a1a1d057d1de2a30521d0037cc3c519/www/caddy/src/opnsense/mvc/app/models/OPNsense/Caddy/Caddy.xml#L159-L169

And having it included in the SearchBase() function like this:
https://github.com/opnsense/plugins/blob/4d63eeca500174b9faccbdf98bb129b19d4415a9/www/caddy/src/opnsense/mvc/app/controllers/OPNsense/Caddy/Api/ReverseProxyController.php#L112
or like this:
https://github.com/opnsense/plugins/blob/8f2490aa8a1a1d057d1de2a30521d0037cc3c519/www/caddy/src/opnsense/mvc/app/controllers/OPNsense/Caddy/Api/ReverseProxyController.php#L112

And then displaying it in a view in a bootgrid:
https://github.com/opnsense/plugins/blob/8f2490aa8a1a1d057d1de2a30521d0037cc3c519/www/caddy/src/opnsense/mvc/app/views/OPNsense/Caddy/reverse_proxy.volt#L242

  • When sorting should happen by clicking on the column, it will sort the model relation fields by their (hidden) UUID value, and not in an alphabetic or numeric order (what a user would expect.)

To Reproduce

Sort any model relation field in a bootgrid, it will be sorted by UUID and not by their display value.

Expected behavior

It's sorted by their displayed value, for example alphabetic.

Describe alternatives you considered

Filling out the description field and sorting it can be a workaround for some usecases.

Software version used and hardware type if relevant, e.g.:

OPNsense 24.1.5_1-amd64
FreeBSD 13.2-RELEASE-p11
OpenSSL 3.0.13

@AdSchellevis AdSchellevis self-assigned this Apr 16, 2024
@AdSchellevis AdSchellevis added the cleanup Low impact changes label Apr 16, 2024
@AdSchellevis AdSchellevis added this to the 24.7 milestone Apr 16, 2024
@Monviech
Copy link
Sponsor Member Author

I wanted to try this out:

[16-Apr-2024 11:00:00 Etc/UTC] Error: Call to undefined method OPNsense\Base\FieldTypes\HostnameField::getDescription() in /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ModelRelationField.php:107

@AdSchellevis
Copy link
Member

@Monviech you need the development version, you probably miss 10c81a4 now

@Monviech
Copy link
Sponsor Member Author

@AdSchellevis Oops, you were right. Works like a charm on dev version. Thank you :)

@AdSchellevis
Copy link
Member

@Monviech nice catch, thanks for testing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Low impact changes
Development

No branches or pull requests

2 participants