[🐛 Bug]: Workflow execution table links for alerts and incidents not working
When viewing workflow executions, clicking on alerts/incidents in the Triggered by column sometimes redirects to incorrect links with undefined IDs, causing users to view unrelated items or broken links.
The reason is that the id of the alert may contains special characters like colons and plus signs. For example: dbt_docs_generate-generate_and_upload_metadata-scheduled__2025-04-16T14:30:00+00:00. I know this is a weird id :D
We can see that instead of displaying name: dbt-docs-..., id: dbt-docs-..., it just display the a part in a name, after that is the splitted part after the plus sign 00:00.
If we click into this alert in the Triggered by column, it will redirect to incorrect link.
To address the issue where workflow execution table links for alerts and incidents redirect to incorrect links due to special characters in the alert ID, you should ensure that the alert ID is properly encoded in the URL. This can be achieved by using the encodeURIComponent function in JavaScript, which handles special characters correctly.
Here's an example of how you can encode the alert ID:
const alertFilterUrl = `/alerts/feed?cel=${encodeURIComponent(
`id=="${execution.enrichment_event.alert_id}" || id=="${execution.enrichment_event.alert_id.replace("-", "")}"`
)}`;
This code snippet constructs the alertFilterUrl by encoding the alert ID using encodeURIComponent. It also accounts for different formats of the alert ID by checking both the original and a version with dashes removed. Make sure this encoding is applied consistently wherever alert IDs are used in URLs to prevent redirection issues [1][2].
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other