Skip to content

Commit

Permalink
fix(notifications): fix wrong urls in ms teams notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Pichugin Anatoly authored and shirshanka committed Sep 30, 2024
1 parent c5af228 commit 175affe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions datahub-actions/src/datahub_actions/utils/datahub_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ def make_datahub_url(urn: str, base_url: str) -> str:
entity_type = entity_type_from_urn(urn)
urn = urn.replace("/", "%2F")
return f"{base_url}/{ENTITY_TYPE_TO_URL_PATH_MAP[entity_type]}/{urn}/"

def make_entity_url(urn: str, entity_type: str, base_url: str) -> str:
urn = urn.replace("/", "%2F")
return f"{base_url}/{entity_type}/{urn}"
9 changes: 5 additions & 4 deletions datahub-actions/src/datahub_actions/utils/social_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from datahub.metadata.schema_classes import EntityChangeEventClass as EntityChangeEvent
from datahub.utilities.urns.urn import Urn

from datahub_actions.utils.datahub_util import make_entity_url
from datahub_actions.utils.name_resolver import (
get_entity_name_from_urn,
get_entity_qualifier_from_urn,
Expand Down Expand Up @@ -108,20 +109,20 @@ def get_message_from_entity_change_event(
parent_specialized_type = get_entity_qualifier_from_urn(
str(parent_entity_urn), datahub_graph
)
parent_entity_url = f"{datahub_base_url}/{parent_entity_urn.get_type()}/{parent_entity_urn}/Schema?schemaFilter={entity_name}"
parent_entity_url = f"{make_entity_url(str(parent_entity_urn), parent_entity_urn.get_type(), datahub_base_url)}/Schema?schemaFilter={entity_name}"
entity_message_trailer = f"{entity_name} of {parent_specialized_type} {make_url_with_title(title=parent_entity_name, url=parent_entity_url, channel=channel)}"
elif event.entityType == "dataFlow":
entity_url = f"{datahub_base_url}/pipelines/{event.entityUrn}"
entity_url = make_entity_url(event.entityUrn, "pipelines", datahub_base_url)
entity_message_trailer = make_url_with_title(
title=entity_name, url=entity_url, channel=channel
)
elif event.entityType == "dataJob":
entity_url = f"{datahub_base_url}/tasks/{event.entityUrn}"
entity_url = make_entity_url(event.entityUrn, "tasks", datahub_base_url)
entity_message_trailer = make_url_with_title(
title=entity_name, url=entity_url, channel=channel
)
else:
entity_url = f"{datahub_base_url}/{event.entityType}/{event.entityUrn}"
entity_url = make_entity_url(event.entityUrn, event.entityType, datahub_base_url)
entity_message_trailer = make_url_with_title(
title=entity_name, url=entity_url, channel=channel
)
Expand Down

0 comments on commit 175affe

Please sign in to comment.