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
Request column names from server when loading table #6375
Request column names from server when loading table #6375
Conversation
- As these are translated by the server, we can make use of them on the client side! - Reduces duplication of translated titles
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Looks/Sounds intresting and relativley simple to implement. Maybe caching all table column names similar to states would be a good idea? |
- Refactoring more columns
Nice idea, LGTM now after caching is implemented. |
- We will rely on the server-side translations!
Co-authored-by: Matthias Mair <code@mjmair.com>
…Tree into table-column-names
- Powerful code reuse is powerful
- Add some missing field descriptors on the backend
- Required to ensure the same columns are fetched
This has now broken my machine integration tables. E.g. this API endpoint is used in a table: https://github.com/wolflu05/InvenTree/blob/34d730febf68dc5e0851837955797e1866042f19/InvenTree/machine/serializers.py#L110 And PUI always shows a notification on load: After investigation, it seems like that this is coming from: InvenTree/src/frontend/src/functions/forms.tsx Lines 56 to 63 in 15f58b9
Because when using an Same things applies for the Plugin page in the Admin center. How should we fix this? |
@wolflu05 you found that so quickly! I had just been looking into this. I think that we should a) Remove the "form error - response did not contain action data" - it is a very "nerdy" error which I had in there for debugging. Probably not very useful |
Yes, was trying to resolve the merge conflicts on the machines branch and refactor the tables, ... Yes, I'm on board with just removing this notification. The enduser doest know what that means. Do you create an PR for that? Regarding the permissions error, I guess that is coming from here: InvenTree/src/frontend/src/functions/forms.tsx Lines 72 to 76 in ec2a66e
|
This PR adds facility for tables to fetch the translated column names from the server, using the existing metadata endpoint. This allows us to reduce duplication of translated strings between the server and client.
As each table is constructed from data provided by a defined endpoint, and (most) API fields have localized
label
attributes, we can use those to render the localized table columns.Note that the table column titles can be manually overridden if required.
If this is deemed a good idea, following improvements can be made: