You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please verify that this bug has NOT been raised before.
I checked and didn't find a similar issue
Describe the bug*
The Notification list API serves link strings that work with CUI.
In the case of orders, these do not work, as the URL path no longer uses "order" for all types of orders.
So, links to any kind of order do not work.
Steps to Reproduce
Trigger a notification on any given order.
Attempt to click the supplied notification
Experience 404
Expected behaviour
Direct you to the relevant notification.
Deployment Method
Docker
Package
Bare metal
Other - added info in Steps to Reproduce
Version Information
master
Please verify if you can reproduce this bug on the demo site.
Ok, so if we served the model name untranslated, and also included the primary-key of the target, then we could use that to navigate straight to the target link in PUI
Given a valid Modeltype enum value, and a PK, we can create a valid url from the APIEndpoint enum.
Question being: Should we add new ifno, or replace current info?
I see the benefit of translating API values, but I'm not sure I feel that those deserve the model variable name.
But I could make a PR that adds a ModelType-respecting model name, and PK to the API endpoint. Then rewrite the PUI code to respect these values rather than the link field.
We could potentially pick and choose which ones we wanted to render a link to, and build out only with the ones we support directly in the PUI frontend
There is already code in place to generate this for PUI. As for the API endpoint itself, that's another story.
In PUI, we simply need to build the URL with the getDetailUrl helper.
I'm drafting a PR for the PUI side of things. The only lacking thing is error report detail pages. It seems we only use a drawer for this, so there's no URL for it atm.
For the purposes of notifications, the currently compiled set of models should work well, unless I've missed an outlier or two.
The links point to actual webpages, so only the subset of models that have an actual details page even need to be included.
But if you don't like the solution, I'll happily defer this one to you. I'm not really into arguing over these kinds of things.
Activity
LavissaWoW commentedon May 26, 2024
I was thinking about using the
ModelTypeenums, but:{ "pk": 149, "target": { "name": "PO0018 - Mouser", "model": "Innkjøpsordre", "link": "/order/purchase-order/18/" }, "source": { "name": "reader", "model": "user" }, "user": 2, "category": "purchase_order.ready_to_issue", "name": "Purchase order is ready to issue", "message": "A Purchase order was just marked ready to issue.", "creation": "2024-05-26 21:41", "age": 4670, "age_human": "an hour ago", "read": true },The model name is translated...
SchrodingersGat commentedon May 26, 2024
I do not think that it makes sense to translate the model name here - does it get displayed in the CUI anywhere?
LavissaWoW commentedon May 26, 2024
LavissaWoW commentedon May 26, 2024
I guess the answer is no there
SchrodingersGat commentedon May 26, 2024
Ok, so if we served the model name untranslated, and also included the primary-key of the target, then we could use that to navigate straight to the target link in PUI
LavissaWoW commentedon May 26, 2024
Yup.
Given a valid
Modeltypeenum value, and a PK, we can create a valid url from theAPIEndpointenum.Question being: Should we add new ifno, or replace current info?
I see the benefit of translating API values, but I'm not sure I feel that those deserve the
modelvariable name.But I could make a PR that adds a
ModelType-respecting model name, and PK to the API endpoint. Then rewrite the PUI code to respect these values rather than thelinkfield.Lemme know.
SchrodingersGat commentedon May 26, 2024
I'd be happy with a PR which adds new fields, and then we can be certain that the old code is not impacted.
LavissaWoW commentedon May 26, 2024
Would you say
ModelTypeenums generally are model names without_?Like how
purchase_orderispurchaseorder?SchrodingersGat commentedon May 27, 2024
Yes, it is the name of the model, just lowercase
matmair commentedon May 27, 2024
This does mean you will need to provide renderes for all model types in PUI.
SchrodingersGat commentedon May 27, 2024
We could potentially pick and choose which ones we wanted to render a link to, and build out only with the ones we support directly in the PUI frontend
LavissaWoW commentedon May 27, 2024
There is already code in place to generate this for PUI. As for the API endpoint itself, that's another story.
In PUI, we simply need to build the URL with the getDetailUrl helper.
I'm drafting a PR for the PUI side of things. The only lacking thing is error report detail pages. It seems we only use a drawer for this, so there's no URL for it atm.
SchrodingersGat commentedon May 27, 2024
You could just redirect to the error report table, rather than the individual error report
matmair commentedon May 27, 2024
Only a third of all available models have a PUI page in getDetailUrl @LavissaWoW, I have no idea what you are talking about
LavissaWoW commentedon May 27, 2024
For the purposes of notifications, the currently compiled set of models should work well, unless I've missed an outlier or two.
The links point to actual webpages, so only the subset of models that have an actual details page even need to be included.
But if you don't like the solution, I'll happily defer this one to you. I'm not really into arguing over these kinds of things.
matmair commentedon Dec 1, 2024
This should be tackled after 0.17.0 as there will be no CUI anymore so the solution is a lot simpler
SchrodingersGat commentedon Dec 1, 2024
I believe that I have already addressed this in #8392
matmair commentedon Dec 2, 2024
So we can close this?